@lytical/jxf 1.0.0 → 1.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/README.md +6 -1
- package/index.d.ts +3 -30
- package/index.d.ts.map +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/jxf.d.ts +31 -0
- package/jxf.d.ts.map +1 -0
- package/jxf.js +6 -0
- package/jxf.js.map +1 -0
- package/package.json +4 -4
- package/transformers/case.d.ts +2 -2
- package/transformers/case.d.ts.map +1 -1
- package/transformers/case.js.map +1 -1
- package/transformers/for-each.d.ts +1 -1
- package/transformers/for-keys.d.ts +1 -1
- package/transformers/if.d.ts +1 -1
- package/transformers/if.d.ts.map +1 -1
- package/transformers/if.js.map +1 -1
- package/transformers/length.d.ts +1 -1
- package/transformers/switch.d.ts +1 -1
- package/transformers/switch.d.ts.map +1 -1
- package/transformers/switch.js.map +1 -1
- package/transformers/value-of.d.ts +1 -1
- package/transformers/variable.d.ts +1 -1
- package/transformers/with.d.ts +1 -1
- package/transformers/with.d.ts.map +1 -1
- package/transformers/with.js.map +1 -1
- package/types.d.ts +3 -0
package/README.md
CHANGED
|
@@ -19,6 +19,11 @@ Supports ES6 environments in both DOM and NodeJS.
|
|
|
19
19
|
|
|
20
20
|
After installing JXF, import and invoke the `jxf()` function. DSL usage documentation can be found in [JSPath]('https://www.npmjs.com/package/jspath').
|
|
21
21
|
|
|
22
|
+
**Please note:**
|
|
23
|
+
The current version of (@types/jspath@0.4.2) is outdated and does not properly exports the default apply() function.
|
|
24
|
+
Until this is corrected, you must `npm install -D @types/jspath` as a dev dependency to avoid TypeScript compile errors.
|
|
25
|
+
see: https://www.npmjs.com/package/@types/jspath
|
|
26
|
+
|
|
22
27
|
## Usage
|
|
23
28
|
|
|
24
29
|
```javascript
|
|
@@ -168,7 +173,7 @@ export function my_custom_xformer(match: string): jxf_transformer_t {
|
|
|
168
173
|
This library has standard transformers;
|
|
169
174
|
|
|
170
175
|
```typescript
|
|
171
|
-
import { ... } from '@lytical/jxf
|
|
176
|
+
import { ... } from '@lytical/jxf';
|
|
172
177
|
```
|
|
173
178
|
|
|
174
179
|
### Transformers
|
package/index.d.ts
CHANGED
|
@@ -1,31 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* @description
|
|
6
|
-
* Transforms a pod or array using an array of transformers, and or text to add to the transformation.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
*
|
|
10
|
-
* import { jxf_value_of } from '@lytical/jxf/transformers/index.js';
|
|
11
|
-
*
|
|
12
|
-
* const data = { name: 'john', age: 42 };
|
|
13
|
-
* const transform = [
|
|
14
|
-
* 'User Information:',
|
|
15
|
-
* jxf_value_of('.name'),
|
|
16
|
-
* ' is ',
|
|
17
|
-
* jxf_value_of('.age'),
|
|
18
|
-
* ' years old.'
|
|
19
|
-
* ];
|
|
20
|
-
* const result = jxf(data, transform);
|
|
21
|
-
* console.log(result.join('')); // "User Information: john is 42 years old."
|
|
22
|
-
*
|
|
23
|
-
* @module \@lytical/jxf/index
|
|
24
|
-
*
|
|
25
|
-
* @param {object} data a pod or array to transform
|
|
26
|
-
* @param {(jxf_transformer_t | string)[]} transform an array of transformers, and or text to add to the transformation
|
|
27
|
-
* @param {jxf_ctx_t} ctx (optional) context object to pass to the transformers that may contain preset variables
|
|
28
|
-
* @returns {string[]} an array of strings that represent the transformed data
|
|
29
|
-
*/
|
|
30
|
-
export default function jxf(data: object, transform: (jxf_transformer_t | string)[], ctx?: jxf_ctx_t): string[];
|
|
1
|
+
import jxf from './jxf.js';
|
|
2
|
+
export default jxf;
|
|
3
|
+
export * from './transformers/index.js';
|
|
31
4
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,GAAG,MAAM,UAAU,CAAC;AAE3B,eAAe,GAAG,CAAC;AAEnB,cAAc,yBAAyB,CAAC"}
|
package/index.js
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
lytical(r) is a registered trademark of lytical, inc.
|
|
4
4
|
please refer to your license agreement on the use of this file.
|
|
5
5
|
*/
|
|
6
|
-
export default
|
|
6
|
+
import jxf from"./jxf.js";export default jxf;export*from"./transformers/index.js";
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;EAIE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAEF,OAAO,GAAG,MAAM,UAAU,CAAC;AAE3B,eAAe,GAAG,CAAC;AAEnB,cAAc,yBAAyB,CAAC"}
|
package/jxf.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { jxf_ctx_t, jxf_transformer_t } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* jxf(data, transform, ctx?)
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* Transforms a pod or array using an array of transformers, and or text to add to the transformation.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
*
|
|
10
|
+
* import { jxf_value_of } from '@lytical/jxf';
|
|
11
|
+
*
|
|
12
|
+
* const data = { name: 'john', age: 42 };
|
|
13
|
+
* const transform = [
|
|
14
|
+
* 'User Information:',
|
|
15
|
+
* jxf_value_of('.name'),
|
|
16
|
+
* ' is ',
|
|
17
|
+
* jxf_value_of('.age'),
|
|
18
|
+
* ' years old.'
|
|
19
|
+
* ];
|
|
20
|
+
* const result = jxf(data, transform);
|
|
21
|
+
* console.log(result.join('')); // "User Information: john is 42 years old."
|
|
22
|
+
*
|
|
23
|
+
* @module \@lytical/jxf/index
|
|
24
|
+
*
|
|
25
|
+
* @param {object} data a pod or array to transform
|
|
26
|
+
* @param {(jxf_transformer_t | string)[]} transform an array of transformers, and or text to add to the transformation
|
|
27
|
+
* @param {jxf_ctx_t} ctx (optional) context object to pass to the transformers that may contain preset variables
|
|
28
|
+
* @returns {string[]} an array of strings that represent the transformed data
|
|
29
|
+
*/
|
|
30
|
+
export default function jxf(data: object, transform: (jxf_transformer_t | string)[], ctx?: jxf_ctx_t): string[];
|
|
31
|
+
//# sourceMappingURL=jxf.d.ts.map
|
package/jxf.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jxf.d.ts","sourceRoot":"","sources":["../src/jxf.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,OAAO,UAAU,GAAG,CACzB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,CAAC,iBAAiB,GAAG,MAAM,CAAC,EAAE,EACzC,GAAG,GAAE,SAAc,GAClB,MAAM,EAAE,CAaV"}
|
package/jxf.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/* @preserve
|
|
2
|
+
(c) 2025 lytical, inc. all rights are reserved.
|
|
3
|
+
lytical(r) is a registered trademark of lytical, inc.
|
|
4
|
+
please refer to your license agreement on the use of this file.
|
|
5
|
+
*/
|
|
6
|
+
export default function jxf(o,t,f={}){const n=[];void 0===f.$&&(f.$=o);for(const r of t)"string"==typeof r?n.push(r):n.push(...r(o,f));return n}
|
package/jxf.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jxf.js","sourceRoot":"","sources":["../src/jxf.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAIF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,OAAO,UAAU,GAAG,CACzB,IAAY,EACZ,SAAyC,EACzC,MAAiB,EAAE;IAEnB,MAAM,EAAE,GAAa,EAAE,CAAC;IACxB,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;QAC3B,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAClB,CAAC;IACD,KAAK,MAAM,EAAE,IAAI,SAAS,EAAE,CAAC;QAC3B,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE,CAAC;YAC3B,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACd,CAAC;aAAM,CAAC;YACN,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lytical/jxf",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "A TypeScript library for transforming template declarations into formatted strings based on provided data.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"private": false,
|
|
@@ -36,8 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"chai": "^6.2.2",
|
|
38
38
|
"jspath": "^0.4.0",
|
|
39
|
-
"mocha": "^11.7.5"
|
|
40
|
-
"typescript": "^5.9.3"
|
|
39
|
+
"mocha": "^11.7.5"
|
|
41
40
|
},
|
|
42
41
|
"devDependencies": {
|
|
43
42
|
"@types/chai": "^5.2.3",
|
|
@@ -47,6 +46,7 @@
|
|
|
47
46
|
"gulp": "^5.0.1",
|
|
48
47
|
"gulp-uglify-es": "^3.0.0",
|
|
49
48
|
"pump": "^3.0.3",
|
|
50
|
-
"rimraf": "^6.1.2"
|
|
49
|
+
"rimraf": "^6.1.2",
|
|
50
|
+
"typescript": "^5.9.3"
|
|
51
51
|
}
|
|
52
52
|
}
|
package/transformers/case.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ import type { jxf_transformer_t } from '../types';
|
|
|
8
8
|
* @returns {jxf_transformer_t} A jxf transformer function.
|
|
9
9
|
* @module \@lytical/jxf/transformers/case
|
|
10
10
|
* @example
|
|
11
|
-
* import { jxf_case } from '@lytical/jxf
|
|
12
|
-
* import jxf from '@lytical/jxf
|
|
11
|
+
* import { jxf_case } from '@lytical/jxf';
|
|
12
|
+
* import jxf from '@lytical/jxf';
|
|
13
13
|
*
|
|
14
14
|
* const data = { age: 25 };
|
|
15
15
|
* const transform = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"case.d.ts","sourceRoot":"","sources":["../../src/transformers/case.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"case.d.ts","sourceRoot":"","sources":["../../src/transformers/case.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAIlD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,CAAC,iBAAiB,GAAG,MAAM,CAAC,EAAE,GACxC,iBAAiB,CAKnB"}
|
package/transformers/case.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"case.js","sourceRoot":"","sources":["../../src/transformers/case.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAEF,OAAO,KAAK,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"case.js","sourceRoot":"","sources":["../../src/transformers/case.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAEF,OAAO,KAAK,MAAM,QAAQ,CAAC;AAI3B,OAAO,GAAG,MAAM,aAAa,CAAC;AAE9B;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,QAAQ,CACtB,KAAa,EACb,SAAyC;IAEzC,OAAO,CAAC,IAAI,EAAE,GAAG,EAAY,EAAE;QAC7B,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,CAAC;QAChD,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,kCAAO,GAAG,KAAE,KAAK,EAAE,GAAG,IAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACjE,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -5,7 +5,7 @@ import type { jxf_transformer_t } from '../types';
|
|
|
5
5
|
* A transformer that iterates over each item in the array resolved by the match expression,
|
|
6
6
|
* applying the given transform to each item.
|
|
7
7
|
* @example
|
|
8
|
-
* import { jxf_for_each, jxf_value_of } from '@lytical/jxf
|
|
8
|
+
* import { jxf_for_each, jxf_value_of } from '@lytical/jxf';
|
|
9
9
|
* const data = { names: ['Alice', 'Bob', 'Charlie'] };
|
|
10
10
|
* const transform = [
|
|
11
11
|
* 'Names:',
|
|
@@ -5,7 +5,7 @@ import type { jxf_transformer_t } from '../types';
|
|
|
5
5
|
* A transformer that iterates over each key in the object resolved by the match expression,
|
|
6
6
|
* applying the given transform to each key.
|
|
7
7
|
* @example
|
|
8
|
-
* import { jxf_for_key } from '@lytical/jxf
|
|
8
|
+
* import { jxf_for_key } from '@lytical/jxf';
|
|
9
9
|
* const data = { age: 25, name: 'Alice' };
|
|
10
10
|
* const transform = [
|
|
11
11
|
* 'Keys:',
|
package/transformers/if.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { jxf_transformer_t } from '../types';
|
|
|
4
4
|
* @description
|
|
5
5
|
* A transformer that conditionally applies the given transform to the data if the match expression evaluates to a truthy value.
|
|
6
6
|
* @example
|
|
7
|
-
* import { jxf_if, jxf_value_of } from '@lytical/jxf
|
|
7
|
+
* import { jxf_if, jxf_value_of } from '@lytical/jxf';
|
|
8
8
|
* const data = { age: 25 };
|
|
9
9
|
* const transform = [
|
|
10
10
|
* jxf_if('.age > 18', ['You are an adult.']),
|
package/transformers/if.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"if.d.ts","sourceRoot":"","sources":["../../src/transformers/if.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"if.d.ts","sourceRoot":"","sources":["../../src/transformers/if.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAIlD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CACpB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,CAAC,iBAAiB,GAAG,MAAM,CAAC,EAAE,GACxC,iBAAiB,CAKnB"}
|
package/transformers/if.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"if.js","sourceRoot":"","sources":["../../src/transformers/if.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAEF,OAAO,KAAK,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"if.js","sourceRoot":"","sources":["../../src/transformers/if.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAEF,OAAO,KAAK,MAAM,QAAQ,CAAC;AAI3B,OAAO,GAAG,MAAM,aAAa,CAAC;AAE9B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,MAAM,CACpB,KAAa,EACb,SAAyC;IAEzC,OAAO,CAAC,IAAI,EAAE,GAAG,EAAY,EAAE;QAC7B,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QACtC,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,kCAAO,GAAG,KAAE,KAAK,EAAE,GAAG,IAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACjE,CAAC,CAAC;AACJ,CAAC"}
|
package/transformers/length.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { jxf_transformer_t } from '../types';
|
|
|
4
4
|
* @description
|
|
5
5
|
* A transformer that computes the length of the array or string resolved by the match expression.
|
|
6
6
|
* @example
|
|
7
|
-
* import { jxf_length } from '@lytical/jxf
|
|
7
|
+
* import { jxf_length } from '@lytical/jxf';
|
|
8
8
|
* @param match a jspath expression that resolves to an array or string
|
|
9
9
|
* @returns {jxf_transformer_t} A jxf transformer function.
|
|
10
10
|
*/
|
package/transformers/switch.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { jxf_transformer_t } from '../types';
|
|
|
4
4
|
* @description
|
|
5
5
|
* A transformer that evaluates the match expression and applies the first case transform that matches.
|
|
6
6
|
* @example
|
|
7
|
-
* import { jxf_switch, jxf_case } from '@lytical/jxf
|
|
7
|
+
* import { jxf_switch, jxf_case } from '@lytical/jxf';
|
|
8
8
|
* const data = { age: 25 };
|
|
9
9
|
* const transform = [
|
|
10
10
|
* jxf_switch('.age', [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/transformers/switch.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/transformers/switch.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAIlD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,CAAC,iBAAiB,GAAG,MAAM,CAAC,EAAE,GACxC,iBAAiB,CAWnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../src/transformers/switch.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAEF,OAAO,KAAK,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../src/transformers/switch.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAEF,OAAO,KAAK,MAAM,QAAQ,CAAC;AAI3B,OAAO,GAAG,MAAM,aAAa,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,UAAU,CACxB,KAAa,EACb,SAAyC;IAEzC,OAAO,CAAC,IAAI,EAAE,GAAG,EAAY,EAAE;QAC7B,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QACtC,KAAK,MAAM,CAAC,IAAI,SAAS,EAAE,CAAC;YAC1B,MAAM,EAAE,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,kCAAO,GAAG,KAAE,OAAO,EAAE,GAAG,IAAG,CAAC;YACpD,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACpB,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -4,7 +4,7 @@ import type { jxf_transformer_t } from '../types';
|
|
|
4
4
|
* @description
|
|
5
5
|
* A transformer that extracts the value resolved by the match expression and formats it as a string.
|
|
6
6
|
* @example
|
|
7
|
-
* import { jxf_value_of } from '@lytical/jxf
|
|
7
|
+
* import { jxf_value_of } from '@lytical/jxf';
|
|
8
8
|
* const data = { name: 'John Doe' };
|
|
9
9
|
* const transform = [
|
|
10
10
|
* jxf_value_of('.name', (val) => `Name: ${val}`),
|
|
@@ -4,7 +4,7 @@ import type { jxf_transformer_t } from '../types';
|
|
|
4
4
|
* @description
|
|
5
5
|
* A transformer that defines a variable in the transformation context by evaluating the match expression.
|
|
6
6
|
* @example
|
|
7
|
-
* import { jxf_variable, jxf_value_of } from '@lytical/jxf
|
|
7
|
+
* import { jxf_variable, jxf_value_of } from '@lytical/jxf';
|
|
8
8
|
* const data = { first_name: 'John', last_name: 'Doe' };
|
|
9
9
|
* const transform = [
|
|
10
10
|
* jxf_variable('fullName', '.first_name + " " + .last_name'),
|
package/transformers/with.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { jxf_transformer_t } from '../types';
|
|
|
4
4
|
* @description
|
|
5
5
|
* A transformer that changes the context to the value resolved by the match expression and applies the given transform.
|
|
6
6
|
* @example
|
|
7
|
-
* import { jxf_with, jxf_value_of } from '@lytical/jxf
|
|
7
|
+
* import { jxf_with, jxf_value_of } from '@lytical/jxf';
|
|
8
8
|
* const data = { user: { name: 'John Doe', age: 30 } };
|
|
9
9
|
* const transform = [
|
|
10
10
|
* jxf_with('.user', [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with.d.ts","sourceRoot":"","sources":["../../src/transformers/with.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"with.d.ts","sourceRoot":"","sources":["../../src/transformers/with.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAIlD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,CAAC,iBAAiB,GAAG,MAAM,CAAC,EAAE,GACxC,iBAAiB,CAKnB"}
|
package/transformers/with.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with.js","sourceRoot":"","sources":["../../src/transformers/with.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAEF,OAAO,KAAK,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"with.js","sourceRoot":"","sources":["../../src/transformers/with.ts"],"names":[],"mappings":"AAAA;;;;EAIE;AAEF,OAAO,KAAK,MAAM,QAAQ,CAAC;AAI3B,OAAO,GAAG,MAAM,aAAa,CAAC;AAE9B;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,QAAQ,CACtB,KAAa,EACb,SAAyC;IAEzC,OAAO,CAAC,IAAI,EAAE,GAAG,EAAY,EAAE;QAC7B,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QACpC,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,kCAAO,GAAG,KAAE,OAAO,EAAE,IAAI,IAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACnE,CAAC,CAAC;AACJ,CAAC"}
|
package/types.d.ts
CHANGED
|
@@ -39,6 +39,9 @@ export type jxf_ctx_t = Record<string, any>;
|
|
|
39
39
|
export type jxf_transformer_t = (data: any, ctx: jxf_ctx_t) => string[];
|
|
40
40
|
|
|
41
41
|
// the current version of (@types/jspath@0.4.2) is outdated and does not properly exports the default apply() function.
|
|
42
|
+
// once an updated version is available, this module declaration can be removed.
|
|
43
|
+
// for now, you must npm install @types/jspath as a dev dependency to avoid TypeScript errors.
|
|
44
|
+
// see: https://www.npmjs.com/package/@types/jspath
|
|
42
45
|
declare module 'jspath' {
|
|
43
46
|
export default function apply<_t_ = any>(
|
|
44
47
|
path: string,
|