1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | /**
|
4 | * Returns the plural form of a word.
|
5 | *
|
6 | * @param n The number of things to represent. This dictates whether to return
|
7 | * the singular or plural form of the word.
|
8 | * @param singular The singular form of the word.
|
9 | * @param plural An optional plural form of the word. If non is given, the
|
10 | * plural form is constructed by appending an "s" to the singular form.
|
11 | */
|
12 | function pluralize(n, singular, plural) {
|
13 | if (n === 1) {
|
14 | return singular;
|
15 | }
|
16 | if (plural !== undefined) {
|
17 | return plural;
|
18 | }
|
19 | return `${singular}s`;
|
20 | }
|
21 | exports.pluralize = pluralize;
|
22 | /**
|
23 | * Replaces all the instances of [[toReplace]] by [[replacement]] in [[str]].
|
24 | */
|
25 | function replaceAll(str, toReplace, replacement) {
|
26 | return str.split(toReplace).join(replacement);
|
27 | }
|
28 | exports.replaceAll = replaceAll;
|
29 | //# sourceMappingURL=strings.js.map |
\ | No newline at end of file |