test-mixer 3.0.3 → 3.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -20
- package/LICENSE +1 -1
- package/dist/test-mixer.esm.js +35 -31
- package/dist/test-mixer.umd.js +3 -3
- package/package.json +22 -26
package/CHANGELOG.md
CHANGED
|
@@ -3,26 +3,6 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## 3.0.3 (2021-11-02)
|
|
7
|
-
|
|
8
|
-
### Bug Fixes
|
|
9
|
-
|
|
10
|
-
- bump TS and separate ESLint plugins away from this monorepo ([b1ebce1](https://github.com/codsen/codsen/commit/b1ebce1637d8c41c2d848fc24b0ba4058865bd5d))
|
|
11
|
-
|
|
12
|
-
### Features
|
|
13
|
-
|
|
14
|
-
- migrate to ES Modules ([c579dff](https://github.com/codsen/codsen/commit/c579dff3b23205e383035ca10ddcec671e35d0fe))
|
|
15
|
-
|
|
16
|
-
### BREAKING CHANGES
|
|
17
|
-
|
|
18
|
-
- programs now are in ES Modules and won't work with Common JS require()
|
|
19
|
-
|
|
20
|
-
## 3.0.1 (2021-09-13)
|
|
21
|
-
|
|
22
|
-
### Bug Fixes
|
|
23
|
-
|
|
24
|
-
- bump TS and separate ESLint plugins away from this monorepo ([2e07d42](https://github.com/codsen/codsen/commit/2e07d424222b6ffedf5fb45c83ad453627ec2904))
|
|
25
|
-
|
|
26
6
|
## 3.0.0 (2021-09-09)
|
|
27
7
|
|
|
28
8
|
### Features
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2010
|
|
3
|
+
Copyright (c) 2010-2021 Roy Revelt and other contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
a copy of this software and associated documentation files (the
|
package/dist/test-mixer.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name test-mixer
|
|
3
3
|
* @fileoverview Test helper to generate function opts object variations
|
|
4
|
-
* @version 3.0.
|
|
4
|
+
* @version 3.0.7
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/test-mixer/}
|
|
@@ -10,41 +10,45 @@
|
|
|
10
10
|
import { combinations } from 'object-boolean-combinations';
|
|
11
11
|
import clone from 'lodash.clonedeep';
|
|
12
12
|
|
|
13
|
-
var version$1 = "3.0.
|
|
13
|
+
var version$1 = "3.0.7";
|
|
14
14
|
|
|
15
15
|
const version = version$1;
|
|
16
16
|
function mixer(ref = {}, defaultsObj = {}) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
if (defaultsObj && typeof defaultsObj !== "object") {
|
|
21
|
-
throw new Error(`test-mixer: [THROW_ID_02] the second input arg is missing!`);
|
|
22
|
-
}
|
|
23
|
-
let caught;
|
|
24
|
-
if (typeof ref === "object" && typeof defaultsObj === "object" && Object.keys(ref).some(refKey => {
|
|
25
|
-
if (!Object.keys(defaultsObj).includes(refKey)) {
|
|
26
|
-
caught = refKey;
|
|
27
|
-
return true;
|
|
17
|
+
if (ref && typeof ref !== "object") {
|
|
18
|
+
throw new Error(`test-mixer: [THROW_ID_01] the first input arg is missing!`);
|
|
28
19
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
if (!Object.keys(defaultsObj).length) {
|
|
33
|
-
return [];
|
|
34
|
-
}
|
|
35
|
-
const refClone = clone(ref);
|
|
36
|
-
const defaultsObjClone = clone(defaultsObj);
|
|
37
|
-
const optsWithBoolValues = {};
|
|
38
|
-
Object.keys(defaultsObj).forEach(key => {
|
|
39
|
-
if (typeof defaultsObjClone[key] === "boolean" && !Object.keys(ref).includes(key)) {
|
|
40
|
-
optsWithBoolValues[key] = defaultsObjClone[key];
|
|
20
|
+
if (defaultsObj && typeof defaultsObj !== "object") {
|
|
21
|
+
throw new Error(`test-mixer: [THROW_ID_02] the second input arg is missing!`);
|
|
41
22
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
23
|
+
let caught;
|
|
24
|
+
if (typeof ref === "object" &&
|
|
25
|
+
typeof defaultsObj === "object" &&
|
|
26
|
+
Object.keys(ref).some((refKey) => {
|
|
27
|
+
if (!Object.keys(defaultsObj).includes(refKey)) {
|
|
28
|
+
caught = refKey;
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
})) {
|
|
32
|
+
throw new Error(`test-mixer: [THROW_ID_03] the second input arg object should be defaults; it should be a superset of 1st input arg object. However, 1st input arg object contains key "${caught}" which 2nd input arg object doesn't have.`);
|
|
33
|
+
}
|
|
34
|
+
if (!Object.keys(defaultsObj).length) {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
const refClone = clone(ref);
|
|
38
|
+
const defaultsObjClone = clone(defaultsObj);
|
|
39
|
+
const optsWithBoolValues = {};
|
|
40
|
+
Object.keys(defaultsObj).forEach((key) => {
|
|
41
|
+
if (typeof defaultsObjClone[key] === "boolean" &&
|
|
42
|
+
!Object.keys(ref).includes(key)) {
|
|
43
|
+
optsWithBoolValues[key] = defaultsObjClone[key];
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const res = combinations(optsWithBoolValues).map((obj) => ({
|
|
47
|
+
...defaultsObj,
|
|
48
|
+
...refClone,
|
|
49
|
+
...obj,
|
|
50
|
+
}));
|
|
51
|
+
return res;
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
export { mixer, version };
|
package/dist/test-mixer.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name test-mixer
|
|
3
3
|
* @fileoverview Test helper to generate function opts object variations
|
|
4
|
-
* @version 3.0.
|
|
4
|
+
* @version 3.0.7
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/test-mixer/}
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
/**
|
|
12
12
|
* @name object-boolean-combinations
|
|
13
13
|
* @fileoverview Consumes a defaults object with booleans, generates all possible variations of it
|
|
14
|
-
* @version 5.0.
|
|
14
|
+
* @version 5.0.7
|
|
15
15
|
* @author Roy Revelt, Codsen Ltd
|
|
16
16
|
* @license MIT
|
|
17
17
|
* {@link https://codsen.com/os/object-boolean-combinations/}
|
|
18
|
-
*/t.mixer=function(t={},r={}){if(t&&"object"!=typeof t)throw new Error("test-mixer: [THROW_ID_01] the first input arg is missing!");if(r&&"object"!=typeof r)throw new Error("test-mixer: [THROW_ID_02] the second input arg is missing!");let e;if("object"==typeof t&&"object"==typeof r&&Object.keys(t).some((t=>{if(!Object.keys(r).includes(t))return e=t,!0})))throw new Error(`test-mixer: [THROW_ID_03] the second input arg object should be defaults; it should be a superset of 1st input arg object. However, 1st input arg object contains key "${e}" which 2nd input arg object doesn't have.`);if(!Object.keys(r).length)return[];const n=it(t),o=it(r),u={};return Object.keys(r).forEach((r=>{"boolean"!=typeof o[r]||Object.keys(t).includes(r)||(u[r]=o[r])})),function(t,r={}){if(!t)throw new Error("[THROW_ID_01] missing input object");if(!ut(t))throw new Error("[THROW_ID_02] the first input object must be a true object");if(r&&!ut(r))throw new Error("[THROW_ID_03] the second override object must be a true object");const e=it(t),n=it(r),o=Object.keys(e),u=[];let c=[];ut(n)&&Object.keys(n).length&&(c=G(Object.keys(n),Object.keys(e)),c.forEach((t=>Y(o,t))));const i=function(t){const r=[];for(let e=0;e<1<<t;e++){const n=[];for(let r=0;r<t;r++)n.push(e&1<<r?1:0);r.push(n)}return r}(Object.keys(o).length);let a;return i.forEach(((t,r)=>{a={},o.forEach(((t,e)=>{a[t]=1===i[r][e]})),u.push(a)})),ut(n)&&Object.keys(n).length&&u.forEach((t=>c.forEach((r=>{t[r]=n[r]})))),u}(u).map((t=>({...r,...n,...t})))},t.version="3.0.
|
|
18
|
+
*/t.mixer=function(t={},r={}){if(t&&"object"!=typeof t)throw new Error("test-mixer: [THROW_ID_01] the first input arg is missing!");if(r&&"object"!=typeof r)throw new Error("test-mixer: [THROW_ID_02] the second input arg is missing!");let e;if("object"==typeof t&&"object"==typeof r&&Object.keys(t).some((t=>{if(!Object.keys(r).includes(t))return e=t,!0})))throw new Error(`test-mixer: [THROW_ID_03] the second input arg object should be defaults; it should be a superset of 1st input arg object. However, 1st input arg object contains key "${e}" which 2nd input arg object doesn't have.`);if(!Object.keys(r).length)return[];const n=it(t),o=it(r),u={};return Object.keys(r).forEach((r=>{"boolean"!=typeof o[r]||Object.keys(t).includes(r)||(u[r]=o[r])})),function(t,r={}){if(!t)throw new Error("[THROW_ID_01] missing input object");if(!ut(t))throw new Error("[THROW_ID_02] the first input object must be a true object");if(r&&!ut(r))throw new Error("[THROW_ID_03] the second override object must be a true object");const e=it(t),n=it(r),o=Object.keys(e),u=[];let c=[];ut(n)&&Object.keys(n).length&&(c=G(Object.keys(n),Object.keys(e)),c.forEach((t=>Y(o,t))));const i=function(t){const r=[];for(let e=0;e<1<<t;e++){const n=[];for(let r=0;r<t;r++)n.push(e&1<<r?1:0);r.push(n)}return r}(Object.keys(o).length);let a;return i.forEach(((t,r)=>{a={},o.forEach(((t,e)=>{a[t]=1===i[r][e]})),u.push(a)})),ut(n)&&Object.keys(n).length&&u.forEach((t=>c.forEach((r=>{t[r]=n[r]})))),u}(u).map((t=>({...r,...n,...t})))},t.version="3.0.7",Object.defineProperty(t,"__esModule",{value:!0})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "test-mixer",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7",
|
|
4
4
|
"description": "Test helper to generate function opts object variations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"combinations",
|
|
@@ -32,13 +32,12 @@
|
|
|
32
32
|
"types": "types/index.d.ts",
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "rollup -c",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
35
|
+
"build:esbuild": "node '../../scripts/esbuild.js'",
|
|
36
|
+
"build:esbuild:dev": "cross-env MODE=dev node '../../scripts/esbuild.js'",
|
|
37
|
+
"ci_test": "npm run build && npm run format && tap --no-only --reporter=silent",
|
|
37
38
|
"clean_types": "../../scripts/cleanTypes.js",
|
|
38
39
|
"dev": "rollup -c --dev",
|
|
39
40
|
"devunittest": "npm run dev && tap --only -R 'base'",
|
|
40
|
-
"esbuild": "node '../../scripts/esbuild.js'",
|
|
41
|
-
"esbuild_dev": "cross-env MODE=dev node '../../scripts/esbuild.js'",
|
|
42
41
|
"format": "npm run lect && npm run prettier && npm run lint",
|
|
43
42
|
"lect": "lect",
|
|
44
43
|
"lint": "../../node_modules/eslint/bin/eslint.js . --ext .js --ext .ts --fix --config \"../../.eslintrc.json\" --quiet",
|
|
@@ -47,17 +46,14 @@
|
|
|
47
46
|
"republish": "npm publish || :",
|
|
48
47
|
"tap": "tap",
|
|
49
48
|
"pretest": "npm run build",
|
|
50
|
-
"test": "npm run
|
|
49
|
+
"test": "npm run test:ci && npm run perf",
|
|
50
|
+
"test:ci": "npm run unittest && npm run test:examples && npm run format",
|
|
51
51
|
"test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
|
|
52
52
|
"tsc": "tsc",
|
|
53
|
-
"unittest": "tap --no-only --
|
|
53
|
+
"unittest": "tap --no-only --reporter=terse && tsc -p tsconfig.json --noEmit"
|
|
54
54
|
},
|
|
55
55
|
"tap": {
|
|
56
56
|
"check-coverage": false,
|
|
57
|
-
"coverage-report": [
|
|
58
|
-
"json-summary",
|
|
59
|
-
"text"
|
|
60
|
-
],
|
|
61
57
|
"node-arg": [
|
|
62
58
|
"--no-warnings",
|
|
63
59
|
"--experimental-loader",
|
|
@@ -79,9 +75,9 @@
|
|
|
79
75
|
}
|
|
80
76
|
},
|
|
81
77
|
"dependencies": {
|
|
82
|
-
"@babel/runtime": "^7.16.
|
|
78
|
+
"@babel/runtime": "^7.16.3",
|
|
83
79
|
"lodash.clonedeep": "^4.5.0",
|
|
84
|
-
"object-boolean-combinations": "^5.0.
|
|
80
|
+
"object-boolean-combinations": "^5.0.7"
|
|
85
81
|
},
|
|
86
82
|
"devDependencies": {
|
|
87
83
|
"@babel/cli": "^7.16.0",
|
|
@@ -92,8 +88,8 @@
|
|
|
92
88
|
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
|
|
93
89
|
"@babel/plugin-proposal-object-rest-spread": "^7.16.0",
|
|
94
90
|
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
|
|
95
|
-
"@babel/plugin-transform-runtime": "^7.16.
|
|
96
|
-
"@babel/preset-env": "^7.16.
|
|
91
|
+
"@babel/plugin-transform-runtime": "^7.16.4",
|
|
92
|
+
"@babel/preset-env": "^7.16.4",
|
|
97
93
|
"@babel/preset-typescript": "^7.16.0",
|
|
98
94
|
"@babel/register": "^7.16.0",
|
|
99
95
|
"@istanbuljs/esm-loader-hook": "^0.1.2",
|
|
@@ -104,25 +100,25 @@
|
|
|
104
100
|
"@rollup/plugin-strip": "^2.1.0",
|
|
105
101
|
"@rollup/plugin-typescript": "^8.3.0",
|
|
106
102
|
"@types/lodash.clonedeep": "^4.5.6",
|
|
107
|
-
"@types/node": "^16.11.
|
|
103
|
+
"@types/node": "^16.11.10",
|
|
108
104
|
"@types/tap": "^15.0.5",
|
|
109
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
110
|
-
"@typescript-eslint/parser": "^5.
|
|
111
|
-
"core-js": "^3.19.
|
|
105
|
+
"@typescript-eslint/eslint-plugin": "^5.5.0",
|
|
106
|
+
"@typescript-eslint/parser": "^5.5.0",
|
|
107
|
+
"core-js": "^3.19.2",
|
|
112
108
|
"cross-env": "^7.0.3",
|
|
113
|
-
"eslint": "^8.
|
|
114
|
-
"lect": "^0.18.
|
|
115
|
-
"rollup": "^2.
|
|
109
|
+
"eslint": "^8.3.0",
|
|
110
|
+
"lect": "^0.18.7",
|
|
111
|
+
"rollup": "^2.60.1",
|
|
116
112
|
"rollup-plugin-ascii": "^0.0.3",
|
|
117
113
|
"rollup-plugin-banner": "^0.2.1",
|
|
118
114
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
119
|
-
"rollup-plugin-dts": "^4.0.
|
|
115
|
+
"rollup-plugin-dts": "^4.0.1",
|
|
120
116
|
"rollup-plugin-terser": "^7.0.2",
|
|
121
|
-
"tap": "^15.
|
|
117
|
+
"tap": "^15.1.5",
|
|
122
118
|
"tslib": "^2.3.1",
|
|
123
|
-
"typescript": "^4.
|
|
119
|
+
"typescript": "^4.5.2"
|
|
124
120
|
},
|
|
125
121
|
"engines": {
|
|
126
|
-
"node": ">=
|
|
122
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
127
123
|
}
|
|
128
124
|
}
|