UNPKG

715 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.arrayToString = void 0;
4/**
5 * Stringify an array of values.
6 */
7const arrayToString = (array, space, next) => {
8 // Map array values to their stringified values with correct indentation.
9 const values = array
10 .map(function (value, index) {
11 const result = next(value, index);
12 if (result === undefined)
13 return String(result);
14 return space + result.split("\n").join(`\n${space}`);
15 })
16 .join(space ? ",\n" : ",");
17 const eol = space && values ? "\n" : "";
18 return `[${eol}${values}${eol}]`;
19};
20exports.arrayToString = arrayToString;
21//# sourceMappingURL=array.js.map
\No newline at end of file