pax_global_header 0000666 0000000 0000000 00000000064 12403027753 0014515 g ustar 00root root 0000000 0000000 52 comment=6fc27c23e1ebf54a4f6ba8a7224dd48dfd9faf7c
node-merge-1.2.0/ 0000775 0000000 0000000 00000000000 12403027753 0013537 5 ustar 00root root 0000000 0000000 node-merge-1.2.0/.npmignore 0000664 0000000 0000000 00000000005 12403027753 0015531 0 ustar 00root root 0000000 0000000 tests node-merge-1.2.0/LICENSE 0000664 0000000 0000000 00000002110 12403027753 0014536 0 ustar 00root root 0000000 0000000 The MIT License (MIT)
Copyright (c) 2014 yeikos - http://www.yeikos.com
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. node-merge-1.2.0/README.md 0000664 0000000 0000000 00000002065 12403027753 0015021 0 ustar 00root root 0000000 0000000 # Merge
Merge multiple objects into one, optionally creating a new cloned object.
Similar to the jQuery.extend but more flexible. Works in Node.js and the
browser.
## Node.js Usage
```sh
npm install merge --save
```
```js
var merge = require('merge'), original, cloned;
console.log(merge({one:'hello'}, {two: 'world'}));
// -> {"one": "hello", "two": "world"}
original = { x: { y: 1 } };
cloned = merge(true, original);
cloned.x.y++;
console.log(original.x.y, cloned.x.y);
// -> 1, 2
console.log(merge.recursive(true, original, { x: { z: 2 } }));
// -> {"x": { "y": 1, "z": 2 } }
```
## Browser Usage
```html
```
## Tests
```sh
npm test
```
node-merge-1.2.0/bower.json 0000664 0000000 0000000 00000000767 12403027753 0015562 0 ustar 00root root 0000000 0000000 {
"name": "merge",
"version": "1.2.0",
"homepage": "https://github.com/yeikos/js.merge",
"authors": [
"yeikos "
],
"description": "Merge multiple objects into one, optionally creating a new cloned object. Similar to the jQuery.extend but more flexible. Works in Node.js and the browser.",
"main": "merge.js",
"keywords": [
"merge",
"recursive",
"extend",
"clone",
"object",
"browser"
],
"license": "MIT",
"ignore": [
"tests"
]
}
node-merge-1.2.0/merge.js 0000664 0000000 0000000 00000005212 12403027753 0015174 0 ustar 00root root 0000000 0000000 /*!
* @name JavaScript/NodeJS Merge v1.2.0
* @author yeikos
* @repository https://github.com/yeikos/js.merge
* Copyright 2014 yeikos - MIT license
* https://raw.github.com/yeikos/js.merge/master/LICENSE
*/
;(function(isNode) {
/**
* Merge one or more objects
* @param bool? clone
* @param mixed,... arguments
* @return object
*/
var Public = function(clone) {
return merge(clone === true, false, arguments);
}, publicName = 'merge';
/**
* Merge two or more objects recursively
* @param bool? clone
* @param mixed,... arguments
* @return object
*/
Public.recursive = function(clone) {
return merge(clone === true, true, arguments);
};
/**
* Clone the input removing any reference
* @param mixed input
* @return mixed
*/
Public.clone = function(input) {
var output = input,
type = typeOf(input),
index, size;
if (type === 'array') {
output = [];
size = input.length;
for (index=0;index