New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

limax

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

limax - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

11

lib/limax.js

@@ -22,3 +22,3 @@ 'use strict';

} else {
deferredLang.resolve(data.languages[0].code);
deferredLang.resolve(data.languages[0].code.substr(0, 2));
}

@@ -36,4 +36,6 @@ });

if (lang == 'zh') {
// Should we use tone numbers? (default is true)
var tone = (typeof options.tone === 'boolean') ? options.tone : true;
text = pinyin(text, {
'style': pinyin.STYLE_TONE2
'style': tone ? pinyin.STYLE_TONE2 : pinyin.STYLE_NORMAL
}).join(' ');

@@ -55,3 +57,6 @@ // Remove punctuation symbols

// Convert to slug using speakingurl
var separator = options.replacement || options.separator || '-';
var separator = options.replacement || options.separator;
if (typeof separator !== 'string') {
separator = '-';
}
var slug = speakingurl(text, {

@@ -58,0 +63,0 @@ lang: lang,

{
"name": "limax",
"version": "1.0.2",
"version": "1.1.0",
"main": "./lib/limax",

@@ -5,0 +5,0 @@ "description": "Node.js module to generate URL slugs. Another one? This one cares about i18n and transliterates non-Latin scripts to conform to the RFC3986 standard. Mostly API-compatible with similar modules.",

@@ -18,3 +18,3 @@ # limax

* Cyrillic: e.g. Русский язык, български език, українська мова
* Chinese: e.g. 官话, 吴语 (converts to Latin script using tone number Pinyin)
* Chinese: e.g. 官话, 吴语 (converts to Latin script using Pinyin with optional tone number)
* Japanese: e.g. ひらがな, カタカナ (converts to Romaji using Hepburn)

@@ -36,3 +36,3 @@

```javascript
var slug = require("limax");
var slug = require('limax');
```

@@ -43,6 +43,6 @@

```javascript
var latin = slug("i ♥ latin"); // i-love-latin
var cyrillic = slug("Я люблю русский"); // ya-lyublyu-russkij
var pinyin = slug("我爱官话"); // wo3-ai4-guan1-hua4
var romaji = slug("私は ひらがな が大好き"); // ha-hiragana-gaki
var latin = slug('i ♥ latin'); // i-love-latin
var cyrillic = slug('Я люблю русский'); // ya-lyublyu-russkij
var pinyin = slug('我爱官话'); // wo3-ai4-guan1-hua4
var romaji = slug('私は ひらがな が大好き'); // ha-hiragana-gaki
```

@@ -53,10 +53,12 @@

options:
* replacement: char to replace whitespace with, defaults to `-` (provides API compatibility with the `slug` module)
* separator: equivalent to `replacement` (provides API compatibility with the `speakingurl` module)
* lang: ISO 639-1 two-letter language code, defaults to auto-detected language
* `replacement`: String to replace whitespace with, defaults to `-` (provides API compatibility with the `slug` module)
* `separator`: String, equivalent to `replacement` (provides API compatibility with the `speakingurl` module)
* `lang`: String, ISO 639-1 two-letter language code, defaults to auto-detected language
* `tone`: Boolean, add tone numbers to Pinyin transliteration of Chinese, defaults to `true`
```javascript
var strich = slug("Ich ♥ Deutsch", {lang: "de"}); // ich-liebe-deutsch
var unterstreichen1 = slug("Ich ♥ Deutsch", {lang: "de", replacement: "_"}); // i_liebe_deutsch
var unterstreichen2 = slug("Ich ♥ Deutsch", {lang: "de", separator: "_"}); // i_liebe_deutsch
var strich = slug('Ich ♥ Deutsch', {lang: 'de'}); // ich-liebe-deutsch
var unterstreichen1 = slug('Ich ♥ Deutsch', {lang: 'de', replacement: '_'}); // i_liebe_deutsch
var unterstreichen2 = slug('Ich ♥ Deutsch', {lang: 'de', separator: '_'}); // i_liebe_deutsch
var wuYin = slug('弄堂里的菜品赤醬', {tone: false}); // nong-tang-li-di-cai-pin-chi-jiang
```

@@ -69,3 +71,3 @@

```javascript
var underscore = slug("i ♥ unicode", "_"); // i_love_unicode
var underscore = slug('i ♥ unicode', '_'); // i_love_unicode
```

@@ -72,0 +74,0 @@

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