@thi.ng/resolve-map 7.1.61 → 7.1.63

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
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-02-25T14:07:53Z
3
+ - **Last updated**: 2024-03-02T14:05:52Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
package/README.md CHANGED
@@ -1,16 +1,5 @@
1
1
  <!-- This file is generated - DO NOT EDIT! -->
2
2
  <!-- Please see: https://github.com/thi-ng/umbrella/blob/develop/CONTRIBUTING.md#changes-to-readme-files -->
3
- > [!IMPORTANT]
4
- > ‼️ Announcing the thi.ng user survey 2024 📋
5
- >
6
- > [Please participate in the survey here!](https://forms.gle/XacbSDEmQMPZg8197)\
7
- > (open until end of February)
8
- >
9
- > **To achieve a better sample size, I'd highly appreciate if you could
10
- > circulate the link to this survey in your own networks.**
11
- >
12
- > [Discussion](https://github.com/thi-ng/umbrella/discussions/447)
13
-
14
3
  # ![@thi.ng/resolve-map](https://media.thi.ng/umbrella/banners-20230807/thing-resolve-map.svg?8522d906)
15
4
 
16
5
  [![npm version](https://img.shields.io/npm/v/@thi.ng/resolve-map.svg)](https://www.npmjs.com/package/@thi.ng/resolve-map)
@@ -22,7 +11,7 @@
22
11
  > of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
23
12
  > and anti-framework.
24
13
  >
25
- > 🚀 Help me to work full-time on these projects by [sponsoring me on
14
+ > 🚀 Please help me to work full-time on these projects by [sponsoring me on
26
15
  > GitHub](https://github.com/sponsors/postspectacular). Thank you! ❤️
27
16
 
28
17
  - [About](#about)
@@ -243,6 +232,8 @@ Absolute refs are always resolved from the root level (the original object
243
232
  passed to this function).
244
233
 
245
234
  ```ts
235
+ import { resolve } from "@thi.ng/resolve-map";
236
+
246
237
  // `c` references sibling `d`
247
238
  // `d` references top-level `a`
248
239
  resolve({ a: 1, b: { c: "@d", d: "@/a"} })
@@ -273,6 +264,8 @@ The `resolve` function provided as arg to the user function accepts a path
273
264
  object.
274
265
 
275
266
  ```ts
267
+ import { resolve } from "@thi.ng/resolve-map";
268
+
276
269
  // `c` uses ES6 destructuring form to look up `a` & `b` values
277
270
  // `d` uses provided resolve fn arg `$` to look up `c`
278
271
  resolve({ a: 1, b: 2, c: ({ a, b }) => a + b, d: ($) => $("c") })
@@ -293,12 +286,14 @@ Similarly, if an actual string value should happen to start with `@`, it
293
286
  needs to be wrapped in a function (see `f` key below).
294
287
 
295
288
  ```ts
289
+ import { resolve } from "@thi.ng/resolve-map";
290
+
296
291
  // `a` is derived from 1st array element in `b.d`
297
292
  // `b.c` is looked up from `b.d[0]`
298
293
  // `b.d[1]` is derived from calling `e(2)`
299
294
  // `e` is a wrapped function
300
295
  // `f` is wrapped to ignore `@` prefix
301
- res = resolve({
296
+ const res = resolve({
302
297
  a: ($) => $("b/c") * 100,
303
298
  b: { c: "@d/0", d: [2, ($) => $("../../e")(2) ] },
304
299
  e: () => (x) => x * 10,
@@ -321,6 +316,8 @@ Unwrapped values will also be supplied to any lookup functions, no
321
316
  there.
322
317
 
323
318
  ```ts
319
+ import { resolve, resolved } from "@thi.ng/resolve-map";
320
+
324
321
  resolve({ a: 42, b: ({a}) => resolved(a) });
325
322
  // { a: 42, b: 42 }
326
323
 
@@ -337,6 +334,8 @@ resolution behavior to **not** consider string values for resolution at all
337
334
  anymore and instead requires the use of function values to trigger resolution.
338
335
 
339
336
  ```ts
337
+ import { resolve } from "@thi.ng/resolve-map";
338
+
340
339
  // default behavior
341
340
  resolve({ a: "@c", b: ({a}) => a, c: 42 })
342
341
  // { a: 42, b: 42, c: 42 }
package/index.d.ts CHANGED
@@ -79,7 +79,9 @@ export interface ResolveOpts {
79
79
  * path (**without `@` prefix**) to look up any other values in the root
80
80
  * object.
81
81
  *
82
- * ```
82
+ * ```ts
83
+ * import { resolve } from "@thi.ng/resolve-map";
84
+ *
83
85
  * // `c` uses ES6 destructuring form to look up `a` & `b` values
84
86
  * // `d` uses provided resolve fn arg `$` to look up `c`
85
87
  * resolve({ a: 1, b: 2, c: ({ a, b }) => a + b, d: ($) => $("c") })
@@ -100,7 +102,9 @@ export interface ResolveOpts {
100
102
  * start with `@`, it needs to be wrapped in a function (see `f` key
101
103
  * below).
102
104
  *
103
- * ```
105
+ * ```ts
106
+ * import { resolve } from "@thi.ng/resolve-map";
107
+ *
104
108
  * // `a` is derived from 1st array element in `b.d`
105
109
  * // `b.c` is looked up from `b.d[0]`
106
110
  * // `b.d[1]` is derived from calling `e(2)`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/resolve-map",
3
- "version": "7.1.61",
3
+ "version": "7.1.63",
4
4
  "description": "DAG resolution of vanilla objects & arrays with internally linked values",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -35,10 +35,10 @@
35
35
  "test": "bun test"
36
36
  },
37
37
  "dependencies": {
38
- "@thi.ng/api": "^8.9.26",
39
- "@thi.ng/checks": "^3.5.0",
40
- "@thi.ng/errors": "^2.4.18",
41
- "@thi.ng/paths": "^5.1.68"
38
+ "@thi.ng/api": "^8.9.27",
39
+ "@thi.ng/checks": "^3.5.1",
40
+ "@thi.ng/errors": "^2.4.19",
41
+ "@thi.ng/paths": "^5.1.70"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@microsoft/api-extractor": "^7.40.1",
@@ -76,5 +76,5 @@
76
76
  ],
77
77
  "year": 2018
78
78
  },
79
- "gitHead": "6e20f80dd9df1c8055ffa3c1e4d6f7598add0c0b\n"
79
+ "gitHead": "df9e312af741d87e6b450afcfea6a6e381662b1e\n"
80
80
  }