array-back
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -5,36 +5,36 @@ 'use strict' | ||
/** | ||
@module array-back | ||
@example | ||
var arrayify = require("array-back") | ||
*/ | ||
* @module array-back | ||
* @example | ||
* var arrayify = require("array-back") | ||
*/ | ||
module.exports = arrayify | ||
/** | ||
Takes any input and guarantees an array back. | ||
- converts array-like objects (e.g. `arguments`) to a real array | ||
- converts `undefined` to an empty array | ||
- converts any another other, singular value (including `null`) into an array containing that value | ||
- ignores input which is already an array | ||
@param {*} - the input value to convert to an array | ||
@returns {Array} | ||
@alias module:array-back | ||
@example | ||
> a.arrayify(undefined) | ||
[] | ||
> a.arrayify(null) | ||
[ null ] | ||
> a.arrayify(0) | ||
[ 0 ] | ||
> a.arrayify([ 1, 2 ]) | ||
[ 1, 2 ] | ||
> function f(){ return a.arrayify(arguments); } | ||
> f(1,2,3) | ||
[ 1, 2, 3 ] | ||
*/ | ||
* Takes any input and guarantees an array back. | ||
* | ||
* - converts array-like objects (e.g. `arguments`) to a real array | ||
* - converts `undefined` to an empty array | ||
* - converts any another other, singular value (including `null`) into an array containing that value | ||
* - ignores input which is already an array | ||
* | ||
* @param {*} - the input value to convert to an array | ||
* @returns {Array} | ||
* @alias module:array-back | ||
* @example | ||
* > a.arrayify(undefined) | ||
* [] | ||
* | ||
* > a.arrayify(null) | ||
* [ null ] | ||
* | ||
* > a.arrayify(0) | ||
* [ 0 ] | ||
* | ||
* > a.arrayify([ 1, 2 ]) | ||
* [ 1, 2 ] | ||
* | ||
* > function f(){ return a.arrayify(arguments); } | ||
* > f(1,2,3) | ||
* [ 1, 2, 3 ] | ||
*/ | ||
function arrayify (input) { | ||
@@ -41,0 +41,0 @@ if (input === undefined) { |
{ | ||
"name": "array-back", | ||
"author": "Lloyd Brookes <75pound@gmail.com>", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Guarantees an array back", | ||
@@ -17,15 +17,16 @@ "repository": "https://github.com/75lb/array-back.git", | ||
"engines": { | ||
"node": ">=0.10.0" | ||
"node": ">=0.12.0" | ||
}, | ||
"scripts": { | ||
"test": "tape test/*.js", | ||
"test": "test-runner test/*.js", | ||
"docs": "jsdoc2md -t jsdoc2md/README.hbs lib/*.js > README.md; echo" | ||
}, | ||
"dependencies": { | ||
"typical": "^2.4.2" | ||
"typical": "^2.6.0" | ||
}, | ||
"devDependencies": { | ||
"jsdoc-to-markdown": "^1.3.3", | ||
"tape": "^4.5.1" | ||
"core-assert": "^0.2.1", | ||
"jsdoc-to-markdown": "^2.0.1", | ||
"test-runner": "^0.3.0" | ||
} | ||
} |
'use strict' | ||
var test = require('tape') | ||
var TestRunner = require('test-runner') | ||
var arrayify = require('../') | ||
var a = require('core-assert') | ||
test('arrayify()', function (t) { | ||
t.deepEqual(arrayify(undefined), []) | ||
t.deepEqual(arrayify(null), [ null ]) | ||
t.deepEqual(arrayify(0), [ 0 ]) | ||
t.deepEqual(arrayify([ 1, 2 ]), [ 1, 2 ]) | ||
var runner = new TestRunner() | ||
runner.test('arrayify()', function () { | ||
a.deepStrictEqual(arrayify(undefined), []) | ||
a.deepStrictEqual(arrayify(null), [ null ]) | ||
a.deepStrictEqual(arrayify(0), [ 0 ]) | ||
a.deepStrictEqual(arrayify([ 1, 2 ]), [ 1, 2 ]) | ||
function func () { | ||
t.deepEqual(arrayify(arguments), [ 1, 2, 3 ]) | ||
a.deepStrictEqual(arrayify(arguments), [ 1, 2, 3 ]) | ||
} | ||
func(1, 2, 3) | ||
t.end() | ||
}) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5634
60
3
Updatedtypical@^2.6.0