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

speakingurl

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

speakingurl - npm Package Compare versions

Comparing version 0.11.0 to 0.12.0

CHANGELOG.md

2

bower.json
{
"name": "speakingurl",
"version": "0.11.0",
"version": "0.12.0",
"description": "Generate of so called 'static' or 'Clean URL' or 'Pretty URL' or 'nice-looking URL' or 'Speaking URL' or 'user-friendly URL' or 'SEO-friendly URL' or 'slug' from a string.",

@@ -5,0 +5,0 @@ "main": "speakingurl.min.js",

@@ -5,3 +5,3 @@ {

"description": "Generate of so called 'static' or 'Clean URL' or 'Pretty URL' or 'nice-looking URL' or 'Speaking URL' or 'user-friendly URL' or 'SEO-friendly URL' or 'slug' from a string.",
"version": "0.11.0",
"version": "0.12.0",
"keywords": [

@@ -8,0 +8,0 @@ "slug",

@@ -44,3 +44,3 @@ module.exports = function(grunt) {

bumpup: ['package.json', 'bower.json', 'component.json', 'composer.json'],
bumpup: ['package.json', 'bower.json', 'component.json'],

@@ -47,0 +47,0 @@ release: {

@@ -13,21 +13,15 @@ (function() {

var maintainCase = (typeof opts === 'object' && opts.maintainCase) ||
false;
var titleCase = (typeof opts === 'object' && opts.titleCase) ? opts
.titleCase :
false;
var customReplacements = (typeof opts === 'object' && typeof opts.custom ===
'object' && opts.custom) ? opts.custom : {};
var maintainCase = (typeof opts === 'object' && opts.maintainCase) || false;
var titleCase = (typeof opts === 'object' && opts.titleCase) ? opts.titleCase : false;
var customReplacements = (typeof opts === 'object' && typeof opts.custom === 'object' && opts.custom) ?
opts.custom : {};
var separator = (typeof opts === 'object' && opts.separator) || '-';
var truncate = (typeof opts === 'object' && +opts.truncate > 1 &&
opts.truncate) ||
false;
var truncate = (typeof opts === 'object' && +opts.truncate > 1 && opts.truncate) || false;
var uricFlag = (typeof opts === 'object' && opts.uric) || false;
var uricNoSlashFlag = (typeof opts === 'object' && opts.uricNoSlash) ||
false;
var uricNoSlashFlag = (typeof opts === 'object' && opts.uricNoSlash) || false;
var markFlag = (typeof opts === 'object' && opts.mark) || false;
var symbol = (typeof opts === 'object' && opts.lang && symbolMap[
opts.lang]) ?
symbolMap[opts.lang] : (typeof opts === 'object' && (opts.lang ===
false || opts.lang === true) ? {} : symbolMap.en);
var symbol = (typeof opts === 'object' && opts.lang && symbolMap[opts.lang]) ? symbolMap[opts.lang] :
(typeof opts === 'object' && (opts.lang === false || opts.lang === true) ? {} : symbolMap.en);
var langChar = (typeof opts === 'object' && opts.lang && langCharMap[opts.lang]) ? langCharMap[opts.lang] :
(typeof opts === 'object' && (opts.lang === false || opts.lang === true) ? {} : langCharMap.en);
var uricChars = [';', '?', ':', '@', '&', '=', '+', '$', ',', '/'];

@@ -44,5 +38,3 @@ var uricNoSlashChars = [';', '?', ':', '@', '&', '=', '+', '$', ','];

if (titleCase && typeof titleCase.length === "number" && Array.prototype
.toString
.call(titleCase)) {
if (titleCase && typeof titleCase.length === "number" && Array.prototype.toString.call(titleCase)) {

@@ -109,4 +101,10 @@ // custom config is an Array, rewrite to object format

if (charMap[ch]) {
if (langChar[ch]) {
// process language specific diactrics chars conversion
ch = lastCharWasSymbol && langChar[ch].match(/[A-Za-z0-9]/) ?
' ' +
langChar[ch] : langChar[ch];
lastCharWasSymbol = false;
} else if (charMap[ch]) {
// process diactrics chars

@@ -467,2 +465,10 @@ ch = lastCharWasSymbol && charMap[ch].match(/[A-Za-z0-9]/) ?

// slovak
'ľ': 'l',
'ĺ': 'l',
'ŕ': 'r',
'Ľ': 'L',
'Ĺ': 'L',
'Ŕ': 'R',
// polish

@@ -706,2 +712,14 @@ 'ą': 'a',

/**
* langCharMap language specific characters translations
* @type {Object}
*/
var langCharMap = {
'en': {}, // default language
'sk': {
'ä': 'a',
'Ä': 'A'
}
};
/**
* symbolMap language specific symbol translations

@@ -808,2 +826,26 @@ * @type {Object}

'cz': {
'∆': 'delta',
'∞': 'nekonecno',
'♥': 'laska',
'&': 'a',
'|': 'nebo',
'<': 'mene jako',
'>': 'vice jako',
'∑': 'soucet',
'¤': 'mena'
},
'sk': {
'∆': 'delta',
'∞': 'nekonecno',
'♥': 'laska',
'&': 'a',
'|': 'alebo',
'<': 'menej ako',
'>': 'viac ako',
'∑': 'sucet',
'¤': 'mena'
},
'vn': {

@@ -810,0 +852,0 @@ '∆': 'delta',

@@ -1,102 +0,80 @@

{
"name": "speakingurl",
"version": "0.11.0",
"description": "Generate a slug with a lot of options; create of so called 'static' or 'Clean URL' or 'Pretty URL' or 'nice-looking URL' or 'Speaking URL' or 'user-friendly URL' or 'SEO-friendly URL' from a string.",
"homepage": "http://pid.github.io/speakingurl/",
"github": "http://github.com/pid/speakingurl",
"repository": {
"type": "git",
"url": "git://github.com:pid/speakingurl.git"
},
"bugs": "https://github.com/pid/speakingurl/issues",
"licenses": [{
"type": "BSD",
"url": "https://raw.github.com/pid/speakingurl/master/LICENSE"
}],
"keywords": [
"slug",
"speakingurl",
"permalink",
"seo",
"url",
"speaking url",
"nice url",
"static url",
"transliteration"
],
"categories": [
"Utilities",
"Parsers & Compilers"
],
"scripts": {
"test": "./node_modules/mocha/bin/mocha"
},
"author": {
"name": "Sascha Droste",
"email": "pid@posteo.net",
"url": "https://twitter.com/SaschaDroste"
},
"main": "index",
"filename": "speakingurl.min.js",
{
"name": "speakingurl",
"version": "0.12.0",
"description": "Generate a slug – transliteration with a lot of options",
"homepage": "http://pid.github.io/speakingurl/",
"github": "http://github.com/pid/speakingurl",
"repository": {
"type": "git",
"url": "git://github.com:pid/speakingurl.git"
},
"bugs": "https://github.com/pid/speakingurl/issues",
"licenses": [{
"type": "BSD",
"url": "https://raw.github.com/pid/speakingurl/master/LICENSE"
}],
"keywords": [
"slug",
"speakingurl",
"transliteration",
"permalink",
"seo",
"url",
"speaking url",
"nice url",
"static url",
"clean url",
"pretty url",
"nice looking url",
"user friendly url",
"seo friendly url"
],
"categories": [
"Utilities",
"Parsers & Compilers"
],
"scripts": {
"test": "./node_modules/mocha/bin/mocha"
},
"author": {
"name": "Sascha Droste",
"email": "pid@posteo.net",
"url": "https://twitter.com/SaschaDroste"
},
"main": "index",
"filename": "speakingurl.min.js",
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.2",
"grunt-bumpup": "^0.6.1",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-uglify": "^0.5.1",
"grunt-contrib-watch": "^0.6.1",
"grunt-jsbeautifier": "~0.2.6",
"grunt-release": "^0.7.0",
"grunt-text-replace": "~0.3.10",
"mocha": "^1.18.2",
"should": "^4.0.4"
},
"jam": {
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.2",
"grunt-bumpup": "^0.6.0",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-uglify": "^0.5.1",
"grunt-contrib-watch": "^0.6.1",
"grunt-jsbeautifier": "~0.2.6",
"grunt-release": "^0.7.0",
"grunt-text-replace": "~0.3.10",
"mocha": "^1.18.2",
"should": "^4.0.4"
},
"testling": {
"harness": "mocha",
"files": "test/*.js",
"browsers": {
"ie": [
6,
7,
8,
9,
10
],
"firefox": [
19
],
"chrome": [
25
],
"safari": [
5.1,
6
],
"opera": [
10,
12
]
}
},
"jam": {
"dependencies": {},
"main": "speakingurl.min.js",
"shim": {
"deps": [],
"exports": [
"getSlug",
"createSlug"
]
},
"include": [
"speakingurl.min.js",
"README.md"
"main": "speakingurl.min.js",
"shim": {
"deps": [],
"exports": [
"getSlug",
"createSlug"
]
},
"volo": {
"url": "//cdnjs.cloudflare.com/ajax/libs/speakingurl/{version}/speakingurl.min.js"
},
"engines": {
"node": ">=0.10.0"
}
"include": [
"speakingurl.min.js",
"README.md"
]
},
"volo": {
"url": "//cdnjs.cloudflare.com/ajax/libs/speakingurl/{version}/speakingurl.min.js"
},
"engines": {
"node": ">=0.10.0"
}
}

@@ -26,2 +26,3 @@ # Speaking URL [![NPM version](https://badge.fury.io/js/speakingurl.png)](http://badge.fury.io/js/speakingurl) [![Build Status](https://travis-ci.org/pid/speakingurl.png)](https://travis-ci.org/pid/speakingurl)

```
#### [jamjs](http://jamjs.org/)

@@ -37,7 +38,7 @@ ```shell

- available versions: http://cdnjs.com/libraries/speakingurl/
- use //cdnjs.cloudflare.com/ajax/libs/speakingurl/0.11.0/speakingurl.min.js
- use //cdnjs.cloudflare.com/ajax/libs/speakingurl/0.12.0/speakingurl.min.js
#### [CDN/maxcdn](https://www.maxcdn.com/)
- available versions: http://www.jsdelivr.com/#!speakingurl
- use //cdn.jsdelivr.net/speakingurl/0.11.0/speakingurl.min.js
- use //cdn.jsdelivr.net/speakingurl/0.12.0/speakingurl.min.js

@@ -54,3 +55,3 @@ ## Usage

* ```lang``` {string} default: 'en'
* language for symbol translation ('ar', 'de', 'en', 'es', 'fr', 'pt', 'ru' and 'vn'; more coming soon, please help!)
* language for symbol translation ('ar', 'cz', 'de', 'en', 'es', 'fr', 'nl', pt', 'ru', 'sk' and 'vn'; more coming soon, please help!)
* false -> don't convert symbols

@@ -241,8 +242,13 @@ * ```maintainCase``` {boolean} default: false

# fork pid/speakingurl on Github
$ git clone git@github.com:<YOUR_USER>/speakingurl.git
$ cd speakingurl
$ npm install
$ npm install -g grunt-cli
# fork pid/speakingurl
# make your changes
# add your stuff
# add tests
# add description to README.md
$ grunt
# if everything works fine, commit, push to your repository
# create pull request

@@ -249,0 +255,0 @@ $

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

/* speakingurl v0.11.0 (c) 2013-2014 Sascha Droste http://pid.github.io/speakingurl/ */!function(){"use strict";var a=function(a,b){var f,g,h,i,j,k="object"==typeof b&&b.maintainCase||!1,l="object"==typeof b&&b.titleCase?b.titleCase:!1,m="object"==typeof b&&"object"==typeof b.custom&&b.custom?b.custom:{},n="object"==typeof b&&b.separator||"-",o="object"==typeof b&&+b.truncate>1&&b.truncate||!1,p="object"==typeof b&&b.uric||!1,q="object"==typeof b&&b.uricNoSlash||!1,r="object"==typeof b&&b.mark||!1,s="object"==typeof b&&b.lang&&e[b.lang]?e[b.lang]:"object"!=typeof b||b.lang!==!1&&b.lang!==!0?e.en:{},t=[";","?",":","@","&","=","+","$",",","/"],u=[";","?",":","@","&","=","+","$",","],v=[".","!","~","*","'","(",")"],w="",x=n;if(l&&"number"==typeof l.length&&Array.prototype.toString.call(l)&&l.forEach(function(a){m[a+""]=a+""}),"string"!=typeof a)return"";for("string"==typeof b?n=b:"object"==typeof b&&(p&&(x+=t.join("")),q&&(x+=u.join("")),r&&(x+=v.join(""))),Object.keys(m).forEach(function(b){var d;d=b.length>1?new RegExp("\\b"+c(b)+"\\b","gi"):new RegExp(c(b),"gi"),a=a.replace(d,m[b])}),l&&(a=a.replace(/(\w)(\S*)/g,function(a,b,c){var d=b.toUpperCase()+(null!==c?c:"");return Object.keys(m).indexOf(d.toLowerCase())<0?d:d.toLowerCase()})),x=c(x),a=a.replace(/(^\s+|\s+$)/g,""),j=!1,g=0,i=a.length;i>g;g++)h=a[g],d[h]?(h=j&&d[h].match(/[A-Za-z0-9]/)?" "+d[h]:d[h],j=!1):!s[h]||p&&-1!==t.join("").indexOf(h)||q&&-1!==u.join("").indexOf(h)||r&&-1!==v.join("").indexOf(h)?(j&&(/[A-Za-z0-9]/.test(h)||w.substr(-1).match(/A-Za-z0-9]/))&&(h=" "+h),j=!1):(h=j||w.substr(-1).match(/[A-Za-z0-9]/)?n+s[h]:s[h],h+=void 0!==a[g+1]&&a[g+1].match(/[A-Za-z0-9]/)?n:"",j=!0),w+=h.replace(new RegExp("[^\\w\\s"+x+"_-]","g"),n);return w=w.replace(/\s+/g,n).replace(new RegExp("\\"+n+"+","g"),n).replace(new RegExp("(^\\"+n+"+|\\"+n+"+$)","g"),""),o&&w.length>o&&(f=w.charAt(o)===n,w=w.slice(0,o),f||(w=w.slice(0,w.lastIndexOf(n)))),k||l||l.length||(w=w.toLowerCase()),w},b=function(b){return function(c){return a(c,b)}},c=function(a){return a.replace(/[-\\^$*+?.()|[\]{}\/]/g,"\\$&")},d={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"Ae","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"Oe","Ő":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"Ue","Ű":"U","Ý":"Y","Þ":"TH","ß":"ss","à":"a","á":"a","â":"a","ã":"a","ä":"ae","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"oe","ő":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"ue","ű":"u","ý":"y","þ":"th","ÿ":"y","ẞ":"SS","α":"a","β":"v","γ":"g","δ":"d","ε":"e","ζ":"z","η":"i","θ":"th","ι":"i","κ":"k","λ":"l","μ":"m","ν":"n","ξ":"ks","ο":"o","π":"p","ρ":"r","σ":"s","τ":"t","υ":"y","φ":"f","χ":"x","ψ":"ps","ω":"o","ά":"a","έ":"e","ί":"i","ό":"o","ύ":"y","ή":"i","ώ":"o","ς":"s","ϊ":"i","ΰ":"y","ϋ":"y","ΐ":"i","Α":"A","Β":"B","Γ":"G","Δ":"D","Ε":"E","Ζ":"Z","Η":"I","Θ":"TH","Ι":"I","Κ":"K","Λ":"L","Μ":"M","Ν":"N","Ξ":"KS","Ο":"O","Π":"P","Ρ":"R","Σ":"S","Τ":"T","Υ":"Y","Φ":"F","Χ":"X","Ψ":"PS","Ω":"W","Ά":"A","Έ":"E","Ί":"I","Ό":"O","Ύ":"Y","Ή":"I","Ώ":"O","Ϊ":"I","Ϋ":"Y","ş":"s","Ş":"S","ı":"i","İ":"I","ğ":"g","Ğ":"G","Ќ":"Kj","ќ":"kj","Љ":"Lj","љ":"lj","Њ":"Nj","њ":"nj","Тс":"Ts","тс":"ts","а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ё":"yo","ж":"zh","з":"z","и":"i","й":"j","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"h","ц":"c","ч":"ch","ш":"sh","щ":"sh","ъ":"","ы":"y","ь":"","э":"e","ю":"yu","я":"ya","А":"A","Б":"B","В":"V","Г":"G","Д":"D","Е":"E","Ё":"Yo","Ж":"Zh","З":"Z","И":"I","Й":"J","К":"K","Л":"L","М":"M","Н":"N","О":"O","П":"P","Р":"R","С":"S","Т":"T","У":"U","Ф":"F","Х":"H","Ц":"C","Ч":"Ch","Ш":"Sh","Щ":"Sh","Ъ":"","Ы":"Y","Ь":"","Э":"E","Ю":"Yu","Я":"Ya","Є":"Ye","І":"I","Ї":"Yi","Ґ":"G","є":"ye","і":"i","ї":"yi","ґ":"g","č":"c","ď":"d","ě":"e","ň":"n","ř":"r","š":"s","ť":"t","ů":"u","ž":"z","Č":"C","Ď":"D","Ě":"E","Ň":"N","Ř":"R","Š":"S","Ť":"T","Ů":"U","Ž":"Z","ą":"a","ć":"c","ę":"e","ł":"l","ń":"n","ś":"s","ź":"z","ż":"z","Ą":"A","Ć":"C","Ę":"E","Ł":"L","Ń":"N","Ś":"S","Ź":"Z","Ż":"Z","ā":"a","ē":"e","ģ":"g","ī":"i","ķ":"k","ļ":"l","ņ":"n","ū":"u","Ā":"A","Ē":"E","Ģ":"G","Ī":"I","Ķ":"k","Ļ":"L","Ņ":"N","Ū":"U","ا":"a","أ":"a","إ":"i","آ":"aa","ؤ":"u","ئ":"e","ء":"a","ب":"b","ت":"t","ث":"th","ج":"j","ح":"h","خ":"kh","د":"d","ذ":"th","ر":"r","ز":"z","س":"s","ش":"sh","ص":"s","ض":"dh","ط":"t","ظ":"z","ع":"a","غ":"gh","ف":"f","ق":"q","ك":"k","ل":"l","م":"m","ن":"n","ه":"h","و":"w","ي":"y","ى":"a","ة":"h","ﻻ":"la","ﻷ":"laa","ﻹ":"lai","ﻵ":"laa","َ":"a","ً":"an","ِ":"e","ٍ":"en","ُ":"u","ٌ":"on","ْ":"","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","“":'"',"”":'"',"‘":"'","’":"'","∂":"d","ƒ":"f","™":"(TM)","©":"(C)","œ":"oe","Œ":"OE","®":"(R)","†":"+","℠":"(SM)","…":"...","˚":"o","º":"o","ª":"a","•":"*",$:"USD","€":"EUR","₢":"BRN","₣":"FRF","£":"GBP","₤":"ITL","₦":"NGN","₧":"ESP","₩":"KRW","₪":"ILS","₫":"VND","₭":"LAK","₮":"MNT","₯":"GRD","₱":"ARS","₲":"PYG","₳":"ARA","₴":"UAH","₵":"GHS","¢":"cent","¥":"CNY","元":"CNY","円":"YEN","﷼":"IRR","₠":"EWE","฿":"THB","₨":"INR","₹":"INR","₰":"PF","đ":"d","Đ":"D","ẹ":"e","Ẹ":"E","ẽ":"e","Ẽ":"E","ế":"e","Ế":"E","ề":"e","Ề":"E","ệ":"e","Ệ":"E","ễ":"e","Ễ":"E","ọ":"o","Ọ":"o","ố":"o","Ố":"O","ồ":"o","Ồ":"O","ộ":"o","Ộ":"O","ỗ":"o","Ỗ":"O","ơ":"o","Ơ":"O","ớ":"o","Ớ":"O","ờ":"o","Ờ":"O","ợ":"o","Ợ":"O","ỡ":"o","Ỡ":"O","ị":"i","Ị":"I","ĩ":"i","Ĩ":"I","ụ":"u","Ụ":"U","ũ":"u","Ũ":"U","ư":"u","Ư":"U","ứ":"u","Ứ":"U","ừ":"u","Ừ":"U","ự":"u","Ự":"U","ữ":"u","Ữ":"U","ỳ":"y","Ỳ":"Y","ỵ":"y","Ỵ":"Y","ỹ":"y","Ỹ":"Y","ạ":"a","Ạ":"A","ấ":"a","Ấ":"A","ầ":"a","Ầ":"A","ậ":"a","Ậ":"A","ẫ":"a","Ẫ":"A","ă":"a","Ă":"A","ắ":"a","Ắ":"A","ằ":"a","Ằ":"A","ặ":"a","Ặ":"A","ẵ":"a","Ẵ":"A"},e={ar:{"∆":"delta","∞":"la-nihaya","♥":"hob","&":"wa","|":"aw","<":"aqal-men",">":"akbar-men","∑":"majmou","¤":"omla"},de:{"∆":"delta","∞":"unendlich","♥":"Liebe","&":"und","|":"oder","<":"kleiner als",">":"groesser als","∑":"Summe von","¤":"Waehrung"},nl:{"∆":"delta","∞":"oneindig","♥":"liefde","&":"en","|":"of","<":"kleiner dan",">":"groter dan","∑":"som","¤":"valuta"},en:{"∆":"delta","∞":"infinity","♥":"love","&":"and","|":"or","<":"less than",">":"greater than","∑":"sum","¤":"currency"},es:{"∆":"delta","∞":"infinito","♥":"amor","&":"y","|":"u","<":"menos que",">":"mas que","∑":"suma de los","¤":"moneda"},fr:{"∆":"delta","∞":"infiniment","♥":"Amour","&":"et","|":"ou","<":"moins que",">":"superieure a","∑":"somme des","¤":"monnaie"},pt:{"∆":"delta","∞":"infinito","♥":"amor","&":"e","|":"ou","<":"menor que",">":"maior que","∑":"soma","¤":"moeda"},ru:{"∆":"delta","∞":"beskonechno","♥":"lubov","&":"i","|":"ili","<":"menshe",">":"bolshe","∑":"summa","¤":"valjuta"},vn:{"∆":"delta","∞":"vo cuc","♥":"yeu","&":"va","|":"hoac","<":"nho hon",">":"lon hon","∑":"tong","¤":"tien te"}};if("undefined"!=typeof module&&module.exports)module.exports=a,module.exports.createSlug=b;else if("undefined"!=typeof define&&define.amd)define([],function(){return a});else try{if(window.getSlug||window.createSlug)throw"speakingurl: globals exists /(getSlug|createSlug)/";window.getSlug=a,window.createSlug=b}catch(f){}}();
/* speakingurl v0.12.0 (c) 2013-2014 Sascha Droste http://pid.github.io/speakingurl/ */!function(){"use strict";var a=function(a,b){var g,h,i,j,k,l="object"==typeof b&&b.maintainCase||!1,m="object"==typeof b&&b.titleCase?b.titleCase:!1,n="object"==typeof b&&"object"==typeof b.custom&&b.custom?b.custom:{},o="object"==typeof b&&b.separator||"-",p="object"==typeof b&&+b.truncate>1&&b.truncate||!1,q="object"==typeof b&&b.uric||!1,r="object"==typeof b&&b.uricNoSlash||!1,s="object"==typeof b&&b.mark||!1,t="object"==typeof b&&b.lang&&f[b.lang]?f[b.lang]:"object"!=typeof b||b.lang!==!1&&b.lang!==!0?f.en:{},u="object"==typeof b&&b.lang&&e[b.lang]?e[b.lang]:"object"!=typeof b||b.lang!==!1&&b.lang!==!0?e.en:{},v=[";","?",":","@","&","=","+","$",",","/"],w=[";","?",":","@","&","=","+","$",","],x=[".","!","~","*","'","(",")"],y="",z=o;if(m&&"number"==typeof m.length&&Array.prototype.toString.call(m)&&m.forEach(function(a){n[a+""]=a+""}),"string"!=typeof a)return"";for("string"==typeof b?o=b:"object"==typeof b&&(q&&(z+=v.join("")),r&&(z+=w.join("")),s&&(z+=x.join(""))),Object.keys(n).forEach(function(b){var d;d=b.length>1?new RegExp("\\b"+c(b)+"\\b","gi"):new RegExp(c(b),"gi"),a=a.replace(d,n[b])}),m&&(a=a.replace(/(\w)(\S*)/g,function(a,b,c){var d=b.toUpperCase()+(null!==c?c:"");return Object.keys(n).indexOf(d.toLowerCase())<0?d:d.toLowerCase()})),z=c(z),a=a.replace(/(^\s+|\s+$)/g,""),k=!1,h=0,j=a.length;j>h;h++)i=a[h],u[i]?(i=k&&u[i].match(/[A-Za-z0-9]/)?" "+u[i]:u[i],k=!1):d[i]?(i=k&&d[i].match(/[A-Za-z0-9]/)?" "+d[i]:d[i],k=!1):!t[i]||q&&-1!==v.join("").indexOf(i)||r&&-1!==w.join("").indexOf(i)||s&&-1!==x.join("").indexOf(i)?(k&&(/[A-Za-z0-9]/.test(i)||y.substr(-1).match(/A-Za-z0-9]/))&&(i=" "+i),k=!1):(i=k||y.substr(-1).match(/[A-Za-z0-9]/)?o+t[i]:t[i],i+=void 0!==a[h+1]&&a[h+1].match(/[A-Za-z0-9]/)?o:"",k=!0),y+=i.replace(new RegExp("[^\\w\\s"+z+"_-]","g"),o);return y=y.replace(/\s+/g,o).replace(new RegExp("\\"+o+"+","g"),o).replace(new RegExp("(^\\"+o+"+|\\"+o+"+$)","g"),""),p&&y.length>p&&(g=y.charAt(p)===o,y=y.slice(0,p),g||(y=y.slice(0,y.lastIndexOf(o)))),l||m||m.length||(y=y.toLowerCase()),y},b=function(b){return function(c){return a(c,b)}},c=function(a){return a.replace(/[-\\^$*+?.()|[\]{}\/]/g,"\\$&")},d={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"Ae","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"Oe","Ő":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"Ue","Ű":"U","Ý":"Y","Þ":"TH","ß":"ss","à":"a","á":"a","â":"a","ã":"a","ä":"ae","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"oe","ő":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"ue","ű":"u","ý":"y","þ":"th","ÿ":"y","ẞ":"SS","α":"a","β":"v","γ":"g","δ":"d","ε":"e","ζ":"z","η":"i","θ":"th","ι":"i","κ":"k","λ":"l","μ":"m","ν":"n","ξ":"ks","ο":"o","π":"p","ρ":"r","σ":"s","τ":"t","υ":"y","φ":"f","χ":"x","ψ":"ps","ω":"o","ά":"a","έ":"e","ί":"i","ό":"o","ύ":"y","ή":"i","ώ":"o","ς":"s","ϊ":"i","ΰ":"y","ϋ":"y","ΐ":"i","Α":"A","Β":"B","Γ":"G","Δ":"D","Ε":"E","Ζ":"Z","Η":"I","Θ":"TH","Ι":"I","Κ":"K","Λ":"L","Μ":"M","Ν":"N","Ξ":"KS","Ο":"O","Π":"P","Ρ":"R","Σ":"S","Τ":"T","Υ":"Y","Φ":"F","Χ":"X","Ψ":"PS","Ω":"W","Ά":"A","Έ":"E","Ί":"I","Ό":"O","Ύ":"Y","Ή":"I","Ώ":"O","Ϊ":"I","Ϋ":"Y","ş":"s","Ş":"S","ı":"i","İ":"I","ğ":"g","Ğ":"G","Ќ":"Kj","ќ":"kj","Љ":"Lj","љ":"lj","Њ":"Nj","њ":"nj","Тс":"Ts","тс":"ts","а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ё":"yo","ж":"zh","з":"z","и":"i","й":"j","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"h","ц":"c","ч":"ch","ш":"sh","щ":"sh","ъ":"","ы":"y","ь":"","э":"e","ю":"yu","я":"ya","А":"A","Б":"B","В":"V","Г":"G","Д":"D","Е":"E","Ё":"Yo","Ж":"Zh","З":"Z","И":"I","Й":"J","К":"K","Л":"L","М":"M","Н":"N","О":"O","П":"P","Р":"R","С":"S","Т":"T","У":"U","Ф":"F","Х":"H","Ц":"C","Ч":"Ch","Ш":"Sh","Щ":"Sh","Ъ":"","Ы":"Y","Ь":"","Э":"E","Ю":"Yu","Я":"Ya","Є":"Ye","І":"I","Ї":"Yi","Ґ":"G","є":"ye","і":"i","ї":"yi","ґ":"g","č":"c","ď":"d","ě":"e","ň":"n","ř":"r","š":"s","ť":"t","ů":"u","ž":"z","Č":"C","Ď":"D","Ě":"E","Ň":"N","Ř":"R","Š":"S","Ť":"T","Ů":"U","Ž":"Z","ľ":"l","ĺ":"l","ŕ":"r","Ľ":"L","Ĺ":"L","Ŕ":"R","ą":"a","ć":"c","ę":"e","ł":"l","ń":"n","ś":"s","ź":"z","ż":"z","Ą":"A","Ć":"C","Ę":"E","Ł":"L","Ń":"N","Ś":"S","Ź":"Z","Ż":"Z","ā":"a","ē":"e","ģ":"g","ī":"i","ķ":"k","ļ":"l","ņ":"n","ū":"u","Ā":"A","Ē":"E","Ģ":"G","Ī":"I","Ķ":"k","Ļ":"L","Ņ":"N","Ū":"U","ا":"a","أ":"a","إ":"i","آ":"aa","ؤ":"u","ئ":"e","ء":"a","ب":"b","ت":"t","ث":"th","ج":"j","ح":"h","خ":"kh","د":"d","ذ":"th","ر":"r","ز":"z","س":"s","ش":"sh","ص":"s","ض":"dh","ط":"t","ظ":"z","ع":"a","غ":"gh","ف":"f","ق":"q","ك":"k","ل":"l","م":"m","ن":"n","ه":"h","و":"w","ي":"y","ى":"a","ة":"h","ﻻ":"la","ﻷ":"laa","ﻹ":"lai","ﻵ":"laa","َ":"a","ً":"an","ِ":"e","ٍ":"en","ُ":"u","ٌ":"on","ْ":"","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","“":'"',"”":'"',"‘":"'","’":"'","∂":"d","ƒ":"f","™":"(TM)","©":"(C)","œ":"oe","Œ":"OE","®":"(R)","†":"+","℠":"(SM)","…":"...","˚":"o","º":"o","ª":"a","•":"*",$:"USD","€":"EUR","₢":"BRN","₣":"FRF","£":"GBP","₤":"ITL","₦":"NGN","₧":"ESP","₩":"KRW","₪":"ILS","₫":"VND","₭":"LAK","₮":"MNT","₯":"GRD","₱":"ARS","₲":"PYG","₳":"ARA","₴":"UAH","₵":"GHS","¢":"cent","¥":"CNY","元":"CNY","円":"YEN","﷼":"IRR","₠":"EWE","฿":"THB","₨":"INR","₹":"INR","₰":"PF","đ":"d","Đ":"D","ẹ":"e","Ẹ":"E","ẽ":"e","Ẽ":"E","ế":"e","Ế":"E","ề":"e","Ề":"E","ệ":"e","Ệ":"E","ễ":"e","Ễ":"E","ọ":"o","Ọ":"o","ố":"o","Ố":"O","ồ":"o","Ồ":"O","ộ":"o","Ộ":"O","ỗ":"o","Ỗ":"O","ơ":"o","Ơ":"O","ớ":"o","Ớ":"O","ờ":"o","Ờ":"O","ợ":"o","Ợ":"O","ỡ":"o","Ỡ":"O","ị":"i","Ị":"I","ĩ":"i","Ĩ":"I","ụ":"u","Ụ":"U","ũ":"u","Ũ":"U","ư":"u","Ư":"U","ứ":"u","Ứ":"U","ừ":"u","Ừ":"U","ự":"u","Ự":"U","ữ":"u","Ữ":"U","ỳ":"y","Ỳ":"Y","ỵ":"y","Ỵ":"Y","ỹ":"y","Ỹ":"Y","ạ":"a","Ạ":"A","ấ":"a","Ấ":"A","ầ":"a","Ầ":"A","ậ":"a","Ậ":"A","ẫ":"a","Ẫ":"A","ă":"a","Ă":"A","ắ":"a","Ắ":"A","ằ":"a","Ằ":"A","ặ":"a","Ặ":"A","ẵ":"a","Ẵ":"A"},e={en:{},sk:{"ä":"a","Ä":"A"}},f={ar:{"∆":"delta","∞":"la-nihaya","♥":"hob","&":"wa","|":"aw","<":"aqal-men",">":"akbar-men","∑":"majmou","¤":"omla"},de:{"∆":"delta","∞":"unendlich","♥":"Liebe","&":"und","|":"oder","<":"kleiner als",">":"groesser als","∑":"Summe von","¤":"Waehrung"},nl:{"∆":"delta","∞":"oneindig","♥":"liefde","&":"en","|":"of","<":"kleiner dan",">":"groter dan","∑":"som","¤":"valuta"},en:{"∆":"delta","∞":"infinity","♥":"love","&":"and","|":"or","<":"less than",">":"greater than","∑":"sum","¤":"currency"},es:{"∆":"delta","∞":"infinito","♥":"amor","&":"y","|":"u","<":"menos que",">":"mas que","∑":"suma de los","¤":"moneda"},fr:{"∆":"delta","∞":"infiniment","♥":"Amour","&":"et","|":"ou","<":"moins que",">":"superieure a","∑":"somme des","¤":"monnaie"},pt:{"∆":"delta","∞":"infinito","♥":"amor","&":"e","|":"ou","<":"menor que",">":"maior que","∑":"soma","¤":"moeda"},ru:{"∆":"delta","∞":"beskonechno","♥":"lubov","&":"i","|":"ili","<":"menshe",">":"bolshe","∑":"summa","¤":"valjuta"},cz:{"∆":"delta","∞":"nekonecno","♥":"laska","&":"a","|":"nebo","<":"mene jako",">":"vice jako","∑":"soucet","¤":"mena"},sk:{"∆":"delta","∞":"nekonecno","♥":"laska","&":"a","|":"alebo","<":"menej ako",">":"viac ako","∑":"sucet","¤":"mena"},vn:{"∆":"delta","∞":"vo cuc","♥":"yeu","&":"va","|":"hoac","<":"nho hon",">":"lon hon","∑":"tong","¤":"tien te"}};if("undefined"!=typeof module&&module.exports)module.exports=a,module.exports.createSlug=b;else if("undefined"!=typeof define&&define.amd)define([],function(){return a});else try{if(window.getSlug||window.createSlug)throw"speakingurl: globals exists /(getSlug|createSlug)/";window.getSlug=a,window.createSlug=b}catch(g){}}();

@@ -32,2 +32,10 @@ /* global describe,it */

getSlug('Foo & Bar | Baz', {
lang: 'cz'
}).should.eql('foo-a-bar-nebo-baz');
getSlug('Foo & Bar | Baz', {
lang: 'sk'
}).should.eql('foo-a-bar-alebo-baz');
done();

@@ -61,2 +69,10 @@ });

}).should.eql('foo-&-bar-ili-baz');
getSlug('Foo & Bar | Baz', {
lang: 'cz',
uric: true
}).should.eql('foo-&-bar-nebo-baz');
getSlug('Foo & Bar | Baz', {
lang: 'sk',
uric: true
}).should.eql('foo-&-bar-alebo-baz');
done();

@@ -90,2 +106,10 @@ });

}).should.eql('foo-&-bar-ili-baz');
getSlug('Foo & Bar | Baz', {
lang: 'cz',
uricNoSlash: true
}).should.eql('foo-&-bar-nebo-baz');
getSlug('Foo & Bar | Baz', {
lang: 'sk',
uricNoSlash: true
}).should.eql('foo-&-bar-alebo-baz');
done();

@@ -125,2 +149,12 @@ });

getSlug('Foo (Bar) . Baz', {
lang: 'cz',
mark: true
}).should.eql('foo-(bar)-.-baz');
getSlug('Foo (Bar) . Baz', {
lang: 'sk',
mark: true
}).should.eql('foo-(bar)-.-baz');
done();

@@ -167,2 +201,16 @@

getSlug('Foo (♥) ; Baz=Bar', {
lang: 'cz',
uric: true,
uricNoSlash: true,
mark: true
}).should.eql('foo-(laska)-;-baz=bar');
getSlug('Foo (♥) ; Baz=Bar', {
lang: 'sk',
uric: true,
uricNoSlash: true,
mark: true
}).should.eql('foo-(laska)-;-baz=bar');
getSlug(' Sch(* )ner (♥)Ti♥tel ♥läßt grüßen!? Bel♥♥ été !', {

@@ -193,2 +241,28 @@ lang: 'en',

it('should replace chars by cz language standards', function(done) {
getSlug('AaÁáBbCcČčDdĎďEeÉéĚěFfGgHhChchIiÍíJjKkLlMmNnŇňOoÓóPpQqRrŘřSsŠšTtŤťUuÚúŮůVvWwXxYyÝýZzŽž', {
lang: 'cz'
}).should.eql('aaaabbccccddddeeeeeeffgghhchchiiiijjkkllmmnnnnooooppqqrrrrssssttttuuuuuuvvwwxxyyyyzzzz');
getSlug('AaÁáBbCcČčDdĎďEeÉéĚěFfGgHhChchIiÍíJjKkLlMmNnŇňOoÓóPpQqRrŘřSsŠšTtŤťUuÚúŮůVvWwXxYyÝýZzŽž', {
lang: 'cz',
maintainCase: true
}).should.eql('AaAaBbCcCcDdDdEeEeEeFfGgHhChchIiIiJjKkLlMmNnNnOoOoPpQqRrRrSsSsTtTtUuUuUuVvWwXxYyYyZzZz');
done();
});
it('should replace chars by sk language standards', function(done) {
getSlug('AaÁaÄäBbCcČčDdĎďDzdzDždžEeÉéFfGgHhChchIiÍíJjKkLlĹ弾MmNnŇňOoÓóÔôPpQqRrŔŕSsŠšTtŤťUuÚúVvWwXxYyÝýZzŽž', {
lang: 'sk'
}).should.eql('aaaaaabbccccdddddzdzdzdzeeeeffgghhchchiiiijjkkllllllmmnnnnooooooppqqrrrrssssttttuuuuvvwwxxyyyyzzzz');
getSlug('AaÁaÄäBbCcČčDdĎďDzdzDždžEeÉéFfGgHhChchIiÍíJjKkLlĹ弾MmNnŇňOoÓóÔôPpQqRrŔŕSsŠšTtŤťUuÚúVvWwXxYyÝýZzŽž', {
lang: 'sk',
maintainCase: true
}).should.eql('AaAaAaBbCcCcDdDdDzdzDzdzEeEeFfGgHhChchIiIiJjKkLlLlLlMmNnNnOoOoOoPpQqRrRrSsSsTtTtUuUuVvWwXxYyYyZzZz');
done();
});
it('should ignore not available language param', function(done) {

@@ -195,0 +269,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