Skip to content

Commit c015d65

Browse files
committed
Arrays in content
1 parent c10cccf commit c015d65

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

dist/plugins/webson.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,16 @@ EasyCoder.domain.webson = EasyCoder_Webson;
271271
break;
272272
case `#content`:
273273
// Handle the content of the element
274-
const val = Webson.expand(element, value, symbols);
274+
// If it's an array, expand it and catenate the elements
275+
var val;
276+
if (Array.isArray(value)) {
277+
for (const item of value) {
278+
val += Webson.expand(element, item, symbols);
279+
}
280+
} else {
281+
val = Webson.expand(element, value, symbols);
282+
}
283+
// const val = Webson.expand(element, value, symbols);
275284
if (symbols[`#debug`] >= 2) {
276285
console.log(`#content: ${value} -> ${val}`);
277286
}

js/plugins/webson.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,16 @@ EasyCoder.domain.webson = EasyCoder_Webson;
271271
break;
272272
case `#content`:
273273
// Handle the content of the element
274-
const val = Webson.expand(element, value, symbols);
274+
// If it's an array, expand it and catenate the elements
275+
var val;
276+
if (Array.isArray(value)) {
277+
for (const item of value) {
278+
val += Webson.expand(element, item, symbols);
279+
}
280+
} else {
281+
val = Webson.expand(element, value, symbols);
282+
}
283+
// const val = Webson.expand(element, value, symbols);
275284
if (symbols[`#debug`] >= 2) {
276285
console.log(`#content: ${value} -> ${val}`);
277286
}

0 commit comments

Comments
 (0)