X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=node_modules%2Fgrunt-legacy-log-utils%2Fnode_modules%2Flodash%2Fiteratee.js;fp=node_modules%2Fgrunt-legacy-log-utils%2Fnode_modules%2Flodash%2Fiteratee.js;h=c761adbbc5a21c06913f57c86adc06347e12d256;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/node_modules/grunt-legacy-log-utils/node_modules/lodash/iteratee.js b/node_modules/grunt-legacy-log-utils/node_modules/lodash/iteratee.js new file mode 100644 index 000000000..c761adbbc --- /dev/null +++ b/node_modules/grunt-legacy-log-utils/node_modules/lodash/iteratee.js @@ -0,0 +1,37 @@ +var baseClone = require('./_baseClone'), + baseIteratee = require('./_baseIteratee'); + +/** + * Creates a function that invokes `func` with the arguments of the created + * function. If `func` is a property name the created callback returns the + * property value for a given element. If `func` is an object the created + * callback returns `true` for elements that contain the equivalent object properties, otherwise it returns `false`. + * + * @static + * @memberOf _ + * @category Util + * @param {*} [func=_.identity] The value to convert to a callback. + * @returns {Function} Returns the callback. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 } + * ]; + * + * // Create custom iteratee shorthands. + * _.iteratee = _.wrap(_.iteratee, function(callback, func) { + * var p = /^(\S+)\s*([<>])\s*(\S+)$/.exec(func); + * return !p ? callback(func) : function(object) { + * return (p[2] == '>' ? object[p[1]] > p[3] : object[p[1]] < p[3]); + * }; + * }); + * + * _.filter(users, 'age > 36'); + * // => [{ 'user': 'fred', 'age': 40 }] + */ +function iteratee(func) { + return baseIteratee(typeof func == 'function' ? func : baseClone(func, true)); +} + +module.exports = iteratee;