mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 01:57:50 +00:00
Compare commits
1 Commits
3.4.1-npm-
...
3.4.2-npm-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90dc45d7fc |
@@ -1,4 +1,4 @@
|
|||||||
# lodash v3.4.1
|
# lodash v3.4.2
|
||||||
|
|
||||||
The [lodash](https://lodash.com/) library exported as [npm packages](https://www.npmjs.com/browse/keyword/lodash-modularized) per method.
|
The [lodash](https://lodash.com/) library exported as [npm packages](https://www.npmjs.com/browse/keyword/lodash-modularized) per method.
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
|
||||||
Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas,
|
Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas,
|
||||||
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
@@ -1,20 +1,18 @@
|
|||||||
# lodash.add v3.4.1
|
# lodash.add v3.4.2
|
||||||
|
|
||||||
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.add` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module.
|
The [lodash](https://lodash.com/) method `_.add` exported as a [Node.js](https://nodejs.org/) module.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Using npm:
|
Using npm:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ {sudo -H} npm i -g npm
|
$ {sudo -H} npm i -g npm
|
||||||
$ npm i --save lodash.add
|
$ npm i --save lodash.add
|
||||||
```
|
```
|
||||||
|
|
||||||
In Node.js/io.js:
|
In Node.js:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var add = require('lodash.add');
|
var add = require('lodash.add');
|
||||||
```
|
```
|
||||||
|
|
||||||
See the [documentation](https://lodash.com/docs#add) or [package source](https://github.com/lodash/lodash/blob/3.4.1-npm-packages/lodash.add) for more details.
|
See the [documentation](https://lodash.com/docs#add) or [package source](https://github.com/lodash/lodash/blob/3.4.2-npm-packages/lodash.add) for more details.
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* lodash 3.4.1 (Custom Build) <https://lodash.com/>
|
* lodash 3.4.2 (Custom Build) <https://lodash.com/>
|
||||||
* Build: `lodash modern modularize exports="npm" -o ./`
|
* Build: `lodash modularize exports="npm" -o ./`
|
||||||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
|
||||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||||
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||||
* Available under MIT license <https://lodash.com/license>
|
* Available under MIT license <https://lodash.com/license>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -13,16 +13,23 @@
|
|||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Math
|
* @category Math
|
||||||
* @param {number} augend The first number to add.
|
* @param {number} augend The first number in an addition.
|
||||||
* @param {number} addend The second number to add.
|
* @param {number} addend The second number in an addition.
|
||||||
* @returns {number} Returns the sum.
|
* @returns {number} Returns the total.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.add(6, 4);
|
* _.add(6, 4);
|
||||||
* // => 10
|
* // => 10
|
||||||
*/
|
*/
|
||||||
function add(augend, addend) {
|
function add(augend, addend) {
|
||||||
return (+augend || 0) + (+addend || 0);
|
var result;
|
||||||
|
if (augend !== undefined) {
|
||||||
|
result = augend;
|
||||||
|
}
|
||||||
|
if (addend !== undefined) {
|
||||||
|
result = result === undefined ? addend : (result + addend);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = add;
|
module.exports = add;
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "lodash.add",
|
"name": "lodash.add",
|
||||||
"version": "3.4.1",
|
"version": "3.4.2",
|
||||||
"description": "The modern build of lodash’s `_.add` as a module.",
|
"description": "The lodash method `_.add` exported as a module.",
|
||||||
"homepage": "https://lodash.com/",
|
"homepage": "https://lodash.com/",
|
||||||
"icon": "https://lodash.com/icon.svg",
|
"icon": "https://lodash.com/icon.svg",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": "lodash, lodash-modularized, stdlib, util",
|
"keywords": "lodash, lodash-modularized, stdlib, util, add",
|
||||||
"author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
|
"author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
|
"John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
|
||||||
"Benjamin Tan <demoneaux@gmail.com> (https://d10.github.io/)",
|
"Blaine Bublitz <blaine@iceddev.com> (https://github.com/phated)",
|
||||||
"Blaine Bublitz <blaine@iceddev.com> (http://www.iceddev.com/)",
|
|
||||||
"Kit Cambridge <github@kitcambridge.be> (http://kitcambridge.be/)",
|
|
||||||
"Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)"
|
"Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)"
|
||||||
],
|
],
|
||||||
"repository": "lodash/lodash",
|
"repository": "lodash/lodash",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# lodash.sortbyorder v3.4.1
|
# lodash.sortbyorder v3.4.2
|
||||||
|
|
||||||
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.sortByOrder` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module.
|
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.sortByOrder` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module.
|
||||||
|
|
||||||
@@ -17,4 +17,4 @@ In Node.js/io.js:
|
|||||||
var sortByOrder = require('lodash.sortbyorder');
|
var sortByOrder = require('lodash.sortbyorder');
|
||||||
```
|
```
|
||||||
|
|
||||||
See the [documentation](https://lodash.com/docs#sortByOrder) or [package source](https://github.com/lodash/lodash/blob/3.4.1-npm-packages/lodash.sortbyorder) for more details.
|
See the [documentation](https://lodash.com/docs#sortByOrder) or [package source](https://github.com/lodash/lodash/blob/3.4.2-npm-packages/lodash.sortbyorder) for more details.
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
* lodash 3.4.1 (Custom Build) <https://lodash.com/>
|
* lodash 3.4.2 (Custom Build) <https://lodash.com/>
|
||||||
* Build: `lodash modern modularize exports="npm" -o ./`
|
* Build: `lodash modern modularize exports="npm" -o ./`
|
||||||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
||||||
* Based on Underscore.js 1.8.2 <http://underscorejs.org/LICENSE>
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||||
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||||
* Available under MIT license <https://lodash.com/license>
|
* Available under MIT license <https://lodash.com/license>
|
||||||
*/
|
*/
|
||||||
@@ -13,45 +13,52 @@ var baseEach = require('lodash._baseeach'),
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is like `_.sortByAll` except that it allows specifying the
|
* This method is like `_.sortByAll` except that it allows specifying the
|
||||||
* sort orders of the property names to sort by. A truthy value in `orders`
|
* sort orders of the iteratees to sort by. A truthy value in `orders` will
|
||||||
* will sort the corresponding property name in ascending order while a
|
* sort the corresponding property name in ascending order while a falsey
|
||||||
* falsey value will sort it in descending order.
|
* value will sort it in descending order.
|
||||||
|
*
|
||||||
|
* If a property name is provided for an iteratee the created `_.property`
|
||||||
|
* style callback returns the property value of the given element.
|
||||||
|
*
|
||||||
|
* If an object is provided for an iteratee the created `_.matches` style
|
||||||
|
* callback returns `true` for elements that have the properties of the given
|
||||||
|
* object, else `false`.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Collection
|
* @category Collection
|
||||||
* @param {Array|Object|string} collection The collection to iterate over.
|
* @param {Array|Object|string} collection The collection to iterate over.
|
||||||
* @param {string[]} props The property names to sort by.
|
* @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
|
||||||
* @param {boolean[]} orders The sort orders of `props`.
|
* @param {boolean[]} orders The sort orders of `iteratees`.
|
||||||
* @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.
|
* @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.
|
||||||
* @returns {Array} Returns the new sorted array.
|
* @returns {Array} Returns the new sorted array.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var users = [
|
* var users = [
|
||||||
* { 'user': 'barney', 'age': 26 },
|
* { 'user': 'fred', 'age': 48 },
|
||||||
* { 'user': 'fred', 'age': 40 },
|
* { 'user': 'barney', 'age': 34 },
|
||||||
* { 'user': 'barney', 'age': 36 },
|
* { 'user': 'fred', 'age': 42 },
|
||||||
* { 'user': 'fred', 'age': 30 }
|
* { 'user': 'barney', 'age': 36 }
|
||||||
* ];
|
* ];
|
||||||
*
|
*
|
||||||
* // sort by `user` in ascending order and by `age` in descending order
|
* // sort by `user` in ascending order and by `age` in descending order
|
||||||
* _.map(_.sortByOrder(users, ['user', 'age'], [true, false]), _.values);
|
* _.map(_.sortByOrder(users, ['user', 'age'], [true, false]), _.values);
|
||||||
* // => [['barney', 36], ['barney', 26], ['fred', 40], ['fred', 30]]
|
* // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
|
||||||
*/
|
*/
|
||||||
function sortByOrder(collection, props, orders, guard) {
|
function sortByOrder(collection, iteratees, orders, guard) {
|
||||||
if (collection == null) {
|
if (collection == null) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
if (guard && isIterateeCall(props, orders, guard)) {
|
if (guard && isIterateeCall(iteratees, orders, guard)) {
|
||||||
orders = null;
|
orders = null;
|
||||||
}
|
}
|
||||||
if (!isArray(props)) {
|
if (!isArray(iteratees)) {
|
||||||
props = props == null ? [] : [props];
|
iteratees = iteratees == null ? [] : [iteratees];
|
||||||
}
|
}
|
||||||
if (!isArray(orders)) {
|
if (!isArray(orders)) {
|
||||||
orders = orders == null ? [] : [orders];
|
orders = orders == null ? [] : [orders];
|
||||||
}
|
}
|
||||||
return baseSortByOrder(collection, props, orders);
|
return baseSortByOrder(collection, iteratees, orders);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = sortByOrder;
|
module.exports = sortByOrder;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lodash.sortbyorder",
|
"name": "lodash.sortbyorder",
|
||||||
"version": "3.4.1",
|
"version": "3.4.2",
|
||||||
"description": "The modern build of lodash’s `_.sortByOrder` as a module.",
|
"description": "The modern build of lodash’s `_.sortByOrder` as a module.",
|
||||||
"homepage": "https://lodash.com/",
|
"homepage": "https://lodash.com/",
|
||||||
"icon": "https://lodash.com/icon.svg",
|
"icon": "https://lodash.com/icon.svg",
|
||||||
|
|||||||
Reference in New Issue
Block a user