@stacksjs/strings 0.65.0 → 0.67.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.
@@ -1,23 +1,20 @@
1
- type Rule = string | RegExp;
2
- type Replacement = string;
3
- type Word = string;
4
- export type PluralizeTest = (word: Word) => boolean;
5
- export interface Pluralize {
6
- plural: (word: Word, count?: number, inclusive?: boolean) => Word;
7
- singular: (word: Word) => Word;
8
- isPlural: (word: Word) => boolean;
9
- isSingular: (word: Word) => boolean;
10
- addPluralRule: (rule: Rule, replacement: Replacement) => void;
11
- addSingularRule: (rule: Rule, replacement: Replacement) => void;
12
- addIrregularRule: (single: Word, plural: Word) => void;
13
- addUncountableRule: (word: Word | RegExp) => void;
1
+ export interface PluralizeOptions {
2
+ count?: number;
3
+ inclusive?: boolean;
14
4
  }
15
- export declare const plural: Pluralize["plural"];
16
- export declare const singular: Pluralize["singular"];
17
- export declare const isPlural: Pluralize["isPlural"];
18
- export declare const isSingular: Pluralize["isSingular"];
19
- export declare const addPluralRule: Pluralize["addPluralRule"];
20
- export declare const addSingularRule: Pluralize["addSingularRule"];
21
- export declare const addIrregularRule: Pluralize["addIrregularRule"];
22
- export declare const addUncountableRule: Pluralize["addUncountableRule"];
23
- export {};
5
+ type StringOrRegExp = string | RegExp;
6
+ interface PluralizeFunction {
7
+ (word: string, options?: PluralizeOptions): string;
8
+ plural: (word: string) => string;
9
+ isPlural: (word: string) => boolean;
10
+ singular: (word: string) => string;
11
+ isSingular: (word: string) => boolean;
12
+ addPluralRule: (rule: StringOrRegExp, replacement: string) => void;
13
+ addSingularRule: (rule: StringOrRegExp, replacement: string) => void;
14
+ addUncountableRule: (word: string | RegExp) => void;
15
+ addIrregularRule: (single: string, plural: string) => void;
16
+ }
17
+ export declare const pluralize: PluralizeFunction;
18
+ export declare const singular: PluralizeFunction;
19
+ export declare const plural: PluralizeFunction;
20
+ export default pluralize;
package/dist/slug.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ export interface SlugifyOptions {
2
+ replacement?: string;
3
+ remove?: RegExp;
4
+ lower?: boolean;
5
+ strict?: boolean;
6
+ locale?: string;
7
+ trim?: boolean;
8
+ }
9
+ type CharMap = Record<string, string>;
10
+ export declare function slugify(string: string, options?: SlugifyOptions): string;
11
+ export declare function extendCharMap(customMap: CharMap): void;
12
+ export {};
@@ -0,0 +1 @@
1
+ export declare function spongeCase(input: string, locale?: string[] | string): string;
package/dist/string.d.ts CHANGED
@@ -2,5 +2,5 @@ export * from "./case";
2
2
  export * from "./helpers";
3
3
  export * from "./macro";
4
4
  export * from "./pluralize";
5
+ export * from "./slug";
5
6
  export * from "./utils";
6
- export { isString } from "@stacksjs/validation";
@@ -0,0 +1 @@
1
+ export declare function swapCase(input: string, locale?: string[] | string): string;
@@ -0,0 +1,13 @@
1
+ export declare const WORD_SEPARATORS: Set<string>;
2
+ export declare const SENTENCE_TERMINATORS: Set<string>;
3
+ export declare const TITLE_TERMINATORS: Set<string>;
4
+ export declare const SMALL_WORDS: Set<string>;
5
+ export interface TitleCaseOptions {
6
+ locale?: string | string[];
7
+ sentenceCase?: boolean;
8
+ sentenceTerminators?: Set<string>;
9
+ smallWords?: Set<string>;
10
+ titleTerminators?: Set<string>;
11
+ wordSeparators?: Set<string>;
12
+ }
13
+ export declare function titleCase(input: string, options?: TitleCaseOptions | string[] | string): string;
package/dist/utils.d.ts CHANGED
@@ -66,5 +66,6 @@ export declare function random(size?: number, dict?: string): string;
66
66
  * ```
67
67
  */
68
68
  export declare function slug(str: string, options?: SlugOptions): string;
69
- export { default as detectIndent } from "detect-indent";
70
- export { detectNewline } from "detect-newline";
69
+ export * from "./detect-indent";
70
+ export * from "./detect-newline";
71
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/strings",
3
3
  "type": "module",
4
- "version": "0.65.0",
4
+ "version": "0.67.0",
5
5
  "description": "The Stacks string utilities.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": ["Chris Breuer <chris@stacksjs.org>"],
@@ -36,17 +36,15 @@
36
36
  ],
37
37
  "exports": {
38
38
  ".": {
39
- "bun": "./src/index.ts",
40
39
  "import": "./dist/index.js"
41
40
  },
42
41
  "./*": {
43
- "bun": "./src/*",
44
42
  "import": "./dist/*"
45
43
  }
46
44
  },
47
45
  "module": "dist/index.js",
48
46
  "types": "dist/index.d.ts",
49
- "files": ["README.md", "dist", "src"],
47
+ "files": ["README.md", "dist"],
50
48
  "scripts": {
51
49
  "build": "bun build.ts",
52
50
  "typecheck": "bun tsc --noEmit",
@@ -54,21 +52,13 @@
54
52
  "prepublishOnly": "bun run build"
55
53
  },
56
54
  "dependencies": {
57
- "@stacksjs/alias": "0.64.6",
58
- "@stacksjs/types": "0.64.6",
59
- "change-case": "^5.4.4",
60
- "detect-indent": "^7.0.1",
61
- "detect-newline": "^4.0.1",
62
55
  "macroable": "^7.0.2",
63
- "pluralize": "^8.0.0",
64
- "slugify": "^1.6.6",
65
- "string-ts": "^2.2.0",
66
- "title-case": "^4.3.2",
67
56
  "validator": "^13.12.0"
68
57
  },
69
58
  "devDependencies": {
70
- "@stacksjs/development": "0.64.6",
71
- "@types/pluralize": "^0.0.33",
59
+ "@stacksjs/alias": "0.67.0",
60
+ "@stacksjs/development": "0.67.0",
61
+ "@stacksjs/types": "0.67.0",
72
62
  "@types/validator": "^13.12.2"
73
63
  }
74
64
  }