UNPKG

compromise

Version:
19 lines (17 loc) 518 B
const keep = { tags: true } const nounToSingular = function (m, parsed) { // already singular? if (parsed.isPlural === false) { return m } const { methods, model } = m.world const { toSingular } = methods.two.transform.noun // inflect the root noun const str = parsed.root.text('normal') const single = toSingular(str, model) m.replace(parsed.root, single, keep).tag('Singular', 'toPlural') // should we change the determiner/article? // m.debug() return m } export default nounToSingular