Initial commit
This commit is contained in:
27
node_modules/list-to-array/.npmignore
generated
vendored
Normal file
27
node_modules/list-to-array/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directory
|
||||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
|
||||
node_modules
|
22
node_modules/list-to-array/LICENSE
generated
vendored
Normal file
22
node_modules/list-to-array/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Jed Watson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
52
node_modules/list-to-array/README.md
generated
vendored
Normal file
52
node_modules/list-to-array/README.md
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
# list-to-array
|
||||
|
||||
Simple javascript lib for converting a [comma || space] delimited string to an array.
|
||||
|
||||
Trims values so you can use human-friendly lists like `'one, two, three' => ['one','two','three']`
|
||||
|
||||
If in array is provided, it is simply returned. If a falsy or non-string value is provided, an empty array is returned.
|
||||
|
||||
Won't work with values that contain spaces.
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
npm install list-to-array
|
||||
```
|
||||
|
||||
Works in node.js, iojs or bundle for the browser with browserify or webpack.
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
var listToArray = require('list-to-array');
|
||||
|
||||
console.log(listToArray('one, two, three'));
|
||||
|
||||
// logs ['one','two','three']
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2015 Jed Watson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
18
node_modules/list-to-array/index.js
generated
vendored
Normal file
18
node_modules/list-to-array/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
function truthy(val) { return val; }
|
||||
function trim(str) { return str.trim(); }
|
||||
|
||||
function listToArray (str, delimiter) {
|
||||
if (Array.isArray(str)) {
|
||||
return str;
|
||||
}
|
||||
if (!str || typeof str !== 'string') {
|
||||
return [];
|
||||
}
|
||||
if (!delimiter) {
|
||||
delimiter = ' ';
|
||||
str = str.replace(/\,/g, ' ');
|
||||
}
|
||||
return str.split(delimiter).map(trim).filter(truthy);
|
||||
}
|
||||
|
||||
module.exports = listToArray;
|
32
node_modules/list-to-array/package.json
generated
vendored
Normal file
32
node_modules/list-to-array/package.json
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "list-to-array",
|
||||
"version": "1.1.0",
|
||||
"description": "Simple javascript lib for converting a [comma || space] delimited string to an array",
|
||||
"main": "index.js",
|
||||
"author": "Jed Watson",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/JedWatson/list-to-array.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/JedWatson/list-to-array/issues"
|
||||
},
|
||||
"homepage": "https://github.com/JedWatson/list-to-array",
|
||||
"scripts": {
|
||||
"test": "mocha tests.js"
|
||||
},
|
||||
"keywords": [
|
||||
"array",
|
||||
"list",
|
||||
"string",
|
||||
"manipulation",
|
||||
"conversion",
|
||||
"function",
|
||||
"library"
|
||||
],
|
||||
"devDependencies": {
|
||||
"mocha": "^2.2.5",
|
||||
"must": "^0.12.0"
|
||||
}
|
||||
}
|
29
node_modules/list-to-array/tests.js
generated
vendored
Normal file
29
node_modules/list-to-array/tests.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
var demand = require('must');
|
||||
var listToArray = require('./index');
|
||||
|
||||
describe('listToArray', function() {
|
||||
it('splits a comma-delimited list into an array', function() {
|
||||
listToArray('one,two,three').must.eql(['one', 'two', 'three']);
|
||||
});
|
||||
it('splits a space-delimited list into an array', function() {
|
||||
listToArray('one two three').must.eql(['one', 'two', 'three']);
|
||||
});
|
||||
it('trims whitespace from values', function() {
|
||||
listToArray('one, two, three').must.eql(['one', 'two', 'three']);
|
||||
});
|
||||
it('splits a list into an array', function() {
|
||||
listToArray('one,two,three').must.eql(['one', 'two', 'three']);
|
||||
});
|
||||
it('returns a empty array w/ no arguments', function() {
|
||||
listToArray().must.eql([]);
|
||||
});
|
||||
it('returns a empty array for a blank string', function() {
|
||||
listToArray('').must.eql([]);
|
||||
});
|
||||
it('returns a empty array when only given whitespace', function() {
|
||||
listToArray(' ').must.eql([]);
|
||||
});
|
||||
it('returns a empty array when only given whitespace and commas', function() {
|
||||
listToArray(' , ').must.eql([]);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user