@appsemble/lang-sdk 0.34.2 → 0.34.5-test.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/examples.js +7 -0
- package/package.json +1 -1
- package/reference-schemas/remappers/arrays.js +9 -0
- package/remap.js +6 -0
- package/types/remapper.d.ts +6 -0
package/examples.js
CHANGED
|
@@ -201,6 +201,13 @@ export const examples = {
|
|
|
201
201
|
},
|
|
202
202
|
result: ['Peter', 'Otto', 'Harry'],
|
|
203
203
|
},
|
|
204
|
+
'array.join': {
|
|
205
|
+
input: ["id eq '5'", "id eq '6'", "id eq '7'"],
|
|
206
|
+
remapper: {
|
|
207
|
+
'array.join': ' or ',
|
|
208
|
+
},
|
|
209
|
+
result: "id eq '5' or id eq '6' or id eq '7'",
|
|
210
|
+
},
|
|
204
211
|
'array.map': {
|
|
205
212
|
input: [
|
|
206
213
|
{
|
package/package.json
CHANGED
|
@@ -25,6 +25,15 @@ return the full object with the data we want in the \`then\` section. It’s als
|
|
|
25
25
|
This results in an array consisting of \`null\` values and objects with actual data in them. To solve
|
|
26
26
|
this problem, we use the \`null.strip\` remapper to remove any null values which results in a clean
|
|
27
27
|
array.
|
|
28
|
+
`,
|
|
29
|
+
},
|
|
30
|
+
'array.join': {
|
|
31
|
+
type: 'string',
|
|
32
|
+
description: `Join the items of an array using the input separator, a comma(,) is used if no separator is provided.
|
|
33
|
+
|
|
34
|
+
If the input is not an array, input is returned without any modifications.
|
|
35
|
+
|
|
36
|
+
${schemaExample('array.join')}
|
|
28
37
|
`,
|
|
29
38
|
},
|
|
30
39
|
'array.unique': {
|
package/remap.js
CHANGED
|
@@ -319,6 +319,12 @@ const mapperImplementations = {
|
|
|
319
319
|
}
|
|
320
320
|
return input.includes(remapped);
|
|
321
321
|
},
|
|
322
|
+
'array.join'(separator, input) {
|
|
323
|
+
if (!Array.isArray(input)) {
|
|
324
|
+
return input;
|
|
325
|
+
}
|
|
326
|
+
return input.join(separator ?? undefined);
|
|
327
|
+
},
|
|
322
328
|
'array.unique'(mapper, input, context) {
|
|
323
329
|
if (!Array.isArray(input)) {
|
|
324
330
|
return input;
|
package/types/remapper.d.ts
CHANGED
|
@@ -422,6 +422,12 @@ export interface Remappers {
|
|
|
422
422
|
*
|
|
423
423
|
*/
|
|
424
424
|
'array.contains': Remapper;
|
|
425
|
+
/**
|
|
426
|
+
* Join the items of an array using the input separator,
|
|
427
|
+
* If No separator is provided, ',' is used.
|
|
428
|
+
*
|
|
429
|
+
*/
|
|
430
|
+
'array.join': string | null;
|
|
425
431
|
/**
|
|
426
432
|
* This remapper return true if the provided string is a substring of the input string.
|
|
427
433
|
*
|