X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=node_modules%2Funcss%2Fnode_modules%2Flodash%2FminBy.js;fp=node_modules%2Funcss%2Fnode_modules%2Flodash%2FminBy.js;h=cb90acec504c552cb2c7e448e2d578f7118ab4a4;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/node_modules/uncss/node_modules/lodash/minBy.js b/node_modules/uncss/node_modules/lodash/minBy.js new file mode 100644 index 000000000..cb90acec5 --- /dev/null +++ b/node_modules/uncss/node_modules/lodash/minBy.js @@ -0,0 +1,33 @@ +var baseExtremum = require('./internal/baseExtremum'), + baseIteratee = require('./internal/baseIteratee'), + lt = require('./lt'); + +/** + * This method is like `_.min` except that it accepts `iteratee` which is + * invoked for each element in `array` to generate the criterion by which + * the value is ranked. The iteratee is invoked with one argument: (value). + * + * @static + * @memberOf _ + * @category Math + * @param {Array} array The array to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. + * @returns {*} Returns the minimum value. + * @example + * + * var objects = [{ 'n': 1 }, { 'n': 2 }]; + * + * _.minBy(objects, function(o) { return o.n; }); + * // => { 'n': 1 } + * + * // using the `_.property` iteratee shorthand + * _.minBy(objects, 'n'); + * // => { 'n': 1 } + */ +function minBy(array, iteratee) { + return (array && array.length) + ? baseExtremum(array, baseIteratee(iteratee), lt) + : undefined; +} + +module.exports = minBy;