Updates parsing of yarn.lock to use resolved URLs that are pulled from yarn and npm registries (#926)

Co-authored-by: Christopher Phillips <christopher.phillips@anchore.com>
This commit is contained in:
Miki
2022-06-24 11:05:25 -04:00
committed by GitHub
co-authored by Christopher Phillips
parent bafc66a5e7
commit d5e12ff89c
91 changed files with 546 additions and 11942 deletions
@@ -1,2 +0,0 @@
*.log
.DS_Store
@@ -1,9 +0,0 @@
language: node_js
node_js:
- 4.0
- 0.12
- 0.11
- 0.10
- 0.9
- 0.8
- 0.6
@@ -1,24 +0,0 @@
# 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
@@ -1,42 +0,0 @@
/**
* 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;
@@ -1,53 +0,0 @@
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');