@vinicunca/perkakas 1.14.0 → 1.15.0
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/to-camel-case.cjs +1 -1
- package/dist/to-camel-case.js +1 -1
- package/dist/to-kebab-case.cjs +1 -1
- package/dist/to-kebab-case.cjs.map +1 -1
- package/dist/to-kebab-case.js +1 -1
- package/dist/to-kebab-case.js.map +1 -1
- package/dist/to-snake-case.cjs +1 -1
- package/dist/to-snake-case.js +1 -1
- package/dist/to-title-case.cjs +1 -1
- package/dist/to-title-case.js +1 -1
- package/dist/{words-CYZ0Lyko.js → words-B9lX8euz.js} +2 -2
- package/dist/{words-CYZ0Lyko.js.map → words-B9lX8euz.js.map} +1 -1
- package/dist/{words-C8Rd_80F.cjs → words-_h74qi45.cjs} +2 -2
- package/dist/{words-C8Rd_80F.cjs.map → words-_h74qi45.cjs.map} +1 -1
- package/package.json +1 -1
package/dist/to-camel-case.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./words-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./words-_h74qi45.cjs`),t=/[a-z]/u;function n(e,t){return typeof e==`string`?r(e,t):t=>r(t,e)}function r(n,{preserveConsecutiveUppercase:r=!0}={}){return e.t(t.test(n)?n:n.toLowerCase()).map((e,t)=>`${t===0?e[0].toLowerCase():e[0].toUpperCase()}${r?e.slice(1):e.slice(1).toLowerCase()}`).join(``)}exports.toCamelCase=n;
|
|
2
2
|
//# sourceMappingURL=to-camel-case.cjs.map
|
package/dist/to-camel-case.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./words-
|
|
1
|
+
import{t as e}from"./words-B9lX8euz.js";const t=/[a-z]/u;function n(e,t){return typeof e==`string`?r(e,t):t=>r(t,e)}function r(n,{preserveConsecutiveUppercase:r=!0}={}){return e(t.test(n)?n:n.toLowerCase()).map((e,t)=>`${t===0?e[0].toLowerCase():e[0].toUpperCase()}${r?e.slice(1):e.slice(1).toLowerCase()}`).join(``)}export{n as toCamelCase};
|
|
2
2
|
//# sourceMappingURL=to-camel-case.js.map
|
package/dist/to-kebab-case.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./curry.cjs`),t=require(`./words-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./curry.cjs`),t=require(`./words-_h74qi45.cjs`);function n(...t){return e.curry(r,t)}function r(e){return t.t(e).join(`-`).toLowerCase()}exports.toKebabCase=n;
|
|
2
2
|
//# sourceMappingURL=to-kebab-case.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-kebab-case.cjs","names":["curry","words"],"sources":["../src/to-kebab-case.ts"],"sourcesContent":["import type { Join, Words } from 'type-fest';\nimport { curry } from './curry';\nimport { words } from './internal/words';\n\ntype KebabCase<S extends string> = string extends S\n ? string\n : Lowercase<Join<Words<S>, '-'>>;\n\n/**\n * Converts text to **kebab-case** by splitting it into words and joining them\n * back together with hyphens (`-`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * For *COBOL-CASE* use `toUpperCase(toKebabCase(data))`.\n *\n * @param data - A string.\n * @signature\n * toKebabCase(data);\n * @example\n * toKebabCase(\"hello world\"); // \"hello-world\"\n * toKebabCase(\"__HELLO_WORLD__\"); // \"hello-world\"\n * @dataFirst\n * @category String\n */\nexport function toKebabCase<S extends string>(data: S): KebabCase<S>;\n\n/**\n * Converts text to **kebab-case** by splitting it into words and joining them\n * back together with hyphens (`-`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * For *COBOL-CASE* use `toUpperCase(toKebabCase(data))`.\n *\n * @signature\n * toKebabCase()(data);\n * @example\n * pipe(\"hello world\", toKebabCase()); // \"hello-world\"\n * pipe(\"__HELLO_WORLD__\", toKebabCase()); // \"hello-world\"\n * @dataLast\n * @category String\n */\nexport function toKebabCase(): <S extends string>(data: S) => KebabCase<S>;\n\nexport function toKebabCase(...args: ReadonlyArray<unknown>): unknown {\n return curry(toKebabCaseImplementation, args);\n}\n\nfunction toKebabCaseImplementation<S extends string>(data: S): KebabCase<S> {\n return words(data).join('-').toLowerCase();\n}\n"],"mappings":"oIA+DA,SAAgB,EAAY,GAAG,EAAuC,CACpE,OAAOA,EAAAA,MAAM,EAA2B,EAAK,CAG/C,SAAS,EAA4C,EAAuB,
|
|
1
|
+
{"version":3,"file":"to-kebab-case.cjs","names":["curry","words"],"sources":["../src/to-kebab-case.ts"],"sourcesContent":["import type { Join, Words } from 'type-fest';\nimport { curry } from './curry';\nimport { words } from './internal/words';\n\ntype KebabCase<S extends string> = string extends S\n ? string\n : Lowercase<Join<Words<S>, '-'>>;\n\n/**\n * Converts text to **kebab-case** by splitting it into words and joining them\n * back together with hyphens (`-`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * For *COBOL-CASE* use `toUpperCase(toKebabCase(data))`.\n *\n * @param data - A string.\n * @signature\n * toKebabCase(data);\n * @example\n * toKebabCase(\"hello world\"); // \"hello-world\"\n * toKebabCase(\"__HELLO_WORLD__\"); // \"hello-world\"\n * @dataFirst\n * @category String\n */\nexport function toKebabCase<S extends string>(data: S): KebabCase<S>;\n\n/**\n * Converts text to **kebab-case** by splitting it into words and joining them\n * back together with hyphens (`-`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * For *COBOL-CASE* use `toUpperCase(toKebabCase(data))`.\n *\n * @signature\n * toKebabCase()(data);\n * @example\n * pipe(\"hello world\", toKebabCase()); // \"hello-world\"\n * pipe(\"__HELLO_WORLD__\", toKebabCase()); // \"hello-world\"\n * @dataLast\n * @category String\n */\nexport function toKebabCase(): <S extends string>(data: S) => KebabCase<S>;\n\nexport function toKebabCase(...args: ReadonlyArray<unknown>): unknown {\n return curry(toKebabCaseImplementation, args);\n}\n\nfunction toKebabCaseImplementation<S extends string>(data: S): KebabCase<S> {\n // @ts-expect-error [ts2322] -- To avoid importing our own utilities for this\n // we are using the built-in `join` and `toLowerCase` functions which aren't\n // typed as well. This is equivalent to `toLowerCase(join(words(data), \"-\"))`\n // which TypeScript infers correctly as KebabCase.\n return words(data).join('-').toLowerCase();\n}\n"],"mappings":"oIA+DA,SAAgB,EAAY,GAAG,EAAuC,CACpE,OAAOA,EAAAA,MAAM,EAA2B,EAAK,CAG/C,SAAS,EAA4C,EAAuB,CAK1E,OAAOC,EAAAA,EAAM,EAAK,CAAC,KAAK,IAAI,CAAC,aAAa"}
|
package/dist/to-kebab-case.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{curry as e}from"./curry.js";import{t}from"./words-
|
|
1
|
+
import{curry as e}from"./curry.js";import{t}from"./words-B9lX8euz.js";function n(...t){return e(r,t)}function r(e){return t(e).join(`-`).toLowerCase()}export{n as toKebabCase};
|
|
2
2
|
//# sourceMappingURL=to-kebab-case.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-kebab-case.js","names":[],"sources":["../src/to-kebab-case.ts"],"sourcesContent":["import type { Join, Words } from 'type-fest';\nimport { curry } from './curry';\nimport { words } from './internal/words';\n\ntype KebabCase<S extends string> = string extends S\n ? string\n : Lowercase<Join<Words<S>, '-'>>;\n\n/**\n * Converts text to **kebab-case** by splitting it into words and joining them\n * back together with hyphens (`-`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * For *COBOL-CASE* use `toUpperCase(toKebabCase(data))`.\n *\n * @param data - A string.\n * @signature\n * toKebabCase(data);\n * @example\n * toKebabCase(\"hello world\"); // \"hello-world\"\n * toKebabCase(\"__HELLO_WORLD__\"); // \"hello-world\"\n * @dataFirst\n * @category String\n */\nexport function toKebabCase<S extends string>(data: S): KebabCase<S>;\n\n/**\n * Converts text to **kebab-case** by splitting it into words and joining them\n * back together with hyphens (`-`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * For *COBOL-CASE* use `toUpperCase(toKebabCase(data))`.\n *\n * @signature\n * toKebabCase()(data);\n * @example\n * pipe(\"hello world\", toKebabCase()); // \"hello-world\"\n * pipe(\"__HELLO_WORLD__\", toKebabCase()); // \"hello-world\"\n * @dataLast\n * @category String\n */\nexport function toKebabCase(): <S extends string>(data: S) => KebabCase<S>;\n\nexport function toKebabCase(...args: ReadonlyArray<unknown>): unknown {\n return curry(toKebabCaseImplementation, args);\n}\n\nfunction toKebabCaseImplementation<S extends string>(data: S): KebabCase<S> {\n return words(data).join('-').toLowerCase();\n}\n"],"mappings":"sEA+DA,SAAgB,EAAY,GAAG,EAAuC,CACpE,OAAO,EAAM,EAA2B,EAAK,CAG/C,SAAS,EAA4C,EAAuB,
|
|
1
|
+
{"version":3,"file":"to-kebab-case.js","names":[],"sources":["../src/to-kebab-case.ts"],"sourcesContent":["import type { Join, Words } from 'type-fest';\nimport { curry } from './curry';\nimport { words } from './internal/words';\n\ntype KebabCase<S extends string> = string extends S\n ? string\n : Lowercase<Join<Words<S>, '-'>>;\n\n/**\n * Converts text to **kebab-case** by splitting it into words and joining them\n * back together with hyphens (`-`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * For *COBOL-CASE* use `toUpperCase(toKebabCase(data))`.\n *\n * @param data - A string.\n * @signature\n * toKebabCase(data);\n * @example\n * toKebabCase(\"hello world\"); // \"hello-world\"\n * toKebabCase(\"__HELLO_WORLD__\"); // \"hello-world\"\n * @dataFirst\n * @category String\n */\nexport function toKebabCase<S extends string>(data: S): KebabCase<S>;\n\n/**\n * Converts text to **kebab-case** by splitting it into words and joining them\n * back together with hyphens (`-`), then lowercasing the result.\n *\n * Because it uses [`toLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase),\n * the function shares its _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase#description)_\n * too, making it best suited for simple strings like identifiers and internal\n * keys. For linguistic text processing, use [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter)\n * with [`granularity: \"word\"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter#parameters), and\n * [`toLocaleLowerCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase),\n * which are purpose-built to handle nuances in languages and locales.\n *\n * For other case manipulations see: `toLowerCase`, `toUpperCase`, `capitalize`,\n * `uncapitalize`, `toCamelCase`, `toSnakeCase`, and `toTitleCase`.\n *\n * For *COBOL-CASE* use `toUpperCase(toKebabCase(data))`.\n *\n * @signature\n * toKebabCase()(data);\n * @example\n * pipe(\"hello world\", toKebabCase()); // \"hello-world\"\n * pipe(\"__HELLO_WORLD__\", toKebabCase()); // \"hello-world\"\n * @dataLast\n * @category String\n */\nexport function toKebabCase(): <S extends string>(data: S) => KebabCase<S>;\n\nexport function toKebabCase(...args: ReadonlyArray<unknown>): unknown {\n return curry(toKebabCaseImplementation, args);\n}\n\nfunction toKebabCaseImplementation<S extends string>(data: S): KebabCase<S> {\n // @ts-expect-error [ts2322] -- To avoid importing our own utilities for this\n // we are using the built-in `join` and `toLowerCase` functions which aren't\n // typed as well. This is equivalent to `toLowerCase(join(words(data), \"-\"))`\n // which TypeScript infers correctly as KebabCase.\n return words(data).join('-').toLowerCase();\n}\n"],"mappings":"sEA+DA,SAAgB,EAAY,GAAG,EAAuC,CACpE,OAAO,EAAM,EAA2B,EAAK,CAG/C,SAAS,EAA4C,EAAuB,CAK1E,OAAO,EAAM,EAAK,CAAC,KAAK,IAAI,CAAC,aAAa"}
|
package/dist/to-snake-case.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./curry.cjs`),t=require(`./words-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./curry.cjs`),t=require(`./words-_h74qi45.cjs`);function n(...t){return e.curry(r,t)}function r(e){return t.t(e).join(`_`).toLowerCase()}exports.toSnakeCase=n;
|
|
2
2
|
//# sourceMappingURL=to-snake-case.cjs.map
|
package/dist/to-snake-case.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{curry as e}from"./curry.js";import{t}from"./words-
|
|
1
|
+
import{curry as e}from"./curry.js";import{t}from"./words-B9lX8euz.js";function n(...t){return e(r,t)}function r(e){return t(e).join(`_`).toLowerCase()}export{n as toSnakeCase};
|
|
2
2
|
//# sourceMappingURL=to-snake-case.js.map
|
package/dist/to-title-case.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./words-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./words-_h74qi45.cjs`),t=/[a-z]/u;function n(e,t){return typeof e==`string`?r(e,t):t=>r(t,e)}function r(n,{preserveConsecutiveUppercase:r=!0}={}){return e.t(t.test(n)?n:n.toLowerCase()).map(e=>`${e[0].toUpperCase()}${r?e.slice(1):e.slice(1).toLowerCase()}`).join(` `)}exports.toTitleCase=n;
|
|
2
2
|
//# sourceMappingURL=to-title-case.cjs.map
|
package/dist/to-title-case.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./words-
|
|
1
|
+
import{t as e}from"./words-B9lX8euz.js";const t=/[a-z]/u;function n(e,t){return typeof e==`string`?r(e,t):t=>r(t,e)}function r(n,{preserveConsecutiveUppercase:r=!0}={}){return e(t.test(n)?n:n.toLowerCase()).map(e=>`${e[0].toUpperCase()}${r?e.slice(1):e.slice(1).toLowerCase()}`).join(` `)}export{n as toTitleCase};
|
|
2
2
|
//# sourceMappingURL=to-title-case.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
const e=new Set([`-`,`_`,...` .
|
|
2
|
-
.\v.\f.\r. .
.\xA0. . . . . . . . . . . . .\u2028.\u2029. . . .`.split(`.`)]);function t(t){let n=[],r=``,i=()=>{r.length>0&&(n.push(r),r=``)};for(let n of t){if(e.has(n)){i();continue}if(/[a-z]$/u.test(r)&&/[A-Z]/u.test(n))i();else if(/[A-Z][A-Z]$/u.test(r)&&/[a-z]/u.test(n)){let e=r.slice(-1);r=r.slice(0,-1),i(),r=e}
|
|
3
|
-
//# sourceMappingURL=words-
|
|
2
|
+
.\v.\f.\r. .
.\xA0. . . . . . . . . . . . .\u2028.\u2029. . . .`.split(`.`)]);function t(t){let n=[],r=``,i=()=>{r.length>0&&(n.push(r),r=``)};for(let n of t){if(e.has(n)){i();continue}if(/[a-z]$/u.test(r)&&/[A-Z]/u.test(n))i();else if(/[A-Z][A-Z]$/u.test(r)&&/[a-z]/u.test(n)){let e=r.slice(-1);r=r.slice(0,-1),i(),r=e}r+=n}return i(),n}export{t};
|
|
3
|
+
//# sourceMappingURL=words-B9lX8euz.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"words-
|
|
1
|
+
{"version":3,"file":"words-B9lX8euz.js","names":[],"sources":["../src/internal/words.ts"],"sourcesContent":["import type { Words } from 'type-fest';\n\n// @see https://github.com/sindresorhus/type-fest/blob/main/source/internal/characters.d.ts#L5-L31\nconst WHITESPACE = [\n '\\u{9}', // '\\t'\n '\\u{A}', // '\\n'\n '\\u{B}', // '\\v'\n '\\u{C}', // '\\f'\n '\\u{D}', // '\\r'\n '\\u{20}', // ' '\n '\\u{85}',\n '\\u{A0}',\n '\\u{1680}',\n '\\u{2000}',\n '\\u{2001}',\n '\\u{2002}',\n '\\u{2003}',\n '\\u{2004}',\n '\\u{2005}',\n '\\u{2006}',\n '\\u{2007}',\n '\\u{2008}',\n '\\u{2009}',\n '\\u{200A}',\n '\\u{2028}',\n '\\u{2029}',\n '\\u{202F}',\n '\\u{205F}',\n '\\u{3000}',\n '\\u{FEFF}',\n] as const;\n\n// @see https://github.com/sindresorhus/type-fest/blob/main/source/internal/characters.d.ts#L33\nconst WORD_SEPARATORS = new Set(['-', '_', ...WHITESPACE]);\n\nexport function words<S extends string>(data: S): string extends S ? Array<string> : Words<S> {\n const results: Array<string> = [];\n let word = '';\n\n const flush = (): void => {\n if (word.length > 0) {\n results.push(word);\n word = '';\n }\n };\n\n for (const character of data) {\n if (WORD_SEPARATORS.has(character)) {\n // Separator encountered; flush the current word & exclude the separator.\n flush();\n continue;\n }\n\n // Detect transitions:\n // 1. Lowercase to uppercase (e.g., \"helloWorld\")\n if (/[a-z]$/u.test(word) && /[A-Z]/u.test(character)) {\n flush();\n } else if (/[A-Z][A-Z]$/u.test(word) && /[a-z]/u.test(character)) {\n // 2. Uppercase to lowercase following multiple uppercase letters (e.g., \"HELLOWorld\")\n // When the text transitions from 2 upper case letters to a lower case\n // letter. (one upper case letter is considered part of the word, e.g.\n // \"Dog\").\n const lastCharacter = word.slice(-1);\n word = word.slice(0, -1);\n flush();\n word = lastCharacter;\n }\n\n // Add the current character to the current word.\n word += character;\n }\n\n // Flush any remaining word.\n flush();\n\n // @ts-expect-error [ts2322] -- TypeScript can't infer this type...\n return results;\n}\n"],"mappings":"AAiCA,MAAM,EAAkB,IAAI,IAAI,CAAC,IAAK,IAAK,GA9BxB;4EA2BlB,CAGwD,CAAC,CAE1D,SAAgB,EAAwB,EAAsD,CAC5F,IAAM,EAAyB,EAAE,CAC7B,EAAO,GAEL,MAAoB,CACpB,EAAK,OAAS,IAChB,EAAQ,KAAK,EAAK,CAClB,EAAO,KAIX,IAAK,IAAM,KAAa,EAAM,CAC5B,GAAI,EAAgB,IAAI,EAAU,CAAE,CAElC,GAAO,CACP,SAKF,GAAI,UAAU,KAAK,EAAK,EAAI,SAAS,KAAK,EAAU,CAClD,GAAO,SACE,eAAe,KAAK,EAAK,EAAI,SAAS,KAAK,EAAU,CAAE,CAKhE,IAAM,EAAgB,EAAK,MAAM,GAAG,CACpC,EAAO,EAAK,MAAM,EAAG,GAAG,CACxB,GAAO,CACP,EAAO,EAIT,GAAQ,EAOV,OAHA,GAAO,CAGA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
const e=new Set([`-`,`_`,...` .
|
|
2
|
-
.\v.\f.\r. .
.\xA0. . . . . . . . . . . . .\u2028.\u2029. . . .`.split(`.`)]);function t(t){let n=[],r=``,i=()=>{r.length>0&&(n.push(r),r=``)};for(let n of t){if(e.has(n)){i();continue}if(/[a-z]$/u.test(r)&&/[A-Z]/u.test(n))i();else if(/[A-Z][A-Z]$/u.test(r)&&/[a-z]/u.test(n)){let e=r.slice(-1);r=r.slice(0,-1),i(),r=e}
|
|
3
|
-
//# sourceMappingURL=words-
|
|
2
|
+
.\v.\f.\r. .
.\xA0. . . . . . . . . . . . .\u2028.\u2029. . . .`.split(`.`)]);function t(t){let n=[],r=``,i=()=>{r.length>0&&(n.push(r),r=``)};for(let n of t){if(e.has(n)){i();continue}if(/[a-z]$/u.test(r)&&/[A-Z]/u.test(n))i();else if(/[A-Z][A-Z]$/u.test(r)&&/[a-z]/u.test(n)){let e=r.slice(-1);r=r.slice(0,-1),i(),r=e}r+=n}return i(),n}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
|
|
3
|
+
//# sourceMappingURL=words-_h74qi45.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"words-
|
|
1
|
+
{"version":3,"file":"words-_h74qi45.cjs","names":[],"sources":["../src/internal/words.ts"],"sourcesContent":["import type { Words } from 'type-fest';\n\n// @see https://github.com/sindresorhus/type-fest/blob/main/source/internal/characters.d.ts#L5-L31\nconst WHITESPACE = [\n '\\u{9}', // '\\t'\n '\\u{A}', // '\\n'\n '\\u{B}', // '\\v'\n '\\u{C}', // '\\f'\n '\\u{D}', // '\\r'\n '\\u{20}', // ' '\n '\\u{85}',\n '\\u{A0}',\n '\\u{1680}',\n '\\u{2000}',\n '\\u{2001}',\n '\\u{2002}',\n '\\u{2003}',\n '\\u{2004}',\n '\\u{2005}',\n '\\u{2006}',\n '\\u{2007}',\n '\\u{2008}',\n '\\u{2009}',\n '\\u{200A}',\n '\\u{2028}',\n '\\u{2029}',\n '\\u{202F}',\n '\\u{205F}',\n '\\u{3000}',\n '\\u{FEFF}',\n] as const;\n\n// @see https://github.com/sindresorhus/type-fest/blob/main/source/internal/characters.d.ts#L33\nconst WORD_SEPARATORS = new Set(['-', '_', ...WHITESPACE]);\n\nexport function words<S extends string>(data: S): string extends S ? Array<string> : Words<S> {\n const results: Array<string> = [];\n let word = '';\n\n const flush = (): void => {\n if (word.length > 0) {\n results.push(word);\n word = '';\n }\n };\n\n for (const character of data) {\n if (WORD_SEPARATORS.has(character)) {\n // Separator encountered; flush the current word & exclude the separator.\n flush();\n continue;\n }\n\n // Detect transitions:\n // 1. Lowercase to uppercase (e.g., \"helloWorld\")\n if (/[a-z]$/u.test(word) && /[A-Z]/u.test(character)) {\n flush();\n } else if (/[A-Z][A-Z]$/u.test(word) && /[a-z]/u.test(character)) {\n // 2. Uppercase to lowercase following multiple uppercase letters (e.g., \"HELLOWorld\")\n // When the text transitions from 2 upper case letters to a lower case\n // letter. (one upper case letter is considered part of the word, e.g.\n // \"Dog\").\n const lastCharacter = word.slice(-1);\n word = word.slice(0, -1);\n flush();\n word = lastCharacter;\n }\n\n // Add the current character to the current word.\n word += character;\n }\n\n // Flush any remaining word.\n flush();\n\n // @ts-expect-error [ts2322] -- TypeScript can't infer this type...\n return results;\n}\n"],"mappings":"AAiCA,MAAM,EAAkB,IAAI,IAAI,CAAC,IAAK,IAAK,GA9BxB;4EA2BlB,CAGwD,CAAC,CAE1D,SAAgB,EAAwB,EAAsD,CAC5F,IAAM,EAAyB,EAAE,CAC7B,EAAO,GAEL,MAAoB,CACpB,EAAK,OAAS,IAChB,EAAQ,KAAK,EAAK,CAClB,EAAO,KAIX,IAAK,IAAM,KAAa,EAAM,CAC5B,GAAI,EAAgB,IAAI,EAAU,CAAE,CAElC,GAAO,CACP,SAKF,GAAI,UAAU,KAAK,EAAK,EAAI,SAAS,KAAK,EAAU,CAClD,GAAO,SACE,eAAe,KAAK,EAAK,EAAI,SAAS,KAAK,EAAU,CAAE,CAKhE,IAAM,EAAgB,EAAK,MAAM,GAAG,CACpC,EAAO,EAAK,MAAM,EAAG,GAAG,CACxB,GAAO,CACP,EAAO,EAIT,GAAQ,EAOV,OAHA,GAAO,CAGA"}
|
package/package.json
CHANGED