@ls-stack/utils 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dedent.d.ts +1 -1
- package/dist/dedent.js.map +1 -1
- package/package.json +1 -1
package/dist/dedent.d.ts
CHANGED
package/dist/dedent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dedent.ts"],"sourcesContent":["// fork of https://github.com/dmnd/dedent\n\nexport function dedent(
|
|
1
|
+
{"version":3,"sources":["../src/dedent.ts"],"sourcesContent":["// fork of https://github.com/dmnd/dedent\n\nexport function dedent(\n strings: TemplateStringsArray,\n ...values: string[]\n): string;\nexport function dedent(strings: string): string;\nexport function dedent(\n strings: TemplateStringsArray | string,\n ...values: string[]\n) {\n // $FlowFixMe: Flow doesn't undestand .raw\n const raw = typeof strings === 'string' ? [strings] : strings.raw;\n\n // first, perform interpolation\n let result = '';\n for (let i = 0; i < raw.length; i++) {\n result += raw[i]! // join lines when there is a suppressed newline\n .replace(/\\\\\\n[ \\t]*/g, '')\n // handle escaped backticks\n .replace(/\\\\`/g, '`');\n\n if (i < values.length) {\n result += values[i];\n }\n }\n\n // now strip indentation\n const lines = result.split('\\n');\n let mindent: number | null = null;\n lines.forEach((l) => {\n const m = l.match(/^(\\s+)\\S+/);\n if (m) {\n const indent = m[1]!.length;\n if (!mindent) {\n // this is the first indented line\n mindent = indent;\n } else {\n mindent = Math.min(mindent, indent);\n }\n }\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (mindent !== null) {\n const m = mindent; // appease Flow\n result = lines.map((l) => (l.startsWith(' ') ? l.slice(m) : l)).join('\\n');\n }\n\n return (\n result\n // dedent eats leading and trailing whitespace too\n .trim()\n // handle escaped newlines at the end to ensure they don't get stripped too\n .replace(/\\\\n/g, '\\n')\n );\n}\n"],"mappings":";AAOO,SAAS,OACd,YACG,QACH;AAEA,QAAM,MAAM,OAAO,YAAY,WAAW,CAAC,OAAO,IAAI,QAAQ;AAG9D,MAAI,SAAS;AACb,WAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;AACnC,cAAU,IAAI,CAAC,EACZ,QAAQ,eAAe,EAAE,EAEzB,QAAQ,QAAQ,GAAG;AAEtB,QAAI,IAAI,OAAO,QAAQ;AACrB,gBAAU,OAAO,CAAC;AAAA,IACpB;AAAA,EACF;AAGA,QAAM,QAAQ,OAAO,MAAM,IAAI;AAC/B,MAAI,UAAyB;AAC7B,QAAM,QAAQ,CAAC,MAAM;AACnB,UAAM,IAAI,EAAE,MAAM,WAAW;AAC7B,QAAI,GAAG;AACL,YAAM,SAAS,EAAE,CAAC,EAAG;AACrB,UAAI,CAAC,SAAS;AAEZ,kBAAU;AAAA,MACZ,OAAO;AACL,kBAAU,KAAK,IAAI,SAAS,MAAM;AAAA,MACpC;AAAA,IACF;AAAA,EACF,CAAC;AAGD,MAAI,YAAY,MAAM;AACpB,UAAM,IAAI;AACV,aAAS,MAAM,IAAI,CAAC,MAAO,EAAE,WAAW,GAAG,IAAI,EAAE,MAAM,CAAC,IAAI,CAAE,EAAE,KAAK,IAAI;AAAA,EAC3E;AAEA,SACE,OAEG,KAAK,EAEL,QAAQ,QAAQ,IAAI;AAE3B;","names":[]}
|