lodash.max
Advanced tools
Comparing version 4.0.0 to 4.0.1
89
index.js
/** | ||
* lodash 4.0.0 (Custom Build) <https://lodash.com/> | ||
* lodash (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modularize exports="npm" -o ./` | ||
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> | ||
* Copyright jQuery Foundation and other contributors <https://jquery.org/> | ||
* Released under MIT license <https://lodash.com/license> | ||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | ||
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
* Available under MIT license <https://lodash.com/license> | ||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
*/ | ||
/** `Object#toString` result references. */ | ||
var symbolTag = '[object Symbol]'; | ||
/** Used for built-in method references. */ | ||
var objectProto = Object.prototype; | ||
/** | ||
* Used to resolve the | ||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
var objectToString = objectProto.toString; | ||
/** | ||
* The base implementation of methods like `_.max` and `_.min` which accepts a | ||
@@ -29,3 +42,3 @@ * `comparator` to determine the extremum value. | ||
if (current != null && (computed === undefined | ||
? current === current | ||
? (current === current && !isSymbol(current)) | ||
: comparator(current, computed) | ||
@@ -41,30 +54,71 @@ )) { | ||
/** | ||
* Checks if `value` is greater than `other`. | ||
* The base implementation of `_.gt` which doesn't coerce arguments to numbers. | ||
* | ||
* @private | ||
* @param {*} value The value to compare. | ||
* @param {*} other The other value to compare. | ||
* @returns {boolean} Returns `true` if `value` is greater than `other`, | ||
* else `false`. | ||
*/ | ||
function baseGt(value, other) { | ||
return value > other; | ||
} | ||
/** | ||
* Checks if `value` is object-like. A value is object-like if it's not `null` | ||
* and has a `typeof` result of "object". | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 4.0.0 | ||
* @category Lang | ||
* @param {*} value The value to compare. | ||
* @param {*} other The other value to compare. | ||
* @returns {boolean} Returns `true` if `value` is greater than `other`, else `false`. | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is object-like, else `false`. | ||
* @example | ||
* | ||
* _.gt(3, 1); | ||
* _.isObjectLike({}); | ||
* // => true | ||
* | ||
* _.gt(3, 3); | ||
* _.isObjectLike([1, 2, 3]); | ||
* // => true | ||
* | ||
* _.isObjectLike(_.noop); | ||
* // => false | ||
* | ||
* _.gt(1, 3); | ||
* _.isObjectLike(null); | ||
* // => false | ||
*/ | ||
function gt(value, other) { | ||
return value > other; | ||
function isObjectLike(value) { | ||
return !!value && typeof value == 'object'; | ||
} | ||
/** | ||
* This method returns the first argument provided to it. | ||
* Checks if `value` is classified as a `Symbol` primitive or object. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 4.0.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is correctly classified, | ||
* else `false`. | ||
* @example | ||
* | ||
* _.isSymbol(Symbol.iterator); | ||
* // => true | ||
* | ||
* _.isSymbol('abc'); | ||
* // => false | ||
*/ | ||
function isSymbol(value) { | ||
return typeof value == 'symbol' || | ||
(isObjectLike(value) && objectToString.call(value) == symbolTag); | ||
} | ||
/** | ||
* This method returns the first argument given to it. | ||
* | ||
* @static | ||
* @since 0.1.0 | ||
* @memberOf _ | ||
* @category Util | ||
@@ -85,6 +139,7 @@ * @param {*} value Any value. | ||
/** | ||
* Computes the maximum value of `array`. If `array` is empty or falsey | ||
* Computes the maximum value of `array`. If `array` is empty or falsey, | ||
* `undefined` is returned. | ||
* | ||
* @static | ||
* @since 0.1.0 | ||
* @memberOf _ | ||
@@ -104,3 +159,3 @@ * @category Math | ||
return (array && array.length) | ||
? baseExtremum(array, identity, gt) | ||
? baseExtremum(array, identity, baseGt) | ||
: undefined; | ||
@@ -107,0 +162,0 @@ } |
{ | ||
"name": "lodash.max", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "The lodash method `_.max` exported as a module.", | ||
@@ -8,7 +8,7 @@ "homepage": "https://lodash.com/", | ||
"license": "MIT", | ||
"keywords": "lodash, lodash-modularized, stdlib, util, max", | ||
"keywords": "lodash-modularized, max", | ||
"author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", | ||
"contributors": [ | ||
"John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", | ||
"Blaine Bublitz <blaine@iceddev.com> (https://github.com/phated)", | ||
"Blaine Bublitz <blaine.bublitz@gmail.com> (https://github.com/phated)", | ||
"Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)" | ||
@@ -15,0 +15,0 @@ ], |
@@ -1,2 +0,2 @@ | ||
# lodash.max v4.0.0 | ||
# lodash.max v4.0.1 | ||
@@ -18,2 +18,2 @@ The [lodash](https://lodash.com/) method `_.max` exported as a [Node.js](https://nodejs.org/) module. | ||
See the [documentation](https://lodash.com/docs#max) or [package source](https://github.com/lodash/lodash/blob/4.0.0-npm-packages/lodash.max) for more details. | ||
See the [documentation](https://lodash.com/docs#max) or [package source](https://github.com/lodash/lodash/blob/4.0.1-npm-packages/lodash.max) for more details. |
Sorry, the diff of this file is not supported yet
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
Mixed license
License(Experimental) Package contains multiple licenses.
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
6938
148
1