UNPKG

superflected

Version:

A port of ActiveSupport's inflector to Node.js

9 lines (7 loc) 307 B
import { applyInflections } from "./applyInflections"; import { cacheable } from "./cacheable"; import { inflections } from "./Inflector"; export const pluralize = cacheable( (word: string, locale = "en") => applyInflections(word, inflections(locale).plurals), (word, locale) => `${word}-${locale}` );