@stryke/string-format 0.16.0 → 0.17.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/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  # Changelog for Stryke - String Format
4
4
 
5
+ ## [0.17.0](https://github.com/storm-software/stryke/releases/tag/string-format%400.17.0) (03/08/2026)
6
+
7
+ ### Features
8
+
9
+ - **string-format:** Added the conjuction option to `list` helper ([058de0bc](https://github.com/storm-software/stryke/commit/058de0bc))
10
+
11
+ ### Updated Dependencies
12
+
13
+ - Updated **helpers** to **v0.10.0**
14
+ - Updated **types** to **v0.10.49**
15
+ - Updated **path** to **v0.26.16**
16
+
5
17
  ## [0.16.0](https://github.com/storm-software/stryke/releases/tag/string-format%400.16.0) (03/06/2026)
6
18
 
7
19
  ### Features
package/dist/index.d.cts CHANGED
@@ -10,7 +10,7 @@ import { escapeHtml, escapeRegExp } from "./escape.cjs";
10
10
  import { FormatSpecialCasesOptions, formatSpecialCases } from "./format-special-cases.cjs";
11
11
  import { CASE_SPLIT_PATTERN, GetWordsOptions, RELAXED_SPLIT_PATTERN, getWords } from "./get-words.cjs";
12
12
  import { isKebabCase, kebabCase } from "./kebab-case.cjs";
13
- import { list } from "./list.cjs";
13
+ import { ListOptions, list } from "./list.cjs";
14
14
  import { lowerCaseFirst } from "./lower-case-first.cjs";
15
15
  import { normalizeEmail } from "./normalize-email.cjs";
16
16
  import { toOrdinal } from "./ordinals.cjs";
@@ -29,4 +29,4 @@ import { TitleCaseOptions, titleCase } from "./title-case.cjs";
29
29
  import { unescape } from "./unescape.cjs";
30
30
  import { upperCaseFirst } from "./upper-case-first.cjs";
31
31
  import { getIndefiniteArticle, isVowel } from "./vowels.cjs";
32
- export { ACRONYMS, ACRONYM_DESCRIPTION, ACRONYM_DISPLAY, ACRONYM_LIST, ARTICLES, CASE_SPLIT_PATTERN, CONJUNCTIONS, FormatSpecialCasesOptions, GetWordsOptions, Options, PREPOSITIONS, PrettyPathOptions, RELAXED_SPLIT_PATTERN, SPECIAL_CASES, SnakeCaseOptions, TitleCaseOptions, camelCase, combine, constantCase, deburr, decamelize, escapeHtml, escapeRegExp, formatSpecialCases, getIndefiniteArticle, getPackageName, getPackageVersion, getWords, hasPackageVersion, isCamelCase, isConstantCase, isKebabCase, isPascalCase, isPeriodSplit, isSnakeCase, isStartCase, isVowel, kebabCase, list, lowerCaseFirst, normalizeEmail, pad, pascalCase, periodSplit, prettyBytes, prettyPath, removePackageVersion, snakeCase, startCase, stripIndents, titleCase, toLocaleString, toOrdinal, unescape, upperCaseFirst };
32
+ export { ACRONYMS, ACRONYM_DESCRIPTION, ACRONYM_DISPLAY, ACRONYM_LIST, ARTICLES, CASE_SPLIT_PATTERN, CONJUNCTIONS, FormatSpecialCasesOptions, GetWordsOptions, ListOptions, Options, PREPOSITIONS, PrettyPathOptions, RELAXED_SPLIT_PATTERN, SPECIAL_CASES, SnakeCaseOptions, TitleCaseOptions, camelCase, combine, constantCase, deburr, decamelize, escapeHtml, escapeRegExp, formatSpecialCases, getIndefiniteArticle, getPackageName, getPackageVersion, getWords, hasPackageVersion, isCamelCase, isConstantCase, isKebabCase, isPascalCase, isPeriodSplit, isSnakeCase, isStartCase, isVowel, kebabCase, list, lowerCaseFirst, normalizeEmail, pad, pascalCase, periodSplit, prettyBytes, prettyPath, removePackageVersion, snakeCase, startCase, stripIndents, titleCase, toLocaleString, toOrdinal, unescape, upperCaseFirst };
package/dist/index.d.mts CHANGED
@@ -10,7 +10,7 @@ import { escapeHtml, escapeRegExp } from "./escape.mjs";
10
10
  import { FormatSpecialCasesOptions, formatSpecialCases } from "./format-special-cases.mjs";
11
11
  import { CASE_SPLIT_PATTERN, GetWordsOptions, RELAXED_SPLIT_PATTERN, getWords } from "./get-words.mjs";
12
12
  import { isKebabCase, kebabCase } from "./kebab-case.mjs";
13
- import { list } from "./list.mjs";
13
+ import { ListOptions, list } from "./list.mjs";
14
14
  import { lowerCaseFirst } from "./lower-case-first.mjs";
15
15
  import { normalizeEmail } from "./normalize-email.mjs";
16
16
  import { toOrdinal } from "./ordinals.mjs";
@@ -29,4 +29,4 @@ import { TitleCaseOptions, titleCase } from "./title-case.mjs";
29
29
  import { unescape } from "./unescape.mjs";
30
30
  import { upperCaseFirst } from "./upper-case-first.mjs";
31
31
  import { getIndefiniteArticle, isVowel } from "./vowels.mjs";
32
- export { ACRONYMS, ACRONYM_DESCRIPTION, ACRONYM_DISPLAY, ACRONYM_LIST, ARTICLES, CASE_SPLIT_PATTERN, CONJUNCTIONS, FormatSpecialCasesOptions, GetWordsOptions, Options, PREPOSITIONS, PrettyPathOptions, RELAXED_SPLIT_PATTERN, SPECIAL_CASES, SnakeCaseOptions, TitleCaseOptions, camelCase, combine, constantCase, deburr, decamelize, escapeHtml, escapeRegExp, formatSpecialCases, getIndefiniteArticle, getPackageName, getPackageVersion, getWords, hasPackageVersion, isCamelCase, isConstantCase, isKebabCase, isPascalCase, isPeriodSplit, isSnakeCase, isStartCase, isVowel, kebabCase, list, lowerCaseFirst, normalizeEmail, pad, pascalCase, periodSplit, prettyBytes, prettyPath, removePackageVersion, snakeCase, startCase, stripIndents, titleCase, toLocaleString, toOrdinal, unescape, upperCaseFirst };
32
+ export { ACRONYMS, ACRONYM_DESCRIPTION, ACRONYM_DISPLAY, ACRONYM_LIST, ARTICLES, CASE_SPLIT_PATTERN, CONJUNCTIONS, FormatSpecialCasesOptions, GetWordsOptions, ListOptions, Options, PREPOSITIONS, PrettyPathOptions, RELAXED_SPLIT_PATTERN, SPECIAL_CASES, SnakeCaseOptions, TitleCaseOptions, camelCase, combine, constantCase, deburr, decamelize, escapeHtml, escapeRegExp, formatSpecialCases, getIndefiniteArticle, getPackageName, getPackageVersion, getWords, hasPackageVersion, isCamelCase, isConstantCase, isKebabCase, isPascalCase, isPeriodSplit, isSnakeCase, isStartCase, isVowel, kebabCase, list, lowerCaseFirst, normalizeEmail, pad, pascalCase, periodSplit, prettyBytes, prettyPath, removePackageVersion, snakeCase, startCase, stripIndents, titleCase, toLocaleString, toOrdinal, unescape, upperCaseFirst };
package/dist/list.cjs CHANGED
@@ -12,13 +12,14 @@
12
12
  * @param strings - The array of strings or a single string to convert into a list.
13
13
  * @returns The converted list string.
14
14
  */
15
- function list(strings) {
15
+ function list(strings, options = {}) {
16
+ const { conjunction = "and" } = options;
16
17
  if (typeof strings === "string") return strings;
17
18
  if (strings.length === 0) return "";
18
19
  if (strings.length === 1) return strings[0];
19
- if (strings.length === 2) return `${strings[0]} and ${strings[1]}`;
20
+ if (strings.length === 2) return `${strings[0]} ${conjunction} ${strings[1]}`;
20
21
  const last = strings.pop();
21
- return `${strings.join(", ")}, and ${last}`;
22
+ return `${strings.join(", ")}, ${conjunction} ${last}`;
22
23
  }
23
24
 
24
25
  //#endregion
package/dist/list.d.cts CHANGED
@@ -1,4 +1,12 @@
1
1
  //#region src/list.d.ts
2
+ interface ListOptions {
3
+ /**
4
+ * The conjunction to use when joining the last two items in the list.
5
+ *
6
+ * @defaultValue "and"
7
+ */
8
+ conjunction?: string;
9
+ }
2
10
  /**
3
11
  * Convert an array of strings into a human-readable list string.
4
12
  *
@@ -11,7 +19,7 @@
11
19
  * @param strings - The array of strings or a single string to convert into a list.
12
20
  * @returns The converted list string.
13
21
  */
14
- declare function list(strings: string | string[]): string;
22
+ declare function list(strings: string | string[], options?: ListOptions): string;
15
23
  //#endregion
16
- export { list };
24
+ export { ListOptions, list };
17
25
  //# sourceMappingURL=list.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.cts","names":[],"sources":["../src/list.ts"],"sourcesContent":[],"mappings":";;AA8BA;;;;;;;;;;;iBAAgB,IAAA"}
1
+ {"version":3,"file":"list.d.cts","names":[],"sources":["../src/list.ts"],"sourcesContent":[],"mappings":";UAkBiB,WAAA;EAAA;AAqBjB;;;;;;;;;;;;;;;;;;iBAAgB,IAAA,uCAEL"}
package/dist/list.d.mts CHANGED
@@ -1,4 +1,12 @@
1
1
  //#region src/list.d.ts
2
+ interface ListOptions {
3
+ /**
4
+ * The conjunction to use when joining the last two items in the list.
5
+ *
6
+ * @defaultValue "and"
7
+ */
8
+ conjunction?: string;
9
+ }
2
10
  /**
3
11
  * Convert an array of strings into a human-readable list string.
4
12
  *
@@ -11,7 +19,7 @@
11
19
  * @param strings - The array of strings or a single string to convert into a list.
12
20
  * @returns The converted list string.
13
21
  */
14
- declare function list(strings: string | string[]): string;
22
+ declare function list(strings: string | string[], options?: ListOptions): string;
15
23
  //#endregion
16
- export { list };
24
+ export { ListOptions, list };
17
25
  //# sourceMappingURL=list.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.mts","names":[],"sources":["../src/list.ts"],"sourcesContent":[],"mappings":";;AA8BA;;;;;;;;;;;iBAAgB,IAAA"}
1
+ {"version":3,"file":"list.d.mts","names":[],"sources":["../src/list.ts"],"sourcesContent":[],"mappings":";UAkBiB,WAAA;EAAA;AAqBjB;;;;;;;;;;;;;;;;;;iBAAgB,IAAA,uCAEL"}
package/dist/list.mjs CHANGED
@@ -11,13 +11,14 @@
11
11
  * @param strings - The array of strings or a single string to convert into a list.
12
12
  * @returns The converted list string.
13
13
  */
14
- function list(strings) {
14
+ function list(strings, options = {}) {
15
+ const { conjunction = "and" } = options;
15
16
  if (typeof strings === "string") return strings;
16
17
  if (strings.length === 0) return "";
17
18
  if (strings.length === 1) return strings[0];
18
- if (strings.length === 2) return `${strings[0]} and ${strings[1]}`;
19
+ if (strings.length === 2) return `${strings[0]} ${conjunction} ${strings[1]}`;
19
20
  const last = strings.pop();
20
- return `${strings.join(", ")}, and ${last}`;
21
+ return `${strings.join(", ")}, ${conjunction} ${last}`;
21
22
  }
22
23
 
23
24
  //#endregion
package/dist/list.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"list.mjs","names":[],"sources":["../src/list.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 * Convert an array of strings into a human-readable list string.\n *\n * @example\n * list([\"apple\", \"banana\", \"cherry\"]) // \"apple, banana, and cherry\"\n * list([\"apple\", \"banana\"]) // \"apple and banana\"\n * list([\"apple\"]) // \"apple\"\n * list(\"apple\") // \"apple\"\n *\n * @param strings - The array of strings or a single string to convert into a list.\n * @returns The converted list string.\n */\nexport function list(strings: string | string[]): string {\n if (typeof strings === \"string\") {\n return strings;\n }\n\n if (strings.length === 0) {\n return \"\";\n }\n\n if (strings.length === 1) {\n return strings[0]!;\n }\n\n if (strings.length === 2) {\n return `${strings[0]} and ${strings[1]}`;\n }\n\n const last = strings.pop();\n\n return `${strings.join(\", \")}, and ${last}`;\n}\n"],"mappings":";;;;;;;;;;;;;AA8BA,SAAgB,KAAK,SAAoC;AACvD,KAAI,OAAO,YAAY,SACrB,QAAO;AAGT,KAAI,QAAQ,WAAW,EACrB,QAAO;AAGT,KAAI,QAAQ,WAAW,EACrB,QAAO,QAAQ;AAGjB,KAAI,QAAQ,WAAW,EACrB,QAAO,GAAG,QAAQ,GAAG,OAAO,QAAQ;CAGtC,MAAM,OAAO,QAAQ,KAAK;AAE1B,QAAO,GAAG,QAAQ,KAAK,KAAK,CAAC,QAAQ"}
1
+ {"version":3,"file":"list.mjs","names":[],"sources":["../src/list.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\nexport interface ListOptions {\n /**\n * The conjunction to use when joining the last two items in the list.\n *\n * @defaultValue \"and\"\n */\n conjunction?: string;\n}\n\n/**\n * Convert an array of strings into a human-readable list string.\n *\n * @example\n * list([\"apple\", \"banana\", \"cherry\"]) // \"apple, banana, and cherry\"\n * list([\"apple\", \"banana\"]) // \"apple and banana\"\n * list([\"apple\"]) // \"apple\"\n * list(\"apple\") // \"apple\"\n *\n * @param strings - The array of strings or a single string to convert into a list.\n * @returns The converted list string.\n */\nexport function list(\n strings: string | string[],\n options: ListOptions = {}\n): string {\n const { conjunction = \"and\" } = options;\n\n if (typeof strings === \"string\") {\n return strings;\n }\n\n if (strings.length === 0) {\n return \"\";\n }\n\n if (strings.length === 1) {\n return strings[0]!;\n }\n\n if (strings.length === 2) {\n return `${strings[0]} ${conjunction} ${strings[1]}`;\n }\n\n const last = strings.pop();\n\n return `${strings.join(\", \")}, ${conjunction} ${last}`;\n}\n"],"mappings":";;;;;;;;;;;;;AAuCA,SAAgB,KACd,SACA,UAAuB,EAAE,EACjB;CACR,MAAM,EAAE,cAAc,UAAU;AAEhC,KAAI,OAAO,YAAY,SACrB,QAAO;AAGT,KAAI,QAAQ,WAAW,EACrB,QAAO;AAGT,KAAI,QAAQ,WAAW,EACrB,QAAO,QAAQ;AAGjB,KAAI,QAAQ,WAAW,EACrB,QAAO,GAAG,QAAQ,GAAG,GAAG,YAAY,GAAG,QAAQ;CAGjD,MAAM,OAAO,QAAQ,KAAK;AAE1B,QAAO,GAAG,QAAQ,KAAK,KAAK,CAAC,IAAI,YAAY,GAAG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/string-format",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "type": "module",
5
5
  "description": "A package containing utility functions to transform strings into various formats.",
6
6
  "repository": {
@@ -134,8 +134,8 @@
134
134
  "./*": "./*"
135
135
  },
136
136
  "types": "./dist/index.d.cts",
137
- "dependencies": { "@stryke/path": "^0.26.15" },
137
+ "dependencies": { "@stryke/path": "^0.26.16" },
138
138
  "devDependencies": { "tsdown": "^0.17.2" },
139
139
  "publishConfig": { "access": "public" },
140
- "gitHead": "6e83233262e8614cd725c601173e20c877d4c60d"
140
+ "gitHead": "ddf54318bd81f6321233db8cfef8b991eb161413"
141
141
  }