import type { RuleSet } from "./types"; interface ResolvedRuleCache extends Omit { uncountable: { [word: string]: boolean; }; irregular: { [singular: string]: string; }; irregularInverse: { [plural: string]: string; }; } /** Inflector.Ember provides a mechanism for supplying inflection rules for your application. Ember includes a default set of inflection rules, and provides an API for providing additional rules. Examples: Creating an inflector with no rules. ```js var inflector = new Ember.Inflector(); ``` Creating an inflector with the default ember ruleset. ```js var inflector = new Ember.Inflector(Ember.Inflector.defaultRules); inflector.pluralize('cow'); //=> 'kine' inflector.singularize('kine'); //=> 'cow' ``` Creating an inflector and adding rules later. ```javascript var inflector = Ember.Inflector.inflector; inflector.pluralize('advice'); // => 'advices' inflector.uncountable('advice'); inflector.pluralize('advice'); // => 'advice' inflector.pluralize('formula'); // => 'formulas' inflector.irregular('formula', 'formulae'); inflector.pluralize('formula'); // => 'formulae' // you would not need to add these as they are the default rules inflector.plural(/$/, 's'); inflector.singular(/s$/i, ''); ``` Creating an inflector with a nondefault ruleset. ```javascript var rules = { plurals: [ [ /$/, 's' ] ], singular: [ [ /\s$/, '' ] ], irregularPairs: [ [ 'cow', 'kine' ] ], uncountable: [ 'fish' ] }; var inflector = new Ember.Inflector(rules); ``` */ export declare class Inflector { #private; static defaultRules: { uncountable: string[]; irregularPairs: [singular: string, plural: string][]; singular: [pluralMatcher: string | RegExp, replacement: string][]; plurals: [singularMatcher: string | RegExp, replacement: string][]; }; static inflector: Inflector; rules: ResolvedRuleCache; constructor(ruleSet?: Partial); /** @public As inflections can be costly, and commonly the same subset of words are repeatedly inflected an optional cache is provided. @method enableCache */ enableCache(): void; /** @public @method purgeCache */ purgeCache(): void; /** @public disable caching @method disableCache; */ disableCache(): void; /** * adds to the list of plural rules, clearing the cache */ plural(regex: RegExp, string: string): void; /** * adds to the list of singular rules, clearing the cache */ singular(regex: RegExp, string: string): void; /** * adds to the list of uncountable rules, clearing the cache */ uncountable(string: string): void; /** * adds to the list of irregular rules, clearing the cache */ irregular(singular: string, plural: string): void; pluralize(word: string): string; pluralize(count: number, word: string, options?: { withoutCount?: boolean; }): string; singularize(word: string): string; inflect(word: string | number, typeRules: [string | RegExp, string][], irregular: { [rule: string]: string; }): string; } export {};