@mythpe/quasar-ui-qui 0.1.94 → 0.1.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/utils/__pluralize.js +284 -277
package/package.json
CHANGED
package/src/utils/__pluralize.js
CHANGED
|
@@ -4,24 +4,28 @@
|
|
|
4
4
|
/* istanbul ignore else */
|
|
5
5
|
if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') {
|
|
6
6
|
// Node.
|
|
7
|
-
module.exports = pluralize()
|
|
7
|
+
// module.exports = pluralize()
|
|
8
|
+
module.exports = {
|
|
9
|
+
pluralize: pluralize(),
|
|
10
|
+
default: pluralize()
|
|
11
|
+
}
|
|
8
12
|
} else if (typeof define === 'function' && define.amd) {
|
|
9
13
|
// AMD, registers as an anonymous module.
|
|
10
14
|
define(function () {
|
|
11
|
-
return pluralize()
|
|
12
|
-
})
|
|
15
|
+
return pluralize()
|
|
16
|
+
})
|
|
13
17
|
} else {
|
|
14
18
|
// Browser global.
|
|
15
|
-
root.pluralize = pluralize()
|
|
19
|
+
root.pluralize = pluralize()
|
|
16
20
|
}
|
|
17
21
|
})(this, function () {
|
|
18
22
|
// Rule storage - pluralize and singularize need to be run sequentially,
|
|
19
23
|
// while other rules can be optimized using an object for instant lookups.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
const pluralRules = []
|
|
25
|
+
const singularRules = []
|
|
26
|
+
const uncountables = {}
|
|
27
|
+
const irregularPlurals = {}
|
|
28
|
+
const irregularSingles = {}
|
|
25
29
|
|
|
26
30
|
/**
|
|
27
31
|
* Sanitize a pluralization rule to a usable regular expression.
|
|
@@ -31,10 +35,10 @@
|
|
|
31
35
|
*/
|
|
32
36
|
function sanitizeRule (rule) {
|
|
33
37
|
if (typeof rule === 'string') {
|
|
34
|
-
return new RegExp('^' + rule + '$', 'i')
|
|
38
|
+
return new RegExp('^' + rule + '$', 'i')
|
|
35
39
|
}
|
|
36
40
|
|
|
37
|
-
return rule
|
|
41
|
+
return rule
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
/**
|
|
@@ -47,21 +51,21 @@
|
|
|
47
51
|
*/
|
|
48
52
|
function restoreCase (word, token) {
|
|
49
53
|
// Tokens are an exact match.
|
|
50
|
-
if (word === token) return token
|
|
54
|
+
if (word === token) return token
|
|
51
55
|
|
|
52
56
|
// Lower cased words. E.g. "hello".
|
|
53
|
-
if (word === word.toLowerCase()) return token.toLowerCase()
|
|
57
|
+
if (word === word.toLowerCase()) return token.toLowerCase()
|
|
54
58
|
|
|
55
59
|
// Upper cased words. E.g. "WHISKY".
|
|
56
|
-
if (word === word.toUpperCase()) return token.toUpperCase()
|
|
60
|
+
if (word === word.toUpperCase()) return token.toUpperCase()
|
|
57
61
|
|
|
58
62
|
// Title cased words. E.g. "Title".
|
|
59
63
|
if (word[0] === word[0].toUpperCase()) {
|
|
60
|
-
return token.charAt(0).toUpperCase() + token.substr(1).toLowerCase()
|
|
64
|
+
return token.charAt(0).toUpperCase() + token.substr(1).toLowerCase()
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
// Lower cased words. E.g. "test".
|
|
64
|
-
return token.toLowerCase()
|
|
68
|
+
return token.toLowerCase()
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
/**
|
|
@@ -73,8 +77,8 @@
|
|
|
73
77
|
*/
|
|
74
78
|
function interpolate (str, args) {
|
|
75
79
|
return str.replace(/\$(\d{1,2})/g, function (match, index) {
|
|
76
|
-
return args[index] || ''
|
|
77
|
-
})
|
|
80
|
+
return args[index] || ''
|
|
81
|
+
})
|
|
78
82
|
}
|
|
79
83
|
|
|
80
84
|
/**
|
|
@@ -86,14 +90,14 @@
|
|
|
86
90
|
*/
|
|
87
91
|
function replace (word, rule) {
|
|
88
92
|
return word.replace(rule[0], function (match, index) {
|
|
89
|
-
|
|
93
|
+
const result = interpolate(rule[1], arguments)
|
|
90
94
|
|
|
91
95
|
if (match === '') {
|
|
92
|
-
return restoreCase(word[index - 1], result)
|
|
96
|
+
return restoreCase(word[index - 1], result)
|
|
93
97
|
}
|
|
94
98
|
|
|
95
|
-
return restoreCase(match, result)
|
|
96
|
-
})
|
|
99
|
+
return restoreCase(match, result)
|
|
100
|
+
})
|
|
97
101
|
}
|
|
98
102
|
|
|
99
103
|
/**
|
|
@@ -107,19 +111,19 @@
|
|
|
107
111
|
function sanitizeWord (token, word, rules) {
|
|
108
112
|
// Empty string or doesn't need fixing.
|
|
109
113
|
if (!token.length || uncountables.hasOwnProperty(token)) {
|
|
110
|
-
return word
|
|
114
|
+
return word
|
|
111
115
|
}
|
|
112
116
|
|
|
113
|
-
|
|
117
|
+
let len = rules.length
|
|
114
118
|
|
|
115
119
|
// Iterate over the sanitization rules and use the first one to match.
|
|
116
120
|
while (len--) {
|
|
117
|
-
|
|
121
|
+
const rule = rules[len]
|
|
118
122
|
|
|
119
|
-
if (rule[0].test(word)) return replace(word, rule)
|
|
123
|
+
if (rule[0].test(word)) return replace(word, rule)
|
|
120
124
|
}
|
|
121
125
|
|
|
122
|
-
return word
|
|
126
|
+
return word
|
|
123
127
|
}
|
|
124
128
|
|
|
125
129
|
/**
|
|
@@ -133,21 +137,21 @@
|
|
|
133
137
|
function replaceWord (replaceMap, keepMap, rules) {
|
|
134
138
|
return function (word) {
|
|
135
139
|
// Get the correct token and case restoration functions.
|
|
136
|
-
|
|
140
|
+
const token = word.toLowerCase()
|
|
137
141
|
|
|
138
142
|
// Check against the keep object map.
|
|
139
143
|
if (keepMap.hasOwnProperty(token)) {
|
|
140
|
-
return restoreCase(word, token)
|
|
144
|
+
return restoreCase(word, token)
|
|
141
145
|
}
|
|
142
146
|
|
|
143
147
|
// Check against the replacement map for a direct word replacement.
|
|
144
148
|
if (replaceMap.hasOwnProperty(token)) {
|
|
145
|
-
return restoreCase(word, replaceMap[token])
|
|
149
|
+
return restoreCase(word, replaceMap[token])
|
|
146
150
|
}
|
|
147
151
|
|
|
148
152
|
// Run all the rules against the word.
|
|
149
|
-
return sanitizeWord(token, word, rules)
|
|
150
|
-
}
|
|
153
|
+
return sanitizeWord(token, word, rules)
|
|
154
|
+
}
|
|
151
155
|
}
|
|
152
156
|
|
|
153
157
|
/**
|
|
@@ -155,13 +159,13 @@
|
|
|
155
159
|
*/
|
|
156
160
|
function checkWord (replaceMap, keepMap, rules, bool) {
|
|
157
161
|
return function (word) {
|
|
158
|
-
|
|
162
|
+
const token = word.toLowerCase()
|
|
159
163
|
|
|
160
|
-
if (keepMap.hasOwnProperty(token)) return true
|
|
161
|
-
if (replaceMap.hasOwnProperty(token)) return false
|
|
164
|
+
if (keepMap.hasOwnProperty(token)) return true
|
|
165
|
+
if (replaceMap.hasOwnProperty(token)) return false
|
|
162
166
|
|
|
163
|
-
return sanitizeWord(token, token, rules) === token
|
|
164
|
-
}
|
|
167
|
+
return sanitizeWord(token, token, rules) === token
|
|
168
|
+
}
|
|
165
169
|
}
|
|
166
170
|
|
|
167
171
|
/**
|
|
@@ -173,10 +177,10 @@
|
|
|
173
177
|
* @return {string}
|
|
174
178
|
*/
|
|
175
179
|
function pluralize (word, count, inclusive) {
|
|
176
|
-
|
|
177
|
-
? pluralize.singular(word) : pluralize.plural(word)
|
|
180
|
+
const pluralized = count === 1
|
|
181
|
+
? pluralize.singular(word) : pluralize.plural(word)
|
|
178
182
|
|
|
179
|
-
return (inclusive ? count + ' ' : '') + pluralized
|
|
183
|
+
return (inclusive ? count + ' ' : '') + pluralized
|
|
180
184
|
}
|
|
181
185
|
|
|
182
186
|
/**
|
|
@@ -186,7 +190,7 @@
|
|
|
186
190
|
*/
|
|
187
191
|
pluralize.plural = replaceWord(
|
|
188
192
|
irregularSingles, irregularPlurals, pluralRules
|
|
189
|
-
)
|
|
193
|
+
)
|
|
190
194
|
|
|
191
195
|
/**
|
|
192
196
|
* Check if a word is plural.
|
|
@@ -195,7 +199,7 @@
|
|
|
195
199
|
*/
|
|
196
200
|
pluralize.isPlural = checkWord(
|
|
197
201
|
irregularSingles, irregularPlurals, pluralRules
|
|
198
|
-
)
|
|
202
|
+
)
|
|
199
203
|
|
|
200
204
|
/**
|
|
201
205
|
* Singularize a word.
|
|
@@ -204,7 +208,7 @@
|
|
|
204
208
|
*/
|
|
205
209
|
pluralize.singular = replaceWord(
|
|
206
210
|
irregularPlurals, irregularSingles, singularRules
|
|
207
|
-
)
|
|
211
|
+
)
|
|
208
212
|
|
|
209
213
|
/**
|
|
210
214
|
* Check if a word is singular.
|
|
@@ -213,7 +217,7 @@
|
|
|
213
217
|
*/
|
|
214
218
|
pluralize.isSingular = checkWord(
|
|
215
219
|
irregularPlurals, irregularSingles, singularRules
|
|
216
|
-
)
|
|
220
|
+
)
|
|
217
221
|
|
|
218
222
|
/**
|
|
219
223
|
* Add a pluralization rule to the collection.
|
|
@@ -222,8 +226,8 @@
|
|
|
222
226
|
* @param {string} replacement
|
|
223
227
|
*/
|
|
224
228
|
pluralize.addPluralRule = function (rule, replacement) {
|
|
225
|
-
pluralRules.push([sanitizeRule(rule), replacement])
|
|
226
|
-
}
|
|
229
|
+
pluralRules.push([sanitizeRule(rule), replacement])
|
|
230
|
+
}
|
|
227
231
|
|
|
228
232
|
/**
|
|
229
233
|
* Add a singularization rule to the collection.
|
|
@@ -232,8 +236,8 @@
|
|
|
232
236
|
* @param {string} replacement
|
|
233
237
|
*/
|
|
234
238
|
pluralize.addSingularRule = function (rule, replacement) {
|
|
235
|
-
singularRules.push([sanitizeRule(rule), replacement])
|
|
236
|
-
}
|
|
239
|
+
singularRules.push([sanitizeRule(rule), replacement])
|
|
240
|
+
}
|
|
237
241
|
|
|
238
242
|
/**
|
|
239
243
|
* Add an uncountable word rule.
|
|
@@ -242,14 +246,14 @@
|
|
|
242
246
|
*/
|
|
243
247
|
pluralize.addUncountableRule = function (word) {
|
|
244
248
|
if (typeof word === 'string') {
|
|
245
|
-
uncountables[word.toLowerCase()] = true
|
|
246
|
-
return
|
|
249
|
+
uncountables[word.toLowerCase()] = true
|
|
250
|
+
return
|
|
247
251
|
}
|
|
248
252
|
|
|
249
253
|
// Set singular and plural references for the word.
|
|
250
|
-
pluralize.addPluralRule(word, '$0')
|
|
251
|
-
pluralize.addSingularRule(word, '$0')
|
|
252
|
-
}
|
|
254
|
+
pluralize.addPluralRule(word, '$0')
|
|
255
|
+
pluralize.addSingularRule(word, '$0')
|
|
256
|
+
}
|
|
253
257
|
|
|
254
258
|
/**
|
|
255
259
|
* Add an irregular word definition.
|
|
@@ -258,246 +262,249 @@
|
|
|
258
262
|
* @param {string} plural
|
|
259
263
|
*/
|
|
260
264
|
pluralize.addIrregularRule = function (single, plural) {
|
|
261
|
-
plural = plural.toLowerCase()
|
|
262
|
-
single = single.toLowerCase()
|
|
265
|
+
plural = plural.toLowerCase()
|
|
266
|
+
single = single.toLowerCase()
|
|
263
267
|
|
|
264
|
-
irregularSingles[single] = plural
|
|
265
|
-
irregularPlurals[plural] = single
|
|
266
|
-
}
|
|
268
|
+
irregularSingles[single] = plural
|
|
269
|
+
irregularPlurals[plural] = single
|
|
270
|
+
}
|
|
267
271
|
|
|
268
272
|
/**
|
|
269
273
|
* Irregular rules.
|
|
270
274
|
*/
|
|
271
|
-
|
|
275
|
+
[
|
|
272
276
|
// Pronouns.
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
277
|
+
['I', 'we'],
|
|
278
|
+
['me', 'us'],
|
|
279
|
+
['he', 'they'],
|
|
280
|
+
['she', 'they'],
|
|
281
|
+
['them', 'them'],
|
|
282
|
+
['myself', 'ourselves'],
|
|
283
|
+
['yourself', 'yourselves'],
|
|
284
|
+
['itself', 'themselves'],
|
|
285
|
+
['herself', 'themselves'],
|
|
286
|
+
['himself', 'themselves'],
|
|
287
|
+
['themself', 'themselves'],
|
|
288
|
+
['is', 'are'],
|
|
289
|
+
['was', 'were'],
|
|
290
|
+
['has', 'have'],
|
|
291
|
+
['this', 'these'],
|
|
292
|
+
['that', 'those'],
|
|
293
|
+
// Words ending in with a consonant and `o`.
|
|
294
|
+
['echo', 'echoes'],
|
|
295
|
+
['dingo', 'dingoes'],
|
|
296
|
+
['volcano', 'volcanoes'],
|
|
297
|
+
['tornado', 'tornadoes'],
|
|
298
|
+
['torpedo', 'torpedoes'],
|
|
299
|
+
// Ends with `us`.
|
|
300
|
+
['genus', 'genera'],
|
|
301
|
+
['viscus', 'viscera'],
|
|
302
|
+
// Ends with `ma`.
|
|
303
|
+
['stigma', 'stigmata'],
|
|
304
|
+
['stoma', 'stomata'],
|
|
305
|
+
['dogma', 'dogmata'],
|
|
306
|
+
['lemma', 'lemmata'],
|
|
307
|
+
['schema', 'schemata'],
|
|
308
|
+
['anathema', 'anathemata'],
|
|
309
|
+
// Other irregular rules.
|
|
310
|
+
['ox', 'oxen'],
|
|
311
|
+
['axe', 'axes'],
|
|
312
|
+
['die', 'dice'],
|
|
313
|
+
['yes', 'yeses'],
|
|
314
|
+
['foot', 'feet'],
|
|
315
|
+
['eave', 'eaves'],
|
|
316
|
+
['goose', 'geese'],
|
|
317
|
+
['tooth', 'teeth'],
|
|
318
|
+
['quiz', 'quizzes'],
|
|
319
|
+
['human', 'humans'],
|
|
320
|
+
['proof', 'proofs'],
|
|
321
|
+
['carve', 'carves'],
|
|
322
|
+
['valve', 'valves'],
|
|
323
|
+
['looey', 'looies'],
|
|
324
|
+
['thief', 'thieves'],
|
|
325
|
+
['groove', 'grooves'],
|
|
326
|
+
['pickaxe', 'pickaxes'],
|
|
327
|
+
['passerby', 'passersby']
|
|
328
|
+
].forEach(function (rule) {
|
|
329
|
+
return pluralize.addIrregularRule(rule[0], rule[1])
|
|
330
|
+
})
|
|
327
331
|
|
|
328
332
|
/**
|
|
329
333
|
* Pluralization rules.
|
|
330
334
|
*/
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
335
|
+
[
|
|
336
|
+
[/s?$/i, 's'],
|
|
337
|
+
[/[^\u0000-\u007F]$/i, '$0'],
|
|
338
|
+
[/([^aeiou]ese)$/i, '$1'],
|
|
339
|
+
[/(ax|test)is$/i, '$1es'],
|
|
340
|
+
[/(alias|[^aou]us|t[lm]as|gas|ris)$/i, '$1es'],
|
|
341
|
+
[/(e[mn]u)s?$/i, '$1s'],
|
|
342
|
+
[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, '$1'],
|
|
343
|
+
[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, '$1i'],
|
|
344
|
+
[/(alumn|alg|vertebr)(?:a|ae)$/i, '$1ae'],
|
|
345
|
+
[/(seraph|cherub)(?:im)?$/i, '$1im'],
|
|
346
|
+
[/(her|at|gr)o$/i, '$1oes'],
|
|
347
|
+
[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, '$1a'],
|
|
348
|
+
[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, '$1a'],
|
|
349
|
+
[/sis$/i, 'ses'],
|
|
350
|
+
[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, '$1$2ves'],
|
|
351
|
+
[/([^aeiouy]|qu)y$/i, '$1ies'],
|
|
352
|
+
[/([^ch][ieo][ln])ey$/i, '$1ies'],
|
|
353
|
+
[/(x|ch|ss|sh|zz)$/i, '$1es'],
|
|
354
|
+
[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, '$1ices'],
|
|
355
|
+
[/\b((?:tit)?m|l)(?:ice|ouse)$/i, '$1ice'],
|
|
356
|
+
[/(pe)(?:rson|ople)$/i, '$1ople'],
|
|
357
|
+
[/(child)(?:ren)?$/i, '$1ren'],
|
|
358
|
+
[/eaux$/i, '$0'],
|
|
359
|
+
[/m[ae]n$/i, 'men'],
|
|
360
|
+
['thou', 'you']
|
|
361
|
+
].forEach(function (rule) {
|
|
362
|
+
return pluralize.addPluralRule(rule[0], rule[1])
|
|
363
|
+
})
|
|
360
364
|
|
|
361
365
|
/**
|
|
362
366
|
* Singularization rules.
|
|
363
367
|
*/
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
368
|
+
[
|
|
369
|
+
[/s$/i, ''],
|
|
370
|
+
[/(ss)$/i, '$1'],
|
|
371
|
+
[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, '$1fe'],
|
|
372
|
+
[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, '$1f'],
|
|
373
|
+
[/ies$/i, 'y'],
|
|
374
|
+
[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, '$1ie'],
|
|
375
|
+
[/\b(mon|smil)ies$/i, '$1ey'],
|
|
376
|
+
[/\b((?:tit)?m|l)ice$/i, '$1ouse'],
|
|
377
|
+
[/(seraph|cherub)im$/i, '$1'],
|
|
378
|
+
[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, '$1'],
|
|
379
|
+
[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, '$1sis'],
|
|
380
|
+
[/(movie|twelve|abuse|e[mn]u)s$/i, '$1'],
|
|
381
|
+
[/(test)(?:is|es)$/i, '$1is'],
|
|
382
|
+
[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, '$1us'],
|
|
383
|
+
[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, '$1um'],
|
|
384
|
+
[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, '$1on'],
|
|
385
|
+
[/(alumn|alg|vertebr)ae$/i, '$1a'],
|
|
386
|
+
[/(cod|mur|sil|vert|ind)ices$/i, '$1ex'],
|
|
387
|
+
[/(matr|append)ices$/i, '$1ix'],
|
|
388
|
+
[/(pe)(rson|ople)$/i, '$1rson'],
|
|
389
|
+
[/(child)ren$/i, '$1'],
|
|
390
|
+
[/(eau)x?$/i, '$1'],
|
|
391
|
+
[/men$/i, 'man']
|
|
392
|
+
].forEach(function (rule) {
|
|
393
|
+
return pluralize.addSingularRule(rule[0], rule[1])
|
|
394
|
+
})
|
|
391
395
|
|
|
392
396
|
/**
|
|
393
397
|
* Uncountable rules.
|
|
394
398
|
*/
|
|
395
|
-
|
|
399
|
+
[
|
|
396
400
|
// Singular words with no plurals.
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
return pluralize
|
|
503
|
-
})
|
|
401
|
+
'adulthood',
|
|
402
|
+
'advice',
|
|
403
|
+
'agenda',
|
|
404
|
+
'aid',
|
|
405
|
+
'aircraft',
|
|
406
|
+
'alcohol',
|
|
407
|
+
'ammo',
|
|
408
|
+
'analytics',
|
|
409
|
+
'anime',
|
|
410
|
+
'athletics',
|
|
411
|
+
'audio',
|
|
412
|
+
'bison',
|
|
413
|
+
'blood',
|
|
414
|
+
'bream',
|
|
415
|
+
'buffalo',
|
|
416
|
+
'butter',
|
|
417
|
+
'carp',
|
|
418
|
+
'cash',
|
|
419
|
+
'chassis',
|
|
420
|
+
'chess',
|
|
421
|
+
'clothing',
|
|
422
|
+
'cod',
|
|
423
|
+
'commerce',
|
|
424
|
+
'cooperation',
|
|
425
|
+
'corps',
|
|
426
|
+
'debris',
|
|
427
|
+
'diabetes',
|
|
428
|
+
'digestion',
|
|
429
|
+
'elk',
|
|
430
|
+
'energy',
|
|
431
|
+
'equipment',
|
|
432
|
+
'excretion',
|
|
433
|
+
'expertise',
|
|
434
|
+
'firmware',
|
|
435
|
+
'flounder',
|
|
436
|
+
'fun',
|
|
437
|
+
'gallows',
|
|
438
|
+
'garbage',
|
|
439
|
+
'graffiti',
|
|
440
|
+
'hardware',
|
|
441
|
+
'headquarters',
|
|
442
|
+
'health',
|
|
443
|
+
'herpes',
|
|
444
|
+
'highjinks',
|
|
445
|
+
'homework',
|
|
446
|
+
'housework',
|
|
447
|
+
'information',
|
|
448
|
+
'jeans',
|
|
449
|
+
'justice',
|
|
450
|
+
'kudos',
|
|
451
|
+
'labour',
|
|
452
|
+
'literature',
|
|
453
|
+
'machinery',
|
|
454
|
+
'mackerel',
|
|
455
|
+
'mail',
|
|
456
|
+
'media',
|
|
457
|
+
'mews',
|
|
458
|
+
'moose',
|
|
459
|
+
'music',
|
|
460
|
+
'mud',
|
|
461
|
+
'manga',
|
|
462
|
+
'news',
|
|
463
|
+
'only',
|
|
464
|
+
'personnel',
|
|
465
|
+
'pike',
|
|
466
|
+
'plankton',
|
|
467
|
+
'pliers',
|
|
468
|
+
'police',
|
|
469
|
+
'pollution',
|
|
470
|
+
'premises',
|
|
471
|
+
'rain',
|
|
472
|
+
'research',
|
|
473
|
+
'rice',
|
|
474
|
+
'salmon',
|
|
475
|
+
'scissors',
|
|
476
|
+
'series',
|
|
477
|
+
'sewage',
|
|
478
|
+
'shambles',
|
|
479
|
+
'shrimp',
|
|
480
|
+
'software',
|
|
481
|
+
'species',
|
|
482
|
+
'staff',
|
|
483
|
+
'swine',
|
|
484
|
+
'tennis',
|
|
485
|
+
'traffic',
|
|
486
|
+
'transportation',
|
|
487
|
+
'trout',
|
|
488
|
+
'tuna',
|
|
489
|
+
'wealth',
|
|
490
|
+
'welfare',
|
|
491
|
+
'whiting',
|
|
492
|
+
'wildebeest',
|
|
493
|
+
'wildlife',
|
|
494
|
+
'you',
|
|
495
|
+
/pok[eé]mon$/i,
|
|
496
|
+
// Regexes.
|
|
497
|
+
/[^aeiou]ese$/i, // "chinese", "japanese"
|
|
498
|
+
/deer$/i, // "deer", "reindeer"
|
|
499
|
+
/fish$/i, // "fish", "blowfish", "angelfish"
|
|
500
|
+
/measles$/i,
|
|
501
|
+
/o[iu]s$/i, // "carnivorous"
|
|
502
|
+
/pox$/i, // "chickpox", "smallpox"
|
|
503
|
+
/sheep$/i
|
|
504
|
+
].forEach(pluralize.addUncountableRule)
|
|
505
|
+
|
|
506
|
+
return pluralize
|
|
507
|
+
})
|
|
508
|
+
|
|
509
|
+
import pluralize from 'pluralize'
|
|
510
|
+
export default pluralize
|