lodash.sortedindex
Advanced tools
Comparing version 3.0.0 to 3.0.1
40
index.js
/** | ||
* lodash 3.0.0 (Custom Build) <https://lodash.com/> | ||
* lodash 3.0.1 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modern modularize exports="npm" -o ./` | ||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
* Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE> | ||
* Based on Underscore.js 1.8.2 <http://underscorejs.org/LICENSE> | ||
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
@@ -14,2 +14,17 @@ * Available under MIT license <https://lodash.com/license> | ||
/** | ||
* Creates a `_.sortedIndex` or `_.sortedLastIndex` function. | ||
* | ||
* @private | ||
* @param {boolean} [retHighest] Specify returning the highest qualified index. | ||
* @returns {Function} Returns the new index function. | ||
*/ | ||
function createSortedIndex(retHighest) { | ||
return function(array, value, iteratee, thisArg) { | ||
return iteratee == null | ||
? binaryIndex(array, value, retHighest) | ||
: binaryIndexBy(array, value, baseCallback(iteratee, thisArg, 1), retHighest); | ||
}; | ||
} | ||
/** | ||
* Uses a binary search to determine the lowest index at which `value` should | ||
@@ -21,6 +36,10 @@ * be inserted into `array` in order to maintain its sort order. If an iteratee | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `iteratee` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `iteratee` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -35,4 +54,3 @@ * object, else `false`. | ||
* @param {Function|Object|string} [iteratee=_.identity] The function invoked | ||
* per iteration. If a property name or object is provided it is used to | ||
* create a "_.property" or "_.matches" style callback respectively. | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `iteratee`. | ||
@@ -46,3 +64,3 @@ * @returns {number} Returns the index at which `value` should be inserted | ||
* | ||
* _.sortedIndex([4, 4, 5, 5, 6, 6], 5); | ||
* _.sortedIndex([4, 4, 5, 5], 5); | ||
* // => 2 | ||
@@ -58,12 +76,8 @@ * | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); | ||
* // => 1 | ||
*/ | ||
function sortedIndex(array, value, iteratee, thisArg) { | ||
return iteratee == null | ||
? binaryIndex(array, value) | ||
: binaryIndexBy(array, value, baseCallback(iteratee, thisArg, 1)); | ||
} | ||
var sortedIndex = createSortedIndex(); | ||
module.exports = sortedIndex; |
Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
Based on Underscore.js 1.7.0, copyright 2009-2015 Jeremy Ashkenas, | ||
Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas, | ||
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/> | ||
@@ -4,0 +4,0 @@ |
{ | ||
"name": "lodash.sortedindex", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "The modern build of lodash’s `_.sortedIndex` as a module.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/", |
@@ -1,2 +0,2 @@ | ||
# lodash.sortedindex v3.0.0 | ||
# lodash.sortedindex v3.0.1 | ||
@@ -20,2 +20,2 @@ The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.sortedIndex` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. | ||
See the [documentation](https://lodash.com/docs#sortedIndex) or [package source](https://github.com/lodash/lodash/blob/3.0.0-npm-packages/lodash.sortedindex) for more details. | ||
See the [documentation](https://lodash.com/docs#sortedIndex) or [package source](https://github.com/lodash/lodash/blob/3.0.1-npm-packages/lodash.sortedindex) for more details. |
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
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
5693
75