object-no-new-keys 4.0.12 → 4.1.2

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 CHANGED
@@ -3,6 +3,18 @@
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
+ ## 4.1.2 (2022-04-18)
7
+
8
+ ### Bug Fixes
9
+
10
+ - tweak types ([fe67aa5](https://github.com/codsen/codsen/commit/fe67aa510c5523969e83d905c7420106081d4a8b))
11
+
12
+ # 4.1.0 (2022-04-10)
13
+
14
+ ### Features
15
+
16
+ - export defaults ([a968629](https://github.com/codsen/codsen/commit/a968629d5cabe320b946c636baea46772bf0d471))
17
+
6
18
  ## 4.0.0 (2021-09-09)
7
19
 
8
20
  ### Features
package/README.md CHANGED
@@ -26,7 +26,7 @@
26
26
 
27
27
  ## Install
28
28
 
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, `3.1.0`.
29
+ This package is [pure ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). If you're not ready yet, install an older version of this program, 3.1.0 (`npm i object-no-new-keys@3.1.0`).
30
30
 
31
31
  ```bash
32
32
  npm i object-no-new-keys
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * @name object-no-new-keys
3
3
  * @fileoverview Check, does a plain object (AST/JSON) has any unique keys, not present in a reference object (another AST/JSON)
4
- * @version 4.0.12
4
+ * @version 4.1.2
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/object-no-new-keys/}
8
8
  */
9
9
 
10
- var i="4.0.12";var f=i;function y(a){return a&&typeof a=="object"&&!Array.isArray(a)}function w(a,u,c){if(c&&!y(c))throw new TypeError(`object-no-new-keys/noNewKeys(): [THROW_ID_02] opts should be a plain object. It was given as ${JSON.stringify(c,null,4)} (type ${typeof c})`);let r={...{mode:2},...c};if(typeof r.mode=="string"&&["1","2"].includes(r.mode))r.mode=+r.mode;else if(![1,2].includes(r.mode))throw new TypeError('object-no-new-keys/objectNoNewKeys(): [THROW_ID_01] opts.mode should be "1" or "2" (string or number).');function l(s,n,p,e){let o;if(y(s))y(n)?Object.keys(s).forEach(t=>{Object.prototype.hasOwnProperty.call(n,t)?(y(s[t])||Array.isArray(s[t]))&&(o={path:e.path.length>0?`${e.path}.${t}`:t,res:e.res},e.res=l(s[t],n[t],p,o).res):(o=e.path.length>0?`${e.path}.${t}`:t,e.res.push(o))}):e.res=e.res.concat(Object.keys(s).map(t=>e.path.length>0?`${e.path}.${t}`:t));else if(Array.isArray(s))if(Array.isArray(n))for(let t=0,d=s.length;t<d;t++)o={path:`${e.path.length>0?e.path:""}[${t}]`,res:e.res},p.mode===2?e.res=l(s[t],n[0],p,o).res:e.res=l(s[t],n[t],p,o).res;else e.res=e.res.concat(s.map((t,d)=>`${e.path.length>0?e.path:""}[${d}]`));return e}return l(a,u,r,{path:"",res:[]}).res}export{w as noNewKeys,f as version};
10
+ var u="4.1.2";var f=u;function y(a){return a&&typeof a=="object"&&!Array.isArray(a)}var b={mode:2};function w(a,h,c){if(c&&!y(c))throw new TypeError(`object-no-new-keys/noNewKeys(): [THROW_ID_02] resolvedOpts should be a plain object. It was given as ${JSON.stringify(c,null,4)} (type ${typeof c})`);let r={...b,...c};if(typeof r.mode=="string"&&["1","2"].includes(r.mode))r.mode=+r.mode;else if(![1,2].includes(r.mode))throw new TypeError('object-no-new-keys/objectNoNewKeys(): [THROW_ID_01] resolvedOpts.mode should be "1" or "2" (string or number).');function i(s,n,p,e){let o;if(y(s))y(n)?Object.keys(s).forEach(t=>{Object.prototype.hasOwnProperty.call(n,t)?(y(s[t])||Array.isArray(s[t]))&&(o={path:e.path.length?`${e.path}.${t}`:t,res:e.res},e.res=i(s[t],n[t],p,o).res):(o=e.path.length?`${e.path}.${t}`:t,e.res.push(o))}):e.res=e.res.concat(Object.keys(s).map(t=>e.path.length?`${e.path}.${t}`:t));else if(Array.isArray(s))if(Array.isArray(n))for(let t=0,l=s.length;t<l;t++)o={path:`${e.path.length?e.path:""}[${t}]`,res:e.res},p.mode===2?e.res=i(s[t],n[0],p,o).res:e.res=i(s[t],n[t],p,o).res;else e.res=e.res.concat(s.map((t,l)=>`${e.path.length?e.path:""}[${l}]`));return e}return i(a,h,r,{path:"",res:[]}).res}export{b as defaults,w as noNewKeys,f as version};
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * @name object-no-new-keys
3
3
  * @fileoverview Check, does a plain object (AST/JSON) has any unique keys, not present in a reference object (another AST/JSON)
4
- * @version 4.0.12
4
+ * @version 4.1.2
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/object-no-new-keys/}
8
8
  */
9
9
 
10
- var objectNoNewKeys=(()=>{var d=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames,m=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var f=(e,t,s)=>t in e?d(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,b=(e,t)=>{for(var s in t||(t={}))j.call(t,s)&&f(e,s,t[s]);if(m)for(var s of m(t))v.call(t,s)&&f(e,s,t[s]);return e};var J=e=>d(e,"__esModule",{value:!0});var $=(e,t)=>{for(var s in t)d(e,s,{get:t[s],enumerable:!0})},x=(e,t,s,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of A(t))!j.call(e,n)&&(s||n!=="default")&&d(e,n,{get:()=>t[n],enumerable:!(u=g(t,n))||u.enumerable});return e};var O=(e=>(t,s)=>e&&e.get(t)||(s=x(J({}),t,1),e&&e.set(t,s),s))(typeof WeakMap!="undefined"?new WeakMap:0);var E={};$(E,{noNewKeys:()=>T,version:()=>k});var w="4.0.12";var k=w;function i(e){return e&&typeof e=="object"&&!Array.isArray(e)}function T(e,t,s){if(s&&!i(s))throw new TypeError(`object-no-new-keys/noNewKeys(): [THROW_ID_02] opts should be a plain object. It was given as ${JSON.stringify(s,null,4)} (type ${typeof s})`);let n=b(b({},{mode:2}),s);if(typeof n.mode=="string"&&["1","2"].includes(n.mode))n.mode=+n.mode;else if(![1,2].includes(n.mode))throw new TypeError('object-no-new-keys/objectNoNewKeys(): [THROW_ID_01] opts.mode should be "1" or "2" (string or number).');function p(a,l,y,o){let c;if(i(a))i(l)?Object.keys(a).forEach(r=>{Object.prototype.hasOwnProperty.call(l,r)?(i(a[r])||Array.isArray(a[r]))&&(c={path:o.path.length>0?`${o.path}.${r}`:r,res:o.res},o.res=p(a[r],l[r],y,c).res):(c=o.path.length>0?`${o.path}.${r}`:r,o.res.push(c))}):o.res=o.res.concat(Object.keys(a).map(r=>o.path.length>0?`${o.path}.${r}`:r));else if(Array.isArray(a))if(Array.isArray(l))for(let r=0,h=a.length;r<h;r++)c={path:`${o.path.length>0?o.path:""}[${r}]`,res:o.res},y.mode===2?o.res=p(a[r],l[0],y,c).res:o.res=p(a[r],l[r],y,c).res;else o.res=o.res.concat(a.map((r,h)=>`${o.path.length>0?o.path:""}[${h}]`));return o}return p(e,t,n,{path:"",res:[]}).res}return O(E);})();
10
+ var objectNoNewKeys=(()=>{var l=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames,b=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable;var m=(t,e,s)=>e in t?l(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,d=(t,e)=>{for(var s in e||(e={}))j.call(e,s)&&m(t,s,e[s]);if(b)for(var s of b(e))A.call(e,s)&&m(t,s,e[s]);return t};var J=(t,e)=>{for(var s in e)l(t,s,{get:e[s],enumerable:!0})},$=(t,e,s,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of O(e))!j.call(t,a)&&a!==s&&l(t,a,{get:()=>e[a],enumerable:!(c=g(e,a))||c.enumerable});return t};var x=t=>$(l({},"__esModule",{value:!0}),t);var E={};J(E,{defaults:()=>w,noNewKeys:()=>T,version:()=>k});var f="4.1.2";var k=f;function u(t){return t&&typeof t=="object"&&!Array.isArray(t)}var w={mode:2};function T(t,e,s){if(s&&!u(s))throw new TypeError(`object-no-new-keys/noNewKeys(): [THROW_ID_02] resolvedOpts should be a plain object. It was given as ${JSON.stringify(s,null,4)} (type ${typeof s})`);let c=d(d({},w),s);if(typeof c.mode=="string"&&["1","2"].includes(c.mode))c.mode=+c.mode;else if(![1,2].includes(c.mode))throw new TypeError('object-no-new-keys/objectNoNewKeys(): [THROW_ID_01] resolvedOpts.mode should be "1" or "2" (string or number).');function a(n,p,y,o){let i;if(u(n))u(p)?Object.keys(n).forEach(r=>{Object.prototype.hasOwnProperty.call(p,r)?(u(n[r])||Array.isArray(n[r]))&&(i={path:o.path.length?`${o.path}.${r}`:r,res:o.res},o.res=a(n[r],p[r],y,i).res):(i=o.path.length?`${o.path}.${r}`:r,o.res.push(i))}):o.res=o.res.concat(Object.keys(n).map(r=>o.path.length?`${o.path}.${r}`:r));else if(Array.isArray(n))if(Array.isArray(p))for(let r=0,h=n.length;r<h;r++)i={path:`${o.path.length?o.path:""}[${r}]`,res:o.res},y.mode===2?o.res=a(n[r],p[0],y,i).res:o.res=a(n[r],p[r],y,i).res;else o.res=o.res.concat(n.map((r,h)=>`${o.path.length?o.path:""}[${h}]`));return o}return a(t,e,c,{path:"",res:[]}).res}return x(E);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "object-no-new-keys",
3
- "version": "4.0.12",
3
+ "version": "4.1.2",
4
4
  "description": "Check, does a plain object (AST/JSON) has any unique keys, not present in a reference object (another AST/JSON)",
5
5
  "keywords": [
6
6
  "compare",
package/types/index.d.ts CHANGED
@@ -13,10 +13,11 @@ declare type JsonArray = JsonValue[];
13
13
  interface Opts {
14
14
  mode: 1 | 2;
15
15
  }
16
+ declare const defaults: Opts;
16
17
  declare function noNewKeys(
17
- inputOuter: JsonValue,
18
- referenceOuter: JsonValue,
19
- originalOptsOuter?: Opts
18
+ input: JsonValue,
19
+ reference: JsonValue,
20
+ opts?: Partial<Opts>
20
21
  ): any;
21
22
 
22
- export { noNewKeys, version };
23
+ export { defaults, noNewKeys, version };