object-no-new-keys 5.3.0 → 5.3.1

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,13 +3,19 @@
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
+ ## 5.3.1 (2026-08-22)
7
+
8
+ ### Performance Improvements
9
+
10
+ - optimise package hot paths and JSON editing ([f3112bd](https://github.com/codsen/codsen/commit/f3112bd7fc0d7c9bc09312d3744c950691d72ca5))
11
+
6
12
  ## 5.3.0 (2026-08-19)
7
13
 
8
14
  ### Bug Fixes
9
15
 
10
16
  - make validation diagnostics safe ([7b01074](https://github.com/codsen/codsen/commit/7b0107476f12734aeb8e82852ba980b187280110))
11
17
  - reorder and standardise validation errors ([5301797](https://github.com/codsen/codsen/commit/5301797af616daf1b632ea5619c898628104d78b))
12
- - resolve review findings REV-004 through REV-007 ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
18
+ - resolve various review findings ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
13
19
  - retire direct publish aliases ([f98e31e](https://github.com/codsen/codsen/commit/f98e31eb89bc185471225664e610b55f34fbf648))
14
20
 
15
21
  ### Features
@@ -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.3.0
4
+ * @version 5.3.1
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/object-no-new-keys/}
8
8
  */
9
9
 
10
- import{formatDiagnosticValue as y,hasOwnProp as f,isPlainObject as a}from"codsen-utils";var m="5.3.0";var O=m,b={mode:2};function k(h,d,r){if(r&&!a(r))throw new TypeError(`object-no-new-keys/noNewKeys(): [THROW_ID_01] resolvedOpts should be a plain object. It was given as ${y(r,4)} (type ${typeof r})`);let c={...b,...r};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/noNewKeys(): [THROW_ID_02] resolvedOpts.mode should be "1" or "2" (string or number).');function i(s,n,p,e){let o;if(a(s))a(n)?Object.keys(s).forEach(t=>{f(n,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],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(h,d,c,{path:"",res:[]}).res}export{b as defaults,k as noNewKeys,O as version};
10
+ import{formatDiagnosticValue as y,hasOwnProp as f,isPlainObject as a}from"codsen-utils";var m="5.3.1";var O=m,b={mode:2};function k(h,d,r){if(r&&!a(r))throw new TypeError(`object-no-new-keys/noNewKeys(): [THROW_ID_01] resolvedOpts should be a plain object. It was given as ${y(r,4)} (type ${typeof r})`);let c={...b,...r};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/noNewKeys(): [THROW_ID_02] resolvedOpts.mode should be "1" or "2" (string or number).');function i(s,n,p,e){let o;if(a(s))a(n)?Object.keys(s).forEach(t=>{f(n,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],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(h,d,c,{path:"",res:[]}).res}export{b as defaults,k as noNewKeys,O as version};
@@ -1,17 +1,17 @@
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.3.0
4
+ * @version 5.3.1
5
5
  * @author Roy Revelt
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 A=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames,C=Object.getOwnPropertySymbols;var k=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var S=(t,r,e)=>r in t?A(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,O=(t,r)=>{for(var e in r||(r={}))k.call(r,e)&&S(t,e,r[e]);if(C)for(var e of C(r))P.call(r,e)&&S(t,e,r[e]);return t};var T=(t,r)=>{for(var e in r)A(t,e,{get:r[e],enumerable:!0})},I=(t,r,e,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of L(r))!k.call(t,a)&&a!==e&&A(t,a,{get:()=>r[a],enumerable:!(i=R(r,a))||i.enumerable});return t};var E=t=>I(A({},"__esModule",{value:!0}),t);var z={};T(z,{defaults:()=>N,noNewKeys:()=>q,version:()=>Q});function U(){let t=[],r=0,e=!1;return{append(i){return e?!1:r+i.length>1999?(t.push("\u2026"),r+=1,e=!0,!1):(t.push(i),r+=i.length,!0)},result(){return t.join("")},stopped(){return e}}}function F(t){return"\\u".concat(t.toString(16).padStart(4,"0"))}function v(t,r){if(t.append('"')){for(let e=0;e<r.length&&!t.stopped();e+=1){let i=r.charCodeAt(e);i===34?t.append('\\"'):i===92?t.append("\\\\"):i===8?t.append("\\b"):i===9?t.append("\\t"):i===10?t.append("\\n"):i===12?t.append("\\f"):i===13?t.append("\\r"):i<32||i===8232||i===8233||i>=55296&&i<=57343?t.append(F(i)):t.append(r[e])}t.append('"')}}function _(t){return t.get&&t.set?"[Getter/Setter]":t.get?"[Getter]":t.set?"[Setter]":"[Accessor]"}function $(t,r){t.append("Symbol(");let e=String(r);e.length>8&&v(t,e.slice(7,-1)),t.append(")")}function x(t,r){typeof r=="symbol"?$(t,r):v(t,String(r))}function D(t,r=0){let e=U(),i=r===4?4:0,a=new WeakSet,u=0;function d(n){i&&e.append(" ".repeat(n*i))}function g(n,o){n&&e.append(","),i&&(e.append("\n"),d(o+1))}function s(n,o,f){i&&o&&(e.append("\n"),d(f)),e.append(n)}function p(n,o){Object.prototype.hasOwnProperty.call(n,"value")?j(n.value,o):e.append(_(n))}function l(n,o){let f;try{f=Reflect.getOwnPropertyDescriptor(n,"length")}catch(h){e.append("[Uninspectable]");return}let c=f==null?void 0:f.value;if(!Number.isSafeInteger(c)||c<0){e.append("[Uninspectable]");return}e.append("[");let m=!1;for(let h=0;h<c&&!e.stopped();h+=1){if(g(m,o),m=!0,u>=50){e.append("[MaxEntries]");break}u+=1;let y;try{y=Reflect.getOwnPropertyDescriptor(n,String(h))}catch(G){e.append("[Uninspectable]");continue}y!=null&&y.enumerable?p(y,o+1):e.append("[Empty]")}s("]",m,o)}function w(n,o){let f;try{f=Reflect.ownKeys(n)}catch(m){e.append("[Uninspectable]");return}e.append("{");let c=!1;for(let m of f){if(e.stopped())break;if(u>=50){g(c,o),c=!0,v(e,"\u2026"),e.append(i?": ":":"),e.append("[MaxEntries]");break}u+=1;let h;try{h=Reflect.getOwnPropertyDescriptor(n,m)}catch(y){g(c,o),c=!0,x(e,m),e.append(i?": ":":"),e.append("[Uninspectable]");continue}h!=null&&h.enumerable&&(g(c,o),c=!0,x(e,m),e.append(i?": ":":"),p(h,o+1))}s("}",c,o)}function B(n,o){if(a.has(n)){e.append("[Circular]");return}if(o>=5){e.append("[MaxDepth]");return}let f;try{f=Array.isArray(n)}catch(c){e.append("[Uninspectable]");return}a.add(n);try{f?l(n,o):w(n,o)}finally{a.delete(n)}}function j(n,o){n===null?e.append("null"):typeof n=="string"?v(e,n):typeof n=="number"?e.append(Object.is(n,-0)?"-0":String(n)):typeof n=="boolean"?e.append(n?"true":"false"):typeof n>"u"?e.append("undefined"):typeof n=="bigint"?e.append("".concat(n,"n")):typeof n=="symbol"?$(e,n):typeof n=="function"?e.append("[Function]"):B(n,o)}try{return j(t,0),e.result()}catch(n){return"[Uninspectable]"}}var X=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]),H=Object.prototype.hasOwnProperty;function b(t){if(t==null||typeof t!="object")return!1;let r=Object.getPrototypeOf(t);return r!==null&&r!==Object.prototype&&Object.getPrototypeOf(r)!==null?!1:!(Symbol.iterator in t)&&!(Symbol.toStringTag in t)}function K(t){return typeof t=="string"}function W(t,r){return b(t)&&K(r)&&H.call(t,r)}var M="5.3.0";var Q=M,N={mode:2};function q(t,r,e){if(e&&!b(e))throw new TypeError("object-no-new-keys/noNewKeys(): [THROW_ID_01] resolvedOpts should be a plain object. It was given as ".concat(D(e,4)," (type ").concat(typeof e,")"));let i=O(O({},N),e);if(typeof i.mode=="string"&&["1","2"].includes(i.mode))i.mode=+i.mode;else if(![1,2].includes(i.mode))throw new TypeError('object-no-new-keys/noNewKeys(): [THROW_ID_02] resolvedOpts.mode should be "1" or "2" (string or number).');function a(u,d,g,s){let p;if(b(u))b(d)?Object.keys(u).forEach(l=>{W(d,l)?(b(u[l])||Array.isArray(u[l]))&&(p={path:s.path.length?"".concat(s.path,".").concat(l):l,res:s.res},s.res=a(u[l],d[l],g,p).res):(p=s.path.length?"".concat(s.path,".").concat(l):l,s.res.push(p))}):s.res=s.res.concat(Object.keys(u).map(l=>s.path.length?"".concat(s.path,".").concat(l):l));else if(Array.isArray(u))if(Array.isArray(d))for(let l=0,w=u.length;l<w;l++)p={path:"".concat(s.path.length?s.path:"","[").concat(l,"]"),res:s.res},g.mode===2?s.res=a(u[l],d[0],g,p).res:s.res=a(u[l],d[l],g,p).res;else s.res=s.res.concat(u.map((l,w)=>"".concat(s.path.length?s.path:"","[").concat(w,"]")));return s}return a(t,r,i,{path:"",res:[]}).res}return E(z);})();
10
+ "use strict";var objectNoNewKeys=(()=>{var w=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames,C=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var S=(t,r,e)=>r in t?w(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,O=(t,r)=>{for(var e in r||(r={}))x.call(r,e)&&S(t,e,r[e]);if(C)for(var e of C(r))N.call(r,e)&&S(t,e,r[e]);return t};var L=(t,r)=>{for(var e in r)w(t,e,{get:r[e],enumerable:!0})},I=(t,r,e,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of E(r))!x.call(t,a)&&a!==e&&w(t,a,{get:()=>r[a],enumerable:!(i=T(r,a))||i.enumerable});return t};var U=t=>I(w({},"__esModule",{value:!0}),t);var G={};L(G,{defaults:()=>B,noNewKeys:()=>z,version:()=>q});function F(){let t=[],r=0,e=!1;return{append(i){return e?!1:r+i.length>1999?(t.push("\u2026"),r+=1,e=!0,!1):(t.push(i),r+=i.length,!0)},result(){return t.join("")},stopped(){return e}}}function _(t){return"\\u".concat(t.toString(16).padStart(4,"0"))}function v(t,r){if(t.append('"')){for(let e=0;e<r.length&&!t.stopped();e+=1){let i=r.charCodeAt(e);i===34?t.append('\\"'):i===92?t.append("\\\\"):i===8?t.append("\\b"):i===9?t.append("\\t"):i===10?t.append("\\n"):i===12?t.append("\\f"):i===13?t.append("\\r"):i<32||i===8232||i===8233||i>=55296&&i<=57343?t.append(_(i)):t.append(r[e])}t.append('"')}}function H(t){return t.get&&t.set?"[Getter/Setter]":t.get?"[Getter]":t.set?"[Setter]":"[Accessor]"}function D(t,r){t.append("Symbol(");let e=String(r);e.length>8&&v(t,e.slice(7,-1)),t.append(")")}function k(t,r){typeof r=="symbol"?D(t,r):v(t,String(r))}function W(t,r=0){let e=F(),i=r===4?4:0,a=new WeakSet,u=0;function d(n){i&&e.append(" ".repeat(n*i))}function g(n,o){n&&e.append(","),i&&(e.append("\n"),d(o+1))}function s(n,o,f){i&&o&&(e.append("\n"),d(f)),e.append(n)}function p(n,o){Object.prototype.hasOwnProperty.call(n,"value")?j(n.value,o):e.append(H(n))}function l(n,o){let f;try{f=Reflect.getOwnPropertyDescriptor(n,"length")}catch(h){e.append("[Uninspectable]");return}let c=f==null?void 0:f.value;if(!Number.isSafeInteger(c)||c<0){e.append("[Uninspectable]");return}e.append("[");let y=!1;for(let h=0;h<c&&!e.stopped();h+=1){if(g(y,o),y=!0,u>=50){e.append("[MaxEntries]");break}u+=1;let m;try{m=Reflect.getOwnPropertyDescriptor(n,String(h))}catch(Z){e.append("[Uninspectable]");continue}m!=null&&m.enumerable?p(m,o+1):e.append("[Empty]")}s("]",y,o)}function A(n,o){let f;try{f=Reflect.ownKeys(n)}catch(y){e.append("[Uninspectable]");return}e.append("{");let c=!1;for(let y of f){if(e.stopped())break;if(u>=50){g(c,o),c=!0,v(e,"\u2026"),e.append(i?": ":":"),e.append("[MaxEntries]");break}u+=1;let h;try{h=Reflect.getOwnPropertyDescriptor(n,y)}catch(m){g(c,o),c=!0,k(e,y),e.append(i?": ":":"),e.append("[Uninspectable]");continue}h!=null&&h.enumerable&&(g(c,o),c=!0,k(e,y),e.append(i?": ":":"),p(h,o+1))}s("}",c,o)}function P(n,o){if(a.has(n)){e.append("[Circular]");return}if(o>=5){e.append("[MaxDepth]");return}let f;try{f=Array.isArray(n)}catch(c){e.append("[Uninspectable]");return}a.add(n);try{f?l(n,o):A(n,o)}finally{a.delete(n)}}function j(n,o){n===null?e.append("null"):typeof n=="string"?v(e,n):typeof n=="number"?e.append(Object.is(n,-0)?"-0":String(n)):typeof n=="boolean"?e.append(n?"true":"false"):typeof n>"u"?e.append("undefined"):typeof n=="bigint"?e.append("".concat(n,"n")):typeof n=="symbol"?D(e,n):typeof n=="function"?e.append("[Function]"):P(n,o)}try{return j(t,0),e.result()}catch(n){return"[Uninspectable]"}}var V=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]),K=Object.prototype.hasOwnProperty;function b(t){if(t==null||typeof t!="object")return!1;let r=Object.getPrototypeOf(t);return r!==null&&r!==Object.prototype&&Object.getPrototypeOf(r)!==null?!1:!(Symbol.iterator in t)&&!(Symbol.toStringTag in t)}function J(t){return typeof t=="string"}var $,ee=($=Object.getOwnPropertyDescriptor(RegExp.prototype,"source"))==null?void 0:$.get;var te=Date.prototype.getTime;function M(t,r){return b(t)&&J(r)&&K.call(t,r)}var R="5.3.1";var q=R,B={mode:2};function z(t,r,e){if(e&&!b(e))throw new TypeError("object-no-new-keys/noNewKeys(): [THROW_ID_01] resolvedOpts should be a plain object. It was given as ".concat(W(e,4)," (type ").concat(typeof e,")"));let i=O(O({},B),e);if(typeof i.mode=="string"&&["1","2"].includes(i.mode))i.mode=+i.mode;else if(![1,2].includes(i.mode))throw new TypeError('object-no-new-keys/noNewKeys(): [THROW_ID_02] resolvedOpts.mode should be "1" or "2" (string or number).');function a(u,d,g,s){let p;if(b(u))b(d)?Object.keys(u).forEach(l=>{M(d,l)?(b(u[l])||Array.isArray(u[l]))&&(p={path:s.path.length?"".concat(s.path,".").concat(l):l,res:s.res},s.res=a(u[l],d[l],g,p).res):(p=s.path.length?"".concat(s.path,".").concat(l):l,s.res.push(p))}):s.res=s.res.concat(Object.keys(u).map(l=>s.path.length?"".concat(s.path,".").concat(l):l));else if(Array.isArray(u))if(Array.isArray(d))for(let l=0,A=u.length;l<A;l++)p={path:"".concat(s.path.length?s.path:"","[").concat(l,"]"),res:s.res},g.mode===2?s.res=a(u[l],d[0],g,p).res:s.res=a(u[l],d[l],g,p).res;else s.res=s.res.concat(u.map((l,A)=>"".concat(s.path.length?s.path:"","[").concat(A,"]")));return s}return a(t,r,i,{path:"",res:[]}).res}return U(G);})();
11
11
  /**
12
12
  * @name codsen-utils
13
13
  * @fileoverview Various utility functions
14
- * @version 1.8.0
14
+ * @version 1.9.0
15
15
  * @author Roy Revelt
16
16
  * @license MIT
17
17
  * {@link https://codsen.com/os/codsen-utils/}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "object-no-new-keys",
3
- "version": "5.3.0",
3
+ "version": "5.3.1",
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",
@@ -68,7 +68,7 @@
68
68
  }
69
69
  },
70
70
  "dependencies": {
71
- "codsen-utils": "^1.8.0"
71
+ "codsen-utils": "^1.9.0"
72
72
  },
73
73
  "engines": {
74
74
  "node": ">=18.20.8"