english-plurals
Advanced tools
Comparing version 0.8.9 to 0.8.10
export interface IrregularPlurals { | ||
[key: string]: string; | ||
} | ||
export declare function getPlural(irregulars: IrregularPlurals, singular: string): string; | ||
export interface WordInfo { | ||
plural: string; | ||
} | ||
export interface WordsInfo { | ||
[key: string]: WordInfo; | ||
} | ||
export declare function getPlural(wordsInfo: WordsInfo, irregulars: IrregularPlurals, singular: string): string; |
@@ -38,3 +38,3 @@ "use strict"; | ||
const consonants = 'bcdfghjklmnpqrstvxzw'; | ||
function getPlural(irregulars, singular) { | ||
function getPlural(wordsInfo, irregulars, singular) { | ||
if (!singular) { | ||
@@ -46,3 +46,6 @@ const err = new Error(); | ||
} | ||
if (dontChange.indexOf(singular) > -1) { | ||
if (wordsInfo && wordsInfo[singular] && wordsInfo[singular].plural) { | ||
return wordsInfo[singular].plural; | ||
} | ||
else if (dontChange.indexOf(singular) > -1) { | ||
return singular; | ||
@@ -49,0 +52,0 @@ } |
{ | ||
"name": "english-plurals", | ||
"version": "0.8.9", | ||
"version": "0.8.10", | ||
"description": "English plural of words", | ||
@@ -48,3 +48,3 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"english-plurals-list": "0.8.9" | ||
"english-plurals-list": "0.8.10" | ||
}, | ||
@@ -58,3 +58,3 @@ "keywords": [ | ||
"license": "MIT", | ||
"gitHead": "cad6ab45154f6680478ace7af2b4eb3b233f9392" | ||
"gitHead": "c4be3bba693b9c5e1564b6da828850c26c7e030f" | ||
} |
@@ -14,2 +14,3 @@ # English plurals | ||
`getPlural` returns the plural of a singular word, based on: | ||
- a list of exception elements where singular is the key and having a `plural` property: in general leave null | ||
- a list of irregular plurals: use `english-plurals-list` | ||
@@ -16,0 +17,0 @@ - the singular word |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55606
590
33