UNPKG

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