superflected
Version:
A port of ActiveSupport's inflector to Node.js
9 lines (7 loc) • 307 B
text/typescript
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}`
);