Comparing version 0.1.0 to 0.2.0
@@ -1,11 +0,19 @@ | ||
function arrayWrap(value) { | ||
if (arguments.length) { | ||
return Array.isArray(value) ? value : [value]; | ||
(function () { | ||
var isArray = Array.isArray || function (value) { | ||
return Object.prototype.toString.call(value) == '[object Array]'; | ||
}; | ||
function arrayWrap(value) { | ||
if (arguments.length) { | ||
return isArray(value) ? value : [value]; | ||
} else { | ||
return []; | ||
} | ||
} | ||
if (typeof module !== 'undefined') { | ||
module.exports = arrayWrap; | ||
} else { | ||
return []; | ||
this.arrayWrap = arrayWrap; | ||
} | ||
} | ||
if (typeof module !== 'undefined') { | ||
module.exports = arrayWrap; | ||
} | ||
})(); |
{ | ||
"name": "arraywrap", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "if it's not an array, wrap it in an array. if it's already an array, do nothing.", | ||
@@ -5,0 +5,0 @@ "main": "arraywrap.js", |
@@ -34,2 +34,2 @@ array wrap dot js | ||
If you need to support browsers that don't have `Array.isArray` (like IE8 and below), you'll need to [polyfill it](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray#Polyfill). | ||
This should support environments that don't have `Array.isArray` (like IE8 and below). |
4032
60