Skip to content

Commit

Permalink
2.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
User committed Jan 22, 2019
1 parent 76286c3 commit 2d6e380
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ __Options:__ (optional)
*/
ignore?: string[];
/**
* 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
* @example tr('你好,世界', { replace: {你: 'You'} }) // You Hao , Shi Jie
* @example tr('你好,世界', { replace: [['', 'You']] }) // You Hao , Shi Jie
Expand Down Expand Up @@ -144,7 +144,7 @@ console.log(tr.config());

### slugify(str, [options])

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.

__Options:__ (optional)

Expand All @@ -155,7 +155,7 @@ __Options:__ (optional)
*/
ignore?: string[];
/**
* 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
* @example tr('你好,世界', { replace: {你: 'You'} }) // You Hao , Shi Jie
* @example tr('你好,世界', { replace: [['', 'You']] }) // You Hao , Shi Jie
Expand Down Expand Up @@ -200,12 +200,7 @@ __Options:__ (optional)
allowedChars?: string;
```

### 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('你好,世界');
// ni-hao-shi-jie
slugify('你好,世界', { lowercase: false, separator: '_' });
Expand All @@ -216,7 +211,13 @@ slugify('你好,世界', { replace: [['你好', 'Hello'], ['世界', 'world']]
// hello_world
slugify('你好,世界', { ignore: ['你好'] });
// 你好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: '_' });
slugify('你好,世界');
// Ni_Hao_Shi_Jie
Expand All @@ -233,8 +234,6 @@ console.log(slugify.config());

```

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

```
Expand All @@ -250,7 +249,7 @@ Options:
-h, --help [boolean]
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!
transliterate "你好,世界!" -i 你好 -i , Ignore `你好` and `,`.
Result: 你好,Shi Jie !
Expand All @@ -272,7 +271,7 @@ Options:
-h, --help [boolean]
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`.
Result: ni-good-shi-jie
slugify "你好,世界!" -i 你好 -i , Ignore `你好` and `,`.
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"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.",
"main": "dist/node/src/node/index.js",
"module": "dist/browser/bundle.esm.min.js",
Expand Down Expand Up @@ -70,6 +70,7 @@
"rollup-plugin-babel": "^4.3.0",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-hashbang": "^1.0.1",
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-terser": "^4.0.2",
"rollup-plugin-typescript2": "^0.19.0",
"rollup-plugin-uglify": "^6.0.0",
Expand Down
3 changes: 3 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { terser } from "rollup-plugin-terser";
import typescript from 'rollup-plugin-typescript2';
import hashbang from 'rollup-plugin-hashbang';
import commonjs from 'rollup-plugin-commonjs';
import sourceMaps from 'rollup-plugin-sourcemaps';
import pkg from './package.json';

const typescriptOptions = {
Expand Down Expand Up @@ -30,6 +31,7 @@ export default [
babel(babelOptions),
commonjs(),
terser(),
sourceMaps(),
],
},
// Browser ESM module
Expand All @@ -39,6 +41,7 @@ export default [
plugins: [
typescript(typescriptOptions),
terser(),
sourceMaps(),
],
},
// Node CLI bin transliteration file
Expand Down

0 comments on commit 2d6e380

Please sign in to comment.