array.js 715 B

123456789101112131415161718192021
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.arrayToString = void 0;
  4. /**
  5. * Stringify an array of values.
  6. */
  7. const 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. };
  20. exports.arrayToString = arrayToString;
  21. //# sourceMappingURL=array.js.map