@stryke/string-format 0.13.6 → 0.14.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/CHANGELOG.md +25 -0
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +2 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +2 -1
- package/dist/ordinals.cjs +31 -0
- package/dist/ordinals.d.cts +23 -0
- package/dist/ordinals.d.cts.map +1 -0
- package/dist/ordinals.d.mts +23 -0
- package/dist/ordinals.d.mts.map +1 -0
- package/dist/ordinals.mjs +31 -0
- package/dist/ordinals.mjs.map +1 -0
- package/package.json +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog for Stryke - String Format
|
|
4
4
|
|
|
5
|
+
## [0.14.0](https://github.com/storm-software/stryke/releases/tag/string-format%400.14.0) (02/09/2026)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- **string-format:** Added the `toOrdinal` helper utility ([eb7aea68](https://github.com/storm-software/stryke/commit/eb7aea68))
|
|
10
|
+
|
|
11
|
+
### Updated Dependencies
|
|
12
|
+
|
|
13
|
+
- Updated **helpers** to **v0.9.41**
|
|
14
|
+
- Updated **types** to **v0.10.38**
|
|
15
|
+
|
|
16
|
+
## [0.13.7](https://github.com/storm-software/stryke/releases/tag/string-format%400.13.7) (01/29/2026)
|
|
17
|
+
|
|
18
|
+
### Updated Dependencies
|
|
19
|
+
|
|
20
|
+
- Updated **helpers** to **v0.9.40**
|
|
21
|
+
- Updated **types** to **v0.10.37**
|
|
22
|
+
|
|
23
|
+
## [0.13.6](https://github.com/storm-software/stryke/releases/tag/string-format%400.13.6) (01/26/2026)
|
|
24
|
+
|
|
25
|
+
### Updated Dependencies
|
|
26
|
+
|
|
27
|
+
- Updated **helpers** to **v0.9.39**
|
|
28
|
+
- Updated **types** to **v0.10.36**
|
|
29
|
+
|
|
5
30
|
## [0.13.5](https://github.com/storm-software/stryke/releases/tag/string-format%400.13.5) (01/25/2026)
|
|
6
31
|
|
|
7
32
|
### Updated Dependencies
|
package/dist/index.cjs
CHANGED
|
@@ -16,6 +16,7 @@ const require_format_special_cases = require('./format-special-cases.cjs');
|
|
|
16
16
|
const require_kebab_case = require('./kebab-case.cjs');
|
|
17
17
|
const require_lower_case_first = require('./lower-case-first.cjs');
|
|
18
18
|
const require_normalize_email = require('./normalize-email.cjs');
|
|
19
|
+
const require_ordinals = require('./ordinals.cjs');
|
|
19
20
|
const require_package = require('./package.cjs');
|
|
20
21
|
const require_pad = require('./pad.cjs');
|
|
21
22
|
const require_pascal_case = require('./pascal-case.cjs');
|
|
@@ -71,5 +72,6 @@ exports.startCase = require_start_case.startCase;
|
|
|
71
72
|
exports.stripIndents = require_strip_indents.stripIndents;
|
|
72
73
|
exports.titleCase = require_title_case.titleCase;
|
|
73
74
|
exports.toLocaleString = require_pretty_bytes.toLocaleString;
|
|
75
|
+
exports.toOrdinal = require_ordinals.toOrdinal;
|
|
74
76
|
exports.unescape = require_unescape.unescape;
|
|
75
77
|
exports.upperCaseFirst = require_upper_case_first.upperCaseFirst;
|
package/dist/index.d.cts
CHANGED
|
@@ -12,6 +12,7 @@ import { CASE_SPLIT_PATTERN, GetWordsOptions, RELAXED_SPLIT_PATTERN, getWords }
|
|
|
12
12
|
import { isKebabCase, kebabCase } from "./kebab-case.cjs";
|
|
13
13
|
import { lowerCaseFirst } from "./lower-case-first.cjs";
|
|
14
14
|
import { normalizeEmail } from "./normalize-email.cjs";
|
|
15
|
+
import { toOrdinal } from "./ordinals.cjs";
|
|
15
16
|
import { getPackageName, getPackageVersion, hasPackageVersion, removePackageVersion } from "./package.cjs";
|
|
16
17
|
import { pad } from "./pad.cjs";
|
|
17
18
|
import { isPascalCase, pascalCase } from "./pascal-case.cjs";
|
|
@@ -26,4 +27,4 @@ import { titleCase } from "./title-case.cjs";
|
|
|
26
27
|
import { unescape } from "./unescape.cjs";
|
|
27
28
|
import { upperCaseFirst } from "./upper-case-first.cjs";
|
|
28
29
|
import { getIndefiniteArticle, isVowel } from "./vowels.cjs";
|
|
29
|
-
export { ACRONYMS, ACRONYM_DESCRIPTION, ACRONYM_DISPLAY, ACRONYM_LIST, ARTICLES, CASE_SPLIT_PATTERN, CONJUNCTIONS, FormatSpecialCasesOptions, GetWordsOptions, Options, PREPOSITIONS, RELAXED_SPLIT_PATTERN, SPECIAL_CASES, SnakeCaseOptions, camelCase, combine, constantCase, deburr, decamelize, escapeHtml, escapeRegExp, formatSpecialCases, getIndefiniteArticle, getPackageName, getPackageVersion, getWords, hasPackageVersion, isCamelCase, isConstantCase, isKebabCase, isPascalCase, isPeriodSplit, isSnakeCase, isStartCase, isVowel, kebabCase, lowerCaseFirst, normalizeEmail, pad, pascalCase, periodSplit, prettyBytes, removePackageVersion, snakeCase, startCase, stripIndents, titleCase, toLocaleString, unescape, upperCaseFirst };
|
|
30
|
+
export { ACRONYMS, ACRONYM_DESCRIPTION, ACRONYM_DISPLAY, ACRONYM_LIST, ARTICLES, CASE_SPLIT_PATTERN, CONJUNCTIONS, FormatSpecialCasesOptions, GetWordsOptions, Options, PREPOSITIONS, RELAXED_SPLIT_PATTERN, SPECIAL_CASES, SnakeCaseOptions, camelCase, combine, constantCase, deburr, decamelize, escapeHtml, escapeRegExp, formatSpecialCases, getIndefiniteArticle, getPackageName, getPackageVersion, getWords, hasPackageVersion, isCamelCase, isConstantCase, isKebabCase, isPascalCase, isPeriodSplit, isSnakeCase, isStartCase, isVowel, kebabCase, lowerCaseFirst, normalizeEmail, pad, pascalCase, periodSplit, prettyBytes, removePackageVersion, snakeCase, startCase, stripIndents, titleCase, toLocaleString, toOrdinal, unescape, upperCaseFirst };
|
package/dist/index.d.mts
CHANGED
|
@@ -12,6 +12,7 @@ import { CASE_SPLIT_PATTERN, GetWordsOptions, RELAXED_SPLIT_PATTERN, getWords }
|
|
|
12
12
|
import { isKebabCase, kebabCase } from "./kebab-case.mjs";
|
|
13
13
|
import { lowerCaseFirst } from "./lower-case-first.mjs";
|
|
14
14
|
import { normalizeEmail } from "./normalize-email.mjs";
|
|
15
|
+
import { toOrdinal } from "./ordinals.mjs";
|
|
15
16
|
import { getPackageName, getPackageVersion, hasPackageVersion, removePackageVersion } from "./package.mjs";
|
|
16
17
|
import { pad } from "./pad.mjs";
|
|
17
18
|
import { isPascalCase, pascalCase } from "./pascal-case.mjs";
|
|
@@ -26,4 +27,4 @@ import { titleCase } from "./title-case.mjs";
|
|
|
26
27
|
import { unescape } from "./unescape.mjs";
|
|
27
28
|
import { upperCaseFirst } from "./upper-case-first.mjs";
|
|
28
29
|
import { getIndefiniteArticle, isVowel } from "./vowels.mjs";
|
|
29
|
-
export { ACRONYMS, ACRONYM_DESCRIPTION, ACRONYM_DISPLAY, ACRONYM_LIST, ARTICLES, CASE_SPLIT_PATTERN, CONJUNCTIONS, FormatSpecialCasesOptions, GetWordsOptions, Options, PREPOSITIONS, RELAXED_SPLIT_PATTERN, SPECIAL_CASES, SnakeCaseOptions, camelCase, combine, constantCase, deburr, decamelize, escapeHtml, escapeRegExp, formatSpecialCases, getIndefiniteArticle, getPackageName, getPackageVersion, getWords, hasPackageVersion, isCamelCase, isConstantCase, isKebabCase, isPascalCase, isPeriodSplit, isSnakeCase, isStartCase, isVowel, kebabCase, lowerCaseFirst, normalizeEmail, pad, pascalCase, periodSplit, prettyBytes, removePackageVersion, snakeCase, startCase, stripIndents, titleCase, toLocaleString, unescape, upperCaseFirst };
|
|
30
|
+
export { ACRONYMS, ACRONYM_DESCRIPTION, ACRONYM_DISPLAY, ACRONYM_LIST, ARTICLES, CASE_SPLIT_PATTERN, CONJUNCTIONS, FormatSpecialCasesOptions, GetWordsOptions, Options, PREPOSITIONS, RELAXED_SPLIT_PATTERN, SPECIAL_CASES, SnakeCaseOptions, camelCase, combine, constantCase, deburr, decamelize, escapeHtml, escapeRegExp, formatSpecialCases, getIndefiniteArticle, getPackageName, getPackageVersion, getWords, hasPackageVersion, isCamelCase, isConstantCase, isKebabCase, isPascalCase, isPeriodSplit, isSnakeCase, isStartCase, isVowel, kebabCase, lowerCaseFirst, normalizeEmail, pad, pascalCase, periodSplit, prettyBytes, removePackageVersion, snakeCase, startCase, stripIndents, titleCase, toLocaleString, toOrdinal, unescape, upperCaseFirst };
|
package/dist/index.mjs
CHANGED
|
@@ -16,6 +16,7 @@ import { formatSpecialCases } from "./format-special-cases.mjs";
|
|
|
16
16
|
import { isKebabCase, kebabCase } from "./kebab-case.mjs";
|
|
17
17
|
import { lowerCaseFirst } from "./lower-case-first.mjs";
|
|
18
18
|
import { normalizeEmail } from "./normalize-email.mjs";
|
|
19
|
+
import { toOrdinal } from "./ordinals.mjs";
|
|
19
20
|
import { getPackageName, getPackageVersion, hasPackageVersion, removePackageVersion } from "./package.mjs";
|
|
20
21
|
import { pad } from "./pad.mjs";
|
|
21
22
|
import { isPascalCase, pascalCase } from "./pascal-case.mjs";
|
|
@@ -27,4 +28,4 @@ import { titleCase } from "./title-case.mjs";
|
|
|
27
28
|
import { unescape } from "./unescape.mjs";
|
|
28
29
|
import { getIndefiniteArticle, isVowel } from "./vowels.mjs";
|
|
29
30
|
|
|
30
|
-
export { ACRONYMS, ACRONYM_DESCRIPTION, ACRONYM_DISPLAY, ACRONYM_LIST, ARTICLES, CASE_SPLIT_PATTERN, CONJUNCTIONS, PREPOSITIONS, RELAXED_SPLIT_PATTERN, SPECIAL_CASES, camelCase, combine, constantCase, deburr, decamelize, escapeHtml, escapeRegExp, formatSpecialCases, getIndefiniteArticle, getPackageName, getPackageVersion, getWords, hasPackageVersion, isCamelCase, isConstantCase, isKebabCase, isPascalCase, isPeriodSplit, isSnakeCase, isStartCase, isVowel, kebabCase, lowerCaseFirst, normalizeEmail, pad, pascalCase, periodSplit, prettyBytes, removePackageVersion, snakeCase, startCase, stripIndents, titleCase, toLocaleString, unescape, upperCaseFirst };
|
|
31
|
+
export { ACRONYMS, ACRONYM_DESCRIPTION, ACRONYM_DISPLAY, ACRONYM_LIST, ARTICLES, CASE_SPLIT_PATTERN, CONJUNCTIONS, PREPOSITIONS, RELAXED_SPLIT_PATTERN, SPECIAL_CASES, camelCase, combine, constantCase, deburr, decamelize, escapeHtml, escapeRegExp, formatSpecialCases, getIndefiniteArticle, getPackageName, getPackageVersion, getWords, hasPackageVersion, isCamelCase, isConstantCase, isKebabCase, isPascalCase, isPeriodSplit, isSnakeCase, isStartCase, isVowel, kebabCase, lowerCaseFirst, normalizeEmail, pad, pascalCase, periodSplit, prettyBytes, removePackageVersion, snakeCase, startCase, stripIndents, titleCase, toLocaleString, toOrdinal, unescape, upperCaseFirst };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/ordinals.ts
|
|
3
|
+
/**
|
|
4
|
+
* Converts a number to its ordinal representation (e.g., 1st, 2nd, 3rd, etc.).
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* toOrdinal(1); // "1st"
|
|
9
|
+
* toOrdinal(2); // "2nd"
|
|
10
|
+
* toOrdinal(3); // "3rd"
|
|
11
|
+
* toOrdinal(4); // "4th"
|
|
12
|
+
* toOrdinal(11); // "11th"
|
|
13
|
+
* toOrdinal(12); // "12th"
|
|
14
|
+
* toOrdinal(13); // "13th"
|
|
15
|
+
* toOrdinal(21); // "21st"
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @param int - The number to convert to an ordinal string.
|
|
19
|
+
* @returns The ordinal representation of the number as a string.
|
|
20
|
+
*/
|
|
21
|
+
function toOrdinal(int) {
|
|
22
|
+
const j = int % 10;
|
|
23
|
+
const k = int % 100;
|
|
24
|
+
if (j === 1 && k !== 11) return `${int}st`;
|
|
25
|
+
if (j === 2 && k !== 12) return `${int}nd`;
|
|
26
|
+
if (j === 3 && k !== 13) return `${int}rd`;
|
|
27
|
+
return `${int}th`;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
exports.toOrdinal = toOrdinal;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/ordinals.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts a number to its ordinal representation (e.g., 1st, 2nd, 3rd, etc.).
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* toOrdinal(1); // "1st"
|
|
8
|
+
* toOrdinal(2); // "2nd"
|
|
9
|
+
* toOrdinal(3); // "3rd"
|
|
10
|
+
* toOrdinal(4); // "4th"
|
|
11
|
+
* toOrdinal(11); // "11th"
|
|
12
|
+
* toOrdinal(12); // "12th"
|
|
13
|
+
* toOrdinal(13); // "13th"
|
|
14
|
+
* toOrdinal(21); // "21st"
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param int - The number to convert to an ordinal string.
|
|
18
|
+
* @returns The ordinal representation of the number as a string.
|
|
19
|
+
*/
|
|
20
|
+
declare function toOrdinal(int: number): string;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { toOrdinal };
|
|
23
|
+
//# sourceMappingURL=ordinals.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ordinals.d.cts","names":[],"sources":["../src/ordinals.ts"],"sourcesContent":[],"mappings":";;AAoCA;;;;;;;;;;;;;;;;;iBAAgB,SAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/ordinals.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts a number to its ordinal representation (e.g., 1st, 2nd, 3rd, etc.).
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* toOrdinal(1); // "1st"
|
|
8
|
+
* toOrdinal(2); // "2nd"
|
|
9
|
+
* toOrdinal(3); // "3rd"
|
|
10
|
+
* toOrdinal(4); // "4th"
|
|
11
|
+
* toOrdinal(11); // "11th"
|
|
12
|
+
* toOrdinal(12); // "12th"
|
|
13
|
+
* toOrdinal(13); // "13th"
|
|
14
|
+
* toOrdinal(21); // "21st"
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param int - The number to convert to an ordinal string.
|
|
18
|
+
* @returns The ordinal representation of the number as a string.
|
|
19
|
+
*/
|
|
20
|
+
declare function toOrdinal(int: number): string;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { toOrdinal };
|
|
23
|
+
//# sourceMappingURL=ordinals.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ordinals.d.mts","names":[],"sources":["../src/ordinals.ts"],"sourcesContent":[],"mappings":";;AAoCA;;;;;;;;;;;;;;;;;iBAAgB,SAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/ordinals.ts
|
|
2
|
+
/**
|
|
3
|
+
* Converts a number to its ordinal representation (e.g., 1st, 2nd, 3rd, etc.).
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* toOrdinal(1); // "1st"
|
|
8
|
+
* toOrdinal(2); // "2nd"
|
|
9
|
+
* toOrdinal(3); // "3rd"
|
|
10
|
+
* toOrdinal(4); // "4th"
|
|
11
|
+
* toOrdinal(11); // "11th"
|
|
12
|
+
* toOrdinal(12); // "12th"
|
|
13
|
+
* toOrdinal(13); // "13th"
|
|
14
|
+
* toOrdinal(21); // "21st"
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param int - The number to convert to an ordinal string.
|
|
18
|
+
* @returns The ordinal representation of the number as a string.
|
|
19
|
+
*/
|
|
20
|
+
function toOrdinal(int) {
|
|
21
|
+
const j = int % 10;
|
|
22
|
+
const k = int % 100;
|
|
23
|
+
if (j === 1 && k !== 11) return `${int}st`;
|
|
24
|
+
if (j === 2 && k !== 12) return `${int}nd`;
|
|
25
|
+
if (j === 3 && k !== 13) return `${int}rd`;
|
|
26
|
+
return `${int}th`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
export { toOrdinal };
|
|
31
|
+
//# sourceMappingURL=ordinals.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ordinals.mjs","names":[],"sources":["../src/ordinals.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Converts a number to its ordinal representation (e.g., 1st, 2nd, 3rd, etc.).\n *\n * @example\n * ```typescript\n * toOrdinal(1); // \"1st\"\n * toOrdinal(2); // \"2nd\"\n * toOrdinal(3); // \"3rd\"\n * toOrdinal(4); // \"4th\"\n * toOrdinal(11); // \"11th\"\n * toOrdinal(12); // \"12th\"\n * toOrdinal(13); // \"13th\"\n * toOrdinal(21); // \"21st\"\n * ```\n *\n * @param int - The number to convert to an ordinal string.\n * @returns The ordinal representation of the number as a string.\n */\nexport function toOrdinal(int: number): string {\n const j = int % 10;\n const k = int % 100;\n if (j === 1 && k !== 11) {\n return `${int}st`;\n }\n if (j === 2 && k !== 12) {\n return `${int}nd`;\n }\n if (j === 3 && k !== 13) {\n return `${int}rd`;\n }\n return `${int}th`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoCA,SAAgB,UAAU,KAAqB;CAC7C,MAAM,IAAI,MAAM;CAChB,MAAM,IAAI,MAAM;AAChB,KAAI,MAAM,KAAK,MAAM,GACnB,QAAO,GAAG,IAAI;AAEhB,KAAI,MAAM,KAAK,MAAM,GACnB,QAAO,GAAG,IAAI;AAEhB,KAAI,MAAM,KAAK,MAAM,GACnB,QAAO,GAAG,IAAI;AAEhB,QAAO,GAAG,IAAI"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryke/string-format",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing utility functions to transform strings into various formats.",
|
|
6
6
|
"repository": {
|
|
@@ -69,6 +69,10 @@
|
|
|
69
69
|
"require": "./dist/normalize-email.cjs",
|
|
70
70
|
"import": "./dist/normalize-email.mjs"
|
|
71
71
|
},
|
|
72
|
+
"./ordinals": {
|
|
73
|
+
"require": "./dist/ordinals.cjs",
|
|
74
|
+
"import": "./dist/ordinals.mjs"
|
|
75
|
+
},
|
|
72
76
|
"./package": {
|
|
73
77
|
"require": "./dist/package.cjs",
|
|
74
78
|
"import": "./dist/package.mjs"
|
|
@@ -127,5 +131,5 @@
|
|
|
127
131
|
"types": "./dist/index.d.cts",
|
|
128
132
|
"devDependencies": { "tsdown": "^0.17.2" },
|
|
129
133
|
"publishConfig": { "access": "public" },
|
|
130
|
-
"gitHead": "
|
|
134
|
+
"gitHead": "6dde4aa98913fd92c253aff3b574cdd5e048b9dc"
|
|
131
135
|
}
|