Comparing version 2.1.0 to 3.0.0
'use strict'; | ||
const speakingurl = require('speakingurl'); | ||
const pinyin = require('pinyin'); | ||
const hepburn = require('hepburn'); | ||
let pinyin, PINYIN_STYLE; | ||
try { | ||
({ pinyin, PINYIN_STYLE } = require('@napi-rs/pinyin')); | ||
} catch (err) {} | ||
@@ -37,3 +40,3 @@ function customCharsAsArray (custom) { | ||
text = text.replace(/([^A-Za-z0-9\- ]+)/g, ''); | ||
} else if (lang.toLowerCase().startsWith('zh') || /[\u4e00-\u9fa5]+/.test(text)) { | ||
} else if (pinyin && (lang.toLowerCase().startsWith('zh') || /[\u4e00-\u9fa5]+/.test(text))) { | ||
// Should we use tone numbers? (default is true) | ||
@@ -43,3 +46,3 @@ const tone = (typeof options.tone === 'boolean') ? options.tone : true; | ||
text = pinyin(text, { | ||
style: tone ? pinyin.STYLE_TONE2 : pinyin.STYLE_NORMAL | ||
style: tone ? PINYIN_STYLE.WithToneNumEnd : PINYIN_STYLE.Plain | ||
}).join(' '); | ||
@@ -46,0 +49,0 @@ // Remove punctuation symbols |
{ | ||
"name": "limax", | ||
"version": "2.1.0", | ||
"version": "3.0.0", | ||
"main": "./lib/limax", | ||
@@ -12,3 +12,3 @@ "types": "index.d.ts", | ||
"engines": { | ||
"node": ">=8" | ||
"node": ">=10" | ||
}, | ||
@@ -44,11 +44,11 @@ "scripts": { | ||
"dependencies": { | ||
"hepburn": "^1.1.3", | ||
"pinyin": "^2.9.1", | ||
"@napi-rs/pinyin": "^1.5.0", | ||
"hepburn": "^1.2.0", | ||
"speakingurl": "^14.0.1" | ||
}, | ||
"devDependencies": { | ||
"ava": "^2.4.0", | ||
"ava": "^3.15.0", | ||
"nyc": "^15.1.0", | ||
"semistandard": "^14.2.2" | ||
"semistandard": "^16.0.0" | ||
} | ||
} |
@@ -95,3 +95,3 @@ # limax | ||
## Test [![Build Status](https://travis-ci.org/lovell/limax.png?branch=master)](https://travis-ci.org/lovell/limax) | ||
## Test ![.github/workflows/ci.yml](https://github.com/lovell/limax/workflows/.github/workflows/ci.yml/badge.svg) | ||
@@ -98,0 +98,0 @@ Run the unit tests with: |
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
20259
71
+ Added@napi-rs/pinyin@^1.5.0
+ Added@napi-rs/pinyin@1.7.5(transitive)
+ Added@napi-rs/pinyin-android-arm-eabi@1.7.5(transitive)
+ Added@napi-rs/pinyin-android-arm64@1.7.5(transitive)
+ Added@napi-rs/pinyin-darwin-arm64@1.7.5(transitive)
+ Added@napi-rs/pinyin-darwin-x64@1.7.5(transitive)
+ Added@napi-rs/pinyin-freebsd-x64@1.7.5(transitive)
+ Added@napi-rs/pinyin-linux-arm-gnueabihf@1.7.5(transitive)
+ Added@napi-rs/pinyin-linux-arm64-gnu@1.7.5(transitive)
+ Added@napi-rs/pinyin-linux-arm64-musl@1.7.5(transitive)
+ Added@napi-rs/pinyin-linux-x64-gnu@1.7.5(transitive)
+ Added@napi-rs/pinyin-linux-x64-musl@1.7.5(transitive)
+ Added@napi-rs/pinyin-win32-arm64-msvc@1.7.5(transitive)
+ Added@napi-rs/pinyin-win32-ia32-msvc@1.7.5(transitive)
+ Added@napi-rs/pinyin-win32-x64-msvc@1.7.5(transitive)
+ Added@napi-rs/triples@1.2.0(transitive)
- Removedpinyin@^2.9.1
- Removed@mapbox/node-pre-gyp@1.0.11(transitive)
- Removedabbrev@1.1.1(transitive)
- Removedagent-base@6.0.2(transitive)
- Removedansi-regex@5.0.1(transitive)
- Removedaproba@2.0.0(transitive)
- Removedare-we-there-yet@2.0.0(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedchownr@2.0.0(transitive)
- Removedcolor-support@1.1.3(transitive)
- Removedcommander@1.1.1(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedconsole-control-strings@1.1.0(transitive)
- Removeddebug@4.3.7(transitive)
- Removeddelegates@1.0.0(transitive)
- Removeddetect-libc@2.0.3(transitive)
- Removedemoji-regex@8.0.0(transitive)
- Removedfs-minipass@2.1.0(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedgauge@3.0.2(transitive)
- Removedglob@7.2.3(transitive)
- Removedhas-unicode@2.0.1(transitive)
- Removedhttps-proxy-agent@5.0.1(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedis-fullwidth-code-point@3.0.0(transitive)
- Removedkeypress@0.1.0(transitive)
- Removedmake-dir@3.1.0(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminipass@3.3.65.0.0(transitive)
- Removedminizlib@2.1.2(transitive)
- Removedmkdirp@1.0.4(transitive)
- Removedms@2.1.3(transitive)
- Removednode-addon-api@3.2.1(transitive)
- Removednode-fetch@2.7.0(transitive)
- Removednodejieba@2.5.2(transitive)
- Removednopt@5.0.0(transitive)
- Removednpmlog@5.0.1(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedpinyin@2.11.2(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedrimraf@3.0.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsemver@6.3.17.6.3(transitive)
- Removedset-blocking@2.0.0(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedstring-width@4.2.3(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedstrip-ansi@6.0.1(transitive)
- Removedtar@6.2.1(transitive)
- Removedtr46@0.0.3(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)
- Removedwide-align@1.1.5(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedyallist@4.0.0(transitive)
Updatedhepburn@^1.2.0