object-no-new-keys 5.0.0 → 5.0.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,17 +3,17 @@
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.0.0 (2022-12-01)
6
+ ## [5.0.2](https://github.com/codsen/codsen/compare/object-no-new-keys@5.0.1...object-no-new-keys@5.0.2) (2022-12-06)
7
7
 
8
- ### Features
8
+ **Note:** Version bump only for package object-no-new-keys
9
9
 
10
- - drop Node v12 support; minimum version requirement now is v14.18 and above ([c8049e8](https://github.com/codsen/codsen/commit/c8049e82a5844d3f72587740f1cc74e3c9020d22))
10
+ ## 5.0.0 (2022-12-01)
11
11
 
12
12
  ### BREAKING CHANGES
13
13
 
14
14
  - Minimum supported Node version is v14.18; we're dropping v12 support
15
15
 
16
- # 4.2.0 (2022-08-12)
16
+ ## 4.2.0 (2022-08-12)
17
17
 
18
18
  ### Features
19
19
 
@@ -32,7 +32,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
32
32
 
33
33
  - tweak types ([fe67aa5](https://github.com/codsen/codsen/commit/fe67aa510c5523969e83d905c7420106081d4a8b))
34
34
 
35
- # 4.1.0 (2022-04-10)
35
+ ## 4.1.0 (2022-04-10)
36
36
 
37
37
  ### Features
38
38
 
@@ -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.0
4
+ * @version 5.0.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 u="5.0.0";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 i(s,n,p,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=i(s[t],n[t],p,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},p.mode===2?e.res=i(s[t],n[0],p,r).res:e.res=i(s[t],n[t],p,r).res;else e.res=e.res.concat(s.map((t,y)=>`${e.path.length?e.path:""}[${y}]`));return e}return i(c,d,o,{path:"",res:[]}).res}export{b as defaults,g as noNewKeys,f as version};
10
+ var m="5.0.2";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};
@@ -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.0
4
+ * @version 5.0.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
- "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="5.0.0";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,p,l,r){let i;if(u(n))u(p)?Object.keys(n).forEach(o=>{Object.prototype.hasOwnProperty.call(p,o)?(u(n[o])||Array.isArray(n[o]))&&(i={path:r.path.length?`${r.path}.${o}`:o,res:r.res},r.res=c(n[o],p[o],l,i).res):(i=r.path.length?`${r.path}.${o}`:o,r.res.push(i))}):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(p))for(let o=0,d=n.length;o<d;o++)i={path:`${r.path.length?r.path:""}[${o}]`,res:r.res},l.mode===2?r.res=c(n[o],p[0],l,i).res:r.res=c(n[o],p[o],l,i).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 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.2";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);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "object-no-new-keys",
3
- "version": "5.0.0",
3
+ "version": "5.0.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",
@@ -36,22 +36,22 @@
36
36
  },
37
37
  "types": "types/index.d.ts",
38
38
  "scripts": {
39
- "build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
39
+ "build": "node '../../ops/scripts/esbuild.js' && npm run dts",
40
40
  "cjs-off": "exit 0",
41
41
  "cjs-on": "exit 0",
42
- "dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
43
- "devtest": "c8 yarn run unit && yarn run examples && yarn run lint",
44
- "dts": "rollup -c && yarn run prettier 'types/index.d.ts' --write",
42
+ "dev": "DEV=true node '../../ops/scripts/esbuild.js' && npm run dts",
43
+ "devtest": "c8 npm run unit && npm run examples && npm run lint",
44
+ "dts": "rollup -c && npm run prettier -- 'types/index.d.ts' --write --loglevel 'silent'",
45
45
  "examples": "node '../../ops/scripts/run-examples.js'",
46
- "lect": "node '../../ops/lect/lect.js' && yarn run prettier 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
47
- "letspublish": "yarn publish || :",
46
+ "lect": "node '../../ops/lect/lect.js' && npm run prettier -- 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
47
+ "letspublish": "npm publish || :",
48
48
  "lint": "eslint . --ext .js --ext .ts --fix",
49
49
  "perf": "node perf/check.js",
50
- "prepare": "echo 'ready'",
50
+ "prep": "echo 'ready'",
51
51
  "prettier": "prettier",
52
- "prettier:format": "prettier --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern",
53
- "pretest": "yarn run lect && yarn run build",
54
- "test": "yarn run devtest",
52
+ "prettier:format": "npm run prettier -- --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern --loglevel 'silent'",
53
+ "pretest": "npm run lect && npm run build",
54
+ "test": "npm run devtest",
55
55
  "unit": "uvu test"
56
56
  },
57
57
  "engines": {
package/types/index.d.ts CHANGED
@@ -1,15 +1,9 @@
1
1
  declare const version: string;
2
- declare type JsonValue =
3
- | string
4
- | number
5
- | boolean
6
- | null
7
- | JsonObject
8
- | JsonArray;
9
- declare type JsonObject = {
2
+ type JsonValue = string | number | boolean | null | JsonObject | JsonArray;
3
+ type JsonObject = {
10
4
  [Key in string]?: JsonValue;
11
5
  };
12
- declare type JsonArray = JsonValue[];
6
+ type JsonArray = JsonValue[];
13
7
  interface Opts {
14
8
  mode: 1 | 2;
15
9
  }