DefinitelyTyped/types/pluralize/index.d.ts
James Bromwell fadcd86546 Add new methods from pluralize v5.1.0 (#20683)
* Add isPlural / isSingular

Test the changes to `index.d.ts`.

* Add isPlural / isSingular

See [release notes](https://github.com/blakeembrey/pluralize/releases), new API has been present since July.
2017-10-18 09:17:51 -07:00

80 lines
1.7 KiB
TypeScript

// Type definitions for pluralize
// Project: https://www.npmjs.com/package/pluralize
// Definitions by: Syu Kato <https://github.com/ukyo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface PluralizeStatic {
/**
* Pluralize or singularize a word based on the passed in count.
*
* @param word
* @param count
* @param inclusive
*/
(word: string, count?: number, inclusive?: boolean): string;
/**
* Pluralize a word based.
*
* @param word
*/
plural(word: string): string;
/**
* Singularize a word based.
*
* @param word
*/
singular(word: string): string;
/**
* Add a pluralization rule to the collection.
*
* @param rule
* @param replacement
*/
addPluralRule(rule: string|RegExp, replacemant: string): void;
/**
* Add a singularization rule to the collection.
*
* @param rule
* @param replacement
*/
addSingularRule(rule: string|RegExp, replacemant: string): void;
/**
* Add an irregular word definition.
*
* @param single
* @param plural
*/
addIrregularRule(single: string, plural: string): void;
/**
* Add an uncountable word rule.
*
* @param word
*/
addUncountableRule(word: string|RegExp): void;
/**
* Test if provided word is plural.
*
* @param word
*/
isPlural(word: string): boolean;
/**
* Test if provided word is singular.
*
* @param word
*/
isSingular(word: string): boolean;
}
declare module "pluralize" {
export = pluralize;
}
declare var pluralize: PluralizeStatic;