mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 16:47:49 +00:00
Bump to v3.0.0.
This commit is contained in:
22
lodash.clone/LICENSE.txt
Normal file
22
lodash.clone/LICENSE.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
||||
Based on Underscore.js 1.7.0, copyright 2009-2015 Jeremy Ashkenas,
|
||||
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
20
lodash.clone/README.md
Normal file
20
lodash.clone/README.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# lodash.clone v3.0.0
|
||||
|
||||
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.clone` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module.
|
||||
|
||||
## Installation
|
||||
|
||||
Using npm:
|
||||
|
||||
```bash
|
||||
$ {sudo -H} npm i -g npm
|
||||
$ npm i --save lodash.clone
|
||||
```
|
||||
|
||||
In Node.js/io.js:
|
||||
|
||||
```js
|
||||
var clone = require('lodash.clone');
|
||||
```
|
||||
|
||||
See the [documentation](https://lodash.com/docs#clone) or [package source](https://github.com/lodash/lodash/blob/3.0.0-npm-packages/lodash.clone) for more details.
|
||||
73
lodash.clone/index.js
Normal file
73
lodash.clone/index.js
Normal file
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* lodash 3.0.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>
|
||||
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
* Available under MIT license <https://lodash.com/license>
|
||||
*/
|
||||
var baseClone = require('lodash._baseclone'),
|
||||
bindCallback = require('lodash._bindcallback'),
|
||||
isIterateeCall = require('lodash._isiterateecall');
|
||||
|
||||
/**
|
||||
* Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned,
|
||||
* otherwise they are assigned by reference. If `customizer` is provided it is
|
||||
* invoked to produce the cloned values. If `customizer` returns `undefined`
|
||||
* cloning is handled by the method instead. The `customizer` is bound to
|
||||
* `thisArg` and invoked with two argument; (value [, index|key, object]).
|
||||
*
|
||||
* **Note:** This method is loosely based on the structured clone algorithm.
|
||||
* The enumerable properties of `arguments` objects and objects created by
|
||||
* constructors other than `Object` are cloned to plain `Object` objects. An
|
||||
* empty object is returned for uncloneable values such as functions, DOM nodes,
|
||||
* Maps, Sets, and WeakMaps. See the [HTML5 specification](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm)
|
||||
* for more details.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Lang
|
||||
* @param {*} value The value to clone.
|
||||
* @param {boolean} [isDeep] Specify a deep clone.
|
||||
* @param {Function} [customizer] The function to customize cloning values.
|
||||
* @param {*} [thisArg] The `this` binding of `customizer`.
|
||||
* @returns {*} Returns the cloned value.
|
||||
* @example
|
||||
*
|
||||
* var users = [
|
||||
* { 'user': 'barney' },
|
||||
* { 'user': 'fred' }
|
||||
* ];
|
||||
*
|
||||
* var shallow = _.clone(users);
|
||||
* shallow[0] === users[0];
|
||||
* // => true
|
||||
*
|
||||
* var deep = _.clone(users, true);
|
||||
* deep[0] === users[0];
|
||||
* // => false
|
||||
*
|
||||
* // using a customizer callback
|
||||
* var body = _.clone(document.body, function(value) {
|
||||
* return _.isElement(value) ? value.cloneNode(false) : undefined;
|
||||
* });
|
||||
*
|
||||
* body === document.body
|
||||
* // => false
|
||||
* body.nodeName
|
||||
* // => BODY
|
||||
* body.childNodes.length;
|
||||
* // => 0
|
||||
*/
|
||||
function clone(value, isDeep, customizer, thisArg) {
|
||||
// Juggle arguments.
|
||||
if (typeof isDeep != 'boolean' && isDeep != null) {
|
||||
thisArg = customizer;
|
||||
customizer = isIterateeCall(value, isDeep, thisArg) ? null : isDeep;
|
||||
isDeep = false;
|
||||
}
|
||||
customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 1);
|
||||
return baseClone(value, isDeep, customizer);
|
||||
}
|
||||
|
||||
module.exports = clone;
|
||||
24
lodash.clone/package.json
Normal file
24
lodash.clone/package.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "lodash.clone",
|
||||
"version": "3.0.0",
|
||||
"description": "The modern build of lodash’s `_.clone` as a module.",
|
||||
"homepage": "https://lodash.com/",
|
||||
"icon": "https://lodash.com/icon.svg",
|
||||
"license": "MIT",
|
||||
"keywords": "lodash, lodash-modularized, stdlib, util",
|
||||
"author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
|
||||
"contributors": [
|
||||
"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> (http://www.iceddev.com/)",
|
||||
"Kit Cambridge <github@kitcambridge.be> (http://kitcambridge.be/)",
|
||||
"Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)"
|
||||
],
|
||||
"repository": "lodash/lodash",
|
||||
"scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" },
|
||||
"dependencies": {
|
||||
"lodash._baseclone": "^3.0.0",
|
||||
"lodash._bindcallback": "^3.0.0",
|
||||
"lodash._isiterateecall": "^3.0.0"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user