@takeshape/util 8.105.0 → 8.109.4

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.
Files changed (93) hide show
  1. package/{lib → dist}/arrays.d.ts +0 -0
  2. package/{lib → dist}/arrays.d.ts.map +0 -0
  3. package/{lib → dist}/arrays.js +0 -0
  4. package/{lib → dist}/async-noop.d.ts +0 -0
  5. package/{lib → dist}/async-noop.d.ts.map +0 -0
  6. package/{lib → dist}/async-noop.js +0 -0
  7. package/{lib → dist}/billing.d.ts +0 -0
  8. package/{lib → dist}/billing.d.ts.map +0 -0
  9. package/{lib → dist}/billing.js +0 -0
  10. package/{lib → dist}/browser.d.ts +0 -0
  11. package/{lib → dist}/browser.d.ts.map +0 -0
  12. package/{lib → dist}/browser.js +0 -0
  13. package/{lib → dist}/clone.d.ts +0 -0
  14. package/{lib → dist}/clone.d.ts.map +0 -0
  15. package/{lib → dist}/clone.js +0 -0
  16. package/{lib → dist}/common.d.ts +0 -0
  17. package/{lib → dist}/common.d.ts.map +0 -0
  18. package/{lib → dist}/common.js +0 -0
  19. package/{lib → dist}/delay.d.ts +0 -0
  20. package/{lib → dist}/delay.d.ts.map +0 -0
  21. package/{lib → dist}/delay.js +0 -0
  22. package/{lib → dist}/draftjs-templates.d.ts +0 -0
  23. package/{lib → dist}/draftjs-templates.d.ts.map +0 -0
  24. package/{lib → dist}/draftjs-templates.js +0 -0
  25. package/{lib → dist}/draftjs.d.ts +0 -0
  26. package/{lib → dist}/draftjs.d.ts.map +0 -0
  27. package/{lib → dist}/draftjs.js +0 -0
  28. package/{lib → dist}/encryption.d.ts +0 -0
  29. package/{lib → dist}/encryption.d.ts.map +0 -0
  30. package/{lib → dist}/encryption.js +0 -0
  31. package/{lib → dist}/get-image-url.d.ts +0 -0
  32. package/{lib → dist}/get-image-url.d.ts.map +0 -0
  33. package/{lib → dist}/get-image-url.js +0 -0
  34. package/{lib → dist}/gzip.d.ts +0 -0
  35. package/{lib → dist}/gzip.d.ts.map +0 -0
  36. package/{lib → dist}/gzip.js +0 -0
  37. package/{lib → dist}/highlight-code.d.ts +0 -0
  38. package/{lib → dist}/highlight-code.d.ts.map +0 -0
  39. package/{lib → dist}/highlight-code.js +0 -0
  40. package/{lib → dist}/http.d.ts +0 -0
  41. package/{lib → dist}/http.d.ts.map +0 -0
  42. package/{lib → dist}/http.js +0 -0
  43. package/{lib → dist}/index.d.ts +0 -0
  44. package/{lib → dist}/index.d.ts.map +0 -0
  45. package/{lib → dist}/index.js +0 -0
  46. package/{lib → dist}/map.d.ts +0 -0
  47. package/{lib → dist}/map.d.ts.map +0 -0
  48. package/{lib → dist}/map.js +0 -0
  49. package/{lib → dist}/merge.d.ts +0 -0
  50. package/{lib → dist}/merge.d.ts.map +0 -0
  51. package/{lib → dist}/merge.js +0 -0
  52. package/{lib → dist}/mime.d.ts +0 -0
  53. package/{lib → dist}/mime.d.ts.map +0 -0
  54. package/{lib → dist}/mime.js +0 -0
  55. package/{lib → dist}/predicate.d.ts +0 -0
  56. package/{lib → dist}/predicate.d.ts.map +0 -0
  57. package/{lib → dist}/predicate.js +0 -0
  58. package/{lib → dist}/search-params.d.ts +0 -0
  59. package/{lib → dist}/search-params.d.ts.map +0 -0
  60. package/{lib → dist}/search-params.js +0 -0
  61. package/{lib → dist}/set-in.d.ts +0 -0
  62. package/{lib → dist}/set-in.d.ts.map +0 -0
  63. package/{lib → dist}/set-in.js +0 -0
  64. package/{lib → dist}/strings.d.ts +0 -0
  65. package/{lib → dist}/strings.d.ts.map +0 -0
  66. package/{lib → dist}/strings.js +0 -0
  67. package/{lib → dist}/templates.d.ts +0 -0
  68. package/{lib → dist}/templates.d.ts.map +0 -0
  69. package/{lib → dist}/templates.js +0 -0
  70. package/{lib → dist}/timezone.d.ts +0 -0
  71. package/{lib → dist}/timezone.d.ts.map +0 -0
  72. package/{lib → dist}/timezone.js +0 -0
  73. package/{lib → dist}/tracing.d.ts +0 -0
  74. package/{lib → dist}/tracing.d.ts.map +0 -0
  75. package/{lib → dist}/tracing.js +0 -0
  76. package/{lib → dist}/types.d.ts +4 -0
  77. package/{lib → dist}/types.d.ts.map +1 -1
  78. package/{lib → dist}/types.js +9 -0
  79. package/{lib → dist}/unix-to-iso.d.ts +0 -0
  80. package/{lib → dist}/unix-to-iso.d.ts.map +0 -0
  81. package/{lib → dist}/unix-to-iso.js +0 -0
  82. package/{lib → dist}/value.d.ts +0 -0
  83. package/{lib → dist}/value.d.ts.map +0 -0
  84. package/{lib → dist}/value.js +0 -0
  85. package/dist/visit.d.ts +10 -0
  86. package/dist/visit.d.ts.map +1 -0
  87. package/dist/visit.js +75 -0
  88. package/es/types.js +7 -0
  89. package/es/visit.js +44 -0
  90. package/package.json +8 -8
  91. package/lib/visit.d.ts +0 -5
  92. package/lib/visit.d.ts.map +0 -1
  93. package/lib/visit.js +0 -29
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -25,4 +25,8 @@ export declare function isPrimitive(maybePrimitive: unknown): maybePrimitive is
25
25
  export declare type Scalar = string | number | boolean | bigint;
26
26
  export declare function isScalar(maybeScalar: unknown): maybeScalar is Scalar;
27
27
  export declare function getSingle<T>(t?: T | T[]): Maybe<T>;
28
+ /**
29
+ * Test whether a provided string is numeric, e.g., '9' is numeric while 'nine' is not.
30
+ */
31
+ export declare function isNumericString(key: string): boolean;
28
32
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,WAAW,CAAC;AAIzC,oBAAY,WAAW,CAAC,GAAG,IAAI;KAAE,CAAC,IAAI,MAAM,QAAQ,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,KAAK;CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AAE1G;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,WAAW,EAAE,OAAO,GAAG,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAErF;AAED,oBAAY,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAG/E,oBAAY,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;AAErC;;;GAGG;AACH,oBAAY,SAAS,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAErE;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,SAAS,MAAM,EAAE,YAAY,EAAE;KAAE,GAAG,IAAI,CAAC,GAAG,KAAK;CAAC,eACtF,MAAM,mCAC1B;AAED,wBAAgB,WAAW,CAAC,cAAc,EAAE,OAAO,GAAG,cAAc,IAAI,SAAS,CAUhF;AAED,oBAAY,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAExD,wBAAgB,QAAQ,CAAC,WAAW,EAAE,OAAO,GAAG,WAAW,IAAI,MAAM,CAOpE;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAMlD"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,WAAW,CAAC;AAIzC,oBAAY,WAAW,CAAC,GAAG,IAAI;KAAE,CAAC,IAAI,MAAM,QAAQ,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,KAAK;CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AAE1G;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,WAAW,EAAE,OAAO,GAAG,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAErF;AAED,oBAAY,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAG/E,oBAAY,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;AAErC;;;GAGG;AACH,oBAAY,SAAS,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAErE;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,SAAS,MAAM,EAAE,YAAY,EAAE;KAAE,GAAG,IAAI,CAAC,GAAG,KAAK;CAAC,eACtF,MAAM,mCAC1B;AAED,wBAAgB,WAAW,CAAC,cAAc,EAAE,OAAO,GAAG,cAAc,IAAI,SAAS,CAUhF;AAED,oBAAY,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAExD,wBAAgB,QAAQ,CAAC,WAAW,EAAE,OAAO,GAAG,WAAW,IAAI,MAAM,CAOpE;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAMlD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEpD"}
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.createEnumMatcher = createEnumMatcher;
7
7
  exports.getSingle = getSingle;
8
+ exports.isNumericString = isNumericString;
8
9
  exports.isPrimitive = isPrimitive;
9
10
  exports.isRecord = isRecord;
10
11
  exports.isScalar = isScalar;
@@ -45,4 +46,12 @@ function getSingle(t) {
45
46
  }
46
47
 
47
48
  return t;
49
+ }
50
+ /**
51
+ * Test whether a provided string is numeric, e.g., '9' is numeric while 'nine' is not.
52
+ */
53
+
54
+
55
+ function isNumericString(key) {
56
+ return !isNaN(Number(key));
48
57
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Walk a tree, calling the callback for any property name matching a value in the keys array.
3
+ */
4
+ export declare function visit<Tree extends Record<string, any>, Node>(tree: Tree, keys: string[], callback: (value: Node, path: string[]) => void): void;
5
+ /**
6
+ * Walk a tree with JSONPath, calling the callback for matching properties.
7
+ * Normalizes the resulting path
8
+ */
9
+ export declare function visitJsonPath<Tree extends Record<string, any>, Node>(tree: Tree, jsonPaths: string[], callback: (value: Node, path: string[], foundIndex: number) => void): void;
10
+ //# sourceMappingURL=visit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visit.d.ts","sourceRoot":"","sources":["../../src/visit.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,KAAK,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,EAC1D,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,MAAM,EAAE,EACd,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,QAehD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,EAClE,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,MAAM,EAAE,EACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,QA0CpE"}
package/dist/visit.js ADDED
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.visit = visit;
7
+ exports.visitJsonPath = visitJsonPath;
8
+
9
+ var _isObject = _interopRequireDefault(require("lodash/isObject"));
10
+
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+
13
+ /**
14
+ * Walk a tree, calling the callback for any property name matching a value in the keys array.
15
+ */
16
+ function visit(tree, keys, callback) {
17
+ const traverse = (obj, path) => {
18
+ for (const [key, value] of Object.entries(obj)) {
19
+ if (keys.includes(key)) {
20
+ callback(value, [...path, key]);
21
+ }
22
+
23
+ if ((0, _isObject.default)(value)) {
24
+ traverse(value, [...path, key]);
25
+ }
26
+ }
27
+ };
28
+
29
+ traverse(tree, []);
30
+ }
31
+ /**
32
+ * Walk a tree with JSONPath, calling the callback for matching properties.
33
+ * Normalizes the resulting path
34
+ */
35
+
36
+
37
+ function visitJsonPath(tree, jsonPaths, callback) {
38
+ const paths = jsonPaths.map(p => p.split('.').slice());
39
+
40
+ const testPaths = propPath => {
41
+ return paths.findIndex(testPath => {
42
+ const isFromRoot = testPath[0] === '$';
43
+ const tPath = isFromRoot ? testPath.slice(1) : testPath.slice().reverse();
44
+ const pPath = isFromRoot ? propPath.slice() : propPath.slice().reverse();
45
+ let isMatchingPath = isFromRoot ? tPath.length === pPath.length : tPath.length <= pPath.length;
46
+
47
+ for (const [pI, pP] of pPath.entries()) {
48
+ if (tPath[pI] === undefined || !isMatchingPath) {
49
+ break;
50
+ }
51
+
52
+ isMatchingPath = pP === tPath[pI] || tPath[pI] === '*';
53
+ }
54
+
55
+ return isMatchingPath;
56
+ });
57
+ };
58
+
59
+ const traverse = (obj, path) => {
60
+ for (const [prop, value] of Object.entries(obj)) {
61
+ const propPath = [...path, prop];
62
+ const foundIndex = testPaths(propPath);
63
+
64
+ if (foundIndex > -1) {
65
+ callback(value, propPath, foundIndex);
66
+ }
67
+
68
+ if ((0, _isObject.default)(value)) {
69
+ traverse(value, propPath);
70
+ }
71
+ }
72
+ };
73
+
74
+ traverse(tree, []);
75
+ }
package/es/types.js CHANGED
@@ -28,4 +28,11 @@ export function getSingle(t) {
28
28
  }
29
29
 
30
30
  return t;
31
+ }
32
+ /**
33
+ * Test whether a provided string is numeric, e.g., '9' is numeric while 'nine' is not.
34
+ */
35
+
36
+ export function isNumericString(key) {
37
+ return !isNaN(Number(key));
31
38
  }
package/es/visit.js CHANGED
@@ -16,5 +16,49 @@ export function visit(tree, keys, callback) {
16
16
  }
17
17
  };
18
18
 
19
+ traverse(tree, []);
20
+ }
21
+ /**
22
+ * Walk a tree with JSONPath, calling the callback for matching properties.
23
+ * Normalizes the resulting path
24
+ */
25
+
26
+ export function visitJsonPath(tree, jsonPaths, callback) {
27
+ const paths = jsonPaths.map(p => p.split('.').slice());
28
+
29
+ const testPaths = propPath => {
30
+ return paths.findIndex(testPath => {
31
+ const isFromRoot = testPath[0] === '$';
32
+ const tPath = isFromRoot ? testPath.slice(1) : testPath.slice().reverse();
33
+ const pPath = isFromRoot ? propPath.slice() : propPath.slice().reverse();
34
+ let isMatchingPath = isFromRoot ? tPath.length === pPath.length : tPath.length <= pPath.length;
35
+
36
+ for (const [pI, pP] of pPath.entries()) {
37
+ if (tPath[pI] === undefined || !isMatchingPath) {
38
+ break;
39
+ }
40
+
41
+ isMatchingPath = pP === tPath[pI] || tPath[pI] === '*';
42
+ }
43
+
44
+ return isMatchingPath;
45
+ });
46
+ };
47
+
48
+ const traverse = (obj, path) => {
49
+ for (const [prop, value] of Object.entries(obj)) {
50
+ const propPath = [...path, prop];
51
+ const foundIndex = testPaths(propPath);
52
+
53
+ if (foundIndex > -1) {
54
+ callback(value, propPath, foundIndex);
55
+ }
56
+
57
+ if (isObject(value)) {
58
+ traverse(value, propPath);
59
+ }
60
+ }
61
+ };
62
+
19
63
  traverse(tree, []);
20
64
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takeshape/util",
3
- "version": "8.105.0",
3
+ "version": "8.109.4",
4
4
  "description": "Shared utilities",
5
5
  "homepage": "https://www.takeshape.io",
6
6
  "repository": {
@@ -12,16 +12,16 @@
12
12
  "engines": {
13
13
  "node": ">=14"
14
14
  },
15
- "main": "lib/index.js",
15
+ "main": "dist/index.js",
16
16
  "module": "es/index.js",
17
17
  "browser": "es/browser.js",
18
- "types": "lib/index.d.ts",
18
+ "types": "dist/index.d.ts",
19
19
  "files": [
20
- "lib",
20
+ "dist",
21
21
  "es"
22
22
  ],
23
23
  "dependencies": {
24
- "@takeshape/routing": "8.105.0",
24
+ "@takeshape/routing": "8.109.4",
25
25
  "@types/url-parse": "^1.4.4",
26
26
  "aws-sdk": "^2.802.0",
27
27
  "classnames": "^2.2.5",
@@ -50,12 +50,12 @@
50
50
  "test-changed": "pnpm run test -- --changedSince=master",
51
51
  "test:ci": "JEST_JUNIT_OUTPUT_DIR=\"${HOME}/test-results/${npm_package_name#*\\/}\" JEST_JUNIT_OUTPUT_NAME=jest-results.xml jest --ci --reporters=default --reporters=jest-junit",
52
52
  "typecheck": "tsc --noEmit",
53
- "clean": "rimraf lib es build *.tsbuildinfo",
53
+ "clean": "rimraf dist es build *.tsbuildinfo",
54
54
  "build": "pnpm build:types && pnpm build:js && pnpm build:es && pnpm build:copy",
55
55
  "build:types": "tsc --emitDeclarationOnly --project tsconfig.build.json",
56
- "build:js": "cross-env BABEL_MODULES=commonjs babel src --out-dir lib --extensions \".js,.ts\" --ignore '**/__tests__'",
56
+ "build:js": "cross-env BABEL_MODULES=commonjs babel src --out-dir dist --extensions \".js,.ts\" --ignore '**/__tests__'",
57
57
  "build:es": "cross-env BABEL_MODULES=es babel src --out-dir es --extensions \".js,.ts\" --ignore '**/__tests__'",
58
- "build:copy": "cp -rf build/src/* lib/",
58
+ "build:copy": "cp -rf build/src/* dist/",
59
59
  "will-it-blend": "pnpm typecheck && pnpm lint -- --quiet && pnpm test -- --silent --coverage false",
60
60
  "todo": "leasot 'src/**/*.{js,jsx,ts,tsx}'"
61
61
  },
package/lib/visit.d.ts DELETED
@@ -1,5 +0,0 @@
1
- /**
2
- * Walk a tree, calling the callback for any property name matching a value in the keys array.
3
- */
4
- export declare function visit<Tree extends Record<string, any>, Node>(tree: Tree, keys: string[], callback: (value: Node, path: string[]) => void): void;
5
- //# sourceMappingURL=visit.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"visit.d.ts","sourceRoot":"","sources":["../../src/visit.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,KAAK,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,EAC1D,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,MAAM,EAAE,EACd,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,QAehD"}
package/lib/visit.js DELETED
@@ -1,29 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.visit = visit;
7
-
8
- var _isObject = _interopRequireDefault(require("lodash/isObject"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- /**
13
- * Walk a tree, calling the callback for any property name matching a value in the keys array.
14
- */
15
- function visit(tree, keys, callback) {
16
- const traverse = (obj, path) => {
17
- for (const [key, value] of Object.entries(obj)) {
18
- if (keys.includes(key)) {
19
- callback(value, [...path, key]);
20
- }
21
-
22
- if ((0, _isObject.default)(value)) {
23
- traverse(value, [...path, key]);
24
- }
25
- }
26
- };
27
-
28
- traverse(tree, []);
29
- }