lodash.sortby
Advanced tools
Comparing version 3.0.0 to 3.1.0
39
index.js
/** | ||
* lodash 3.0.0 (Custom Build) <https://lodash.com/> | ||
* lodash 3.1.0 (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 | ||
@@ -13,3 +13,5 @@ * Available under MIT license <https://lodash.com/license> | ||
baseSortBy = require('lodash._basesortby'), | ||
isIterateeCall = require('lodash._isiterateecall'); | ||
isIterateeCall = require('lodash._isiterateecall'), | ||
isArray = require('lodash.isarray'), | ||
keys = require('lodash.keys'); | ||
@@ -31,3 +33,3 @@ /** | ||
* Used as the maximum length of an array-like value. | ||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) | ||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) | ||
* for more details. | ||
@@ -40,2 +42,6 @@ */ | ||
* | ||
* **Note:** This function is based on ES `ToLength`. See the | ||
* [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) | ||
* for more details. | ||
* | ||
* @private | ||
@@ -56,6 +62,10 @@ * @param {*} value The value to check. | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` 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 `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -70,3 +80,3 @@ * object, else `false`. | ||
* invoked per iteration. If a property name or an object is provided it is | ||
* used to create a "_.property" or "_.matches" style callback respectively. | ||
* used to create a `_.property` or `_.matches` style callback respectively. | ||
* @param {*} [thisArg] The `this` binding of `iteratee`. | ||
@@ -76,6 +86,10 @@ * @returns {Array} Returns the new sorted array. | ||
* | ||
* _.sortBy([1, 2, 3], function(n) { return Math.sin(n); }); | ||
* _.sortBy([1, 2, 3], function(n) { | ||
* return Math.sin(n); | ||
* }); | ||
* // => [3, 1, 2] | ||
* | ||
* _.sortBy([1, 2, 3], function(n) { return this.sin(n); }, Math); | ||
* _.sortBy([1, 2, 3], function(n) { | ||
* return this.sin(n); | ||
* }, Math); | ||
* // => [3, 1, 2] | ||
@@ -89,3 +103,3 @@ * | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.pluck(_.sortBy(users, 'user'), 'user'); | ||
@@ -95,4 +109,7 @@ * // => ['barney', 'fred', 'pebbles'] | ||
function sortBy(collection, iteratee, thisArg) { | ||
if (collection == null) { | ||
return []; | ||
} | ||
var index = -1, | ||
length = collection ? collection.length : 0, | ||
length = collection.length, | ||
result = isLength(length) ? Array(length) : []; | ||
@@ -99,0 +116,0 @@ |
{ | ||
"name": "lodash.sortby", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "The modern build of lodash’s `_.sortBy` as a module.", | ||
@@ -24,4 +24,6 @@ "homepage": "https://lodash.com/", | ||
"lodash._basesortby": "^3.0.0", | ||
"lodash._isiterateecall": "^3.0.0" | ||
"lodash._isiterateecall": "^3.0.0", | ||
"lodash.isarray": "^3.0.0", | ||
"lodash.keys": "^3.0.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# lodash.sortby v3.0.0 | ||
# lodash.sortby v3.1.0 | ||
@@ -20,2 +20,2 @@ The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.sortBy` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. | ||
See the [documentation](https://lodash.com/docs#sortBy) or [package source](https://github.com/lodash/lodash/blob/3.0.0-npm-packages/lodash.sortby) for more details. | ||
See the [documentation](https://lodash.com/docs#sortBy) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.sortby) for more details. |
7265
113
7
+ Addedlodash.isarray@^3.0.0
+ Addedlodash.keys@^3.0.0