Galerie und tage
This commit is contained in:
38
node_modules/plur/index.d.ts
generated
vendored
38
node_modules/plur/index.d.ts
generated
vendored
@@ -1,38 +0,0 @@
|
||||
/**
|
||||
Pluralize a word.
|
||||
|
||||
@param word - Word to pluralize.
|
||||
@param plural - Pluralized word.
|
||||
The plural suffix will match the case of the last letter in the word.
|
||||
This option is only for extreme edge-cases. You probably won't need it.
|
||||
|
||||
Default:
|
||||
|
||||
- Irregular nouns will use this [list](https://github.com/sindresorhus/irregular-plurals/blob/master/irregular-plurals.json).
|
||||
- Words ending in *s*, *x*, *z*, *ch*, *sh* will be pluralized with *-es* (eg. *foxes*).
|
||||
- Words ending in *y* that are preceded by a consonant will be pluralized by replacing *y* with *-ies* (eg. *puppies*).
|
||||
- All other words will have "s" added to the end (eg. *days*).
|
||||
|
||||
@param count - Count to determine whether to use singular or plural.
|
||||
|
||||
@example
|
||||
```
|
||||
import plur = require('plur');
|
||||
|
||||
plur('unicorn', 4);
|
||||
//=> 'unicorns'
|
||||
|
||||
plur('puppy', 2);
|
||||
//=> 'puppies'
|
||||
|
||||
plur('box', 2);
|
||||
//=> 'boxes'
|
||||
|
||||
plur('cactus', 2);
|
||||
//=> 'cacti'
|
||||
```
|
||||
*/
|
||||
declare function plur(word: string, count?: number): string;
|
||||
declare function plur(word: string, plural: string, count?: number): string;
|
||||
|
||||
export = plur;
|
||||
29
node_modules/plur/index.js
generated
vendored
29
node_modules/plur/index.js
generated
vendored
@@ -1,31 +1,20 @@
|
||||
'use strict';
|
||||
const irregularPlurals = require('irregular-plurals');
|
||||
var irregularPlurals = require('irregular-plurals');
|
||||
|
||||
module.exports = (word, plural, count) => {
|
||||
module.exports = function (str, plural, count) {
|
||||
if (typeof plural === 'number') {
|
||||
count = plural;
|
||||
}
|
||||
|
||||
if (irregularPlurals.has(word.toLowerCase())) {
|
||||
plural = irregularPlurals.get(word.toLowerCase());
|
||||
|
||||
const firstLetter = word.charAt(0);
|
||||
const isFirstLetterUpperCase = firstLetter === firstLetter.toUpperCase();
|
||||
if (isFirstLetterUpperCase) {
|
||||
plural = firstLetter.toUpperCase() + plural.slice(1);
|
||||
}
|
||||
|
||||
const isWholeWordUpperCase = word === word.toUpperCase();
|
||||
if (isWholeWordUpperCase) {
|
||||
plural = plural.toUpperCase();
|
||||
}
|
||||
if (str in irregularPlurals) {
|
||||
plural = irregularPlurals[str];
|
||||
} else if (typeof plural !== 'string') {
|
||||
plural = (word.replace(/(?:s|x|z|ch|sh)$/i, '$&e').replace(/([^aeiou])y$/i, '$1ie') + 's')
|
||||
.replace(/i?e?s$/i, match => {
|
||||
const isTailLowerCase = word.slice(-1) === word.slice(-1).toLowerCase();
|
||||
return isTailLowerCase ? match.toLowerCase() : match.toUpperCase();
|
||||
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 Math.abs(count) === 1 ? word : plural;
|
||||
return count === 1 ? str : plural;
|
||||
};
|
||||
|
||||
20
node_modules/plur/license
generated
vendored
20
node_modules/plur/license
generated
vendored
@@ -1,9 +1,21 @@
|
||||
MIT License
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
80
node_modules/plur/package.json
generated
vendored
80
node_modules/plur/package.json
generated
vendored
@@ -1,42 +1,42 @@
|
||||
{
|
||||
"name": "plur",
|
||||
"version": "3.1.1",
|
||||
"description": "Pluralize a word",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/plur",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"plural",
|
||||
"plurals",
|
||||
"pluralize",
|
||||
"singular",
|
||||
"count",
|
||||
"word",
|
||||
"string",
|
||||
"irregular",
|
||||
"noun",
|
||||
"nouns"
|
||||
],
|
||||
"dependencies": {
|
||||
"irregular-plurals": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
"name": "plur",
|
||||
"version": "2.1.2",
|
||||
"description": "Pluralize a word",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/plur",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"plur",
|
||||
"plural",
|
||||
"plurals",
|
||||
"pluralize",
|
||||
"singular",
|
||||
"count",
|
||||
"word",
|
||||
"string",
|
||||
"str",
|
||||
"irregular",
|
||||
"noun",
|
||||
"nouns"
|
||||
],
|
||||
"dependencies": {
|
||||
"irregular-plurals": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
||||
|
||||
6
node_modules/plur/readme.md
generated
vendored
6
node_modules/plur/readme.md
generated
vendored
@@ -6,7 +6,7 @@
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install plur
|
||||
$ npm install --save plur
|
||||
```
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ Word to pluralize.
|
||||
|
||||
#### plural
|
||||
|
||||
Type: `string`<br>
|
||||
Type: `string`
|
||||
Default:
|
||||
|
||||
- Irregular nouns will use this [list](https://github.com/sindresorhus/irregular-plurals/blob/master/irregular-plurals.json).
|
||||
@@ -64,4 +64,4 @@ Count to determine whether to use singular or plural.
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
|
||||
Reference in New Issue
Block a user