transliteration
Advanced tools
Comparing version 2.1.1 to 2.1.2
{ | ||
"name": "transliteration", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "Unicode to ACSII transliteration / slugify module for node.js, browser, Web Worker, ReactNative and CLI.", | ||
@@ -73,2 +73,3 @@ "main": "dist/node/src/node/index.js", | ||
"rollup-plugin-hashbang": "^1.0.1", | ||
"rollup-plugin-sourcemaps": "^0.4.2", | ||
"rollup-plugin-terser": "^4.0.2", | ||
@@ -75,0 +76,0 @@ "rollup-plugin-typescript2": "^0.19.0", |
@@ -1,2 +0,2 @@ | ||
# Transliteration | ||
<p align="center"><img src="http://dzcpy.github.io/transliteration/transliteration.png" alt="Transliteration"></p> | ||
@@ -9,6 +9,5 @@ [![Build Status](https://img.shields.io/circleci/project/github/dzcpy/transliteration/master.svg)](https://circleci.com/gh/dzcpy/transliteration) | ||
[![NPM Download](https://img.shields.io/npm/dm/transliteration.svg)](https://www.npmjs.com/package/transliteration) | ||
[![License](https://img.shields.io/npm/l/transliteration.svg)](https://github.com/dzcpy/transliteration/blob/master/LICENSE.txt) | ||
[![License](https://img.shields.io/npm/l/transliteration.svg)](https://github.com/dzcpy/transliteration/blob/master/LICENSE.txt)\ | ||
Universal Unicode to Latin transliteration + slugify module. Works on all platforms and with all major languages. | ||
Universal Unicode ➡ Latin transliteration / slugify module. Works with all major languages and on all platforms. | ||
## Demo | ||
@@ -22,3 +21,3 @@ | ||
Other platforms including Node.js, Web Worker, ReactNative and CLI | ||
Other platforms includes Node.js, Web Worker, ReactNative and CLI | ||
@@ -33,2 +32,4 @@ ## Install | ||
If you are using Typescript, please do not install `@types/transliteration`. Since `v2` type definition files are built-in. | ||
```javascript | ||
@@ -47,3 +48,3 @@ import { transliterate as tr, slugify } from 'transliteration'; | ||
<!-- UMD build --> | ||
<script async defer src="https://cdn.jsdelivr.net/npm/transliteration@2.1.1/dist/browser/bundle.umd.min.js"></script> | ||
<script async defer src="https://cdn.jsdelivr.net/npm/transliteration@2.1.2/dist/browser/bundle.umd.min.js"></script> | ||
<script> | ||
@@ -57,3 +58,3 @@ console.log(transliterate('你好')); | ||
<script type="module"> | ||
import { transliterate } from 'https://cdn.jsdelivr.net/npm/transliteration@2.1.1/dist/browser/bundle.esm.min.js'; | ||
import { transliterate } from 'https://cdn.jsdelivr.net/npm/transliteration@2.1.2/dist/browser/bundle.esm.min.js'; | ||
console.log(transliterate('你好')); | ||
@@ -100,3 +101,3 @@ </script> | ||
/** | ||
* Replace a list of string / regex in the source string into the provided target string before transliteration | ||
* Replace a list of string / regex in the source string with the provided target string before transliteration | ||
* The option can either be an array or an object | ||
@@ -152,3 +153,3 @@ * @example tr('你好,世界', { replace: {你: 'You'} }) // You Hao , Shi Jie | ||
Convert Unicode `str` into a slug string for making sure it is safe to be used in an URL as a file name. | ||
Convert Unicode `str` to a slug string for making sure it is safe to be used in an URL as a file name. | ||
@@ -164,3 +165,3 @@ __Options:__ (optional) | ||
/** | ||
* Replace a list of string / regex in the source string into the provided target string before transliteration | ||
* Replace a list of string / regex in the source string with the provided target string before transliteration | ||
* The option can either be an array or an object | ||
@@ -210,8 +211,3 @@ * @example tr('你好,世界', { replace: {你: 'You'} }) // You Hao , Shi Jie | ||
### slugify.config([optionsObj], [reset = false]) | ||
Bind options globally so any following calls will be using `optoinsObj` by default. If `optionsObj` argument is omitted, it will return current default option object. | ||
```javascript | ||
import { slugify } from 'transliteration'; | ||
slugify('你好,世界'); | ||
@@ -227,3 +223,9 @@ // ni-hao-shi-jie | ||
// 你好shi-jie | ||
``` | ||
### slugify.config([optionsObj], [reset = false]) | ||
Bind options globally so any following calls will be using `optoinsObj` by default. If `optionsObj` argument is omitted, it will return current default option object. | ||
```javascript | ||
slugify.config({ lowercase: false, separator: '_' }); | ||
@@ -245,4 +247,2 @@ slugify('你好,世界'); | ||
If the variable names conflict with other libraries in your project or you prefer not to use global variables, use noConfilict() before loading libraries which contain the conflicting variables.: | ||
### CLI | ||
@@ -263,3 +263,3 @@ | ||
Examples: | ||
transliterate "你好, world!" -r 好=good -r Replace `,` into `!`, `world` into `shijie`. | ||
transliterate "你好, world!" -r 好=good -r Replace `,` with `!`, `world` with `shijie`. | ||
"world=Shi Jie" Result: Ni good, Shi Jie! | ||
@@ -286,3 +286,3 @@ transliterate "你好,世界!" -i 你好 -i , Ignore `你好` and `,`. | ||
Examples: | ||
slugify "你好, world!" -r 好=good -r "world=Shi Replace `,` into `!` and `world` into | ||
slugify "你好, world!" -r 好=good -r "world=Shi Replace `,` with `!` and `world` with | ||
Jie" `shijie`. | ||
@@ -289,0 +289,0 @@ Result: ni-good-shi-jie |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
0
1395550
29
22
3661