mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
chore(deps): nuke taffydb from orbit
Even as a dev dependency, used solely to verify the correctness of its replacement, `@jsdoc/salty`, it was triggering bogus security warnings. Fixes #2041.
This commit is contained in:
parent
0662bc73e3
commit
1192486324
@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"extends": ["config:base"],
|
"extends": ["config:base"],
|
||||||
"statusCheckVerify": true,
|
"statusCheckVerify": true,
|
||||||
"ignoreDeps": ["taffydb"],
|
|
||||||
"automerge": true,
|
"automerge": true,
|
||||||
"automergeType": "branch",
|
"automergeType": "branch",
|
||||||
"rangeStrategy": "bump",
|
"rangeStrategy": "bump",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"packageAllowlist": [
|
"packageAllowlist": [
|
||||||
"argparse", // Python-2.0 licensed, which is fine but not on js-green-licenses default list
|
// Python-2.0 licensed, which is fine but not on js-green-licenses default list
|
||||||
"taffydb" // MIT licensed, per its source code
|
"argparse"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
15
package-lock.json
generated
15
package-lock.json
generated
@ -39,8 +39,7 @@
|
|||||||
"license-check-and-add": "^4.0.5",
|
"license-check-and-add": "^4.0.5",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"mock-fs": "^5.2.0",
|
"mock-fs": "^5.2.0",
|
||||||
"prettier": "^2.8.4",
|
"prettier": "^2.8.4"
|
||||||
"taffydb": "2.6.2"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=v18.12.0"
|
"node": ">=v18.12.0"
|
||||||
@ -10510,12 +10509,6 @@
|
|||||||
"node": ">=8.0.0"
|
"node": ">=8.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/taffydb": {
|
|
||||||
"version": "2.6.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.6.2.tgz",
|
|
||||||
"integrity": "sha512-y3JaeRSplks6NYQuCOj3ZFMO3j60rTwbuKCvZxsAraGYH2epusatvZ0baZYA01WsGqJBq/Dl6vOrMUJqyMj8kA==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/tar": {
|
"node_modules/tar": {
|
||||||
"version": "6.1.11",
|
"version": "6.1.11",
|
||||||
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz",
|
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz",
|
||||||
@ -19153,12 +19146,6 @@
|
|||||||
"wordwrapjs": "^4.0.0"
|
"wordwrapjs": "^4.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"taffydb": {
|
|
||||||
"version": "2.6.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.6.2.tgz",
|
|
||||||
"integrity": "sha512-y3JaeRSplks6NYQuCOj3ZFMO3j60rTwbuKCvZxsAraGYH2epusatvZ0baZYA01WsGqJBq/Dl6vOrMUJqyMj8kA==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"tar": {
|
"tar": {
|
||||||
"version": "6.1.11",
|
"version": "6.1.11",
|
||||||
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz",
|
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz",
|
||||||
|
|||||||
@ -32,8 +32,7 @@
|
|||||||
"license-check-and-add": "^4.0.5",
|
"license-check-and-add": "^4.0.5",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"mock-fs": "^5.2.0",
|
"mock-fs": "^5.2.0",
|
||||||
"prettier": "^2.8.4",
|
"prettier": "^2.8.4"
|
||||||
"taffydb": "2.6.2"
|
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
@ -16,7 +16,6 @@
|
|||||||
describe('@jsdoc/salty/lib/salty', () => {
|
describe('@jsdoc/salty/lib/salty', () => {
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const Salty = require('../../../lib/salty');
|
const Salty = require('../../../lib/salty');
|
||||||
const { taffy } = require('taffydb');
|
|
||||||
|
|
||||||
const data = [
|
const data = [
|
||||||
{ a: 2, b: undefined, c: true },
|
{ a: 2, b: undefined, c: true },
|
||||||
@ -29,20 +28,12 @@ describe('@jsdoc/salty/lib/salty', () => {
|
|||||||
{ a: 17, b: 0, c: false },
|
{ a: 17, b: 0, c: false },
|
||||||
{ a: 66, c: true },
|
{ a: 66, c: true },
|
||||||
];
|
];
|
||||||
let saltyDB;
|
let db;
|
||||||
let taffyDB;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
saltyDB = new Salty(_.cloneDeep(data));
|
db = new Salty(_.cloneDeep(data));
|
||||||
taffyDB = taffy(_.cloneDeep(data));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// To confirm that TaffyDB and Salty have equivalent behavior, run the same test for both.
|
|
||||||
function validate(f) {
|
|
||||||
f(saltyDB);
|
|
||||||
f(taffyDB);
|
|
||||||
}
|
|
||||||
|
|
||||||
it('is a constructor that returns a function', () => {
|
it('is a constructor that returns a function', () => {
|
||||||
expect(new Salty()).toBeFunction();
|
expect(new Salty()).toBeFunction();
|
||||||
});
|
});
|
||||||
@ -56,9 +47,9 @@ describe('@jsdoc/salty/lib/salty', () => {
|
|||||||
it('sorts by a single key', () => {
|
it('sorts by a single key', () => {
|
||||||
// TaffyDB sorts things strangely when null or undefined values are present. Salty doesn't
|
// TaffyDB sorts things strangely when null or undefined values are present. Salty doesn't
|
||||||
// attempt to match that behavior, so we just verify that Salty does what it's supposed to.
|
// attempt to match that behavior, so we just verify that Salty does what it's supposed to.
|
||||||
saltyDB.sort('b');
|
db.sort('b');
|
||||||
|
|
||||||
expect(saltyDB().get()).toMatchArrayOfObjects([
|
expect(db().get()).toMatchArrayOfObjects([
|
||||||
{ a: 7, b: 'goodbye', c: false },
|
{ a: 7, b: 'goodbye', c: false },
|
||||||
{ a: 100, b: 'hello', c: true },
|
{ a: 100, b: 'hello', c: true },
|
||||||
{ a: 17, b: 0, c: false },
|
{ a: 17, b: 0, c: false },
|
||||||
@ -72,7 +63,6 @@ describe('@jsdoc/salty/lib/salty', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('sorts by multiple keys', () => {
|
it('sorts by multiple keys', () => {
|
||||||
validate((db) => {
|
|
||||||
db.sort('a, b');
|
db.sort('a, b');
|
||||||
|
|
||||||
expect(db().get()).toMatchArrayOfObjects([
|
expect(db().get()).toMatchArrayOfObjects([
|
||||||
@ -87,68 +77,54 @@ describe('@jsdoc/salty/lib/salty', () => {
|
|||||||
{ a: 100, b: 'hello', c: true },
|
{ a: 100, b: 'hello', c: true },
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('has no effect when called with a nonexistent key', () => {
|
it('has no effect when called with a nonexistent key', () => {
|
||||||
validate((db) => {
|
|
||||||
db.sort('q');
|
db.sort('q');
|
||||||
|
|
||||||
expect(db().get()).toMatchArrayOfObjects(data);
|
expect(db().get()).toMatchArrayOfObjects(data);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('returns true', () => {
|
it('returns true', () => {
|
||||||
validate((db) => {
|
|
||||||
expect(db.sort('a')).toBeTrue();
|
expect(db.sort('a')).toBeTrue();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
describe('queries', () => {
|
describe('queries', () => {
|
||||||
it('returns an object with the expected methods after a query', () => {
|
it('returns an object with the expected methods after a query', () => {
|
||||||
validate((db) => {
|
|
||||||
const query = db();
|
const query = db();
|
||||||
|
|
||||||
expect(query.each).toBeFunction();
|
expect(query.each).toBeFunction();
|
||||||
expect(query.get).toBeFunction();
|
expect(query.get).toBeFunction();
|
||||||
expect(query.remove).toBeFunction();
|
expect(query.remove).toBeFunction();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
describe('each', () => {
|
describe('each', () => {
|
||||||
it('calls the function on each item if there is no selection', () => {
|
it('calls the function on each item if there is no selection', () => {
|
||||||
validate((db) => {
|
|
||||||
const result = [];
|
const result = [];
|
||||||
|
|
||||||
db().each((item) => result.push(item.a));
|
db().each((item) => result.push(item.a));
|
||||||
|
|
||||||
expect(result).toEqual([2, 47, 100, 7, 42, 35, 22, 17, 66]);
|
expect(result).toEqual([2, 47, 100, 7, 42, 35, 22, 17, 66]);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('calls the function on selected items if there is a selection', () => {
|
it('calls the function on selected items if there is a selection', () => {
|
||||||
validate((db) => {
|
|
||||||
const result = [];
|
const result = [];
|
||||||
|
|
||||||
db({ c: false }).each((item) => result.push(item.a));
|
db({ c: false }).each((item) => result.push(item.a));
|
||||||
|
|
||||||
expect(result).toEqual([7, 17]);
|
expect(result).toEqual([7, 17]);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('does not call the function if the selection is empty', () => {
|
it('does not call the function if the selection is empty', () => {
|
||||||
validate((db) => {
|
|
||||||
const fn = jasmine.createSpy();
|
const fn = jasmine.createSpy();
|
||||||
|
|
||||||
db({ a: 1000000000 }).each(fn);
|
db({ a: 1000000000 }).each(fn);
|
||||||
|
|
||||||
expect(fn).not.toHaveBeenCalled();
|
expect(fn).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('returns an object with the expected methods', () => {
|
it('returns an object with the expected methods', () => {
|
||||||
validate((db) => {
|
|
||||||
const query = db().each(() => true);
|
const query = db().each(() => true);
|
||||||
|
|
||||||
expect(query.each).toBeFunction();
|
expect(query.each).toBeFunction();
|
||||||
@ -156,17 +132,13 @@ describe('@jsdoc/salty/lib/salty', () => {
|
|||||||
expect(query.remove).toBeFunction();
|
expect(query.remove).toBeFunction();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
describe('get', () => {
|
describe('get', () => {
|
||||||
it('returns all items if there is no selection', () => {
|
it('returns all items if there is no selection', () => {
|
||||||
validate((db) => {
|
|
||||||
expect(db().get()).toMatchArrayOfObjects(data);
|
expect(db().get()).toMatchArrayOfObjects(data);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('returns the selected items when one matcher is provided', () => {
|
it('returns the selected items when one matcher is provided', () => {
|
||||||
validate((db) => {
|
|
||||||
const result = db({ c: false }).get();
|
const result = db({ c: false }).get();
|
||||||
|
|
||||||
expect(result).toMatchArrayOfObjects([
|
expect(result).toMatchArrayOfObjects([
|
||||||
@ -174,18 +146,14 @@ describe('@jsdoc/salty/lib/salty', () => {
|
|||||||
{ a: 17, b: 0, c: false },
|
{ a: 17, b: 0, c: false },
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('returns the selected items when multiple matchers are provided', () => {
|
it('returns the selected items when multiple matchers are provided', () => {
|
||||||
validate((db) => {
|
|
||||||
const result = db({ c: false }, { b: 0 }).get();
|
const result = db({ c: false }, { b: 0 }).get();
|
||||||
|
|
||||||
expect(result).toMatchArrayOfObjects([{ a: 17, b: 0, c: false }]);
|
expect(result).toMatchArrayOfObjects([{ a: 17, b: 0, c: false }]);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('returns the selected items when the matcher contains an array of values', () => {
|
it('returns the selected items when the matcher contains an array of values', () => {
|
||||||
validate((db) => {
|
|
||||||
const result = db({ a: [2, 47] }).get();
|
const result = db({ a: [2, 47] }).get();
|
||||||
|
|
||||||
expect(result).toMatchArrayOfObjects([
|
expect(result).toMatchArrayOfObjects([
|
||||||
@ -193,10 +161,8 @@ describe('@jsdoc/salty/lib/salty', () => {
|
|||||||
{ a: 47, b: null, c: true },
|
{ a: 47, b: null, c: true },
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('returns the correct items with the special matcher for undefined values', () => {
|
it('returns the correct items with the special matcher for undefined values', () => {
|
||||||
validate((db) => {
|
|
||||||
const result = db({ b: { isUndefined: true } }).get();
|
const result = db({ b: { isUndefined: true } }).get();
|
||||||
|
|
||||||
expect(result).toMatchArrayOfObjects([
|
expect(result).toMatchArrayOfObjects([
|
||||||
@ -205,16 +171,12 @@ describe('@jsdoc/salty/lib/salty', () => {
|
|||||||
{ a: 66, c: true },
|
{ a: 66, c: true },
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('returns no items if the selection is empty', () => {
|
it('returns no items if the selection is empty', () => {
|
||||||
validate((db) => {
|
|
||||||
expect(db({ a: 1000000000 }).get()).toBeEmptyArray();
|
expect(db({ a: 1000000000 }).get()).toBeEmptyArray();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('returns the correct items with a custom matcher function', () => {
|
it('returns the correct items with a custom matcher function', () => {
|
||||||
validate((db) => {
|
|
||||||
function matcher() {
|
function matcher() {
|
||||||
return this.a > 20; // eslint-disable-line
|
return this.a > 20; // eslint-disable-line
|
||||||
}
|
}
|
||||||
@ -229,19 +191,15 @@ describe('@jsdoc/salty/lib/salty', () => {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
describe('remove', () => {
|
describe('remove', () => {
|
||||||
it('deletes everything if there is no selection', () => {
|
it('deletes everything if there is no selection', () => {
|
||||||
validate((db) => {
|
|
||||||
db().remove();
|
db().remove();
|
||||||
|
|
||||||
expect(db().get()).toBeEmptyArray();
|
expect(db().get()).toBeEmptyArray();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('deletes the selected items if there is a selection', () => {
|
it('deletes the selected items if there is a selection', () => {
|
||||||
validate((db) => {
|
|
||||||
db({ c: true }).remove();
|
db({ c: true }).remove();
|
||||||
|
|
||||||
expect(db().get()).toMatchArrayOfObjects([
|
expect(db().get()).toMatchArrayOfObjects([
|
||||||
@ -250,31 +208,24 @@ describe('@jsdoc/salty/lib/salty', () => {
|
|||||||
{ a: 17, b: 0, c: false },
|
{ a: 17, b: 0, c: false },
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('deletes nothing if the selection is empty', () => {
|
it('deletes nothing if the selection is empty', () => {
|
||||||
validate((db) => {
|
|
||||||
db({ a: 846 }).remove();
|
db({ a: 846 }).remove();
|
||||||
|
|
||||||
expect(db().get()).toMatchArrayOfObjects(data);
|
expect(db().get()).toMatchArrayOfObjects(data);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('removes the selected items from the active selection', () => {
|
it('removes the selected items from the active selection', () => {
|
||||||
validate((db) => {
|
|
||||||
const db2 = db({ a: 7 });
|
const db2 = db({ a: 7 });
|
||||||
|
|
||||||
db2.remove();
|
db2.remove();
|
||||||
|
|
||||||
expect(db2.get()).toBeEmptyArray();
|
expect(db2.get()).toBeEmptyArray();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('returns the number of removed items', () => {
|
it('returns the number of removed items', () => {
|
||||||
validate((db) => {
|
|
||||||
expect(db({ c: true }).remove()).toBe(6);
|
expect(db({ c: true }).remove()).toBe(6);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user