UNPKG

inflected

Version:

A port of ActiveSupport's inflector to Node.js

23 lines (18 loc) 449 B
import isFunction from "./util/isFunction"; import Inflector from "./Inflector"; import defaults from "./defaults"; export default function inflections(locale, fn) { if (isFunction(locale)) { fn = locale; locale = null; } locale = locale || "en"; if (fn) { fn(Inflector.getInstance(locale)); } else { return Inflector.getInstance(locale); } } for (let locale in defaults) { inflections(locale, defaults[locale]); }