@ryanforever/parse-list
v1.0.0
Published
parse a string of items into an array
Downloads
2
Readme
parse-list
parse a list of values into an array
usage
const parseList = require("@ryanforever/parse-list")
let items = "apples, oranges,bananas, grapes,pineapples"
let array = parseList(items)
// [ 'apples', 'oranges', 'bananas', 'grapes', 'pineapples' ]
customize sepearator
let items = "black\nblue\ngreen\nwhite\npurple"
let array = parseList(items, "\n")
// [ 'black', 'blue', 'green', 'white', 'purple' ]