array.js 646 B

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