1 | # Installation
|
2 | > `npm install --save @types/pluralize`
|
3 |
|
4 | # Summary
|
5 | This package contains type definitions for pluralize (https://www.npmjs.com/package/pluralize).
|
6 |
|
7 | # Details
|
8 | Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pluralize.
|
9 | ## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pluralize/index.d.ts)
|
10 | ````ts
|
11 | // Type definitions for pluralize
|
12 | // Project: https://www.npmjs.com/package/pluralize
|
13 | // Definitions by: Syu Kato <https://github.com/ukyo>
|
14 | // Karol Majewski <https://github.com/karol-majewski>
|
15 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
16 |
|
17 | /**
|
18 | * Pluralize or singularize a word based on the passed in count.
|
19 | *
|
20 | * @param word
|
21 | * @param count
|
22 | * @param inclusive
|
23 | */
|
24 | declare function pluralize(word: string, count?: number, inclusive?: boolean): string;
|
25 |
|
26 | declare namespace pluralize {
|
27 | /**
|
28 | * Pluralize a word based.
|
29 | *
|
30 | * @param word
|
31 | */
|
32 | function plural(word: string): string;
|
33 |
|
34 | /**
|
35 | * Singularize a word based.
|
36 | *
|
37 | * @param word
|
38 | */
|
39 | function singular(word: string): string;
|
40 |
|
41 | /**
|
42 | * Add a pluralization rule to the collection.
|
43 | *
|
44 | * @param rule
|
45 | * @param replacement
|
46 | */
|
47 | function addPluralRule(rule: string | RegExp, replacement: string): void;
|
48 |
|
49 | /**
|
50 | * Add a singularization rule to the collection.
|
51 | *
|
52 | * @param rule
|
53 | * @param replacement
|
54 | */
|
55 | function addSingularRule(rule: string | RegExp, replacement: string): void;
|
56 |
|
57 | /**
|
58 | * Add an irregular word definition.
|
59 | *
|
60 | * @param single
|
61 | * @param plural
|
62 | */
|
63 | function addIrregularRule(single: string, plural: string): void;
|
64 |
|
65 | /**
|
66 | * Add an uncountable word rule.
|
67 | *
|
68 | * @param word
|
69 | */
|
70 | function addUncountableRule(word: string | RegExp): void;
|
71 |
|
72 | /**
|
73 | * Test if provided word is plural.
|
74 | *
|
75 | * @param word
|
76 | */
|
77 | function isPlural(word: string): boolean;
|
78 |
|
79 | /**
|
80 | * Test if provided word is singular.
|
81 | *
|
82 | * @param word
|
83 | */
|
84 | function isSingular(word: string): boolean;
|
85 | }
|
86 |
|
87 | export = pluralize;
|
88 | export as namespace pluralize;
|
89 |
|
90 | ````
|
91 |
|
92 | ### Additional Details
|
93 | * Last updated: Thu, 06 Jul 2023 20:32:45 GMT
|
94 | * Dependencies: none
|
95 | * Global values: `pluralize`
|
96 |
|
97 | # Credits
|
98 | These definitions were written by [Syu Kato](https://github.com/ukyo), and [Karol Majewski](https://github.com/karol-majewski).
|
99 |
|
\ | No newline at end of file |