summaryrefslogtreecommitdiff
path: root/node_modules/@sindresorhus/transliterate/index.d.ts
blob: 535f4e16b2f330a4a167c648731fe5b788b1e849 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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;