object-no-new-keys 5.1.19 → 5.2.0
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/.eslintcache +1 -0
- package/CHANGELOG.md +6 -0
- package/LICENSE +2 -2
- package/README.md +2 -2
- package/dist/object-no-new-keys.esm.js +3 -3
- package/dist/object-no-new-keys.umd.js +5 -5
- package/package.json +3 -3
package/.eslintcache
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"/home/runner/work/codsen/codsen/packages/object-no-new-keys/examples/_quickTake.js":"1","/home/runner/work/codsen/codsen/packages/object-no-new-keys/perf/check.js":"2","/home/runner/work/codsen/codsen/packages/object-no-new-keys/rollup.config.js":"3","/home/runner/work/codsen/codsen/packages/object-no-new-keys/src/main.ts":"4","/home/runner/work/codsen/codsen/packages/object-no-new-keys/test/test.js":"5"},{"size":306,"mtime":1760566739124,"results":"6","hashOfConfig":"7"},{"size":570,"mtime":1760566739124,"results":"8","hashOfConfig":"9"},{"size":373,"mtime":1760566739124,"results":"10","hashOfConfig":"7"},{"size":3765,"mtime":1760566739124,"results":"11","hashOfConfig":"9"},{"size":6445,"mtime":1760566739124,"results":"12","hashOfConfig":"13"},{"filePath":"14","messages":"15","suppressedMessages":"16","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1nlhngw",{"filePath":"17","messages":"18","suppressedMessages":"19","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1xjytlu",{"filePath":"20","messages":"21","suppressedMessages":"22","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"23","messages":"24","suppressedMessages":"25","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"26","messages":"27","suppressedMessages":"28","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"nrihsz","/home/runner/work/codsen/codsen/packages/object-no-new-keys/examples/_quickTake.js",[],[],"/home/runner/work/codsen/codsen/packages/object-no-new-keys/perf/check.js",[],[],"/home/runner/work/codsen/codsen/packages/object-no-new-keys/rollup.config.js",[],[],"/home/runner/work/codsen/codsen/packages/object-no-new-keys/src/main.ts",[],[],"/home/runner/work/codsen/codsen/packages/object-no-new-keys/test/test.js",[],["29","30","31","32","33"],{"ruleId":"34","severity":2,"message":"35","line":3,"column":17,"nodeType":null,"messageId":"36","endLine":3,"endColumn":19,"suppressions":"37"},{"ruleId":"34","severity":2,"message":"38","line":3,"column":21,"nodeType":null,"messageId":"36","endLine":3,"endColumn":23,"suppressions":"39"},{"ruleId":"34","severity":2,"message":"40","line":3,"column":33,"nodeType":null,"messageId":"36","endLine":3,"endColumn":37,"suppressions":"41"},{"ruleId":"34","severity":2,"message":"42","line":3,"column":39,"nodeType":null,"messageId":"36","endLine":3,"endColumn":42,"suppressions":"43"},{"ruleId":"34","severity":2,"message":"44","line":3,"column":44,"nodeType":null,"messageId":"36","endLine":3,"endColumn":49,"suppressions":"45"},"@typescript-eslint/no-unused-vars","'is' is defined but never used.","unusedVar",["46"],"'ok' is defined but never used.",["47"],"'type' is defined but never used.",["48"],"'not' is defined but never used.",["49"],"'match' is defined but never used.",["50"],{"kind":"51","justification":"52"},{"kind":"51","justification":"52"},{"kind":"51","justification":"52"},{"kind":"51","justification":"52"},{"kind":"51","justification":"52"},"directive",""]
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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.2.0 (2025-10-15)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- if value to be added is a number, keep it as is, don't stringify ([ce3e1a5](https://github.com/codsen/codsen/commit/ce3e1a525998ca3c0abf0142affef95b14cd1990))
|
|
11
|
+
|
|
6
12
|
## 5.1.0 (2023-05-13)
|
|
7
13
|
|
|
8
14
|
### Features
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright
|
|
3
|
+
Copyright © 2010-2025 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
|
|
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
19
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
21
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -65,8 +65,8 @@ To report bugs or request features or assistance, [raise an issue](https://githu
|
|
|
65
65
|
|
|
66
66
|
## Licence
|
|
67
67
|
|
|
68
|
-
MIT License
|
|
68
|
+
MIT License
|
|
69
69
|
|
|
70
|
-
Copyright © 2010-2025 Roy Revelt and other contributors
|
|
70
|
+
Copyright © 2010-2025 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.
|
|
5
|
-
* @author Roy Revelt
|
|
4
|
+
* @version 5.2.0
|
|
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{hasOwnProp as y,isPlainObject as l}from"codsen-utils";var m="5.
|
|
10
|
+
import{hasOwnProp as y,isPlainObject as l}from"codsen-utils";var m="5.2.0";var O=m,b={mode:2};function x(u,h,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,h,n,{path:"",res:[]}).res}export{b as defaults,x as noNewKeys,O as version};
|
|
@@ -1,18 +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.
|
|
5
|
-
* @author Roy Revelt
|
|
4
|
+
* @version 5.2.0
|
|
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 N=Object.create;var b=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames,w=Object.getOwnPropertySymbols,v=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var j=(t,n,o)=>n in t?b(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,g=(t,n)=>{for(var o in n||(n={}))O.call(n,o)&&j(t,o,n[o]);if(w)for(var o of w(n))P.call(n,o)&&j(t,o,n[o]);return t};var M=(t,n)=>()=>(n||t((n={exports:{}}).exports,n),n.exports),L=(t,n)=>{for(var o in n)b(t,o,{get:n[o],enumerable:!0})},S=(t,n,o,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of T(n))!O.call(t,a)&&a!==o&&b(t,a,{get:()=>n[a],enumerable:!(l=E(n,a))||l.enumerable});return t};var F=(t,n,o)=>(o=t!=null?N(v(t)):{},S(n||!t||!t.__esModule?b(o,"default",{value:t,enumerable:!0}):o,t)),H=t=>S(b({},"__esModule",{value:!0}),t);var C=M((I,x)=>{"use strict";x.exports=J;function
|
|
10
|
+
"use strict";var objectNoNewKeys=(()=>{var N=Object.create;var b=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames,w=Object.getOwnPropertySymbols,v=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var j=(t,n,o)=>n in t?b(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,g=(t,n)=>{for(var o in n||(n={}))O.call(n,o)&&j(t,o,n[o]);if(w)for(var o of w(n))P.call(n,o)&&j(t,o,n[o]);return t};var M=(t,n)=>()=>(n||t((n={exports:{}}).exports,n),n.exports),L=(t,n)=>{for(var o in n)b(t,o,{get:n[o],enumerable:!0})},S=(t,n,o,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of T(n))!O.call(t,a)&&a!==o&&b(t,a,{get:()=>n[a],enumerable:!(l=E(n,a))||l.enumerable});return t};var F=(t,n,o)=>(o=t!=null?N(v(t)):{},S(n||!t||!t.__esModule?b(o,"default",{value:t,enumerable:!0}):o,t)),H=t=>S(b({},"__esModule",{value:!0}),t);var C=M((I,x)=>{"use strict";x.exports=J;function m(t){return t instanceof Buffer?Buffer.from(t):new t.constructor(t.buffer.slice(),t.byteOffset,t.length)}function J(t){if(t=t||{},t.circles)return R(t);let n=new Map;if(n.set(Date,s=>new Date(s)),n.set(Map,(s,u)=>new Map(l(Array.from(s),u))),n.set(Set,(s,u)=>new Set(l(Array.from(s),u))),t.constructorHandlers)for(let s of t.constructorHandlers)n.set(s[0],s[1]);let o=null;return t.proto?f:a;function l(s,u){let e=Object.keys(s),r=new Array(e.length);for(let i=0;i<e.length;i++){let c=e[i],p=s[c];typeof p!="object"||p===null?r[c]=p:p.constructor!==Object&&(o=n.get(p.constructor))?r[c]=o(p,u):ArrayBuffer.isView(p)?r[c]=m(p):r[c]=u(p)}return r}function a(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return l(s,a);if(s.constructor!==Object&&(o=n.get(s.constructor)))return o(s,a);let u={};for(let e in s){if(Object.hasOwnProperty.call(s,e)===!1)continue;let r=s[e];typeof r!="object"||r===null?u[e]=r:r.constructor!==Object&&(o=n.get(r.constructor))?u[e]=o(r,a):ArrayBuffer.isView(r)?u[e]=m(r):u[e]=a(r)}return u}function f(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return l(s,f);if(s.constructor!==Object&&(o=n.get(s.constructor)))return o(s,f);let u={};for(let e in s){let r=s[e];typeof r!="object"||r===null?u[e]=r:r.constructor!==Object&&(o=n.get(r.constructor))?u[e]=o(r,f):ArrayBuffer.isView(r)?u[e]=m(r):u[e]=f(r)}return u}}function R(t){let n=[],o=[],l=new Map;if(l.set(Date,e=>new Date(e)),l.set(Map,(e,r)=>new Map(f(Array.from(e),r))),l.set(Set,(e,r)=>new Set(f(Array.from(e),r))),t.constructorHandlers)for(let e of t.constructorHandlers)l.set(e[0],e[1]);let a=null;return t.proto?u:s;function f(e,r){let i=Object.keys(e),c=new Array(i.length);for(let p=0;p<i.length;p++){let h=i[p],y=e[h];if(typeof y!="object"||y===null)c[h]=y;else if(y.constructor!==Object&&(a=l.get(y.constructor)))c[h]=a(y,r);else if(ArrayBuffer.isView(y))c[h]=m(y);else{let A=n.indexOf(y);A!==-1?c[h]=o[A]:c[h]=r(y)}}return c}function s(e){if(typeof e!="object"||e===null)return e;if(Array.isArray(e))return f(e,s);if(e.constructor!==Object&&(a=l.get(e.constructor)))return a(e,s);let r={};n.push(e),o.push(r);for(let i in e){if(Object.hasOwnProperty.call(e,i)===!1)continue;let c=e[i];if(typeof c!="object"||c===null)r[i]=c;else if(c.constructor!==Object&&(a=l.get(c.constructor)))r[i]=a(c,s);else if(ArrayBuffer.isView(c))r[i]=m(c);else{let p=n.indexOf(c);p!==-1?r[i]=o[p]:r[i]=s(c)}}return n.pop(),o.pop(),r}function u(e){if(typeof e!="object"||e===null)return e;if(Array.isArray(e))return f(e,u);if(e.constructor!==Object&&(a=l.get(e.constructor)))return a(e,u);let r={};n.push(e),o.push(r);for(let i in e){let c=e[i];if(typeof c!="object"||c===null)r[i]=c;else if(c.constructor!==Object&&(a=l.get(c.constructor)))r[i]=a(c,u);else if(ArrayBuffer.isView(c))r[i]=m(c);else{let p=n.indexOf(c);p!==-1?r[i]=o[p]:r[i]=u(c)}}return n.pop(),o.pop(),r}}});var W={};L(W,{defaults:()=>D,noNewKeys:()=>U,version:()=>Q});var k=F(C(),1);var Z=(0,k.default)();function d(t){if(t==null||typeof t!="object")return!1;let n=Object.getPrototypeOf(t);return n!==null&&n!==Object.prototype&&Object.getPrototypeOf(n)!==null?!1:!(Symbol.iterator in t)&&!(Symbol.toStringTag in t)}function _(t){return typeof t=="string"}function $(t,n){return d(t)&&_(n)&&n in t}var B="5.2.0";var Q=B,D={mode:2};function U(t,n,o){if(o&&!d(o))throw new TypeError("object-no-new-keys/noNewKeys(): [THROW_ID_02] resolvedOpts should be a plain object. It was given as ".concat(JSON.stringify(o,null,4)," (type ").concat(typeof o,")"));let l=g(g({},D),o);if(typeof l.mode=="string"&&["1","2"].includes(l.mode))l.mode=+l.mode;else if(![1,2].includes(l.mode))throw new TypeError('object-no-new-keys/objectNoNewKeys(): [THROW_ID_01] resolvedOpts.mode should be "1" or "2" (string or number).');function a(f,s,u,e){let r;if(d(f))d(s)?Object.keys(f).forEach(i=>{$(s,i)?(d(f[i])||Array.isArray(f[i]))&&(r={path:e.path.length?"".concat(e.path,".").concat(i):i,res:e.res},e.res=a(f[i],s[i],u,r).res):(r=e.path.length?"".concat(e.path,".").concat(i):i,e.res.push(r))}):e.res=e.res.concat(Object.keys(f).map(i=>e.path.length?"".concat(e.path,".").concat(i):i));else if(Array.isArray(f))if(Array.isArray(s))for(let i=0,c=f.length;i<c;i++)r={path:"".concat(e.path.length?e.path:"","[").concat(i,"]"),res:e.res},u.mode===2?e.res=a(f[i],s[0],u,r).res:e.res=a(f[i],s[i],u,r).res;else e.res=e.res.concat(f.map((i,c)=>"".concat(e.path.length?e.path:"","[").concat(c,"]")));return e}return a(t,n,l,{path:"",res:[]}).res}return H(W);})();
|
|
11
11
|
/**
|
|
12
12
|
* @name codsen-utils
|
|
13
13
|
* @fileoverview Various utility functions
|
|
14
|
-
* @version 1.
|
|
15
|
-
* @author Roy Revelt
|
|
14
|
+
* @version 1.7.0
|
|
15
|
+
* @author Roy Revelt
|
|
16
16
|
* @license MIT
|
|
17
17
|
* {@link https://codsen.com/os/codsen-utils/}
|
|
18
18
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "object-no-new-keys",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
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",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"examples": "node '../../ops/scripts/run-examples.js'",
|
|
46
46
|
"lect": "node '../../ops/lect/lect.js' && npm run prettier -- 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
|
|
47
47
|
"letspublish": "npm publish --provenance || :",
|
|
48
|
-
"lint": "eslint . --fix",
|
|
48
|
+
"lint": "eslint . --fix --concurrency=auto --cache",
|
|
49
49
|
"perf": "node perf/check.js",
|
|
50
50
|
"prep": "echo 'ready'",
|
|
51
51
|
"prettier": "prettier",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"codsen-utils": "^1.
|
|
75
|
+
"codsen-utils": "^1.7.0"
|
|
76
76
|
},
|
|
77
77
|
"publishConfig": {
|
|
78
78
|
"registry": "https://registry.npmjs.org/"
|