Skip package-lock.json and yarn.lock in node_modules #431 (#485)

Signed-off-by: Keith Zantow <kzantow@gmail.com>
This commit is contained in:
Keith Zantow
2021-08-20 13:50:28 -04:00
committed by GitHub
parent cba5b5723b
commit ff828fbac2
116 changed files with 23778 additions and 5 deletions
@@ -0,0 +1,2 @@
*.log
.DS_Store
@@ -0,0 +1,9 @@
language: node_js
node_js:
- 4.0
- 0.12
- 0.11
- 0.10
- 0.9
- 0.8
- 0.6
@@ -0,0 +1,19 @@
Copyright (c) 2015 Oleksii Shevchenko <shevaroller@gmail.com> (http://shevaroller.me)
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.
@@ -0,0 +1,24 @@
# node-merge-objects
Merge two objects and concatenate arrays that are values of the same object key.
Similar to extend in JQuery, but with arrays concatenation. Does deep merging too.
[![Build Status](https://secure.travis-ci.org/shevaroller/node-merge-objects.png)](http://travis-ci.org/shevaroller/node-merge-objects)
## Installation
npm install merge-objects --save
## Usage
var merge = require('merge-objects');
var object1 = {a: 1, b: [2, 3]};
var object2 = {b: [4, 5], c: 6};
var result = merge(object1, object2);
console.log(result); //logs {a: 1, b: [2, 3, 4, 5], c: 6}
## License
MIT
@@ -0,0 +1,42 @@
/**
* Merge two objects and concatenate arrays that are values of the same object key
*
* @author Oleksii Shevchenko <shevaroller@gmail.com> (http://shevaroller.me)
* @since 6 September 2015
*/
var mergeObjects;
mergeObjects = function(object1, object2) {
var key;
// concatenate not objects into arrays
if (typeof object1 !== 'object') {
if (typeof object2 !== 'object') {
return [object1, object2];
}
return object2.concat(object1);
}
if (typeof object2 !== 'object') {
return object1.concat(object2);
}
// merge object2 into object1
for (key in object2) {
if ((Array.isArray(object1[key])) && (Array.isArray(object2[key]))) {
// concatenate arrays that are values of the same object key
object1[key] = object1[key].concat(object2[key]);
} else if (typeof object1[key] === 'object' && typeof object2[key] === 'object') {
// deep merge object2 into object1
object1[key] = mergeObjects(object1[key], object2[key]);
} else {
object1[key] = object2[key];
}
}
return object1;
};
/**
* Exports Module mergeObjects
*/
module.exports = mergeObjects;
@@ -0,0 +1,23 @@
{
"name": "merge-objects",
"version": "1.0.5",
"description": "Merge two objects and concatenate arrays that are values of the same object key.",
"main": "lib/merge-objects.js",
"scripts": {
"test": "node test/test.js"
},
"repository": {
"type": "git",
"url": "git@github.com:shevaroller/node-merge-objects.git"
},
"keywords": [
"merge",
"object",
"extend",
"concat",
"array",
"mixin"
],
"author": "Oleksii Shevchenko <shevaroller@gmail.com> (http://shevaroller.me)",
"license": "MIT"
}
@@ -0,0 +1,53 @@
var merge = require('../lib/merge-objects');
var assert = require('assert');
var object1, object2, result;
/* Test not objects */
object1 = 0;
object2 = 'a string';
result = merge(object1, object2);
assert.deepEqual(result, [0, 'a string'], 'two not objects');
/* Test one object and one not object */
object1 = [0, 1];
object2 = 'a string';
result = merge(object1, object2);
assert.deepEqual(result, [0, 1, 'a string'], 'one object and one not object');
/* Test one not object and one object */
object1 = 0;
object2 = ['a string', 'string2'];
result = merge(object1, object2);
assert.deepEqual(result, ['a string', 'string2', 0], 'one not object and one object');
/* Test two objects with no depth */
object1 = {a: 1};
object2 = {b: 2};
result = merge(object1, object2);
assert.deepEqual(result, {a: 1, b: 2}, 'two objects with no depth');
/* Test two objects with equal keys */
object1 = {a: 1};
object2 = {a: 2};
result = merge(object1, object2);
assert.deepEqual(result, {a: 2}, 'two objects with equal keys');
/* Test array concatenation inside objects */
object1 = {a: 1, b: [2, 3]};
object2 = {b: [4, 5], c: 6};
result = merge(object1, object2);
assert.deepEqual(result, {a: 1, b: [2, 3, 4, 5], c: 6}, 'array concatenation inside objects');
/* Test two objects with depth and equal keys */
object1 = {a: {b: [0, 1], c: 'a'}};
object2 = {a: {b: [2, 3], c: 'b'}};
result = merge(object1, object2);
assert.deepEqual(result, {a: {b: [0, 1, 2, 3], c: 'b'}}, 'two objects with depth and equal keys');