Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

transliteration

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

transliteration - npm Package Compare versions

Comparing version 2.1.8 to 2.1.9

32

dist/node/src/common/utils.js

@@ -11,9 +11,7 @@ "use strict";

exports.escapeRegExp = escapeRegExp;
;
function isChinese(char) {
const c = char.charCodeAt(0);
return c >= 0x4e00 && c <= 0x9fff || c >= 0xf900 && c <= 0xfaff;
return (c >= 0x4e00 && c <= 0x9fff) || (c >= 0xf900 && c <= 0xfaff);
}
exports.isChinese = isChinese;
;
/**

@@ -32,4 +30,4 @@ * Deep clone a variable

return clonedArr;
// case obj instanceof Date:
// return new Date(obj.valueOf());
case obj instanceof Date:
return new Date(obj.valueOf());
case obj instanceof RegExp:

@@ -51,3 +49,2 @@ return new RegExp(obj.source, obj.flags);

exports.deepClone = deepClone;
;
/**

@@ -74,8 +71,8 @@ * Find all occurrences of a list of strings and merge the result in an interval array

// merge overlapped ranges
sortedResult.forEach(r => !last || r[0] > last[1] + 1 ? result.push(last = r) : r[1] > last[1] && (last[1] = r[1]));
sortedResult.forEach((r) => !last || r[0] > last[1] + 1
? result.push((last = r))
: r[1] > last[1] && (last[1] = r[1]));
return result;
}
exports.findStrOccurrences = findStrOccurrences;
;
;
/**

@@ -95,3 +92,2 @@ * Check the position of the number of a specific range

}
;
/**

@@ -116,3 +112,2 @@ * Check if the given `num` is in the `rangeArr` interval array using Binary Search algorithm

exports.inRange = inRange;
;
/**

@@ -127,3 +122,5 @@ * Custom RegExp replace function to replace all unnecessary strings into target replacement string

// RegExp version of ignored
const ignoredRegexp = ignored.length ? RegExp(ignored.map(escapeRegExp).join('|'), 'g') : null;
const ignoredRegexp = ignored.length
? RegExp(ignored.map(escapeRegExp).join('|'), 'g')
: null;
// clones regex and with g flag

@@ -141,5 +138,8 @@ const rule = RegExp(regexp.source, regexp.flags.replace('g', '') + 'g');

while (true) {
const matchIgnore = ignoredRegexp ? ignoredRegexp.exec(matchMain[0]) : null;
const matchIgnore = ignoredRegexp
? ignoredRegexp.exec(matchMain[0])
: null;
if (matchIgnore) {
ignoreResult += matchIgnore.index > ignoreLastIndex ? replacement : '';
ignoreResult +=
matchIgnore.index > ignoreLastIndex ? replacement : '';
ignoreResult += matchIgnore[0];

@@ -149,3 +149,4 @@ ignoreLastIndex = ignoredRegexp.lastIndex;

else {
ignoreResult += matchMain[0].length > ignoreLastIndex ? replacement : '';
ignoreResult +=
matchMain[0].length > ignoreLastIndex ? replacement : '';
break;

@@ -165,2 +166,1 @@ }

exports.regexpReplaceCustom = regexpReplaceCustom;
;

@@ -62,3 +62,3 @@ import { Charmap } from '../../data/charmap';

export declare type Options = OptionsTransliterate | OptionsSlugify;
export declare type IntervalArray = Array<[number, number]>;
export declare type IntervalArray = [number, number][];
interface TransliterationFunction<T> {

@@ -65,0 +65,0 @@ (source: string, options?: T): string;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
;
;
;

@@ -1,2 +0,2 @@

Copyright Andy Hu http://github.com/andyhu/node-transliteration
Copyright http://github.com/dzcpy/transliteration

@@ -3,0 +3,0 @@ Permission is hereby granted, free of charge, to any person obtaining

{
"name": "transliteration",
"version": "2.1.8",
"version": "2.1.9",
"description": "Unicode to ACSII transliteration / slugify module for node.js, browser, Web Worker, ReactNative and CLI.",

@@ -46,3 +46,3 @@ "main": "dist/node/src/node/index.js",

],
"author": "Andy Hu",
"author": "",
"license": "MIT",

@@ -56,36 +56,38 @@ "bugs": {

"devDependencies": {
"@babel/core": "7.7.5",
"@babel/plugin-proposal-class-properties": "7.7.4",
"@babel/plugin-proposal-object-rest-spread": "7.7.4",
"@babel/preset-env": "7.7.6",
"@babel/preset-typescript": "7.7.4",
"@babel/core": "7.9.6",
"@babel/plugin-proposal-class-properties": "7.8.3",
"@babel/plugin-proposal-object-rest-spread": "7.9.6",
"@babel/preset-env": "7.9.6",
"@babel/preset-typescript": "7.9.0",
"@types/execa": "2.0.0",
"@types/tape": "4.2.33",
"@types/yargs": "13.0.3",
"codecov": "3.6.1",
"core-js": "3.5.0",
"coveralls": "3.0.9",
"execa": "3.4.0",
"json5": "2.1.1",
"nyc": "14.1.1",
"rimraf": "3.0.0",
"rollup": "1.27.13",
"@types/tape": "4.13.0",
"@types/yargs": "15.0.4",
"codecov": "3.6.5",
"core-js": "3.6.5",
"coveralls": "3.1.0",
"eslint-config-prettier": "^6.11.0",
"execa": "4.0.0",
"json5": "2.1.3",
"nyc": "15.0.1",
"prettier": "^2.0.5",
"rimraf": "3.0.2",
"rollup": "2.7.6",
"rollup-plugin-babel": "5.0.0-alpha.0",
"rollup-plugin-commonjs": "10.1.0",
"rollup-plugin-hashbang": "2.2.2",
"rollup-plugin-sourcemaps": "0.4.2",
"rollup-plugin-terser": "5.1.3",
"rollup-plugin-typescript2": "0.25.3",
"rollup-plugin-sourcemaps": "0.6.1",
"rollup-plugin-terser": "5.3.0",
"rollup-plugin-typescript2": "0.27.0",
"rollup-plugin-uglify": "6.0.4",
"tap-spec": "5.0.0",
"tape": "4.12.0",
"ts-loader": "6.2.1",
"ts-node": "8.5.4",
"tslint": "5.20.1",
"tape": "5.0.0",
"ts-loader": "7.0.2",
"ts-node": "8.9.1",
"tslint": "6.1.2",
"tslint-config-prettier": "1.18.0",
"typescript": "3.7.3"
"typescript": "3.8.3"
},
"dependencies": {
"yargs": "^15.0.2"
"yargs": "^15.3.1"
}
}

@@ -18,8 +18,6 @@ <p align="center"><img src="http://dzcpy.github.io/transliteration/transliteration.png" alt="Transliteration"></p>

IE 9+ and all modern browsers.
IE 9+ and all modern browsers, Node.js, Web Worker, React Native and CLI
Other platforms includes Node.js, Web Worker, ReactNative and CLI
## Installation
## Install
### Node.js / React Native

@@ -31,3 +29,3 @@

If you are using Typescript, please do not install `@types/transliteration`. Since `v2` type definition files are built-in.
If you are using Typescript, please do not install `@types/transliteration`. Since in verson `2.x`, type definition files are built-in within this project.

@@ -47,3 +45,3 @@ ```javascript

<!-- UMD build -->
<script async defer src="https://cdn.jsdelivr.net/npm/transliteration@2.1.4/dist/browser/bundle.umd.min.js"></script>
<script async defer src="https://cdn.jsdelivr.net/npm/transliteration@2.1.8/dist/browser/bundle.umd.min.js"></script>
<script>

@@ -57,3 +55,3 @@ console.log(transliterate('你好'));

<script type="module">
import { transliterate } from 'https://cdn.jsdelivr.net/npm/transliteration@2.1.4/dist/browser/bundle.esm.min.js';
import { transliterate } from 'https://cdn.jsdelivr.net/npm/transliteration@2.1.8/dist/browser/bundle.esm.min.js';
console.log(transliterate('你好'));

@@ -65,3 +63,3 @@ </script>

When using it in the browser, by default it creates global variables under `window` object:
When you use it in the browser, by default it creates three global variables under `window` object:

@@ -73,2 +71,4 @@ ```javascript

// window.slugify
transl('Hola, mundo'); // For backward compatibility only, will be removed in next major version
// window.transl
```

@@ -90,3 +90,3 @@

Transliterates the string `str` and return the result. Characters which this module doesn't recognise will be defaulted to the placeholder from the `unknown` argument in the configuration option, defaults to `''`.
Transliterate the string `str` and return the result. Characters which this module can't handle will default to the placeholder character(s) given in the `unknown` option. If it's not provided, they will be removed.

@@ -129,3 +129,3 @@ __Options:__ (optional)

Bind options object globally so any following calls will be using `optionsObj` as default. If `optionsObj` is omitted, it will return current default options object.
Bind option object globally so any following calls will use `optionsObj` by default. If `optionsObj` is not given, it will return current default option object.

@@ -155,3 +155,3 @@ ```javascript

Convert Unicode `str` to a slug string for making sure it is safe to be used in an URL as a file name.
Convert Unicode `str` into a slug string, making sure it is safe to be used in an URL or in a file name.

@@ -205,3 +205,3 @@ __Options:__ (optional)

* Allowed characters.
* When `allowedChars` is set to `'abc'`, then only characters which match `/[abc]/g` will be preserved.
* When `allowedChars` is set to `'abc'`, only characters which match `/[abc]/g` will be preserved.
* Other characters will all be converted to `separator`

@@ -228,3 +228,3 @@ * @default 'a-zA-Z0-9-_.~''

Bind options globally so any following calls will be using `optionsObj` by default. If `optionsObj` argument is omitted, it will return current default option object.
Bind option object globally so any following calls will use `optionsObj` by default. If `optionsObj` is not given, it will return current default option object.

@@ -297,3 +297,3 @@ ```javascript

* Added `transliterate` as global variable for browser builds. Keep `transl` for backward compatibility.
* Add `transliterate` as a global variable for browser builds. Keep `transl` for backward compatibility.

@@ -300,0 +300,0 @@ ### 2.0.0

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc