string-intern.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. (function (factory) {
  2. if (typeof module === "object" && typeof module.exports === "object") {
  3. var v = factory(require, exports);
  4. if (v !== undefined) module.exports = v;
  5. }
  6. else if (typeof define === "function" && define.amd) {
  7. define(["require", "exports"], factory);
  8. }
  9. })(function (require, exports) {
  10. "use strict";
  11. Object.defineProperty(exports, "__esModule", { value: true });
  12. exports.supportedEols = exports.cachedBreakLinesWithSpaces = exports.cachedSpaces = void 0;
  13. exports.cachedSpaces = new Array(20).fill(0).map((_, index) => {
  14. return ' '.repeat(index);
  15. });
  16. const maxCachedValues = 200;
  17. exports.cachedBreakLinesWithSpaces = {
  18. ' ': {
  19. '\n': new Array(maxCachedValues).fill(0).map((_, index) => {
  20. return '\n' + ' '.repeat(index);
  21. }),
  22. '\r': new Array(maxCachedValues).fill(0).map((_, index) => {
  23. return '\r' + ' '.repeat(index);
  24. }),
  25. '\r\n': new Array(maxCachedValues).fill(0).map((_, index) => {
  26. return '\r\n' + ' '.repeat(index);
  27. }),
  28. },
  29. '\t': {
  30. '\n': new Array(maxCachedValues).fill(0).map((_, index) => {
  31. return '\n' + '\t'.repeat(index);
  32. }),
  33. '\r': new Array(maxCachedValues).fill(0).map((_, index) => {
  34. return '\r' + '\t'.repeat(index);
  35. }),
  36. '\r\n': new Array(maxCachedValues).fill(0).map((_, index) => {
  37. return '\r\n' + '\t'.repeat(index);
  38. }),
  39. }
  40. };
  41. exports.supportedEols = ['\n', '\r', '\r\n'];
  42. });