ensure-array
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -1,10 +0,30 @@ | ||
'use strict'; | ||
(function (root, factory) { | ||
/*global define:true */ | ||
module.exports = function array(a, b, n) { | ||
if (arguments.length === 0) return []; //no args, ret [] | ||
if (arguments.length === 1) { //single argument | ||
if (a === undefined || a === null) return []; // undefined or null, ret [] | ||
if (Array.isArray(a)) return a; // isArray, return it | ||
if (typeof exports === 'object') { | ||
// Node. Does not work with strict CommonJS, but | ||
// only CommonJS-like enviroments that support module.exports, | ||
// like Node. | ||
module.exports = factory(); | ||
} else if (typeof define === 'function' && define.amd) { | ||
// AMD. Register as an anonymous module. | ||
define([], factory); | ||
} else { | ||
// Browser globals | ||
root.ensureArray = factory(); | ||
} | ||
}(this, function () { | ||
'use strict'; | ||
function ensureArray(a, b, n) { | ||
if (arguments.length === 0) return []; //no args, ret [] | ||
if (arguments.length === 1) { //single argument | ||
if (a === undefined || a === null) return []; // undefined or null, ret [] | ||
if (Array.isArray(a)) return a; // isArray, return it | ||
} | ||
return Array.prototype.slice.call(arguments); //return array with copy of all arguments | ||
} | ||
return Array.prototype.slice.call(arguments); //return array with copy of all arguments | ||
}; | ||
return ensureArray; | ||
})); | ||
@@ -5,5 +5,5 @@ { | ||
"description": "Ensure that an object is an array. Moves error checking out of your code.", | ||
"version": "0.0.4", | ||
"repository": { "type": "git", "url": "http://github.com/jeffbski/ensure-array.git" }, | ||
"bugs" : { "url": "http://github.com/jeffbski/ensure-array/issues" }, | ||
"version": "0.0.5", | ||
"repository": { "type": "git", "url": "http://github.com/jeffbski/ensure-array.git" }, | ||
"bugs" : { "url": "http://github.com/jeffbski/ensure-array/issues" }, | ||
"main": "ensure-array.js", | ||
@@ -15,8 +15,8 @@ "engines": { | ||
"devDependencies": { | ||
"tap": "~0.1.2", | ||
"tapr": "~0.1.1" | ||
"mocha": "~0.14.1", | ||
"chai": "~0.5.2" | ||
}, | ||
"scripts": { | ||
"test" : "node_modules/.bin/tapr ./test" | ||
"test": "./node_modules/mocha/bin/mocha ./test/*.mocha.js" | ||
} | ||
} |
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
7460
8
101