object-no-new-keys 5.0.4 → 5.0.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2010-2022 Roy Revelt and other contributors
3
+ Copyright (c) 2010-2023 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
@@ -67,6 +67,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
67
67
 
68
68
  MIT License.
69
69
 
70
- Copyright © 2010-2022 Roy Revelt and other contributors.
70
+ Copyright © 2010-2023 Roy Revelt and other contributors.
71
71
 
72
72
  <p align="center"><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"></p>
@@ -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 5.0.4
4
+ * @version 5.0.6
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 m="5.0.4";var f=m;function a(p){return!!p&&typeof p=="object"&&!Array.isArray(p)}var h={mode:2};function g(p,y,c){if(c&&!a(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 n={...h,...c};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] resolvedOpts.mode should be "1" or "2" (string or number).');function i(s,r,l,e){let o;if(a(s))a(r)?Object.keys(s).forEach(t=>{Object.prototype.hasOwnProperty.call(r,t)?(a(s[t])||Array.isArray(s[t]))&&(o={path:e.path.length?`${e.path}.${t}`:t,res:e.res},e.res=i(s[t],r[t],l,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(r))for(let t=0,u=s.length;t<u;t++)o={path:`${e.path.length?e.path:""}[${t}]`,res:e.res},l.mode===2?e.res=i(s[t],r[0],l,o).res:e.res=i(s[t],r[t],l,o).res;else e.res=e.res.concat(s.map((t,u)=>`${e.path.length?e.path:""}[${u}]`));return e}return i(p,y,n,{path:"",res:[]}).res}export{h as defaults,g as noNewKeys,f as version};
10
+ import{hasOwnProp as y,isPlainObject as l}from"codsen-utils";var m="5.0.6";var x=m,b={mode:2};function O(u,d,p){if(p&&!l(p))throw new TypeError(`object-no-new-keys/noNewKeys(): [THROW_ID_02] resolvedOpts should be a plain object. It was given as ${JSON.stringify(p,null,4)} (type ${typeof p})`);let n={...b,...p};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] resolvedOpts.mode should be "1" or "2" (string or number).');function c(s,r,i,e){let o;if(l(s))l(r)?Object.keys(s).forEach(t=>{y(r,t)?(l(s[t])||Array.isArray(s[t]))&&(o={path:e.path.length?`${e.path}.${t}`:t,res:e.res},e.res=c(s[t],r[t],i,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(r))for(let t=0,a=s.length;t<a;t++)o={path:`${e.path.length?e.path:""}[${t}]`,res:e.res},i.mode===2?e.res=c(s[t],r[0],i,o).res:e.res=c(s[t],r[t],i,o).res;else e.res=e.res.concat(s.map((t,a)=>`${e.path.length?e.path:""}[${a}]`));return e}return c(u,d,n,{path:"",res:[]}).res}export{b as defaults,O as noNewKeys,x as version};
@@ -1,10 +1,18 @@
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 5.0.4
4
+ * @version 5.0.6
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
- "use strict";var objectNoNewKeys=(()=>{var u=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames,h=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var b=(t,e,s)=>e in t?u(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)&&b(t,s,e[s]);if(h)for(var s of h(e))O.call(e,s)&&b(t,s,e[s]);return t};var A=(t,e)=>{for(var s in e)u(t,s,{get:e[s],enumerable:!0})},J=(t,e,s,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of x(e))!j.call(t,p)&&p!==s&&u(t,p,{get:()=>e[p],enumerable:!(c=w(e,p))||c.enumerable});return t};var $=t=>J(u({},"__esModule",{value:!0}),t);var E={};A(E,{defaults:()=>g,noNewKeys:()=>T,version:()=>N});var f="5.0.4";var N=f;function m(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}var g={mode:2};function T(t,e,s){if(s&&!m(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({},g),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 p(r,l,a,o){let i;if(m(r))m(l)?Object.keys(r).forEach(n=>{Object.prototype.hasOwnProperty.call(l,n)?(m(r[n])||Array.isArray(r[n]))&&(i={path:o.path.length?`${o.path}.${n}`:n,res:o.res},o.res=p(r[n],l[n],a,i).res):(i=o.path.length?`${o.path}.${n}`:n,o.res.push(i))}):o.res=o.res.concat(Object.keys(r).map(n=>o.path.length?`${o.path}.${n}`:n));else if(Array.isArray(r))if(Array.isArray(l))for(let n=0,y=r.length;n<y;n++)i={path:`${o.path.length?o.path:""}[${n}]`,res:o.res},a.mode===2?o.res=p(r[n],l[0],a,i).res:o.res=p(r[n],l[n],a,i).res;else o.res=o.res.concat(r.map((n,y)=>`${o.path.length?o.path:""}[${y}]`));return o}return p(t,e,c,{path:"",res:[]}).res}return $(E);})();
10
+ "use strict";var objectNoNewKeys=(()=>{var m=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var f=(t,e,s)=>e in t?m(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,b=(t,e)=>{for(var s in e||(e={}))y.call(e,s)&&f(t,s,e[s]);if(d)for(var s of d(e))O.call(e,s)&&f(t,s,e[s]);return t};var C=(t,e)=>{for(var s in e)m(t,s,{get:e[s],enumerable:!0})},$=(t,e,s,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of x(e))!y.call(t,i)&&i!==s&&m(t,i,{get:()=>e[i],enumerable:!(a=w(e,i))||a.enumerable});return t};var S=t=>$(m({},"__esModule",{value:!0}),t);var T={};C(T,{defaults:()=>j,noNewKeys:()=>B,version:()=>N});function l(t){if(t==null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null?!1:!(Symbol.iterator in t)&&!(Symbol.toStringTag in t)}function D(t){return typeof t=="string"}function g(t,e){return l(t)&&D(e)&&Object.prototype.hasOwnProperty.call(t,e)}var A="5.0.6";var N=A,j={mode:2};function B(t,e,s){if(s&&!l(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 a=b(b({},j),s);if(typeof a.mode=="string"&&["1","2"].includes(a.mode))a.mode=+a.mode;else if(![1,2].includes(a.mode))throw new TypeError('object-no-new-keys/objectNoNewKeys(): [THROW_ID_01] resolvedOpts.mode should be "1" or "2" (string or number).');function i(o,c,p,r){let u;if(l(o))l(c)?Object.keys(o).forEach(n=>{g(c,n)?(l(o[n])||Array.isArray(o[n]))&&(u={path:r.path.length?`${r.path}.${n}`:n,res:r.res},r.res=i(o[n],c[n],p,u).res):(u=r.path.length?`${r.path}.${n}`:n,r.res.push(u))}):r.res=r.res.concat(Object.keys(o).map(n=>r.path.length?`${r.path}.${n}`:n));else if(Array.isArray(o))if(Array.isArray(c))for(let n=0,h=o.length;n<h;n++)u={path:`${r.path.length?r.path:""}[${n}]`,res:r.res},p.mode===2?r.res=i(o[n],c[0],p,u).res:r.res=i(o[n],c[n],p,u).res;else r.res=r.res.concat(o.map((n,h)=>`${r.path.length?r.path:""}[${h}]`));return r}return i(t,e,a,{path:"",res:[]}).res}return S(T);})();
11
+ /**
12
+ * @name codsen-utils
13
+ * @fileoverview Various utility functions
14
+ * @version 1.3.0
15
+ * @author Roy Revelt, Codsen Ltd
16
+ * @license MIT
17
+ * {@link https://codsen.com/os/codsen-utils/}
18
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "object-no-new-keys",
3
- "version": "5.0.4",
3
+ "version": "5.0.6",
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",
@@ -70,5 +70,8 @@
70
70
  ""
71
71
  ]
72
72
  }
73
+ },
74
+ "dependencies": {
75
+ "codsen-utils": "^1.3.0"
73
76
  }
74
77
  }