object-no-new-keys 4.2.3 → 4.2.5

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
@@ -36,7 +36,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
36
36
 
37
37
  ### BREAKING CHANGES
38
38
 
39
- - programs now are in ES Modules and won't work with Common JS require()
39
+ - programs now are in ES Modules and won't work with Common JS `require()`
40
40
 
41
41
  ## 3.1.0 (2021-05-24)
42
42
 
@@ -54,7 +54,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
54
54
 
55
55
  ### Fixed
56
56
 
57
- - add testStats to npmignore ([f3c84e9](https://github.com/codsen/codsen/commit/f3c84e95afc5514214312f913692d85b2e12eb29))
57
+ - add `testStats` to npmignore ([f3c84e9](https://github.com/codsen/codsen/commit/f3c84e95afc5514214312f913692d85b2e12eb29))
58
58
 
59
59
  ## 3.0.0 (2021-01-23)
60
60
 
@@ -68,7 +68,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
68
68
 
69
69
  ## 2.10.0 (2020-11-28)
70
70
 
71
- Accidental version bump during migration to sourcehut. Sorry about that.
71
+ Accidental version bump during migration to SourceHut. Sorry about that.
72
72
 
73
73
  ## 2.9.0 (2020-02-01)
74
74
 
package/README.md CHANGED
@@ -1,28 +1,25 @@
1
- # object-no-new-keys
1
+ <h1 align="center">object-no-new-keys</h1>
2
2
 
3
- > Check, does a plain object (AST/JSON) has any unique keys, not present in a reference object (another AST/JSON)
3
+ <p align="center">Check, does a plain object (AST/JSON) has any unique keys, not present in a reference object (another AST/JSON)</p>
4
4
 
5
- <div class="package-badges">
6
- <a href="https://www.npmjs.com/package/object-no-new-keys" rel="nofollow noreferrer noopener">
7
- <img src="https://img.shields.io/badge/-npm-blue?style=flat-square" alt="page on npm">
8
- </a>
5
+ <p align="center">
9
6
  <a href="https://codsen.com/os/object-no-new-keys" rel="nofollow noreferrer noopener">
10
7
  <img src="https://img.shields.io/badge/-codsen-blue?style=flat-square" alt="page on codsen.com">
11
8
  </a>
9
+ <a href="https://www.npmjs.com/package/object-no-new-keys" rel="nofollow noreferrer noopener">
10
+ <img src="https://img.shields.io/badge/-npm-blue?style=flat-square" alt="page on npm">
11
+ </a>
12
12
  <a href="https://github.com/codsen/codsen/tree/main/packages/object-no-new-keys" rel="nofollow noreferrer noopener">
13
13
  <img src="https://img.shields.io/badge/-github-blue?style=flat-square" alt="page on github">
14
14
  </a>
15
15
  <a href="https://npmcharts.com/compare/object-no-new-keys?interval=30" rel="nofollow noreferrer noopener" target="_blank">
16
16
  <img src="https://img.shields.io/npm/dm/object-no-new-keys.svg?style=flat-square" alt="Downloads per month">
17
17
  </a>
18
- <a href="https://prettier.io" rel="nofollow noreferrer noopener" target="_blank">
19
- <img src="https://img.shields.io/badge/code_style-prettier-brightgreen.svg?style=flat-square" alt="Code style: prettier">
20
- </a>
21
- <img src="https://img.shields.io/badge/licence-MIT-brightgreen.svg?style=flat-square" alt="MIT License">
22
- <a href="https://liberamanifesto.com" rel="nofollow noreferrer noopener" target="_blank">
23
- <img src="https://img.shields.io/badge/libera-manifesto-lightgrey.svg?style=flat-square" alt="libera manifesto">
18
+ <a href="https://codsen.com/os/object-no-new-keys/changelog" rel="nofollow noreferrer noopener">
19
+ <img src="https://img.shields.io/badge/changelog-here-brightgreen?style=flat-square" alt="changelog">
24
20
  </a>
25
- </div>
21
+ <img src="https://img.shields.io/badge/licence-MIT-brightgreen.svg?style=flat-square" alt="MIT Licence">
22
+ </p>
26
23
 
27
24
  ## Install
28
25
 
@@ -68,8 +65,8 @@ To report bugs or request features or assistance, [raise an issue](https://githu
68
65
 
69
66
  ## Licence
70
67
 
71
- MIT License
68
+ MIT License.
72
69
 
73
- Copyright (c) 2010-2022 Roy Revelt and other contributors
70
+ Copyright © 2010-2022 Roy Revelt and other contributors.
74
71
 
75
- <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">
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 4.2.3
4
+ * @version 4.2.5
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 u="4.2.3";var f=u;function l(c){return!!c&&typeof c=="object"&&!Array.isArray(c)}var b={mode:2};function g(c,d,a){if(a&&!l(a))throw new TypeError(`object-no-new-keys/noNewKeys(): [THROW_ID_02] resolvedOpts should be a plain object. It was given as ${JSON.stringify(a,null,4)} (type ${typeof a})`);let o={...b,...a};if(typeof o.mode=="string"&&["1","2"].includes(o.mode))o.mode=+o.mode;else if(![1,2].includes(o.mode))throw new TypeError('object-no-new-keys/objectNoNewKeys(): [THROW_ID_01] resolvedOpts.mode should be "1" or "2" (string or number).');function p(s,n,i,e){let r;if(l(s))l(n)?Object.keys(s).forEach(t=>{Object.prototype.hasOwnProperty.call(n,t)?(l(s[t])||Array.isArray(s[t]))&&(r={path:e.path.length?`${e.path}.${t}`:t,res:e.res},e.res=p(s[t],n[t],i,r).res):(r=e.path.length?`${e.path}.${t}`:t,e.res.push(r))}):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,y=s.length;t<y;t++)r={path:`${e.path.length?e.path:""}[${t}]`,res:e.res},i.mode===2?e.res=p(s[t],n[0],i,r).res:e.res=p(s[t],n[t],i,r).res;else e.res=e.res.concat(s.map((t,y)=>`${e.path.length?e.path:""}[${y}]`));return e}return p(c,d,o,{path:"",res:[]}).res}export{b as defaults,g as noNewKeys,f as version};
10
+ var u="4.2.5";var f=u;function l(c){return!!c&&typeof c=="object"&&!Array.isArray(c)}var b={mode:2};function g(c,d,a){if(a&&!l(a))throw new TypeError(`object-no-new-keys/noNewKeys(): [THROW_ID_02] resolvedOpts should be a plain object. It was given as ${JSON.stringify(a,null,4)} (type ${typeof a})`);let o={...b,...a};if(typeof o.mode=="string"&&["1","2"].includes(o.mode))o.mode=+o.mode;else if(![1,2].includes(o.mode))throw new TypeError('object-no-new-keys/objectNoNewKeys(): [THROW_ID_01] resolvedOpts.mode should be "1" or "2" (string or number).');function p(s,n,i,e){let r;if(l(s))l(n)?Object.keys(s).forEach(t=>{Object.prototype.hasOwnProperty.call(n,t)?(l(s[t])||Array.isArray(s[t]))&&(r={path:e.path.length?`${e.path}.${t}`:t,res:e.res},e.res=p(s[t],n[t],i,r).res):(r=e.path.length?`${e.path}.${t}`:t,e.res.push(r))}):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,y=s.length;t<y;t++)r={path:`${e.path.length?e.path:""}[${t}]`,res:e.res},i.mode===2?e.res=p(s[t],n[0],i,r).res:e.res=p(s[t],n[t],i,r).res;else e.res=e.res.concat(s.map((t,y)=>`${e.path.length?e.path:""}[${y}]`));return e}return p(c,d,o,{path:"",res:[]}).res}export{b as defaults,g 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.2.3
4
+ * @version 4.2.5
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 y=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames,b=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable;var m=(t,e,s)=>e in t?y(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,h=(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))x.call(e,s)&&m(t,s,e[s]);return t};var A=(t,e)=>{for(var s in e)y(t,s,{get:e[s],enumerable:!0})},J=(t,e,s,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of O(e))!j.call(t,c)&&c!==s&&y(t,c,{get:()=>e[c],enumerable:!(a=w(e,c))||a.enumerable});return t};var $=t=>J(y({},"__esModule",{value:!0}),t);var E={};A(E,{defaults:()=>g,noNewKeys:()=>T,version:()=>N});var f="4.2.3";var N=f;function u(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}var g={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 a=h(h({},g),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 c(n,i,l,r){let p;if(u(n))u(i)?Object.keys(n).forEach(o=>{Object.prototype.hasOwnProperty.call(i,o)?(u(n[o])||Array.isArray(n[o]))&&(p={path:r.path.length?`${r.path}.${o}`:o,res:r.res},r.res=c(n[o],i[o],l,p).res):(p=r.path.length?`${r.path}.${o}`:o,r.res.push(p))}):r.res=r.res.concat(Object.keys(n).map(o=>r.path.length?`${r.path}.${o}`:o));else if(Array.isArray(n))if(Array.isArray(i))for(let o=0,d=n.length;o<d;o++)p={path:`${r.path.length?r.path:""}[${o}]`,res:r.res},l.mode===2?r.res=c(n[o],i[0],l,p).res:r.res=c(n[o],i[o],l,p).res;else r.res=r.res.concat(n.map((o,d)=>`${r.path.length?r.path:""}[${d}]`));return r}return c(t,e,a,{path:"",res:[]}).res}return $(E);})();
10
+ "use strict";var objectNoNewKeys=(()=>{var y=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames,b=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var m=(t,e,s)=>e in t?y(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,h=(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))O.call(e,s)&&m(t,s,e[s]);return t};var A=(t,e)=>{for(var s in e)y(t,s,{get:e[s],enumerable:!0})},J=(t,e,s,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of x(e))!j.call(t,c)&&c!==s&&y(t,c,{get:()=>e[c],enumerable:!(a=w(e,c))||a.enumerable});return t};var $=t=>J(y({},"__esModule",{value:!0}),t);var E={};A(E,{defaults:()=>g,noNewKeys:()=>T,version:()=>N});var f="4.2.5";var N=f;function u(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}var g={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 a=h(h({},g),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 c(n,i,l,r){let p;if(u(n))u(i)?Object.keys(n).forEach(o=>{Object.prototype.hasOwnProperty.call(i,o)?(u(n[o])||Array.isArray(n[o]))&&(p={path:r.path.length?`${r.path}.${o}`:o,res:r.res},r.res=c(n[o],i[o],l,p).res):(p=r.path.length?`${r.path}.${o}`:o,r.res.push(p))}):r.res=r.res.concat(Object.keys(n).map(o=>r.path.length?`${r.path}.${o}`:o));else if(Array.isArray(n))if(Array.isArray(i))for(let o=0,d=n.length;o<d;o++)p={path:`${r.path.length?r.path:""}[${o}]`,res:r.res},l.mode===2?r.res=c(n[o],i[0],l,p).res:r.res=c(n[o],i[o],l,p).res;else r.res=r.res.concat(n.map((o,d)=>`${r.path.length?r.path:""}[${d}]`));return r}return c(t,e,a,{path:"",res:[]}).res}return $(E);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "object-no-new-keys",
3
- "version": "4.2.3",
3
+ "version": "4.2.5",
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",
@@ -43,7 +43,7 @@
43
43
  "examples": "node '../../ops/scripts/run-examples.js'",
44
44
  "lect": "node '../../ops/lect/lect.js' && yarn run prettier 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
45
45
  "letspublish": "yarn publish || :",
46
- "lint": "eslint . --fix",
46
+ "lint": "eslint . --ext .js --ext .ts --fix",
47
47
  "perf": "node perf/check.js",
48
48
  "prepare": "echo 'ready'",
49
49
  "prettier": "prettier",
@@ -1,23 +0,0 @@
1
- // Quick Take
2
-
3
- import { strict as assert } from "assert";
4
-
5
- import { noNewKeys } from "../dist/object-no-new-keys.esm.js";
6
-
7
- assert.deepEqual(
8
- noNewKeys(
9
- {
10
- a: {
11
- b: "b",
12
- c: "c",
13
- },
14
- x: "y",
15
- },
16
- {
17
- a: {
18
- c: "z",
19
- },
20
- }
21
- ),
22
- ["a.b", "x"]
23
- );