object-boolean-combinations 5.0.5 → 5.0.11
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/LICENSE +1 -1
- package/README.md +4 -5
- package/dist/object-boolean-combinations.esm.js +2 -57
- package/dist/object-boolean-combinations.umd.js +2 -2
- package/examples/_quickTake.js +1 -0
- package/package.json +24 -82
- package/types/index.d.ts +6 -3
- package/examples/api.json +0 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2010-
|
|
3
|
+
Copyright (c) 2010-2022 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/README.md
CHANGED
|
@@ -26,18 +26,17 @@
|
|
|
26
26
|
|
|
27
27
|
## Install
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
The latest version is **ESM only**: Node 12+ is needed to use it and it must be `import`ed instead of `require`d. If your project is not on ESM yet and you want to use `require`, use an older version of this program, `4.1.0`.
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
32
|
npm i object-boolean-combinations
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
If you need a legacy version which works with `require`, use version 4.1.0
|
|
36
|
-
|
|
37
35
|
## Quick Take
|
|
38
36
|
|
|
39
37
|
```js
|
|
40
38
|
import { strict as assert } from "assert";
|
|
39
|
+
|
|
41
40
|
import { combinations } from "object-boolean-combinations";
|
|
42
41
|
|
|
43
42
|
assert.deepEqual(
|
|
@@ -62,7 +61,7 @@ assert.deepEqual(
|
|
|
62
61
|
|
|
63
62
|
## Documentation
|
|
64
63
|
|
|
65
|
-
Please [visit codsen.com](https://codsen.com/os/object-boolean-combinations/) for a full description of the API
|
|
64
|
+
Please [visit codsen.com](https://codsen.com/os/object-boolean-combinations/) for a full description of the API.
|
|
66
65
|
|
|
67
66
|
## Contributing
|
|
68
67
|
|
|
@@ -72,6 +71,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
|
|
|
72
71
|
|
|
73
72
|
MIT License
|
|
74
73
|
|
|
75
|
-
Copyright (c) 2010-
|
|
74
|
+
Copyright (c) 2010-2022 Roy Revelt and other contributors
|
|
76
75
|
|
|
77
76
|
<img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center">
|
|
@@ -1,65 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name object-boolean-combinations
|
|
3
3
|
* @fileoverview Consumes a defaults object with booleans, generates all possible variations of it
|
|
4
|
-
* @version 5.0.
|
|
4
|
+
* @version 5.0.11
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/object-boolean-combinations/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import intersection from
|
|
11
|
-
import pull from 'lodash.pull';
|
|
12
|
-
import isObj from 'lodash.isplainobject';
|
|
13
|
-
import clone from 'lodash.clonedeep';
|
|
14
|
-
|
|
15
|
-
var version$1 = "5.0.5";
|
|
16
|
-
|
|
17
|
-
const version = version$1;
|
|
18
|
-
function combinations(originalIncomingObject, originalOverrideObject = {}) {
|
|
19
|
-
function combi(n) {
|
|
20
|
-
const r = [];
|
|
21
|
-
for (let i = 0; i < 1 << n; i++) {
|
|
22
|
-
const c = [];
|
|
23
|
-
for (let j = 0; j < n; j++) {
|
|
24
|
-
c.push(i & 1 << j ? 1 : 0);
|
|
25
|
-
}
|
|
26
|
-
r.push(c);
|
|
27
|
-
}
|
|
28
|
-
return r;
|
|
29
|
-
}
|
|
30
|
-
if (!originalIncomingObject) {
|
|
31
|
-
throw new Error("[THROW_ID_01] missing input object");
|
|
32
|
-
}
|
|
33
|
-
if (!isObj(originalIncomingObject)) {
|
|
34
|
-
throw new Error("[THROW_ID_02] the first input object must be a true object");
|
|
35
|
-
}
|
|
36
|
-
if (originalOverrideObject && !isObj(originalOverrideObject)) {
|
|
37
|
-
throw new Error("[THROW_ID_03] the second override object must be a true object");
|
|
38
|
-
}
|
|
39
|
-
const incomingObject = clone(originalIncomingObject);
|
|
40
|
-
const overrideObject = clone(originalOverrideObject);
|
|
41
|
-
const propertiesToMix = Object.keys(incomingObject);
|
|
42
|
-
const outcomingObjectsArray = [];
|
|
43
|
-
let propertiesToBeOverridden = [];
|
|
44
|
-
if (isObj(overrideObject) && Object.keys(overrideObject).length) {
|
|
45
|
-
propertiesToBeOverridden = intersection(Object.keys(overrideObject), Object.keys(incomingObject));
|
|
46
|
-
propertiesToBeOverridden.forEach(elem => pull(propertiesToMix, elem));
|
|
47
|
-
}
|
|
48
|
-
const boolCombinations = combi(Object.keys(propertiesToMix).length);
|
|
49
|
-
let tempObject;
|
|
50
|
-
boolCombinations.forEach((_elem1, index1) => {
|
|
51
|
-
tempObject = {};
|
|
52
|
-
propertiesToMix.forEach((elem2, index2) => {
|
|
53
|
-
tempObject[elem2] = boolCombinations[index1][index2] === 1;
|
|
54
|
-
});
|
|
55
|
-
outcomingObjectsArray.push(tempObject);
|
|
56
|
-
});
|
|
57
|
-
if (isObj(overrideObject) && Object.keys(overrideObject).length) {
|
|
58
|
-
outcomingObjectsArray.forEach(elem3 => propertiesToBeOverridden.forEach(elem4 => {
|
|
59
|
-
elem3[elem4] = overrideObject[elem4];
|
|
60
|
-
}));
|
|
61
|
-
}
|
|
62
|
-
return outcomingObjectsArray;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export { combinations, version };
|
|
10
|
+
import O from"lodash.intersection";import k from"lodash.pull";import r from"lodash.isplainobject";import j from"lodash.clonedeep";var h="5.0.11";var _=h;function T(i,c={}){function y(e){let t=[];for(let s=0;s<1<<e;s++){let n=[];for(let b=0;b<e;b++)n.push(s&1<<b?1:0);t.push(n)}return t}if(!i)throw new Error("[THROW_ID_01] missing input object");if(!r(i))throw new Error("[THROW_ID_02] the first input object must be a true object");if(c&&!r(c))throw new Error("[THROW_ID_03] the second override object must be a true object");let d=j(i),o=j(c),l=Object.keys(d),a=[],p=[];r(o)&&Object.keys(o).length&&(p=O(Object.keys(o),Object.keys(d)),p.forEach(e=>k(l,e)));let m=y(Object.keys(l).length),u;return m.forEach((e,t)=>{u={},l.forEach((s,n)=>{u[s]=m[t][n]===1}),a.push(u)}),r(o)&&Object.keys(o).length&&a.forEach(e=>{p.forEach(t=>{e[t]=o[t]})}),a}export{T as combinations,_ as version};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name object-boolean-combinations
|
|
3
3
|
* @fileoverview Consumes a defaults object with booleans, generates all possible variations of it
|
|
4
|
-
* @version 5.0.
|
|
4
|
+
* @version 5.0.11
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/object-boolean-combinations/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t="undefined"!=typeof globalThis?globalThis:t||self).objectBooleanCombinations={})}(this,(function(t){"use strict";var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n="__lodash_hash_undefined__",e=9007199254740991,o=/^\[object .+?Constructor\]$/,u="object"==typeof self&&self&&self.Object===Object&&self,c="object"==typeof r&&r&&r.Object===Object&&r||u||Function("return this")();function a(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}function i(t,r){return!!(t?t.length:0)&&function(t,r,n){if(r!=r)return function(t,r,n,e){var o=t.length,u=n+(e?1:-1);for(;e?u--:++u<o;)if(r(t[u],u,t))return u;return-1}(t,l,n);var e=n-1,o=t.length;for(;++e<o;)if(t[e]===r)return e;return-1}(t,r,0)>-1}function f(t,r,n){for(var e=-1,o=t?t.length:0;++e<o;)if(n(r,t[e]))return!0;return!1}function s(t,r){for(var n=-1,e=t?t.length:0,o=Array(e);++n<e;)o[n]=r(t[n],n,t);return o}function l(t){return t!=t}function h(t){return function(r){return t(r)}}function p(t,r){return t.has(r)}var _,y=Array.prototype,v=Function.prototype,d=Object.prototype,b=c["__core-js_shared__"],g=(_=/[^.]+$/.exec(b&&b.keys&&b.keys.IE_PROTO||""))?"Symbol(src)_1."+_:"",j=v.toString,O=d.hasOwnProperty,w=d.toString,m=RegExp("^"+j.call(O).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),A=y.splice,x=Math.max,S=Math.min,E=D(c,"Map"),$=D(Object,"create");function k(t){var r=-1,n=t?t.length:0;for(this.clear();++r<n;){var e=t[r];this.set(e[0],e[1])}}function P(t){var r=-1,n=t?t.length:0;for(this.clear();++r<n;){var e=t[r];this.set(e[0],e[1])}}function F(t){var r=-1,n=t?t.length:0;for(this.clear();++r<n;){var e=t[r];this.set(e[0],e[1])}}function I(t){var r=-1,n=t?t.length:0;for(this.__data__=new F;++r<n;)this.add(t[r])}function T(t,r){for(var n,e,o=t.length;o--;)if((n=t[o][0])===(e=r)||n!=n&&e!=e)return o;return-1}function M(t){if(!z(t)||(r=t,g&&g in r))return!1;var r,n=H(t)||function(t){var r=!1;if(null!=t&&"function"!=typeof t.toString)try{r=!!(t+"")}catch(t){}return r}(t)?m:o;return n.test(function(t){if(null!=t){try{return j.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function R(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&function(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=e}(t.length)&&!H(t)}(t)}(t)?t:[]}function B(t,r){var n,e,o=t.__data__;return("string"==(e=typeof(n=r))||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==n:null===n)?o["string"==typeof r?"string":"hash"]:o.map}function D(t,r){var n=function(t,r){return null==t?void 0:t[r]}(t,r);return M(n)?n:void 0}k.prototype.clear=function(){this.__data__=$?$(null):{}},k.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},k.prototype.get=function(t){var r=this.__data__;if($){var e=r[t];return e===n?void 0:e}return O.call(r,t)?r[t]:void 0},k.prototype.has=function(t){var r=this.__data__;return $?void 0!==r[t]:O.call(r,t)},k.prototype.set=function(t,r){return this.__data__[t]=$&&void 0===r?n:r,this},P.prototype.clear=function(){this.__data__=[]},P.prototype.delete=function(t){var r=this.__data__,n=T(r,t);return!(n<0)&&(n==r.length-1?r.pop():A.call(r,n,1),!0)},P.prototype.get=function(t){var r=this.__data__,n=T(r,t);return n<0?void 0:r[n][1]},P.prototype.has=function(t){return T(this.__data__,t)>-1},P.prototype.set=function(t,r){var n=this.__data__,e=T(n,t);return e<0?n.push([t,r]):n[e][1]=r,this},F.prototype.clear=function(){this.__data__={hash:new k,map:new(E||P),string:new k}},F.prototype.delete=function(t){return B(this,t).delete(t)},F.prototype.get=function(t){return B(this,t).get(t)},F.prototype.has=function(t){return B(this,t).has(t)},F.prototype.set=function(t,r){return B(this,t).set(t,r),this},I.prototype.add=I.prototype.push=function(t){return this.__data__.set(t,n),this},I.prototype.has=function(t){return this.__data__.has(t)};var U,W,C=(U=function(t){var r=s(t,R);return r.length&&r[0]===t[0]?function(t,r,n){for(var e=n?f:i,o=t[0].length,u=t.length,c=u,a=Array(u),l=1/0,_=[];c--;){var y=t[c];c&&r&&(y=s(y,h(r))),l=S(y.length,l),a[c]=!n&&(r||o>=120&&y.length>=120)?new I(c&&y):void 0}y=t[0];var v=-1,d=a[0];t:for(;++v<o&&_.length<l;){var b=y[v],g=r?r(b):b;if(b=n||0!==b?b:0,!(d?p(d,g):e(_,g,n))){for(c=u;--c;){var j=a[c];if(!(j?p(j,g):e(t[c],g,n)))continue t}d&&d.push(g),_.push(b)}}return _}(r):[]},W=x(void 0===W?U.length-1:W,0),function(){for(var t=arguments,r=-1,n=x(t.length-W,0),e=Array(n);++r<n;)e[r]=t[W+r];r=-1;for(var o=Array(W+1);++r<W;)o[r]=t[r];return o[W]=e,a(U,this,o)});function H(t){var r=z(t)?w.call(t):"";return"[object Function]"==r||"[object GeneratorFunction]"==r}function z(t){var r=typeof t;return!!t&&("object"==r||"function"==r)}var G=C;function L(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}function V(t,r,n){if(r!=r)return function(t,r,n,e){for(var o=t.length,u=n+(e?1:-1);e?u--:++u<o;)if(r(t[u],u,t))return u;return-1}(t,q,n);for(var e=n-1,o=t.length;++e<o;)if(t[e]===r)return e;return-1}function N(t,r,n,e){for(var o=n-1,u=t.length;++o<u;)if(e(t[o],r))return o;return-1}function q(t){return t!=t}var J=Array.prototype.splice,K=Math.max;function Q(t,r,n,e){var o=e?N:V,u=-1,c=r.length,a=t;for(t===r&&(r=function(t,r){var n=-1,e=t.length;r||(r=Array(e));for(;++n<e;)r[n]=t[n];return r}(r)),n&&(a=function(t,r){for(var n=-1,e=t?t.length:0,o=Array(e);++n<e;)o[n]=r(t[n],n,t);return o}(t,function(t){return function(r){return t(r)}}(n)));++u<c;)for(var i=0,f=r[u],s=n?n(f):f;(i=o(a,s,i,e))>-1;)a!==t&&J.call(a,i,1),J.call(t,i,1);return t}var X=function(t,r){return r=K(void 0===r?t.length-1:r,0),function(){for(var n=arguments,e=-1,o=K(n.length-r,0),u=Array(o);++e<o;)u[e]=n[r+e];e=-1;for(var c=Array(r+1);++e<r;)c[e]=n[e];return c[r]=u,L(t,this,c)}}((function(t,r){return t&&t.length&&r&&r.length?Q(t,r):t}));var Y=X;var Z=Object.prototype,tt=Function.prototype.toString,rt=Z.hasOwnProperty,nt=tt.call(Object),et=Z.toString,ot=function(t,r){return function(n){return t(r(n))}}(Object.getPrototypeOf,Object);var ut=function(t){if(!function(t){return!!t&&"object"==typeof t}(t)||"[object Object]"!=et.call(t)||function(t){var r=!1;if(null!=t&&"function"!=typeof t.toString)try{r=!!(t+"")}catch(t){}return r}(t))return!1;var r=ot(t);if(null===r)return!0;var n=rt.call(r,"constructor")&&r.constructor;return"function"==typeof n&&n instanceof n&&tt.call(n)==nt},ct={exports:{}};!function(t,n){var e="__lodash_hash_undefined__",o=9007199254740991,u="[object Arguments]",c="[object Boolean]",a="[object Date]",i="[object Function]",f="[object GeneratorFunction]",s="[object Map]",l="[object Number]",h="[object Object]",p="[object Promise]",_="[object RegExp]",y="[object Set]",v="[object String]",d="[object Symbol]",b="[object WeakMap]",g="[object ArrayBuffer]",j="[object DataView]",O="[object Float32Array]",w="[object Float64Array]",m="[object Int8Array]",A="[object Int16Array]",x="[object Int32Array]",S="[object Uint8Array]",E="[object Uint8ClampedArray]",$="[object Uint16Array]",k="[object Uint32Array]",P=/\w*$/,F=/^\[object .+?Constructor\]$/,I=/^(?:0|[1-9]\d*)$/,T={};T[u]=T["[object Array]"]=T[g]=T[j]=T[c]=T[a]=T[O]=T[w]=T[m]=T[A]=T[x]=T[s]=T[l]=T[h]=T[_]=T[y]=T[v]=T[d]=T[S]=T[E]=T[$]=T[k]=!0,T["[object Error]"]=T[i]=T[b]=!1;var M="object"==typeof self&&self&&self.Object===Object&&self,R="object"==typeof r&&r&&r.Object===Object&&r||M||Function("return this")(),B=n&&!n.nodeType&&n,D=B&&t&&!t.nodeType&&t,U=D&&D.exports===B;function W(t,r){return t.set(r[0],r[1]),t}function C(t,r){return t.add(r),t}function H(t,r,n,e){var o=-1,u=t?t.length:0;for(e&&u&&(n=t[++o]);++o<u;)n=r(n,t[o],o,t);return n}function z(t){var r=!1;if(null!=t&&"function"!=typeof t.toString)try{r=!!(t+"")}catch(t){}return r}function G(t){var r=-1,n=Array(t.size);return t.forEach((function(t,e){n[++r]=[e,t]})),n}function L(t,r){return function(n){return t(r(n))}}function V(t){var r=-1,n=Array(t.size);return t.forEach((function(t){n[++r]=t})),n}var N=Array.prototype,q=Function.prototype,J=Object.prototype,K=R["__core-js_shared__"],Q=function(){var t=/[^.]+$/.exec(K&&K.keys&&K.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),X=q.toString,Y=J.hasOwnProperty,Z=J.toString,tt=RegExp("^"+X.call(Y).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=U?R.Buffer:void 0,nt=R.Symbol,et=R.Uint8Array,ot=L(Object.getPrototypeOf,Object),ut=Object.create,ct=J.propertyIsEnumerable,at=N.splice,it=Object.getOwnPropertySymbols,ft=rt?rt.isBuffer:void 0,st=L(Object.keys,Object),lt=Bt(R,"DataView"),ht=Bt(R,"Map"),pt=Bt(R,"Promise"),_t=Bt(R,"Set"),yt=Bt(R,"WeakMap"),vt=Bt(Object,"create"),dt=Ht(lt),bt=Ht(ht),gt=Ht(pt),jt=Ht(_t),Ot=Ht(yt),wt=nt?nt.prototype:void 0,mt=wt?wt.valueOf:void 0;function At(t){var r=-1,n=t?t.length:0;for(this.clear();++r<n;){var e=t[r];this.set(e[0],e[1])}}function xt(t){var r=-1,n=t?t.length:0;for(this.clear();++r<n;){var e=t[r];this.set(e[0],e[1])}}function St(t){var r=-1,n=t?t.length:0;for(this.clear();++r<n;){var e=t[r];this.set(e[0],e[1])}}function Et(t){this.__data__=new xt(t)}function $t(t,r){var n=Gt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Lt(t)}(t)&&Y.call(t,"callee")&&(!ct.call(t,"callee")||Z.call(t)==u)}(t)?function(t,r){for(var n=-1,e=Array(t);++n<t;)e[n]=r(n);return e}(t.length,String):[],e=n.length,o=!!e;for(var c in t)!r&&!Y.call(t,c)||o&&("length"==c||Wt(c,e))||n.push(c);return n}function kt(t,r,n){var e=t[r];Y.call(t,r)&&zt(e,n)&&(void 0!==n||r in t)||(t[r]=n)}function Pt(t,r){for(var n=t.length;n--;)if(zt(t[n][0],r))return n;return-1}function Ft(t,r,n,e,o,p,b){var F;if(e&&(F=p?e(t,o,p,b):e(t)),void 0!==F)return F;if(!qt(t))return t;var I=Gt(t);if(I){if(F=function(t){var r=t.length,n=t.constructor(r);r&&"string"==typeof t[0]&&Y.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!r)return function(t,r){var n=-1,e=t.length;r||(r=Array(e));for(;++n<e;)r[n]=t[n];return r}(t,F)}else{var M=Ut(t),R=M==i||M==f;if(Vt(t))return function(t,r){if(r)return t.slice();var n=new t.constructor(t.length);return t.copy(n),n}(t,r);if(M==h||M==u||R&&!p){if(z(t))return p?t:{};if(F=function(t){return"function"!=typeof t.constructor||Ct(t)?{}:(r=ot(t),qt(r)?ut(r):{});var r}(R?{}:t),!r)return function(t,r){return Mt(t,Dt(t),r)}(t,function(t,r){return t&&Mt(r,Jt(r),t)}(F,t))}else{if(!T[M])return p?t:{};F=function(t,r,n,e){var o=t.constructor;switch(r){case g:return Tt(t);case c:case a:return new o(+t);case j:return function(t,r){var n=r?Tt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,e);case O:case w:case m:case A:case x:case S:case E:case $:case k:return function(t,r){var n=r?Tt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}(t,e);case s:return function(t,r,n){return H(r?n(G(t),!0):G(t),W,new t.constructor)}(t,e,n);case l:case v:return new o(t);case _:return function(t){var r=new t.constructor(t.source,P.exec(t));return r.lastIndex=t.lastIndex,r}(t);case y:return function(t,r,n){return H(r?n(V(t),!0):V(t),C,new t.constructor)}(t,e,n);case d:return u=t,mt?Object(mt.call(u)):{}}var u}(t,M,Ft,r)}}b||(b=new Et);var B=b.get(t);if(B)return B;if(b.set(t,F),!I)var D=n?function(t){return function(t,r,n){var e=r(t);return Gt(t)?e:function(t,r){for(var n=-1,e=r.length,o=t.length;++n<e;)t[o+n]=r[n];return t}(e,n(t))}(t,Jt,Dt)}(t):Jt(t);return function(t,r){for(var n=-1,e=t?t.length:0;++n<e&&!1!==r(t[n],n,t););}(D||t,(function(o,u){D&&(o=t[u=o]),kt(F,u,Ft(o,r,n,e,u,t,b))})),F}function It(t){return!(!qt(t)||function(t){return!!Q&&Q in t}(t))&&(Nt(t)||z(t)?tt:F).test(Ht(t))}function Tt(t){var r=new t.constructor(t.byteLength);return new et(r).set(new et(t)),r}function Mt(t,r,n,e){n||(n={});for(var o=-1,u=r.length;++o<u;){var c=r[o],a=e?e(n[c],t[c],c,n,t):void 0;kt(n,c,void 0===a?t[c]:a)}return n}function Rt(t,r){var n,e,o=t.__data__;return("string"==(e=typeof(n=r))||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==n:null===n)?o["string"==typeof r?"string":"hash"]:o.map}function Bt(t,r){var n=function(t,r){return null==t?void 0:t[r]}(t,r);return It(n)?n:void 0}At.prototype.clear=function(){this.__data__=vt?vt(null):{}},At.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},At.prototype.get=function(t){var r=this.__data__;if(vt){var n=r[t];return n===e?void 0:n}return Y.call(r,t)?r[t]:void 0},At.prototype.has=function(t){var r=this.__data__;return vt?void 0!==r[t]:Y.call(r,t)},At.prototype.set=function(t,r){return this.__data__[t]=vt&&void 0===r?e:r,this},xt.prototype.clear=function(){this.__data__=[]},xt.prototype.delete=function(t){var r=this.__data__,n=Pt(r,t);return!(n<0)&&(n==r.length-1?r.pop():at.call(r,n,1),!0)},xt.prototype.get=function(t){var r=this.__data__,n=Pt(r,t);return n<0?void 0:r[n][1]},xt.prototype.has=function(t){return Pt(this.__data__,t)>-1},xt.prototype.set=function(t,r){var n=this.__data__,e=Pt(n,t);return e<0?n.push([t,r]):n[e][1]=r,this},St.prototype.clear=function(){this.__data__={hash:new At,map:new(ht||xt),string:new At}},St.prototype.delete=function(t){return Rt(this,t).delete(t)},St.prototype.get=function(t){return Rt(this,t).get(t)},St.prototype.has=function(t){return Rt(this,t).has(t)},St.prototype.set=function(t,r){return Rt(this,t).set(t,r),this},Et.prototype.clear=function(){this.__data__=new xt},Et.prototype.delete=function(t){return this.__data__.delete(t)},Et.prototype.get=function(t){return this.__data__.get(t)},Et.prototype.has=function(t){return this.__data__.has(t)},Et.prototype.set=function(t,r){var n=this.__data__;if(n instanceof xt){var e=n.__data__;if(!ht||e.length<199)return e.push([t,r]),this;n=this.__data__=new St(e)}return n.set(t,r),this};var Dt=it?L(it,Object):function(){return[]},Ut=function(t){return Z.call(t)};function Wt(t,r){return!!(r=null==r?o:r)&&("number"==typeof t||I.test(t))&&t>-1&&t%1==0&&t<r}function Ct(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||J)}function Ht(t){if(null!=t){try{return X.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function zt(t,r){return t===r||t!=t&&r!=r}(lt&&Ut(new lt(new ArrayBuffer(1)))!=j||ht&&Ut(new ht)!=s||pt&&Ut(pt.resolve())!=p||_t&&Ut(new _t)!=y||yt&&Ut(new yt)!=b)&&(Ut=function(t){var r=Z.call(t),n=r==h?t.constructor:void 0,e=n?Ht(n):void 0;if(e)switch(e){case dt:return j;case bt:return s;case gt:return p;case jt:return y;case Ot:return b}return r});var Gt=Array.isArray;function Lt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=o}(t.length)&&!Nt(t)}var Vt=ft||function(){return!1};function Nt(t){var r=qt(t)?Z.call(t):"";return r==i||r==f}function qt(t){var r=typeof t;return!!t&&("object"==r||"function"==r)}function Jt(t){return Lt(t)?$t(t):function(t){if(!Ct(t))return st(t);var r=[];for(var n in Object(t))Y.call(t,n)&&"constructor"!=n&&r.push(n);return r}(t)}t.exports=function(t){return Ft(t,!0,!0)}}(ct,ct.exports);var at=ct.exports;t.combinations=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 n=at(t),e=at(r),o=Object.keys(n),u=[];let c=[];ut(e)&&Object.keys(e).length&&(c=G(Object.keys(e),Object.keys(n)),c.forEach((t=>Y(o,t))));const a=function(t){const r=[];for(let n=0;n<1<<t;n++){const e=[];for(let r=0;r<t;r++)e.push(n&1<<r?1:0);r.push(e)}return r}(Object.keys(o).length);let i;return a.forEach(((t,r)=>{i={},o.forEach(((t,n)=>{i[t]=1===a[r][n]})),u.push(i)})),ut(e)&&Object.keys(e).length&&u.forEach((t=>c.forEach((r=>{t[r]=e[r]})))),u},t.version="5.0.5",Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
10
|
+
var objectBooleanCombinations=(()=>{var Se=Object.create;var D=Object.defineProperty;var Ae=Object.getOwnPropertyDescriptor;var Te=Object.getOwnPropertyNames;var Ee=Object.getPrototypeOf,Ie=Object.prototype.hasOwnProperty;var pt=t=>D(t,"__esModule",{value:!0});var R=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pe=(t,e)=>{for(var n in e)D(t,n,{get:e[n],enumerable:!0})},dt=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Te(e))!Ie.call(t,o)&&(n||o!=="default")&&D(t,o,{get:()=>e[o],enumerable:!(r=Ae(e,o))||r.enumerable});return t},F=(t,e)=>dt(pt(D(t!=null?Se(Ee(t)):{},"default",!e&&t&&t.__esModule?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t),Me=(t=>(e,n)=>t&&t.get(e)||(n=dt(pt({}),e,1),t&&t.set(e,n),n))(typeof WeakMap!="undefined"?new WeakMap:0);var St=R((Ro,Ct)=>{var J="__lodash_hash_undefined__",He=9007199254740991,De="[object Function]",Re="[object GeneratorFunction]",Fe=/[\\^$.*+?()[\]{}|]/g,Le=/^\[object .+?Constructor\]$/,Ge=typeof global=="object"&&global&&global.Object===Object&&global,Ne=typeof self=="object"&&self&&self.Object===Object&&self,gt=Ge||Ne||Function("return this")();function Be(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Ue(t,e){var n=t?t.length:0;return!!n&&Ke(t,e,0)>-1}function $e(t,e,n){for(var r=-1,o=t?t.length:0;++r<o;)if(n(e,t[r]))return!0;return!1}function bt(t,e){for(var n=-1,r=t?t.length:0,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}function Ve(t,e,n,r){for(var o=t.length,i=n+(r?1:-1);r?i--:++i<o;)if(e(t[i],i,t))return i;return-1}function Ke(t,e,n){if(e!==e)return Ve(t,We,n);for(var r=n-1,o=t.length;++r<o;)if(t[r]===e)return r;return-1}function We(t){return t!==t}function ke(t){return function(e){return t(e)}}function _t(t,e){return t.has(e)}function qe(t,e){return t==null?void 0:t[e]}function Je(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch(n){}return e}var Xe=Array.prototype,Ye=Function.prototype,yt=Object.prototype,X=gt["__core-js_shared__"],jt=function(){var t=/[^.]+$/.exec(X&&X.keys&&X.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),vt=Ye.toString,Y=yt.hasOwnProperty,Ze=yt.toString,Qe=RegExp("^"+vt.call(Y).replace(Fe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ze=Xe.splice,wt=Math.max,tn=Math.min,en=Ot(gt,"Map"),E=Ot(Object,"create");function j(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function nn(){this.__data__=E?E(null):{}}function rn(t){return this.has(t)&&delete this.__data__[t]}function on(t){var e=this.__data__;if(E){var n=e[t];return n===J?void 0:n}return Y.call(e,t)?e[t]:void 0}function an(t){var e=this.__data__;return E?e[t]!==void 0:Y.call(e,t)}function cn(t,e){var n=this.__data__;return n[t]=E&&e===void 0?J:e,this}j.prototype.clear=nn;j.prototype.delete=rn;j.prototype.get=on;j.prototype.has=an;j.prototype.set=cn;function m(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function sn(){this.__data__=[]}function un(t){var e=this.__data__,n=G(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():ze.call(e,n,1),!0}function ln(t){var e=this.__data__,n=G(e,t);return n<0?void 0:e[n][1]}function fn(t){return G(this.__data__,t)>-1}function hn(t,e){var n=this.__data__,r=G(n,t);return r<0?n.push([t,e]):n[r][1]=e,this}m.prototype.clear=sn;m.prototype.delete=un;m.prototype.get=ln;m.prototype.has=fn;m.prototype.set=hn;function x(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function pn(){this.__data__={hash:new j,map:new(en||m),string:new j}}function dn(t){return N(this,t).delete(t)}function gn(t){return N(this,t).get(t)}function bn(t){return N(this,t).has(t)}function _n(t,e){return N(this,t).set(t,e),this}x.prototype.clear=pn;x.prototype.delete=dn;x.prototype.get=gn;x.prototype.has=bn;x.prototype.set=_n;function L(t){var e=-1,n=t?t.length:0;for(this.__data__=new x;++e<n;)this.add(t[e])}function yn(t){return this.__data__.set(t,J),this}function jn(t){return this.__data__.has(t)}L.prototype.add=L.prototype.push=yn;L.prototype.has=jn;function G(t,e){for(var n=t.length;n--;)if(Tn(t[n][0],e))return n;return-1}function vn(t,e,n){for(var r=n?$e:Ue,o=t[0].length,i=t.length,a=i,c=Array(i),h=1/0,l=[];a--;){var u=t[a];a&&e&&(u=bt(u,ke(e))),h=tn(u.length,h),c[a]=!n&&(e||o>=120&&u.length>=120)?new L(a&&u):void 0}u=t[0];var d=-1,g=c[0];t:for(;++d<o&&l.length<h;){var f=u[d],p=e?e(f):f;if(f=n||f!==0?f:0,!(g?_t(g,p):r(l,p,n))){for(a=i;--a;){var ht=c[a];if(!(ht?_t(ht,p):r(t[a],p,n)))continue t}g&&g.push(p),l.push(f)}}return l}function wn(t){if(!xt(t)||Cn(t))return!1;var e=mt(t)||Je(t)?Qe:Le;return e.test(Sn(t))}function On(t,e){return e=wt(e===void 0?t.length-1:e,0),function(){for(var n=arguments,r=-1,o=wt(n.length-e,0),i=Array(o);++r<o;)i[r]=n[e+r];r=-1;for(var a=Array(e+1);++r<e;)a[r]=n[r];return a[e]=i,Be(t,this,a)}}function mn(t){return In(t)?t:[]}function N(t,e){var n=t.__data__;return xn(e)?n[typeof e=="string"?"string":"hash"]:n.map}function Ot(t,e){var n=qe(t,e);return wn(n)?n:void 0}function xn(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function Cn(t){return!!jt&&jt in t}function Sn(t){if(t!=null){try{return vt.call(t)}catch(e){}try{return t+""}catch(e){}}return""}var An=On(function(t){var e=bt(t,mn);return e.length&&e[0]===t[0]?vn(e):[]});function Tn(t,e){return t===e||t!==t&&e!==e}function En(t){return t!=null&&Pn(t.length)&&!mt(t)}function In(t){return Mn(t)&&En(t)}function mt(t){var e=xt(t)?Ze.call(t):"";return e==De||e==Re}function Pn(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=He}function xt(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Mn(t){return!!t&&typeof t=="object"}Ct.exports=An});var It=R((Fo,Et)=>{function Hn(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Dn(t,e){for(var n=-1,r=t?t.length:0,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}function Rn(t,e,n,r){for(var o=t.length,i=n+(r?1:-1);r?i--:++i<o;)if(e(t[i],i,t))return i;return-1}function Fn(t,e,n){if(e!==e)return Rn(t,Gn,n);for(var r=n-1,o=t.length;++r<o;)if(t[r]===e)return r;return-1}function Ln(t,e,n,r){for(var o=n-1,i=t.length;++o<i;)if(r(t[o],e))return o;return-1}function Gn(t){return t!==t}function Nn(t){return function(e){return t(e)}}var Bn=Array.prototype,At=Bn.splice,Tt=Math.max;function Un(t,e,n,r){var o=r?Ln:Fn,i=-1,a=e.length,c=t;for(t===e&&(e=Vn(e)),n&&(c=Dn(t,Nn(n)));++i<a;)for(var h=0,l=e[i],u=n?n(l):l;(h=o(c,u,h,r))>-1;)c!==t&&At.call(c,h,1),At.call(t,h,1);return t}function $n(t,e){return e=Tt(e===void 0?t.length-1:e,0),function(){for(var n=arguments,r=-1,o=Tt(n.length-e,0),i=Array(o);++r<o;)i[r]=n[e+r];r=-1;for(var a=Array(e+1);++r<e;)a[r]=n[r];return a[e]=i,Hn(t,this,a)}}function Vn(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}var Kn=$n(Wn);function Wn(t,e){return t&&t.length&&e&&e.length?Un(t,e):t}Et.exports=Kn});var Dt=R((Lo,Ht)=>{var kn="[object Object]";function qn(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch(n){}return e}function Jn(t,e){return function(n){return t(e(n))}}var Xn=Function.prototype,Pt=Object.prototype,Mt=Xn.toString,Yn=Pt.hasOwnProperty,Zn=Mt.call(Object),Qn=Pt.toString,zn=Jn(Object.getPrototypeOf,Object);function tr(t){return!!t&&typeof t=="object"}function er(t){if(!tr(t)||Qn.call(t)!=kn||qn(t))return!1;var e=zn(t);if(e===null)return!0;var n=Yn.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&Mt.call(n)==Zn}Ht.exports=er});var Oe=R((M,T)=>{var nr=200,Rt="__lodash_hash_undefined__",Ft=9007199254740991,Z="[object Arguments]",rr="[object Array]",Lt="[object Boolean]",Gt="[object Date]",or="[object Error]",Q="[object Function]",Nt="[object GeneratorFunction]",B="[object Map]",Bt="[object Number]",z="[object Object]",Ut="[object Promise]",$t="[object RegExp]",U="[object Set]",Vt="[object String]",Kt="[object Symbol]",tt="[object WeakMap]",Wt="[object ArrayBuffer]",$="[object DataView]",kt="[object Float32Array]",qt="[object Float64Array]",Jt="[object Int8Array]",Xt="[object Int16Array]",Yt="[object Int32Array]",Zt="[object Uint8Array]",Qt="[object Uint8ClampedArray]",zt="[object Uint16Array]",te="[object Uint32Array]",ir=/[\\^$.*+?()[\]{}|]/g,ar=/\w*$/,cr=/^\[object .+?Constructor\]$/,sr=/^(?:0|[1-9]\d*)$/,s={};s[Z]=s[rr]=s[Wt]=s[$]=s[Lt]=s[Gt]=s[kt]=s[qt]=s[Jt]=s[Xt]=s[Yt]=s[B]=s[Bt]=s[z]=s[$t]=s[U]=s[Vt]=s[Kt]=s[Zt]=s[Qt]=s[zt]=s[te]=!0;s[or]=s[Q]=s[tt]=!1;var ur=typeof global=="object"&&global&&global.Object===Object&&global,lr=typeof self=="object"&&self&&self.Object===Object&&self,b=ur||lr||Function("return this")(),ee=typeof M=="object"&&M&&!M.nodeType&&M,ne=ee&&typeof T=="object"&&T&&!T.nodeType&&T,fr=ne&&ne.exports===ee;function hr(t,e){return t.set(e[0],e[1]),t}function pr(t,e){return t.add(e),t}function dr(t,e){for(var n=-1,r=t?t.length:0;++n<r&&e(t[n],n,t)!==!1;);return t}function gr(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}function re(t,e,n,r){var o=-1,i=t?t.length:0;for(r&&i&&(n=t[++o]);++o<i;)n=e(n,t[o],o,t);return n}function br(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function _r(t,e){return t==null?void 0:t[e]}function oe(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch(n){}return e}function ie(t){var e=-1,n=Array(t.size);return t.forEach(function(r,o){n[++e]=[o,r]}),n}function et(t,e){return function(n){return t(e(n))}}function ae(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var yr=Array.prototype,jr=Function.prototype,V=Object.prototype,nt=b["__core-js_shared__"],ce=function(){var t=/[^.]+$/.exec(nt&&nt.keys&&nt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),se=jr.toString,y=V.hasOwnProperty,K=V.toString,vr=RegExp("^"+se.call(y).replace(ir,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ue=fr?b.Buffer:void 0,le=b.Symbol,fe=b.Uint8Array,wr=et(Object.getPrototypeOf,Object),Or=Object.create,mr=V.propertyIsEnumerable,xr=yr.splice,he=Object.getOwnPropertySymbols,Cr=ue?ue.isBuffer:void 0,Sr=et(Object.keys,Object),rt=A(b,"DataView"),I=A(b,"Map"),ot=A(b,"Promise"),it=A(b,"Set"),at=A(b,"WeakMap"),P=A(Object,"create"),Ar=O(rt),Tr=O(I),Er=O(ot),Ir=O(it),Pr=O(at),pe=le?le.prototype:void 0,de=pe?pe.valueOf:void 0;function v(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Mr(){this.__data__=P?P(null):{}}function Hr(t){return this.has(t)&&delete this.__data__[t]}function Dr(t){var e=this.__data__;if(P){var n=e[t];return n===Rt?void 0:n}return y.call(e,t)?e[t]:void 0}function Rr(t){var e=this.__data__;return P?e[t]!==void 0:y.call(e,t)}function Fr(t,e){var n=this.__data__;return n[t]=P&&e===void 0?Rt:e,this}v.prototype.clear=Mr;v.prototype.delete=Hr;v.prototype.get=Dr;v.prototype.has=Rr;v.prototype.set=Fr;function _(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Lr(){this.__data__=[]}function Gr(t){var e=this.__data__,n=W(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():xr.call(e,n,1),!0}function Nr(t){var e=this.__data__,n=W(e,t);return n<0?void 0:e[n][1]}function Br(t){return W(this.__data__,t)>-1}function Ur(t,e){var n=this.__data__,r=W(n,t);return r<0?n.push([t,e]):n[r][1]=e,this}_.prototype.clear=Lr;_.prototype.delete=Gr;_.prototype.get=Nr;_.prototype.has=Br;_.prototype.set=Ur;function C(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function $r(){this.__data__={hash:new v,map:new(I||_),string:new v}}function Vr(t){return k(this,t).delete(t)}function Kr(t){return k(this,t).get(t)}function Wr(t){return k(this,t).has(t)}function kr(t,e){return k(this,t).set(t,e),this}C.prototype.clear=$r;C.prototype.delete=Vr;C.prototype.get=Kr;C.prototype.has=Wr;C.prototype.set=kr;function S(t){this.__data__=new _(t)}function qr(){this.__data__=new _}function Jr(t){return this.__data__.delete(t)}function Xr(t){return this.__data__.get(t)}function Yr(t){return this.__data__.has(t)}function Zr(t,e){var n=this.__data__;if(n instanceof _){var r=n.__data__;if(!I||r.length<nr-1)return r.push([t,e]),this;n=this.__data__=new C(r)}return n.set(t,e),this}S.prototype.clear=qr;S.prototype.delete=Jr;S.prototype.get=Xr;S.prototype.has=Yr;S.prototype.set=Zr;function Qr(t,e){var n=ut(t)||mo(t)?br(t.length,String):[],r=n.length,o=!!r;for(var i in t)(e||y.call(t,i))&&!(o&&(i=="length"||jo(i,r)))&&n.push(i);return n}function ge(t,e,n){var r=t[e];(!(y.call(t,e)&&je(r,n))||n===void 0&&!(e in t))&&(t[e]=n)}function W(t,e){for(var n=t.length;n--;)if(je(t[n][0],e))return n;return-1}function zr(t,e){return t&&be(e,lt(e),t)}function ct(t,e,n,r,o,i,a){var c;if(r&&(c=i?r(t,o,i,a):r(t)),c!==void 0)return c;if(!q(t))return t;var h=ut(t);if(h){if(c=bo(t),!e)return ho(t,c)}else{var l=w(t),u=l==Q||l==Nt;if(Co(t))return io(t,e);if(l==z||l==Z||u&&!i){if(oe(t))return i?t:{};if(c=_o(u?{}:t),!e)return po(t,zr(c,t))}else{if(!s[l])return i?t:{};c=yo(t,l,ct,e)}}a||(a=new S);var d=a.get(t);if(d)return d;if(a.set(t,c),!h)var g=n?go(t):lt(t);return dr(g||t,function(f,p){g&&(p=f,f=t[p]),ge(c,p,ct(f,e,n,r,p,t,a))}),c}function to(t){return q(t)?Or(t):{}}function eo(t,e,n){var r=e(t);return ut(t)?r:gr(r,n(t))}function no(t){return K.call(t)}function ro(t){if(!q(t)||wo(t))return!1;var e=we(t)||oe(t)?vr:cr;return e.test(O(t))}function oo(t){if(!ye(t))return Sr(t);var e=[];for(var n in Object(t))y.call(t,n)&&n!="constructor"&&e.push(n);return e}function io(t,e){if(e)return t.slice();var n=new t.constructor(t.length);return t.copy(n),n}function st(t){var e=new t.constructor(t.byteLength);return new fe(e).set(new fe(t)),e}function ao(t,e){var n=e?st(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}function co(t,e,n){var r=e?n(ie(t),!0):ie(t);return re(r,hr,new t.constructor)}function so(t){var e=new t.constructor(t.source,ar.exec(t));return e.lastIndex=t.lastIndex,e}function uo(t,e,n){var r=e?n(ae(t),!0):ae(t);return re(r,pr,new t.constructor)}function lo(t){return de?Object(de.call(t)):{}}function fo(t,e){var n=e?st(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function ho(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}function be(t,e,n,r){n||(n={});for(var o=-1,i=e.length;++o<i;){var a=e[o],c=r?r(n[a],t[a],a,n,t):void 0;ge(n,a,c===void 0?t[a]:c)}return n}function po(t,e){return be(t,_e(t),e)}function go(t){return eo(t,lt,_e)}function k(t,e){var n=t.__data__;return vo(e)?n[typeof e=="string"?"string":"hash"]:n.map}function A(t,e){var n=_r(t,e);return ro(n)?n:void 0}var _e=he?et(he,Object):To,w=no;(rt&&w(new rt(new ArrayBuffer(1)))!=$||I&&w(new I)!=B||ot&&w(ot.resolve())!=Ut||it&&w(new it)!=U||at&&w(new at)!=tt)&&(w=function(t){var e=K.call(t),n=e==z?t.constructor:void 0,r=n?O(n):void 0;if(r)switch(r){case Ar:return $;case Tr:return B;case Er:return Ut;case Ir:return U;case Pr:return tt}return e});function bo(t){var e=t.length,n=t.constructor(e);return e&&typeof t[0]=="string"&&y.call(t,"index")&&(n.index=t.index,n.input=t.input),n}function _o(t){return typeof t.constructor=="function"&&!ye(t)?to(wr(t)):{}}function yo(t,e,n,r){var o=t.constructor;switch(e){case Wt:return st(t);case Lt:case Gt:return new o(+t);case $:return ao(t,r);case kt:case qt:case Jt:case Xt:case Yt:case Zt:case Qt:case zt:case te:return fo(t,r);case B:return co(t,r,n);case Bt:case Vt:return new o(t);case $t:return so(t);case U:return uo(t,r,n);case Kt:return lo(t)}}function jo(t,e){return e=e==null?Ft:e,!!e&&(typeof t=="number"||sr.test(t))&&t>-1&&t%1==0&&t<e}function vo(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function wo(t){return!!ce&&ce in t}function ye(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||V;return t===n}function O(t){if(t!=null){try{return se.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function Oo(t){return ct(t,!0,!0)}function je(t,e){return t===e||t!==t&&e!==e}function mo(t){return xo(t)&&y.call(t,"callee")&&(!mr.call(t,"callee")||K.call(t)==Z)}var ut=Array.isArray;function ve(t){return t!=null&&So(t.length)&&!we(t)}function xo(t){return Ao(t)&&ve(t)}var Co=Cr||Eo;function we(t){var e=q(t)?K.call(t):"";return e==Q||e==Nt}function So(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Ft}function q(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Ao(t){return!!t&&typeof t=="object"}function lt(t){return ve(t)?Qr(t):oo(t)}function To(){return[]}function Eo(){return!1}T.exports=Oo});var Ho={};Pe(Ho,{combinations:()=>Mo,version:()=>Po});var xe=F(St(),1),Ce=F(It(),1),H=F(Dt(),1),ft=F(Oe(),1);var me="5.0.11";var Po=me;function Mo(t,e={}){function n(u){let d=[];for(let g=0;g<1<<u;g++){let f=[];for(let p=0;p<u;p++)f.push(g&1<<p?1:0);d.push(f)}return d}if(!t)throw new Error("[THROW_ID_01] missing input object");if(!(0,H.default)(t))throw new Error("[THROW_ID_02] the first input object must be a true object");if(e&&!(0,H.default)(e))throw new Error("[THROW_ID_03] the second override object must be a true object");let r=(0,ft.default)(t),o=(0,ft.default)(e),i=Object.keys(r),a=[],c=[];(0,H.default)(o)&&Object.keys(o).length&&(c=(0,xe.default)(Object.keys(o),Object.keys(r)),c.forEach(u=>(0,Ce.default)(i,u)));let h=n(Object.keys(i).length),l;return h.forEach((u,d)=>{l={},i.forEach((g,f)=>{l[g]=h[d][f]===1}),a.push(l)}),(0,H.default)(o)&&Object.keys(o).length&&a.forEach(u=>{c.forEach(d=>{u[d]=o[d]})}),a}return Me(Ho);})();
|
package/examples/_quickTake.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "object-boolean-combinations",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.11",
|
|
4
4
|
"description": "Consumes a defaults object with booleans, generates all possible variations of it",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"all",
|
|
@@ -30,106 +30,48 @@
|
|
|
30
30
|
},
|
|
31
31
|
"types": "types/index.d.ts",
|
|
32
32
|
"scripts": {
|
|
33
|
-
"build": "
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"tap": "tap",
|
|
48
|
-
"pretest": "npm run build",
|
|
49
|
-
"test": "npm run lint && npm run unittest && npm run test:examples && npm run clean_cov && npm run format",
|
|
50
|
-
"test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
|
|
51
|
-
"tsc": "tsc",
|
|
52
|
-
"unittest": "tap --no-only --output-file=testStats.md --reporter=terse && tsc -p tsconfig.json --noEmit && npm run clean_cov && npm run perf"
|
|
33
|
+
"build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
34
|
+
"dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
35
|
+
"dts": "rollup -c && yarn run prettier 'types/index.d.ts' --write",
|
|
36
|
+
"examples": "node '../../ops/scripts/run-examples.js'",
|
|
37
|
+
"lect": "node '../../ops/lect/lect.js'",
|
|
38
|
+
"letspublish": "yarn publish || :",
|
|
39
|
+
"lint": "eslint . --fix",
|
|
40
|
+
"perf": "node perf/check.js",
|
|
41
|
+
"prepare": "echo 'ready'",
|
|
42
|
+
"prettier": "prettier",
|
|
43
|
+
"prettier:format": "prettier --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern",
|
|
44
|
+
"pretest": "yarn run lect && yarn run build",
|
|
45
|
+
"test": "c8 yarn run unit && yarn run examples && yarn run lint",
|
|
46
|
+
"unit": "uvu test"
|
|
53
47
|
},
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"--no-warnings",
|
|
62
|
-
"--experimental-loader",
|
|
63
|
-
"@istanbuljs/esm-loader-hook"
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
50
|
+
},
|
|
51
|
+
"c8": {
|
|
52
|
+
"check-coverage": true,
|
|
53
|
+
"exclude": [
|
|
54
|
+
"**/test/**/*.*"
|
|
64
55
|
],
|
|
65
|
-
"
|
|
56
|
+
"lines": 100
|
|
66
57
|
},
|
|
67
58
|
"lect": {
|
|
68
59
|
"licence": {
|
|
69
60
|
"extras": [
|
|
70
61
|
""
|
|
71
62
|
]
|
|
72
|
-
},
|
|
73
|
-
"req": "{ combinations }",
|
|
74
|
-
"various": {
|
|
75
|
-
"devDependencies": [
|
|
76
|
-
"@types/lodash.clonedeep",
|
|
77
|
-
"@types/lodash.intersection",
|
|
78
|
-
"@types/lodash.isplainobject",
|
|
79
|
-
"@types/lodash.pull"
|
|
80
|
-
]
|
|
81
63
|
}
|
|
82
64
|
},
|
|
83
65
|
"dependencies": {
|
|
84
|
-
"@babel/runtime": "^7.16.0",
|
|
85
66
|
"lodash.clonedeep": "^4.5.0",
|
|
86
67
|
"lodash.intersection": "^4.4.0",
|
|
87
68
|
"lodash.isplainobject": "^4.0.6",
|
|
88
69
|
"lodash.pull": "^4.1.0"
|
|
89
70
|
},
|
|
90
71
|
"devDependencies": {
|
|
91
|
-
"@babel/cli": "^7.16.0",
|
|
92
|
-
"@babel/core": "^7.16.0",
|
|
93
|
-
"@babel/node": "^7.16.0",
|
|
94
|
-
"@babel/plugin-external-helpers": "^7.16.0",
|
|
95
|
-
"@babel/plugin-proposal-class-properties": "^7.16.0",
|
|
96
|
-
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
|
|
97
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.16.0",
|
|
98
|
-
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
|
|
99
|
-
"@babel/plugin-transform-runtime": "^7.16.0",
|
|
100
|
-
"@babel/preset-env": "^7.16.0",
|
|
101
|
-
"@babel/preset-typescript": "^7.16.0",
|
|
102
|
-
"@babel/register": "^7.16.0",
|
|
103
|
-
"@istanbuljs/esm-loader-hook": "^0.1.2",
|
|
104
|
-
"@rollup/plugin-babel": "^5.3.0",
|
|
105
|
-
"@rollup/plugin-commonjs": "^21.0.1",
|
|
106
|
-
"@rollup/plugin-json": "^4.1.0",
|
|
107
|
-
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
108
|
-
"@rollup/plugin-strip": "^2.1.0",
|
|
109
|
-
"@rollup/plugin-typescript": "^8.3.0",
|
|
110
72
|
"@types/lodash.clonedeep": "^4.5.6",
|
|
111
73
|
"@types/lodash.intersection": "^4.4.6",
|
|
112
74
|
"@types/lodash.isplainobject": "^4.0.6",
|
|
113
|
-
"@types/lodash.pull": "^4.1.6"
|
|
114
|
-
"@types/node": "^16.11.6",
|
|
115
|
-
"@types/tap": "^15.0.5",
|
|
116
|
-
"@typescript-eslint/eslint-plugin": "^5.3.0",
|
|
117
|
-
"@typescript-eslint/parser": "^5.3.0",
|
|
118
|
-
"core-js": "^3.19.1",
|
|
119
|
-
"cross-env": "^7.0.3",
|
|
120
|
-
"eslint": "^8.2.0",
|
|
121
|
-
"lect": "^0.18.5",
|
|
122
|
-
"rollup": "^2.59.0",
|
|
123
|
-
"rollup-plugin-ascii": "^0.0.3",
|
|
124
|
-
"rollup-plugin-banner": "^0.2.1",
|
|
125
|
-
"rollup-plugin-cleanup": "^3.2.1",
|
|
126
|
-
"rollup-plugin-dts": "^4.0.1",
|
|
127
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
128
|
-
"tap": "^15.0.10",
|
|
129
|
-
"tslib": "^2.3.1",
|
|
130
|
-
"typescript": "^4.4.4"
|
|
131
|
-
},
|
|
132
|
-
"engines": {
|
|
133
|
-
"node": ">=12"
|
|
75
|
+
"@types/lodash.pull": "^4.1.6"
|
|
134
76
|
}
|
|
135
77
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
declare const version: string;
|
|
2
2
|
interface BoolValueObj {
|
|
3
|
-
|
|
3
|
+
[key: string]: boolean;
|
|
4
4
|
}
|
|
5
5
|
interface UnknownValueObj {
|
|
6
|
-
|
|
6
|
+
[key: string]: any;
|
|
7
7
|
}
|
|
8
|
-
declare function combinations(
|
|
8
|
+
declare function combinations(
|
|
9
|
+
originalIncomingObject: UnknownValueObj,
|
|
10
|
+
originalOverrideObject?: undefined | UnknownValueObj
|
|
11
|
+
): BoolValueObj[];
|
|
9
12
|
|
|
10
13
|
export { combinations, version };
|
package/examples/api.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"_quickTake.js":{"title":"Quick Take","content":"import { strict as assert } from \"assert\";\nimport { combinations } from \"object-boolean-combinations\";\n\nassert.deepEqual(\n combinations({\n a: true,\n b: false,\n c: true,\n }),\n [\n { a: false, b: false, c: false },\n { a: true, b: false, c: false },\n { a: false, b: true, c: false },\n { a: true, b: true, c: false },\n { a: false, b: false, c: true },\n { a: true, b: false, c: true },\n { a: false, b: true, c: true },\n { a: true, b: true, c: true },\n ]\n);\n// you get 2^n plain objects in an array"}}
|