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.4.0 to 0.4.1

2

bower.json
{
"name": "speakingurl",
"version": "0.4.0",
"version": "0.4.1",
"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.4.0",
"version": "0.4.1",
"keywords": [

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

{
"name": "pid/speakingurl",
"version": "0.4.0",
"version": "0.4.1",
"type": "library",

@@ -5,0 +5,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.",

@@ -79,2 +79,12 @@ 'use strict';

slug = getSlug('*Foo and Bar or Baz', {
custom: {
'and': 'UND', // replace word
'or': '', // remove word
'*': 'star'
}
});
console.log(slug); // Output: starfoo-und-bar-baz
console.log("\n");
slug = getSlug('NEXUS4 only $299');

@@ -88,2 +98,2 @@ console.log(slug); // Output: nexus-4-only-usd-299

console.log(slug); // Output: NEXUS-4-only-EUR-299
console.log("\n");
console.log("\n");

@@ -21,3 +21,3 @@ (function() {

var symbol = symbolMap[language] || symbolMap.en;
var customChars = (typeof opts === 'object' && opts.custom) || {};
var customReplacements = (typeof opts === 'object' && opts.custom) || {};
var uricChars = [';', '?', ':', '@', '&', '=', '+', '$', ',', '/'];

@@ -55,4 +55,18 @@ var uricNoSlashChars = [';', '?', ':', '@', '&', '=', '+', '$', ','];

// replace custom replacements
Object.keys(customReplacements).forEach(function(v) {
var r;
if (v.length > 1) {
r = new RegExp('\\b' + escapeChars(v) + '\\b', 'gi');
} else {
r = new RegExp(escapeChars(v), 'gi');
}
input = input.replace(r, customReplacements[v]);
});
// escape all necessary chars
allowedChars = allowedChars.replace(/[-\\^$*+?.()|[\]{}\/]/g, '\\$&');
allowedChars = escapeChars(allowedChars);

@@ -67,10 +81,4 @@ // trim whitespaces

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

@@ -143,2 +151,6 @@ ch = lastCharWasSymbol && charMap[ch].match(/[A-Za-z0-9]/) ? ' ' + charMap[ch] : charMap[ch];

var escapeChars = function escapeChars(input) {
return input.replace(/[-\\^$*+?.()|[\]{}\/]/g, '\\$&');
};
/**

@@ -487,21 +499,21 @@ * charMap

// Arabic diactrics
'َ': 'a',
'ً': 'an',
'ِ': 'e',
'ٍ': 'en',
'ُ': 'u',
'ٌ': 'on',
'ْ': '',
// Arabic numbers
'٠': '0',
'١': '1',
'٢': '2',
'٣': '3',
'٤': '4',
'٥': '5',
'٦': '6',
'٧': '7',
'٨': '8',
'٩': '9',
'َ': 'a',
'ً': 'an',
'ِ': 'e',
'ٍ': 'en',
'ُ': 'u',
'ٌ': 'on',
'ْ': '',
// Arabic numbers
'٠': '0',
'١': '1',
'٢': '2',
'٣': '3',
'٤': '4',
'٥': '5',
'٦': '6',
'٧': '7',
'٨': '8',
'٩': '9',
// symbols

@@ -508,0 +520,0 @@ '“': '"',

{
"name": "speakingurl",
"version": "0.4.0",
"version": "0.4.1",
"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 @@ "homepage": "http://pid.github.io/speakingurl/",

@@ -36,3 +36,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)

or use the CDN from Cloudflare
use //cdnjs.cloudflare.com/ajax/libs/speakingurl/0.4.0/speakingurl.min.js
use //cdnjs.cloudflare.com/ajax/libs/speakingurl/0.4.1/speakingurl.min.js

@@ -75,6 +75,6 @@ ## Usage

slug = getSlug("Schöner Titel läßt grüßen!? Bel été !", "*");
slug = getSlug("Schöner Titel läßt grüßen!? Bel été !", '*');
console.log(slug); // Output: schoener*titel*laesst*gruessen*bel*ete
slug = getSlug("Schöner Titel läßt grüßen!? Bel été !", {separator: "_"});
slug = getSlug("Schöner Titel läßt grüßen!? Bel été !", {separator: '_'});
console.log(slug); // Output: schoener_titel_laesst_gruessen_bel_ete

@@ -109,5 +109,8 @@

slug = getSlug('Foo & Bar | (Baz) * Doo', {custom:{'*': "Boo"},mark:true});
slug = getSlug('Foo & Bar | (Baz) * Doo', {custom:{'*': 'Boo'},mark:true});
console.log(slug); // Output: foo-and-bar-or-(baz)-boo-doo
slug = getSlug('Foo and Bar or Baz', {custom:{'and': 'und', 'or': ''}});
console.log(slug); // Output: foo-und-bar-baz
slug = getSlug('NEXUS4 only $299');

@@ -200,1 +203,5 @@ console.log(slug); // Output: nexus-4-only-usd299

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/pid/speakingurl/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

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

/* speakingurl v0.4.0 (c) 2013 Sascha Droste http://pid.github.io/speakingurl/ */!function(){"use strict";var a=function(a,b){var e,f,g,h,i,j="object"==typeof b&&b.maintainCase||!1,k="object"==typeof b&&b.separator||"-",l="object"==typeof b&&b.truncate,m="object"==typeof b&&b.lang||"en",n="object"==typeof b&&b.uric||!1,o="object"==typeof b&&b.uricNoSlash||!1,p="object"==typeof b&&b.mark||!1,q=d[m]||d.en,r="object"==typeof b&&b.custom||{},s=[";","?",":","@","&","=","+","$",",","/"],t=[";","?",":","@","&","=","+","$",","],u=[".","!","~","*","'","(",")"],v="",w=k;if("string"!=typeof a)return"";for("string"==typeof b?k=b:"object"==typeof b&&(n&&(w+=s.join("")),o&&(w+=t.join("")),p&&(w+=u.join(""))),w=w.replace(/[-\\^$*+?.()|[\]{}\/]/g,"\\$&"),a=a.replace(/(^\s+|\s+$)/g,""),i=!1,f=0,h=a.length;h>f;f++)g=a[f],r[g]?(g=i&&r[g].match(/[A-Za-z0-9]/)?" "+r[g]:r[g],i=!1):c[g]?(g=i&&c[g].match(/[A-Za-z0-9]/)?" "+c[g]:c[g],i=!1):!q[g]||n&&-1!==s.join("").indexOf(g)||o&&-1!==t.join("").indexOf(g)||p&&-1!==u.join("").indexOf(g)?(i&&(/[A-Za-z0-9]/.test(g)||v.substr(-1).match(/A-Za-z0-9]/))&&(g=" "+g),i=!1):(g=i||v.substr(-1).match(/[A-Za-z0-9]/)?k+q[g]:q[g],g+=void 0!==a[f+1]&&a[f+1].match(/[A-Za-z0-9]/)?k:"",i=!0),v+=g.replace(new RegExp("[^\\w\\s"+w+"_-]","g"),k);return v=v.replace(/\s+/g,k).replace(new RegExp("\\"+k+"+","g"),k).replace(new RegExp("(^\\"+k+"+|\\"+k+"+$)","g"),""),l&&v.length>l&&(e=v.charAt(l)===k,v=v.slice(0,l),e||(v=v.slice(0,v.lastIndexOf(k)))),j||(v=v.toLowerCase()),v},b=function(b){return function(c){return a(c,b)}},c={"À":"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","β":"b","γ":"g","δ":"d","ε":"e","ζ":"z","η":"h","θ":"8","ι":"i","κ":"k","λ":"l","μ":"m","ν":"n","ξ":"3","ο":"o","π":"p","ρ":"r","σ":"s","τ":"t","υ":"y","φ":"f","χ":"x","ψ":"ps","ω":"w","ά":"a","έ":"e","ί":"i","ό":"o","ύ":"y","ή":"h","ώ":"w","ς":"s","ϊ":"i","ΰ":"y","ϋ":"y","ΐ":"i","Α":"A","Β":"B","Γ":"G","Δ":"D","Ε":"E","Ζ":"Z","Η":"H","Θ":"8","Ι":"I","Κ":"K","Λ":"L","Μ":"M","Ν":"N","Ξ":"3","Ο":"O","Π":"P","Ρ":"R","Σ":"S","Τ":"T","Υ":"Y","Φ":"F","Χ":"X","Ψ":"PS","Ω":"W","Ά":"A","Έ":"E","Ί":"I","Ό":"O","Ύ":"Y","Ή":"H","Ώ":"W","Ϊ":"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","ъ":"u","ы":"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","Ъ":"U","Ы":"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={ar:{"∆":"delta","∞":"la-nihaya","♥":"hob","&":"wa","|":"aw","<":"aqal-men",">":"akbar-men","∑":"majmou","¤":"omla"},en:{"∆":"delta","∞":"infinity","♥":"love","&":"and","|":"or","<":"less than",">":"greater than","∑":"sum","¤":"currency"},de:{"∆":"delta","∞":"unendlich","♥":"Liebe","&":"und","|":"oder","<":"kleiner als",">":"groesser als","∑":"Summe von","¤":"Waehrung"},fr:{"∆":"delta","∞":"infiniment","♥":"Amour","&":"et","|":"ou","<":"moins que",">":"superieure a","∑":"somme des","¤":"monnaie"},es:{"∆":"delta","∞":"infinito","♥":"amor","&":"y","|":"u","<":"menos que",">":"mas que","∑":"suma de los","¤":"moneda"},ru:{"∆":"delta","∞":"beskonechno","♥":"lubov","&":"i","|":"ili","<":"menshe",">":"bolshe","∑":"summa","¤":"valjuta"}};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(e){}}();
/* speakingurl v0.4.1 (c) 2013 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.separator||"-",m="object"==typeof b&&b.truncate,n="object"==typeof b&&b.lang||"en",o="object"==typeof b&&b.uric||!1,p="object"==typeof b&&b.uricNoSlash||!1,q="object"==typeof b&&b.mark||!1,r=e[n]||e.en,s="object"==typeof b&&b.custom||{},t=[";","?",":","@","&","=","+","$",",","/"],u=[";","?",":","@","&","=","+","$",","],v=[".","!","~","*","'","(",")"],w="",x=l;if("string"!=typeof a)return"";for("string"==typeof b?l=b:"object"==typeof b&&(o&&(x+=t.join("")),p&&(x+=u.join("")),q&&(x+=v.join(""))),Object.keys(s).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,s[b])}),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):!r[h]||o&&-1!==t.join("").indexOf(h)||p&&-1!==u.join("").indexOf(h)||q&&-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]/)?l+r[h]:r[h],h+=void 0!==a[g+1]&&a[g+1].match(/[A-Za-z0-9]/)?l:"",j=!0),w+=h.replace(new RegExp("[^\\w\\s"+x+"_-]","g"),l);return w=w.replace(/\s+/g,l).replace(new RegExp("\\"+l+"+","g"),l).replace(new RegExp("(^\\"+l+"+|\\"+l+"+$)","g"),""),m&&w.length>m&&(f=w.charAt(m)===l,w=w.slice(0,m),f||(w=w.slice(0,w.lastIndexOf(l)))),k||(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","β":"b","γ":"g","δ":"d","ε":"e","ζ":"z","η":"h","θ":"8","ι":"i","κ":"k","λ":"l","μ":"m","ν":"n","ξ":"3","ο":"o","π":"p","ρ":"r","σ":"s","τ":"t","υ":"y","φ":"f","χ":"x","ψ":"ps","ω":"w","ά":"a","έ":"e","ί":"i","ό":"o","ύ":"y","ή":"h","ώ":"w","ς":"s","ϊ":"i","ΰ":"y","ϋ":"y","ΐ":"i","Α":"A","Β":"B","Γ":"G","Δ":"D","Ε":"E","Ζ":"Z","Η":"H","Θ":"8","Ι":"I","Κ":"K","Λ":"L","Μ":"M","Ν":"N","Ξ":"3","Ο":"O","Π":"P","Ρ":"R","Σ":"S","Τ":"T","Υ":"Y","Φ":"F","Χ":"X","Ψ":"PS","Ω":"W","Ά":"A","Έ":"E","Ί":"I","Ό":"O","Ύ":"Y","Ή":"H","Ώ":"W","Ϊ":"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","ъ":"u","ы":"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","Ъ":"U","Ы":"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"},e={ar:{"∆":"delta","∞":"la-nihaya","♥":"hob","&":"wa","|":"aw","<":"aqal-men",">":"akbar-men","∑":"majmou","¤":"omla"},en:{"∆":"delta","∞":"infinity","♥":"love","&":"and","|":"or","<":"less than",">":"greater than","∑":"sum","¤":"currency"},de:{"∆":"delta","∞":"unendlich","♥":"Liebe","&":"und","|":"oder","<":"kleiner als",">":"groesser als","∑":"Summe von","¤":"Waehrung"},fr:{"∆":"delta","∞":"infiniment","♥":"Amour","&":"et","|":"ou","<":"moins que",">":"superieure a","∑":"somme des","¤":"monnaie"},es:{"∆":"delta","∞":"infinito","♥":"amor","&":"y","|":"u","<":"menos que",">":"mas que","∑":"suma de los","¤":"moneda"},ru:{"∆":"delta","∞":"beskonechno","♥":"lubov","&":"i","|":"ili","<":"menshe",">":"bolshe","∑":"summa","¤":"valjuta"}};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){}}();

@@ -155,2 +155,80 @@ /* global describe,it */

});
});
it('with custom char to string replacement', function(done) {
var getSlug = require('../lib').createSlug({
custom: {
'*': 'STAR',
'q': 'qqq',
'and': '',
'or': ''
}
});
getSlug('xyl*ph*n').should.eql('xylstarphstarn');
getSlug('quack').should.eql('qqquack');
getSlug('Foo and Bar or Baz').should.eql('foo-bar-baz');
done();
});
it('with custom string replacement', function(done) {
var getSlug = require('../lib').createSlug({
custom: {
'and': 'und',
'or': 'oder',
'*': ' and '
}
});
getSlug('bus and train').should.eql('bus-und-train');
getSlug('bus or train').should.eql('bus-oder-train');
getSlug('busandtrain').should.eql('busandtrain');
getSlug('busortrain').should.eql('busortrain');
getSlug('bus*train').should.eql('bus-and-train');
getSlug('bus and train bus and train').should.eql('bus-und-train-bus-und-train');
getSlug('bus or train bus or train').should.eql('bus-oder-train-bus-oder-train');
getSlug('busandtrain busandtrain').should.eql('busandtrain-busandtrain');
getSlug('busortrain busortrain').should.eql('busortrain-busortrain');
done();
});
it('with custom string replacement with option mark', function(done) {
var getSlug = require('../lib').createSlug({
custom: {
'*': 'STAR',
'q': 'qqq',
'z': ''
},
mark: true
});
getSlug('xyl*ph*n').should.eql('xylstarphstarn');
getSlug('qxxx').should.eql('qqqxxx');
getSlug('xxxqxxx').should.eql('xxxqqqxxx');
getSlug('qqq').should.eql('qqqqqqqqq');
getSlug('*q*').should.eql('starqqqstar');
getSlug('zoo').should.eql('oo');
getSlug('zooz').should.eql('oo');
done();
});
it('with custom string replacement with option maintainCase', function(done) {
var getSlug = require('../lib').createSlug({
custom: {
'*': 'STAR',
'q': 'qqq',
},
maintainCase: true
});
getSlug('xyl*ph*n').should.eql('xylSTARphSTARn');
getSlug('qXXX').should.eql('qqqXXX');
getSlug('qqq').should.eql('qqqqqqqqq');
getSlug('*q*').should.eql('STARqqqSTAR');
done();
});
});

@@ -32,5 +32,3 @@ /* global describe,it */

getSlug('-foo- bar -baz-').should.eql('foo-bar-baz');
getSlug('--foo- bar -baz---').should.eql('foo-bar-baz');
getSlug('---foo- bar -baz---').should.eql('foo-bar-baz');

@@ -100,2 +98,2 @@

});
});

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