array-back
Advanced tools
Comparing version
@@ -1,3 +0,3 @@ | ||
"use strict"; | ||
var t = require("typical"); | ||
'use strict' | ||
var t = require('typical') | ||
@@ -7,5 +7,5 @@ /** | ||
@example | ||
var arrayify = require("array-back"); | ||
var arrayify = require("array-back") | ||
*/ | ||
module.exports = arrayify; | ||
module.exports = arrayify | ||
@@ -40,10 +40,10 @@ /** | ||
*/ | ||
function arrayify(input){ | ||
if (input === undefined){ | ||
return []; | ||
} else if (t.isArrayLike(input)){ | ||
return Array.prototype.slice.call(input); | ||
} else { | ||
return Array.isArray(input) ? input : [ input ]; | ||
} | ||
function arrayify (input) { | ||
if (input === undefined) { | ||
return [] | ||
} else if (t.isArrayLike(input)) { | ||
return Array.prototype.slice.call(input) | ||
} else { | ||
return Array.isArray(input) ? input : [ input ] | ||
} | ||
} |
{ | ||
"name": "array-back", | ||
"author": "Lloyd Brookes <75pound@gmail.com>", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Guarantees an array back", | ||
@@ -24,8 +24,8 @@ "repository": "https://github.com/75lb/array-back.git", | ||
"dependencies": { | ||
"typical": "^2.2.0" | ||
"typical": "^2.4.2" | ||
}, | ||
"devDependencies": { | ||
"jsdoc-to-markdown": "^1.1.1", | ||
"tape": "^4.0.0" | ||
"jsdoc-to-markdown": "^1.3.3", | ||
"tape": "^4.5.1" | ||
} | ||
} |
[](https://www.npmjs.org/package/array-back) | ||
[](https://www.npmjs.org/package/array-back) | ||
[](https://www.npmjs.org/package/array-back) | ||
[](https://travis-ci.org/75lb/array-back) | ||
[](https://david-dm.org/75lb/array-back) | ||
[](https://github.com/feross/standard) | ||
<a name="module_array-back"></a> | ||
## array-back | ||
**Example** | ||
```js | ||
var arrayify = require("array-back"); | ||
var arrayify = require("array-back") | ||
``` | ||
<a name="exp_module_array-back--arrayify"></a> | ||
### arrayify(input) ⇒ <code>Array</code> ⏏ | ||
@@ -48,2 +51,2 @@ Takes any input and guarantees an array back. | ||
© 2015 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown). | ||
© 2015-16 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown). |
@@ -1,17 +0,17 @@ | ||
"use strict"; | ||
var test = require("tape"); | ||
var arrayify = require("../"); | ||
'use strict' | ||
var test = require('tape') | ||
var arrayify = require('../') | ||
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 ]); | ||
function func(){ | ||
t.deepEqual(arrayify(arguments), [ 1, 2, 3 ]); | ||
} | ||
func(1, 2, 3); | ||
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 ]) | ||
t.end(); | ||
}); | ||
function func () { | ||
t.deepEqual(arrayify(arguments), [ 1, 2, 3 ]) | ||
} | ||
func(1, 2, 3) | ||
t.end() | ||
}) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
5395
3.51%51
6.25%Updated