flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
3
VISUALIZACION/node_modules/ngraph.merge/.travis.yml
generated
vendored
Executable file
3
VISUALIZACION/node_modules/ngraph.merge/.travis.yml
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- node
|
||||
21
VISUALIZACION/node_modules/ngraph.merge/LICENSE
generated
vendored
Executable file
21
VISUALIZACION/node_modules/ngraph.merge/LICENSE
generated
vendored
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2019 Andrei Kashcha
|
||||
|
||||
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.
|
||||
38
VISUALIZACION/node_modules/ngraph.merge/README.md
generated
vendored
Executable file
38
VISUALIZACION/node_modules/ngraph.merge/README.md
generated
vendored
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
# ngraph.merge
|
||||
|
||||
Simple merge utility to extend objects without extra dependencies. This utility
|
||||
may be useful when you want to quickly provide optional settings
|
||||
|
||||
[](http://travis-ci.org/anvaka/ngraph.merge)
|
||||
# usage
|
||||
|
||||
``` js
|
||||
var merge = require('ngraph.merge');
|
||||
var options = { age: 42 };
|
||||
merge(options, { name: 'John' });
|
||||
console.log(options); // { age: 42, name: 'John'}
|
||||
|
||||
merge(options, { age: 100 });
|
||||
console.log(options.age); // 42. Options already has age defined
|
||||
|
||||
merge(options, {age: '100'});
|
||||
console.log(options.age); // '100'. Type mismatch. Age is overwritten
|
||||
```
|
||||
|
||||
For more examples please refer to [tests](https://github.com/anvaka/ngraph.merge/blob/master/test/merge.js).
|
||||
|
||||
# why?
|
||||
I want to control dependencies chain and not pull too many external libraries
|
||||
into ngraph.
|
||||
|
||||
# install
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```
|
||||
npm install ngraph.merge
|
||||
```
|
||||
|
||||
# license
|
||||
|
||||
MIT
|
||||
31
VISUALIZACION/node_modules/ngraph.merge/index.js
generated
vendored
Executable file
31
VISUALIZACION/node_modules/ngraph.merge/index.js
generated
vendored
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
module.exports = merge;
|
||||
|
||||
/**
|
||||
* Augments `target` with properties in `options`. Does not override
|
||||
* target's properties if they are defined and matches expected type in
|
||||
* options
|
||||
*
|
||||
* @returns {Object} merged object
|
||||
*/
|
||||
function merge(target, options) {
|
||||
var key;
|
||||
if (!target) { target = {}; }
|
||||
if (options) {
|
||||
for (key in options) {
|
||||
if (options.hasOwnProperty(key)) {
|
||||
var targetHasIt = target.hasOwnProperty(key),
|
||||
optionsValueType = typeof options[key],
|
||||
shouldReplace = !targetHasIt || (typeof target[key] !== optionsValueType);
|
||||
|
||||
if (shouldReplace) {
|
||||
target[key] = options[key];
|
||||
} else if (optionsValueType === 'object') {
|
||||
// go deep, don't care about loops here, we are simple API!:
|
||||
target[key] = merge(target[key], options[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
22
VISUALIZACION/node_modules/ngraph.merge/package.json
generated
vendored
Executable file
22
VISUALIZACION/node_modules/ngraph.merge/package.json
generated
vendored
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"name": "ngraph.merge",
|
||||
"version": "1.0.0",
|
||||
"description": "Simple merge utility to extend objects without extra dependencies",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"keywords": [
|
||||
"merge",
|
||||
"utility"
|
||||
],
|
||||
"author": "Andrei Kashcha",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/anvaka/ngraph.merge"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tap": "^14.2.0"
|
||||
}
|
||||
}
|
||||
100
VISUALIZACION/node_modules/ngraph.merge/test/merge.js
generated
vendored
Executable file
100
VISUALIZACION/node_modules/ngraph.merge/test/merge.js
generated
vendored
Executable file
|
|
@ -0,0 +1,100 @@
|
|||
var test = require('tap').test,
|
||||
merge = require('..');
|
||||
|
||||
test('Should not touch properties when types match', function(t) {
|
||||
var options = {
|
||||
age: 42
|
||||
};
|
||||
merge(options, {
|
||||
age: 24
|
||||
});
|
||||
|
||||
t.equals(options.age, 42);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Should extend, because types are different', function(t) {
|
||||
var options = {
|
||||
age: '42'
|
||||
};
|
||||
merge(options, {
|
||||
age: 24
|
||||
});
|
||||
|
||||
t.equals(options.age, 24);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Should augment with new properties', function(t) {
|
||||
var options = {
|
||||
age: 42
|
||||
};
|
||||
merge(options, {
|
||||
newproperty: 24
|
||||
});
|
||||
|
||||
t.equals(options.age, 42);
|
||||
t.equals(options.newproperty, 24);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('goes deep', function(t) {
|
||||
var options = {
|
||||
age: 42
|
||||
};
|
||||
merge(options, {
|
||||
nested: {
|
||||
name: 'deep'
|
||||
}
|
||||
});
|
||||
|
||||
t.equals(options.age, 42);
|
||||
t.equals(options.nested.name, 'deep');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('goes deep avoids conflicts', function(t) {
|
||||
var options = {
|
||||
age: 42,
|
||||
user: {
|
||||
firstName: 'John'
|
||||
}
|
||||
};
|
||||
merge(options, {
|
||||
user: {
|
||||
lastName: 'Smith'
|
||||
}
|
||||
});
|
||||
|
||||
t.equals(options.age, 42);
|
||||
t.equals(options.user.firstName, 'John');
|
||||
t.equals(options.user.lastName, 'Smith');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Initializes with default object', function(t) {
|
||||
var options = {
|
||||
age: '42'
|
||||
};
|
||||
var result = merge(undefined, options);
|
||||
t.deepEqual(result, options);
|
||||
|
||||
var onlyOptions = merge(options);
|
||||
t.deepEqual(onlyOptions, options);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Do not copy prototype', function(t) {
|
||||
function Options() {
|
||||
this.age = 42;
|
||||
}
|
||||
Options.prototype.foo = 'foo';
|
||||
|
||||
var options = new Options();
|
||||
var result = merge({}, options);
|
||||
t.equals(result.age, 42);
|
||||
t.ok(result.foo === undefined);
|
||||
|
||||
t.end();
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue