UNPKG

@beenotung/tslib

Version:
28 lines 746 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.to_plural = exports.isEngChar = void 0; function isEngChar(c) { return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'); } exports.isEngChar = isEngChar; function to_plural(word) { if (word.endsWith('y')) { switch (word[word.length - 1 - 1]) { case 'a': case 'e': case 'i': case 'o': case 'u': break; default: return word.replace(/y$/, 'ies'); } } if (isEngChar(word[word.length - 1])) { return word + 's'; } // non-english word return word; } exports.to_plural = to_plural; //# sourceMappingURL=en.js.map