transliteration
- Version 2.3.5
- Published
- 1.59 MB
- 1 dependency
- MIT license
Install
npm i transliterationyarn add transliterationpnpm add transliterationOverview
Unicode to ACSII transliteration / slugify module for node.js, browser, Web Worker, ReactNative and CLI.
Index
Variables
Interfaces
Type Aliases
Variables
variable slugify
const slugify: SlugifyFunction;variable transliterate
const transliterate: TransliterateFunction;Interfaces
interface BrowserGlobalObject
interface BrowserGlobalObject {}property slugify
slugify: SlugifyFunction;property transl
transl: TransliterateFunction;property transliterate
transliterate: TransliterateFunction;interface OptionReplaceObject
interface OptionReplaceObject {}index signature
[from: string]: string;interface OptionsSlugify
interface OptionsSlugify extends OptionsTransliterate {}property allowedChars
allowedChars?: string;Allowed characters. When
allowedCharsis set to'abc', then only characters match/[abc]/gwill be preserved. Other characters will all be converted toseparator'a-zA-Z0-9-_.~''
property fixChineseSpacing
fixChineseSpacing?: boolean;Fix Chinese spacing. For example,
你好is transliterated toNi Haoinstead ofNiHao. If you don't need to transliterate Chinese characters, set it to false to false to improve performance.
property lowercase
lowercase?: boolean;Whether the result need to be converted into lowercase true
property separator
separator?: string;Custom separator string '-'
property uppercase
uppercase?: boolean;Whether the result need to be converted into uppercase false
interface OptionsTransliterate
interface OptionsTransliterate {}property fixChineseSpacing
fixChineseSpacing?: boolean;Fix Chinese spacing. For example,
你好is transliterated toNi Haoinstead ofNiHao. If you don't need to transliterate Chinese characters, set it to false to false to improve performance. true
property ignore
ignore?: string[];Ignore a list of strings untouched
Example 1
tr('你好,世界', { ignore: ['你'] }) // 你 Hao , Shi Jie
property replace
replace?: OptionReplaceCombined;Replace a list of string / regex in the source string into the provided target string before transliteration The option can either be an array or an object
Example 1
tr('你好,世界', { replace: {你: 'You'} }) // You Hao , Shi Jie
Example 2
tr('你好,世界', { replace: [['你', 'You']] }) // You Hao , Shi Jie
Example 3
tr('你好,世界', { replace: [[/你/g, 'You']] }) // You Hao , Shi Jie
property replaceAfter
replaceAfter?: OptionReplaceCombined;Same as
replacebut after transliteration
property trim
trim?: boolean;Decides whether or not to trim the result string after transliteration false
property unknown
unknown?: string;Any characters not known by this library will be replaced by a specific string
unknown''
Type Aliases
type IntervalArray
type IntervalArray = [number, number][];type OptionReplaceArray
type OptionReplaceArray = OptionReplaceArrayItem[];type OptionReplaceArrayItem
type OptionReplaceArrayItem = [string | RegExp, string];type OptionReplaceCombined
type OptionReplaceCombined = OptionReplaceArray | OptionReplaceObject;type Options
type Options = OptionsTransliterate | OptionsSlugify;type SlugifyFunction
type SlugifyFunction = TransliterationFunction<OptionsSlugify>;type TransliterateFunction
type TransliterateFunction = TransliterationFunction<OptionsTransliterate>;Package Files (2)
Dependencies (1)
Dev Dependencies (30)
- @babel/core
- @babel/plugin-proposal-class-properties
- @babel/plugin-proposal-object-rest-spread
- @babel/preset-env
- @babel/preset-typescript
- @types/tape
- @types/yargs
- codecov
- core-js
- coveralls
- eslint-config-prettier
- json5
- nyc
- prettier
- rimraf
- rollup
- rollup-plugin-babel
- rollup-plugin-commonjs
- rollup-plugin-hashbang
- rollup-plugin-sourcemaps
- rollup-plugin-terser
- rollup-plugin-typescript2
- rollup-plugin-uglify
- tap-spec
- tape
- ts-loader
- ts-node
- tslint
- tslint-config-prettier
- typescript
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/transliteration.
- Markdown[](https://www.jsdocs.io/package/transliteration)
- HTML<a href="https://www.jsdocs.io/package/transliteration"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 1249 ms. - Missing or incorrect documentation? Open an issue for this package.
