jtlt 0.2.0 → 0.3.0
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/CHANGES.md +18 -0
- package/README.md +16 -87
- package/demo/calltemplate-params-demo.js +138 -0
- package/demo/index.html +31 -0
- package/demo/index.js +30 -0
- package/demo/xpath2-placeholder.js +1 -0
- package/dist/AbstractJoiningTransformer.d.ts +83 -9
- package/dist/AbstractJoiningTransformer.d.ts.map +1 -1
- package/dist/DOMJoiningTransformer.d.ts +85 -25
- package/dist/DOMJoiningTransformer.d.ts.map +1 -1
- package/dist/JSONJoiningTransformer.d.ts +159 -51
- package/dist/JSONJoiningTransformer.d.ts.map +1 -1
- package/dist/JSONPathTransformer.d.ts +37 -38
- package/dist/JSONPathTransformer.d.ts.map +1 -1
- package/dist/JSONPathTransformerContext.d.ts +247 -121
- package/dist/JSONPathTransformerContext.d.ts.map +1 -1
- package/dist/StringJoiningTransformer.d.ts +132 -41
- package/dist/StringJoiningTransformer.d.ts.map +1 -1
- package/dist/XPathTransformer.d.ts +35 -20
- package/dist/XPathTransformer.d.ts.map +1 -1
- package/dist/XPathTransformerContext.d.ts +191 -99
- package/dist/XPathTransformerContext.d.ts.map +1 -1
- package/dist/index-browser.d.ts +4 -0
- package/dist/index-browser.d.ts.map +1 -0
- package/dist/index-node.d.ts +4 -0
- package/dist/index-node.d.ts.map +1 -0
- package/dist/index.d.ts +330 -57
- package/dist/index.d.ts.map +1 -1
- package/dist/types.d.ts +204 -0
- package/dist/types.d.ts.map +1 -0
- package/docs/API.expanded.md +167 -2
- package/docs/API.md +91 -1
- package/docs/TO-DO.md +144 -0
- package/docs/calltemplate-params.md +251 -0
- package/eslint.config.js +9 -5
- package/package.json +13 -7
- package/pnpm-workspace.yaml +1 -0
- package/src/AbstractJoiningTransformer.js +54 -15
- package/src/DOMJoiningTransformer.js +275 -28
- package/src/JSONJoiningTransformer.js +351 -70
- package/src/JSONPathTransformer.js +48 -30
- package/src/JSONPathTransformerContext.js +308 -104
- package/src/StringJoiningTransformer.js +311 -57
- package/src/XPathTransformer.js +27 -12
- package/src/XPathTransformerContext.js +467 -89
- package/src/index-browser.js +5 -0
- package/src/index-node.js +7 -0
- package/src/index.js +498 -97
- package/typings/xpath2-js.d.ts +40 -1
- package/src/types/xpath2-js.d.ts +0 -2
|
@@ -1,4 +1,29 @@
|
|
|
1
1
|
export default XPathTransformerContext;
|
|
2
|
+
export type XPathTransformerContextConfig = {
|
|
3
|
+
/**
|
|
4
|
+
* - XML/DOM root to transform
|
|
5
|
+
*/
|
|
6
|
+
data?: unknown;
|
|
7
|
+
/**
|
|
8
|
+
* - 1 or 2 (default 1)
|
|
9
|
+
*/
|
|
10
|
+
xpathVersion?: number | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Joiner
|
|
13
|
+
*/
|
|
14
|
+
joiningTransformer: import("./index.js").JoiningTransformer;
|
|
15
|
+
errorOnEqualPriority?: boolean | undefined;
|
|
16
|
+
specificityPriorityResolver?: ((path: string) => number) | undefined;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {object} XPathTransformerContextConfig
|
|
20
|
+
* @property {unknown} [data] - XML/DOM root to transform
|
|
21
|
+
* @property {number} [xpathVersion] - 1 or 2 (default 1)
|
|
22
|
+
* @property {import('./index.js').
|
|
23
|
+
* JoiningTransformer} joiningTransformer Joiner
|
|
24
|
+
* @property {boolean} [errorOnEqualPriority]
|
|
25
|
+
* @property {(path: string) => number} [specificityPriorityResolver]
|
|
26
|
+
*/
|
|
2
27
|
/**
|
|
3
28
|
* Execution context for XPath-driven template application.
|
|
4
29
|
*
|
|
@@ -13,31 +38,27 @@ export default XPathTransformerContext;
|
|
|
13
38
|
* - errorOnEqualPriority, specificityPriorityResolver (same semantics).
|
|
14
39
|
*/
|
|
15
40
|
declare class XPathTransformerContext {
|
|
16
|
-
/**
|
|
17
|
-
* Log a message (for debugging).
|
|
18
|
-
* @param {*} json Any value
|
|
19
|
-
* @returns {void}
|
|
20
|
-
*/
|
|
21
|
-
static message(json: any): void;
|
|
22
41
|
static DefaultTemplateRules: {
|
|
23
42
|
transformRoot: {
|
|
24
43
|
/**
|
|
25
|
-
* @
|
|
44
|
+
* @this {XPathTransformerContext}
|
|
45
|
+
* @param {unknown} node Root node
|
|
26
46
|
* @param {{mode:string}} cfg Config
|
|
27
47
|
* @returns {void}
|
|
28
48
|
*/
|
|
29
|
-
template(node:
|
|
49
|
+
template(this: XPathTransformerContext, node: unknown, cfg: {
|
|
30
50
|
mode: string;
|
|
31
51
|
}): void;
|
|
32
52
|
};
|
|
33
53
|
transformElements: {
|
|
34
54
|
/**
|
|
35
|
-
* @
|
|
36
|
-
* @param {
|
|
55
|
+
* @this {XPathTransformerContext}
|
|
56
|
+
* @param {unknown} node Element node
|
|
57
|
+
* @param {{mode?:string}} cfg Config
|
|
37
58
|
* @returns {void}
|
|
38
59
|
*/
|
|
39
|
-
template(node:
|
|
40
|
-
mode
|
|
60
|
+
template(this: XPathTransformerContext, node: unknown, cfg: {
|
|
61
|
+
mode?: string;
|
|
41
62
|
}): void;
|
|
42
63
|
};
|
|
43
64
|
transformTextNodes: {
|
|
@@ -50,114 +71,117 @@ declare class XPathTransformerContext {
|
|
|
50
71
|
}): string;
|
|
51
72
|
};
|
|
52
73
|
transformScalars: {
|
|
53
|
-
/**
|
|
54
|
-
|
|
74
|
+
/**
|
|
75
|
+
* @this {XPathTransformerContext}
|
|
76
|
+
* @returns {XPathTransformerContext}
|
|
77
|
+
*/
|
|
78
|
+
template(this: XPathTransformerContext): XPathTransformerContext;
|
|
55
79
|
};
|
|
56
80
|
};
|
|
57
81
|
/**
|
|
58
|
-
* @param {
|
|
59
|
-
* @param {
|
|
60
|
-
*
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
string: Function;
|
|
78
|
-
object: Function;
|
|
79
|
-
array: Function;
|
|
80
|
-
};
|
|
81
|
-
errorOnEqualPriority?: boolean | undefined;
|
|
82
|
-
specificityPriorityResolver?: Function | undefined;
|
|
83
|
-
}, templates: any[]);
|
|
84
|
-
_config: {
|
|
85
|
-
data: Document | Element | any;
|
|
86
|
-
xpathVersion?: number | undefined;
|
|
87
|
-
joiningTransformer: {
|
|
88
|
-
append: Function;
|
|
89
|
-
get: Function;
|
|
90
|
-
string: Function;
|
|
91
|
-
object: Function;
|
|
92
|
-
array: Function;
|
|
93
|
-
};
|
|
94
|
-
errorOnEqualPriority?: boolean | undefined;
|
|
95
|
-
specificityPriorityResolver?: Function | undefined;
|
|
96
|
-
};
|
|
97
|
-
_templates: any[];
|
|
98
|
-
_contextNode: any;
|
|
99
|
-
_origNode: any;
|
|
100
|
-
/** @type {Record<string, any>} */
|
|
101
|
-
vars: Record<string, any>;
|
|
102
|
-
/** @type {Record<string, any>} */
|
|
103
|
-
propertySets: Record<string, any>;
|
|
104
|
-
/** @type {Record<string, any>} */
|
|
105
|
-
keys: Record<string, any>;
|
|
82
|
+
* @param {XPathTransformerContextConfig} config
|
|
83
|
+
* @param {import('./index.js').
|
|
84
|
+
* XPathTemplateObject<any>[]} templates - Template objects
|
|
85
|
+
*/
|
|
86
|
+
constructor(config: XPathTransformerContextConfig, templates: import("./index.js").XPathTemplateObject<any>[]);
|
|
87
|
+
_config: XPathTransformerContextConfig;
|
|
88
|
+
_templates: import("./index.js").XPathTemplateObject<any>[];
|
|
89
|
+
/** @type {Document|Element|Node} */
|
|
90
|
+
_contextNode: Document | Element | Node;
|
|
91
|
+
_origNode: Document | Element | Node;
|
|
92
|
+
/** @type {Record<string, unknown>} */
|
|
93
|
+
vars: Record<string, unknown>;
|
|
94
|
+
/** @type {Record<string, Record<string, unknown>>} */
|
|
95
|
+
propertySets: Record<string, Record<string, unknown>>;
|
|
96
|
+
/** @type {Record<string, {match: string, use: string}>} */
|
|
97
|
+
keys: Record<string, {
|
|
98
|
+
match: string;
|
|
99
|
+
use: string;
|
|
100
|
+
}>;
|
|
106
101
|
/** @type {boolean|undefined} */
|
|
107
102
|
_initialized: boolean | undefined;
|
|
108
103
|
/** @type {string|undefined} */
|
|
109
104
|
_currPath: string | undefined;
|
|
110
|
-
/** @
|
|
111
|
-
|
|
105
|
+
/** @type {Record<string, any> | undefined} */
|
|
106
|
+
_params: Record<string, any> | undefined;
|
|
107
|
+
/** @returns {import('./index.js').JoiningTransformer} */
|
|
108
|
+
_getJoiningTransformer(): import("./index.js").JoiningTransformer;
|
|
112
109
|
/**
|
|
113
110
|
* Evaluate an XPath expression against the current context node.
|
|
114
111
|
* @param {string} expr - XPath expression
|
|
115
|
-
|
|
116
|
-
* @returns {
|
|
112
|
+
* @param {boolean} [asNodes] Return nodes (array) instead of scalar
|
|
113
|
+
* @returns {unknown}
|
|
117
114
|
*/
|
|
118
|
-
_evalXPath(expr: string, asNodes?: boolean):
|
|
115
|
+
_evalXPath(expr: string, asNodes?: boolean): unknown;
|
|
119
116
|
/**
|
|
120
117
|
* Append raw item to output.
|
|
121
|
-
* @param {
|
|
118
|
+
* @param {unknown} item
|
|
122
119
|
* @returns {XPathTransformerContext}
|
|
123
120
|
*/
|
|
124
|
-
appendOutput(item:
|
|
125
|
-
/** @returns {
|
|
126
|
-
getOutput():
|
|
121
|
+
appendOutput(item: unknown): XPathTransformerContext;
|
|
122
|
+
/** @returns {unknown} */
|
|
123
|
+
getOutput(): unknown;
|
|
127
124
|
/**
|
|
128
125
|
* Get value(s) by XPath relative to current context.
|
|
129
126
|
* @param {string} select - XPath expression
|
|
130
127
|
* @param {boolean} [asNodes]
|
|
131
|
-
* @returns {
|
|
128
|
+
* @returns {Node[]}
|
|
132
129
|
*/
|
|
133
|
-
get(select: string, asNodes?: boolean):
|
|
130
|
+
get(select: string, asNodes?: boolean): Node[];
|
|
134
131
|
/**
|
|
135
132
|
* Set current context's parent property (for parity with JSONPath context).
|
|
136
133
|
* Mostly placeholder for object-mirroring behavior.
|
|
137
|
-
* @param {
|
|
134
|
+
* @param {Document|Element|Node} v
|
|
138
135
|
* @returns {XPathTransformerContext}
|
|
139
136
|
*/
|
|
140
|
-
set(v:
|
|
137
|
+
set(v: Document | Element | Node): XPathTransformerContext;
|
|
141
138
|
/**
|
|
142
139
|
* Apply templates to nodes matched by an XPath expression.
|
|
143
|
-
* @param {string} select - XPath expression (default '.')
|
|
140
|
+
* @param {string} [select] - XPath expression (default '.')
|
|
144
141
|
* @param {string} [mode]
|
|
145
142
|
* @returns {XPathTransformerContext}
|
|
146
143
|
*/
|
|
147
|
-
applyTemplates(select
|
|
144
|
+
applyTemplates(select?: string, mode?: string): XPathTransformerContext;
|
|
145
|
+
/**
|
|
146
|
+
* @param {string|
|
|
147
|
+
* {name: string, withParam?: any[]}} name - Template name or
|
|
148
|
+
* options object
|
|
149
|
+
* @param {any[]} [withParams] - Parameters to pass to template
|
|
150
|
+
* @returns {this}
|
|
151
|
+
*/
|
|
152
|
+
callTemplate(name: string | {
|
|
153
|
+
name: string;
|
|
154
|
+
withParam?: any[];
|
|
155
|
+
}, withParams?: any[]): this;
|
|
148
156
|
/**
|
|
149
157
|
* Iterate over nodes selected by XPath.
|
|
150
158
|
* @param {string} select - XPath expression
|
|
151
|
-
* @param {
|
|
159
|
+
* @param {(this: XPathTransformerContext,
|
|
160
|
+
* node: Node
|
|
161
|
+
* )=>void} cb - Callback invoked per node
|
|
152
162
|
* @returns {XPathTransformerContext}
|
|
153
163
|
*/
|
|
154
|
-
forEach(select: string, cb:
|
|
164
|
+
forEach(select: string, cb: (this: XPathTransformerContext, node: Node) => void): XPathTransformerContext;
|
|
155
165
|
/**
|
|
156
166
|
* Append the value from an XPath expression or the context node text.
|
|
157
167
|
* @param {string|object} [select]
|
|
158
168
|
* @returns {XPathTransformerContext}
|
|
159
169
|
*/
|
|
160
170
|
valueOf(select?: string | object): XPathTransformerContext;
|
|
171
|
+
/**
|
|
172
|
+
* Deep copy selection or current context when omitted.
|
|
173
|
+
* For DOM nodes uses cloneNode(true); for scalars copies the value.
|
|
174
|
+
* @param {string} [select] XPath expression selecting nodes (optional)
|
|
175
|
+
* @returns {XPathTransformerContext}
|
|
176
|
+
*/
|
|
177
|
+
copyOf(select?: string): XPathTransformerContext;
|
|
178
|
+
/**
|
|
179
|
+
* Shallow copy current context node (cloneNode(false)); scalars copied
|
|
180
|
+
* directly. Provided for parity with JSONPath copy().
|
|
181
|
+
* @param {string[]} [_propertySets] Ignored in XPath variant (parity only)
|
|
182
|
+
* @returns {XPathTransformerContext}
|
|
183
|
+
*/
|
|
184
|
+
copy(_propertySets?: string[]): XPathTransformerContext;
|
|
161
185
|
/**
|
|
162
186
|
* Define a variable by XPath selection (stores node array if nodes).
|
|
163
187
|
* @param {string} name Variable name
|
|
@@ -165,13 +189,19 @@ declare class XPathTransformerContext {
|
|
|
165
189
|
* @returns {XPathTransformerContext}
|
|
166
190
|
*/
|
|
167
191
|
variable(name: string, select: string): XPathTransformerContext;
|
|
192
|
+
/**
|
|
193
|
+
* Log a message (for debugging).
|
|
194
|
+
* @param {unknown} json Any value
|
|
195
|
+
* @returns {void}
|
|
196
|
+
*/
|
|
197
|
+
message(json: unknown): void;
|
|
168
198
|
/**
|
|
169
199
|
* Append string.
|
|
170
200
|
* @param {string} str String to append
|
|
171
|
-
* @param {
|
|
201
|
+
* @param {(this: XPathTransformerContext) => void} [cb] Callback
|
|
172
202
|
* @returns {XPathTransformerContext}
|
|
173
203
|
*/
|
|
174
|
-
string(str: string, cb?:
|
|
204
|
+
string(str: string, cb?: (this: XPathTransformerContext) => void): XPathTransformerContext;
|
|
175
205
|
/**
|
|
176
206
|
* Append number.
|
|
177
207
|
* @param {number} num Number
|
|
@@ -187,65 +217,96 @@ declare class XPathTransformerContext {
|
|
|
187
217
|
/**
|
|
188
218
|
* Append property/value pair.
|
|
189
219
|
* @param {string} prop Property name
|
|
190
|
-
* @param {
|
|
220
|
+
* @param {any} val Value
|
|
191
221
|
* @returns {XPathTransformerContext}
|
|
192
222
|
*/
|
|
193
223
|
propValue(prop: string, val: any): XPathTransformerContext;
|
|
194
224
|
/**
|
|
195
225
|
* Append object.
|
|
196
|
-
* @param {
|
|
226
|
+
* @param {Record<string, unknown>|
|
|
227
|
+
* ((this: XPathTransformerContext) => void)} objOrCb Object or callback
|
|
228
|
+
* @param {((this: XPathTransformerContext) => void)|
|
|
229
|
+
* any[]} [cbOrUsePropertySets] Callback or property sets
|
|
230
|
+
* @param {any[]|
|
|
231
|
+
* Record<string, unknown>} [usePropertySetsOrPropSets]
|
|
232
|
+
* Property sets or props
|
|
233
|
+
* @param {Record<string, unknown>} [propSets] Additional property sets
|
|
197
234
|
* @returns {XPathTransformerContext}
|
|
198
235
|
*/
|
|
199
|
-
object(
|
|
236
|
+
object(objOrCb: Record<string, unknown> | ((this: XPathTransformerContext) => void), cbOrUsePropertySets?: ((this: XPathTransformerContext) => void) | any[], usePropertySetsOrPropSets?: any[] | Record<string, unknown>, propSets?: Record<string, unknown>): XPathTransformerContext;
|
|
200
237
|
/**
|
|
201
238
|
* Append array.
|
|
202
|
-
* @param {
|
|
239
|
+
* @param {any[]|
|
|
240
|
+
* ((this: XPathTransformerContext) => void)} [arrOrCb]
|
|
241
|
+
* Array or callback
|
|
242
|
+
* @param {(this: XPathTransformerContext) => void} [cb] Callback
|
|
243
|
+
* @returns {XPathTransformerContext}
|
|
244
|
+
*/
|
|
245
|
+
array(arrOrCb?: any[] | ((this: XPathTransformerContext) => void), cb?: (this: XPathTransformerContext) => void): XPathTransformerContext;
|
|
246
|
+
/**
|
|
247
|
+
* Append text node content.
|
|
248
|
+
* @param {import('./StringJoiningTransformer.js').OutputConfig} cfg Text
|
|
203
249
|
* @returns {XPathTransformerContext}
|
|
204
250
|
*/
|
|
205
|
-
|
|
251
|
+
output(cfg: import("./StringJoiningTransformer.js").OutputConfig): XPathTransformerContext;
|
|
206
252
|
/**
|
|
207
253
|
* Append element.
|
|
208
254
|
* @param {string} name Tag name
|
|
209
|
-
* @param {
|
|
210
|
-
*
|
|
211
|
-
* @param {
|
|
255
|
+
* @param {Record<string, string>|any[]|
|
|
256
|
+
* ((this: XPathTransformerContext)=>void)} [atts] Attributes
|
|
257
|
+
* @param {any[]|((this: XPathTransformerContext)=>void)} [children]
|
|
258
|
+
* Children
|
|
259
|
+
* @param {(this: XPathTransformerContext)=>void} [cb] Callback
|
|
212
260
|
* @returns {XPathTransformerContext}
|
|
213
261
|
*/
|
|
214
|
-
element(name: string, atts?:
|
|
262
|
+
element(name: string, atts?: Record<string, string> | any[] | ((this: XPathTransformerContext) => void), children?: any[] | ((this: XPathTransformerContext) => void), cb?: (this: XPathTransformerContext) => void): XPathTransformerContext;
|
|
215
263
|
/**
|
|
216
264
|
* Append attribute.
|
|
217
265
|
* @param {string} name Attribute name
|
|
218
|
-
* @param {string|
|
|
266
|
+
* @param {string|Record<string, unknown>} val Value
|
|
219
267
|
* @param {boolean} [avoid] Avoid duplicates
|
|
220
268
|
* @returns {XPathTransformerContext}
|
|
221
269
|
*/
|
|
222
|
-
attribute(name: string, val: string |
|
|
270
|
+
attribute(name: string, val: string | Record<string, unknown>, avoid?: boolean): XPathTransformerContext;
|
|
223
271
|
/**
|
|
224
272
|
* Append text node content.
|
|
225
273
|
* @param {string} txt Text
|
|
226
274
|
* @returns {XPathTransformerContext}
|
|
227
275
|
*/
|
|
228
276
|
text(txt: string): XPathTransformerContext;
|
|
277
|
+
/**
|
|
278
|
+
* Append a comment.
|
|
279
|
+
* @param {string} text - Comment text
|
|
280
|
+
* @returns {XPathTransformerContext}
|
|
281
|
+
*/
|
|
282
|
+
comment(text: string): XPathTransformerContext;
|
|
283
|
+
/**
|
|
284
|
+
* Append a processing instruction.
|
|
285
|
+
* @param {string} target - Processing instruction target
|
|
286
|
+
* @param {string} data - Processing instruction data
|
|
287
|
+
* @returns {XPathTransformerContext}
|
|
288
|
+
*/
|
|
289
|
+
processingInstruction(target: string, data: string): XPathTransformerContext;
|
|
229
290
|
/**
|
|
230
291
|
* Define a property set (optionally composed from other sets).
|
|
231
292
|
* @param {string} name Property set name
|
|
232
|
-
* @param {
|
|
293
|
+
* @param {Record<string, unknown>} obj Base properties
|
|
233
294
|
* @param {string[]} [use] Property set names to merge
|
|
234
295
|
* @returns {XPathTransformerContext}
|
|
235
296
|
*/
|
|
236
|
-
propertySet(name: string, obj:
|
|
297
|
+
propertySet(name: string, obj: Record<string, unknown>, use?: string[]): XPathTransformerContext;
|
|
237
298
|
/**
|
|
238
299
|
* Merge properties from a named property set into obj.
|
|
239
|
-
* @param {
|
|
300
|
+
* @param {Record<string, unknown>} obj Target object
|
|
240
301
|
* @param {string} name Property set name
|
|
241
|
-
* @returns {
|
|
302
|
+
* @returns {Record<string, unknown>}
|
|
242
303
|
*/
|
|
243
|
-
_usePropertySets(obj:
|
|
304
|
+
_usePropertySets(obj: Record<string, unknown>, name: string): Record<string, unknown>;
|
|
244
305
|
/**
|
|
245
306
|
* Retrieve a key-mapped node matching a value or return context.
|
|
246
307
|
* @param {string} name Key name
|
|
247
|
-
* @param {
|
|
248
|
-
* @returns {
|
|
308
|
+
* @param {any} value Value to match
|
|
309
|
+
* @returns {any}
|
|
249
310
|
*/
|
|
250
311
|
getKey(name: string, value: any): any;
|
|
251
312
|
/**
|
|
@@ -256,5 +317,36 @@ declare class XPathTransformerContext {
|
|
|
256
317
|
* @returns {XPathTransformerContext}
|
|
257
318
|
*/
|
|
258
319
|
key(name: string, match: string, use: string): XPathTransformerContext;
|
|
320
|
+
/**
|
|
321
|
+
* Conditionally execute a callback when an XPath evaluates to a truthy
|
|
322
|
+
* scalar or a non-empty node set (akin to xsl:if semantics).
|
|
323
|
+
*
|
|
324
|
+
* Truthiness rules:
|
|
325
|
+
* - Node set: length > 0 passes.
|
|
326
|
+
* - Scalar: Boolean(value) must be true.
|
|
327
|
+
*
|
|
328
|
+
* @param {string} select XPath expression
|
|
329
|
+
* @param {(this: XPathTransformerContext)
|
|
330
|
+
* => void} cb Callback invoked if condition passes
|
|
331
|
+
* @returns {XPathTransformerContext}
|
|
332
|
+
*/
|
|
333
|
+
if(select: string, cb: (this: XPathTransformerContext) => void): XPathTransformerContext;
|
|
334
|
+
/**
|
|
335
|
+
* Internal helper: evaluate XPath truthiness like if().
|
|
336
|
+
* @param {string} select
|
|
337
|
+
* @returns {boolean}
|
|
338
|
+
*/
|
|
339
|
+
_passesIf(select: string): boolean;
|
|
340
|
+
/**
|
|
341
|
+
* Conditional with optional fallback (like choose/otherwise).
|
|
342
|
+
* Truthiness same as `if()`.
|
|
343
|
+
* @param {string} select XPath expression
|
|
344
|
+
* @param {(this: XPathTransformerContext)
|
|
345
|
+
* => void} whenCb Callback when condition passes
|
|
346
|
+
* @param {(this: XPathTransformerContext)
|
|
347
|
+
* => void} [otherwiseCb] Callback when condition fails
|
|
348
|
+
* @returns {XPathTransformerContext}
|
|
349
|
+
*/
|
|
350
|
+
choose(select: string, whenCb: (this: XPathTransformerContext) => void, otherwiseCb?: (this: XPathTransformerContext) => void): XPathTransformerContext;
|
|
259
351
|
}
|
|
260
352
|
//# sourceMappingURL=XPathTransformerContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XPathTransformerContext.d.ts","sourceRoot":"","sources":["../src/XPathTransformerContext.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"XPathTransformerContext.d.ts","sourceRoot":"","sources":["../src/XPathTransformerContext.js"],"names":[],"mappings":";;;;;WAKc,OAAO;;;;;;;;wBAEP,OAAO,YAAY,EAC5B,kBAAkB;;0CAEF,MAAM,KAAK,MAAM;;AAPtC;;;;;;;;GAQG;AAEH;;;;;;;;;;;;GAYG;AACH;IAkyBE;;YAEI;;;;;eAKG;0DAHQ,OAAO,OACP;gBAAC,IAAI,EAAC,MAAM,CAAA;aAAC,GACX,IAAI;;;YAOjB;;;;;eAKG;0DAHQ,OAA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AED;;;;;;;;;;;;OAYG;IACH,WALW,MAAM,MACN,CAAC,IAAI,EAAE,uBAAuB,KACjC,IAAI,GACC,uBAAuB,CAQnC;IAED;;;;OAIG;IACH,kBAHW,MAAM,GACJ,OAAO,CA8CnB;IAED;;;;;;;;;OASG;IACH,eAPW,MAAM,UACN,CAAC,IAAI,EAAE,uBAAuB,KACjC,IAAI,gBACD,CAAC,IAAI,EAAE,uBAAuB,KACjC,IAAI,GACC,uBAAuB,CAYnC;CA+CF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-browser.d.ts","sourceRoot":"","sources":["../src/index-browser.js"],"names":[],"mappings":";;iBAA8B,YAAY"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-node.d.ts","sourceRoot":"","sources":["../src/index-node.js"],"names":[],"mappings":";;iBAC8B,YAAY"}
|