Initial commit

This commit is contained in:
2024-11-03 17:41:45 +01:00
commit c1640c1754
8043 changed files with 775536 additions and 0 deletions

48
node_modules/@sindresorhus/transliterate/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,48 @@
export interface Options {
/**
Add your own custom replacements.
The replacements are run on the original string before any other transformations.
This only overrides a default replacement if you set an item with the same key.
@default []
@example
```
import transliterate from '@sindresorhus/transliterate';
transliterate('Я люблю единорогов', {
customReplacements: [
['единорогов', '🦄']
]
})
//=> 'Ya lyublyu 🦄'
```
*/
readonly customReplacements?: ReadonlyArray<[string, string]>;
}
/**
Convert Unicode characters to Latin characters using [transliteration](https://en.wikipedia.org/wiki/Transliteration).
@param string - String to transliterate.
@example
```
import transliterate from '@sindresorhus/transliterate';
transliterate('Fußgängerübergänge');
//=> 'Fussgaengeruebergaenge'
transliterate('Я люблю единорогов');
//=> 'Ya lyublyu edinorogov'
transliterate('أنا أحب حيدات');
//=> 'ana ahb hydat'
transliterate('tôi yêu những chú kỳ lân');
//=> 'toi yeu nhung chu ky lan'
```
*/
export default function transliterate(string: string, options?: Options): string;

33
node_modules/@sindresorhus/transliterate/index.js generated vendored Normal file
View File

@@ -0,0 +1,33 @@
import escapeStringRegexp from 'escape-string-regexp';
import builtinReplacements from './replacements.js';
const doCustomReplacements = (string, replacements) => {
for (const [key, value] of replacements) {
// TODO: Use `String#replaceAll()` when targeting Node.js 16.
string = string.replace(new RegExp(escapeStringRegexp(key), 'g'), value);
}
return string;
};
export default function transliterate(string, options) {
if (typeof string !== 'string') {
throw new TypeError(`Expected a string, got \`${typeof string}\``);
}
options = {
customReplacements: [],
...options
};
const customReplacements = new Map([
...builtinReplacements,
...options.customReplacements
]);
string = string.normalize();
string = doCustomReplacements(string, customReplacements);
string = string.normalize('NFD').replace(/\p{Diacritic}/gu, '').normalize();
return string;
}

9
node_modules/@sindresorhus/transliterate/license generated vendored Normal file
View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://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:
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.

47
node_modules/@sindresorhus/transliterate/package.json generated vendored Normal file
View File

@@ -0,0 +1,47 @@
{
"name": "@sindresorhus/transliterate",
"version": "1.6.0",
"description": "Convert Unicode characters to Latin characters using transliteration",
"license": "MIT",
"repository": "sindresorhus/transliterate",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=12"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts",
"replacements.js"
],
"keywords": [
"transliterate",
"transliteration",
"string",
"deburr",
"unicode",
"ascii",
"text",
"latin",
"latinize",
"convert",
"replace"
],
"dependencies": {
"escape-string-regexp": "^5.0.0"
},
"devDependencies": {
"ava": "^3.15.0",
"tsd": "^0.14.0",
"xo": "^0.38.2"
}
}

103
node_modules/@sindresorhus/transliterate/readme.md generated vendored Normal file
View File

@@ -0,0 +1,103 @@
# transliterate
> Convert Unicode characters to Latin characters using [transliteration](https://en.wikipedia.org/wiki/Transliteration)
Can be useful for [slugification](https://github.com/sindresorhus/slugify) purposes and other times you cannot use Unicode.
## Install
```
$ npm install @sindresorhus/transliterate
```
## Usage
```js
import transliterate from '@sindresorhus/transliterate';
transliterate('Fußgängerübergänge');
//=> 'Fussgaengeruebergaenge'
transliterate('Я люблю единорогов');
//=> 'Ya lyublyu edinorogov'
transliterate('أنا أحب حيدات');
//=> 'ana ahb hydat'
transliterate('tôi yêu những chú kỳ lân');
//=> 'toi yeu nhung chu ky lan'
```
## API
### transliterate(string, options?)
#### string
Type: `string`
String to transliterate.
#### options
Type: `object`
##### customReplacements
Type: `Array<string[]>`\
Default: `[]`
Add your own custom replacements.
The replacements are run on the original string before any other transformations.
This only overrides a default replacement if you set an item with the same key.
```js
import transliterate from '@sindresorhus/transliterate';
transliterate('Я люблю единорогов', {
customReplacements: [
['единорогов', '🦄']
]
})
//=> 'Ya lyublyu 🦄'
```
## Supported languages
Most major languages are supported.
This includes special handling for:
- Arabic
- Armenian
- Czech
- Danish
- Dhivehi
- Georgian
- German (umlauts)
- Greek
- Hungarian
- Latin
- Latvian
- Lithuanian
- Macedonian
- Pashto
- Persian
- Polish
- Romanian
- Russian
- Serbian
- Slovak
- Swedish
- Turkish
- Ukrainian
- Urdu
- Vietnamese
However, Chinese is [currently not supported](https://github.com/sindresorhus/transliterate/issues/1).
## Related
- [slugify](https://github.com/sindresorhus/slugify) - Slugify a string

2056
node_modules/@sindresorhus/transliterate/replacements.js generated vendored Normal file

File diff suppressed because it is too large Load Diff