X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=node_modules%2Fgrunt-legacy-log%2Fnode_modules%2Flodash%2Flang%2FtoArray.js;fp=node_modules%2Fgrunt-legacy-log%2Fnode_modules%2Flodash%2Flang%2FtoArray.js;h=72b0b46e1804c96bdf248bb89b811619b49754b4;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/node_modules/grunt-legacy-log/node_modules/lodash/lang/toArray.js b/node_modules/grunt-legacy-log/node_modules/lodash/lang/toArray.js new file mode 100644 index 000000000..72b0b46e1 --- /dev/null +++ b/node_modules/grunt-legacy-log/node_modules/lodash/lang/toArray.js @@ -0,0 +1,32 @@ +var arrayCopy = require('../internal/arrayCopy'), + getLength = require('../internal/getLength'), + isLength = require('../internal/isLength'), + values = require('../object/values'); + +/** + * Converts `value` to an array. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to convert. + * @returns {Array} Returns the converted array. + * @example + * + * (function() { + * return _.toArray(arguments).slice(1); + * }(1, 2, 3)); + * // => [2, 3] + */ +function toArray(value) { + var length = value ? getLength(value) : 0; + if (!isLength(length)) { + return values(value); + } + if (!length) { + return []; + } + return arrayCopy(value); +} + +module.exports = toArray;