mirror of
https://github.com/thangisme/notes.git
synced 2026-06-18 00:20:03 -04:00
Initial commit
This commit is contained in:
20
node_modules/plur/index.js
generated
vendored
Normal file
20
node_modules/plur/index.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
var irregularPlurals = require('irregular-plurals');
|
||||
|
||||
module.exports = function (str, plural, count) {
|
||||
if (typeof plural === 'number') {
|
||||
count = plural;
|
||||
}
|
||||
|
||||
if (str in irregularPlurals) {
|
||||
plural = irregularPlurals[str];
|
||||
} else if (typeof plural !== 'string') {
|
||||
plural = (str.replace(/(?:s|x|z|ch|sh)$/i, '$&e').replace(/([^aeiou])y$/i, '$1ie') + 's')
|
||||
.replace(/i?e?s$/i, function (m) {
|
||||
var isTailLowerCase = str.slice(-1) === str.slice(-1).toLowerCase();
|
||||
return isTailLowerCase ? m.toLowerCase() : m.toUpperCase();
|
||||
});
|
||||
}
|
||||
|
||||
return count === 1 ? str : plural;
|
||||
};
|
||||
Reference in New Issue
Block a user