speakingurl
Advanced tools
Comparing version 0.7.0 to 0.8.0
{ | ||
"name": "speakingurl", | ||
"version": "0.7.0", | ||
"version": "0.8.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.", | ||
@@ -12,11 +12,9 @@ "main": "speakingurl.min.js", | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "BSD", | ||
"url": "https://raw.github.com/pid/speakingurl/master/LICENSE" | ||
} | ||
], | ||
"licenses": [{ | ||
"type": "BSD", | ||
"url": "https://raw.github.com/pid/speakingurl/master/LICENSE" | ||
}], | ||
"ignore": [ | ||
"node_modules" | ||
] | ||
} | ||
} |
# Changelog | ||
* v0.8.0 add feature to set 'lang' to true or false to deactivate symbol translation | ||
* v0.7.0 add titleCase feature #26 | ||
@@ -4,0 +5,0 @@ * v0.6.0 add symbol translation pt |
@@ -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.7.0", | ||
"version": "0.8.0", | ||
"keywords": [ | ||
@@ -22,2 +22,2 @@ "slug", | ||
] | ||
} | ||
} |
{ | ||
"name": "pid/speakingurl", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"type": "library", | ||
@@ -16,12 +16,10 @@ "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.", | ||
"license": "BSD", | ||
"authors": [ | ||
{ | ||
"name": "Sascha Droste", | ||
"email": "pid@posteo.net", | ||
"url": "https://plus.google.com/118215422942628160262/about", | ||
"role": "Developer" | ||
} | ||
], | ||
"authors": [{ | ||
"name": "Sascha Droste", | ||
"email": "pid@posteo.net", | ||
"url": "https://plus.google.com/118215422942628160262/about", | ||
"role": "Developer" | ||
}], | ||
"require": {}, | ||
"autoload": {} | ||
} | ||
} |
@@ -98,1 +98,7 @@ 'use strict'; | ||
console.log("\n"); | ||
slug = getSlug('Foo & Bar ♥ Foo < Bar', { | ||
lang: false | ||
}); | ||
console.log(slug); // Output: foo-bar-foo-bar | ||
console.log("\n"); |
@@ -28,2 +28,18 @@ module.exports = function(grunt) { | ||
jsbeautifier: { | ||
modify: { | ||
src: ['<%= sourceFiles %>', '<%= testFiles %>', '<%= jsonFiles %>'], | ||
options: { | ||
config: '.jsbeautifyrc' | ||
} | ||
}, | ||
verify: { | ||
src: ['<%= sourceFiles %>', '<%= testFiles %>', '<%= jsonFiles %>'], | ||
options: { | ||
mode: 'VERIFY_ONLY', | ||
config: '.jsbeautifyrc' | ||
} | ||
} | ||
}, | ||
bumpup: ['package.json', 'bower.json', 'component.json', 'composer.json'], | ||
@@ -74,2 +90,3 @@ | ||
grunt.loadNpmTasks('grunt-contrib-watch'); | ||
grunt.loadNpmTasks('grunt-jsbeautifier'); | ||
grunt.loadNpmTasks('grunt-release'); | ||
@@ -80,4 +97,4 @@ grunt.loadNpmTasks('grunt-bumpup'); | ||
// Default task(s). | ||
grunt.registerTask('default', ['uglify', 'jshint', 'mocha', 'replace']); | ||
grunt.registerTask('default', ['jsbeautifier:modify', 'jshint', 'uglify', 'mocha', 'replace']); | ||
}; |
@@ -17,8 +17,7 @@ (function() { | ||
var separator = (typeof opts === 'object' && opts.separator) || '-'; | ||
var truncate = typeof opts === 'object' && opts.truncate; | ||
var language = (typeof opts === 'object' && opts.lang) || 'en'; | ||
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 markFlag = (typeof opts === 'object' && opts.mark) || false; | ||
var symbol = symbolMap[language] || 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 uricChars = [';', '?', ':', '@', '&', '=', '+', '$', ',', '/']; | ||
@@ -36,2 +35,3 @@ var uricNoSlashChars = [';', '?', ':', '@', '&', '=', '+', '$', ',']; | ||
if (titleCase && typeof titleCase.length === "number" && Array.prototype.toString.call(titleCase)) { | ||
// custom config is an Array, rewrite to object format | ||
@@ -64,3 +64,3 @@ titleCase.forEach(function(v) { | ||
// replace custom replacements | ||
// custom replacements | ||
Object.keys(customReplacements).forEach(function(v) { | ||
@@ -67,0 +67,0 @@ |
{ | ||
"name": "speakingurl", | ||
"version": "0.7.0", | ||
"version": "0.8.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.", | ||
@@ -12,8 +12,6 @@ "homepage": "http://pid.github.io/speakingurl/", | ||
"bugs": "https://github.com/pid/speakingurl/issues", | ||
"licenses": [ | ||
{ | ||
"type": "BSD", | ||
"url": "https://raw.github.com/pid/speakingurl/master/LICENSE" | ||
} | ||
], | ||
"licenses": [{ | ||
"type": "BSD", | ||
"url": "https://raw.github.com/pid/speakingurl/master/LICENSE" | ||
}], | ||
"keywords": [ | ||
@@ -53,3 +51,4 @@ "slug", | ||
"grunt-bumpup": "~0.4.1", | ||
"grunt-text-replace": "~0.3.6" | ||
"grunt-text-replace": "~0.3.6", | ||
"grunt-jsbeautifier": "~0.2.3" | ||
}, | ||
@@ -56,0 +55,0 @@ "testling": { |
@@ -35,3 +35,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) | ||
- available version overview: http://cdnjs.com/libraries/speakingurl/ | ||
- use //cdnjs.cloudflare.com/ajax/libs/speakingurl/0.7.0/speakingurl.min.js | ||
- use //cdnjs.cloudflare.com/ajax/libs/speakingurl/0.8.0/speakingurl.min.js | ||
@@ -50,22 +50,21 @@ ## Usage | ||
* language for symbol translation ('ar', 'de', 'en', 'es', 'fr', 'pt' and 'ru'; more coming soon, please help!) | ||
* false -> don't convert symbols | ||
* ```maintainCase``` {boolean} default: false | ||
* true -> maintain case chars | ||
* false -> convert all chars to lower case | ||
* ```titleCase``` {boolean|array} default: false | ||
* true -> convert input string to title-case | ||
* array -> exclude words | ||
* ```truncate``` {number} default: 0 | ||
* 0 -> don't trim length | ||
* >= 1 -> trim to max length while not breaking any words | ||
* ```uric``` {boolean} default: false | ||
* true -> additionally allow chars: ";", "?", ":", "@", "&", "=", "+", "$", ",", "/" | ||
* false -> only Base64 chars allowed (/A-Za-z0-9-_/) | ||
* false | ||
* ```uricNoSlash``` {boolean} default: false | ||
* true -> additionally allow chars: ";", "?", ":", "@", "&", "=", "+", "$", "," | ||
* false -> only Base64 chars allowed (/A-Za-z0-9-_/) | ||
* ```mark``` {boolean} default: false | ||
* true -> additionally allow chars: "-", "_", ".", "!", "~", "*", "'", "(", ")" | ||
* false -> only Base64 chars allowed (/A-Za-z0-9-_/) | ||
* ```custom``` {object} default: {} | ||
* custom map for translation, overwrites all i.e. { '&': '#', '*': ' star ' } | ||
* ```titleCase``` {boolean|array} default: false | ||
* true -> convert input string to title-case | ||
* array -> exclude words | ||
* ```truncate``` {number} default: 0 | ||
* 0 -> don't trim length | ||
* >= 1 -> trim to max length while not breaking any words | ||
@@ -171,2 +170,7 @@ * ```options``` {string} separator | ||
slug = getSlug('Foo & Bar ♥ Foo < Bar', { | ||
lang: false | ||
}); | ||
console.log(slug); // Output: foo-bar-foo-bar | ||
``` | ||
@@ -173,0 +177,0 @@ |
@@ -1,1 +0,1 @@ | ||
/* speakingurl v0.7.0 (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.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,p="object"==typeof b&&b.lang||"en",q="object"==typeof b&&b.uric||!1,r="object"==typeof b&&b.uricNoSlash||!1,s="object"==typeof b&&b.mark||!1,t=e[p]||e.en,u=[";","?",":","@","&","=","+","$",",","/"],v=[";","?",":","@","&","=","+","$",","],w=[".","!","~","*","'","(",")"],x="",y=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&&(q&&(y+=u.join("")),r&&(y+=v.join("")),s&&(y+=w.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()})),y=c(y),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):!t[h]||q&&-1!==u.join("").indexOf(h)||r&&-1!==v.join("").indexOf(h)||s&&-1!==w.join("").indexOf(h)?(j&&(/[A-Za-z0-9]/.test(h)||x.substr(-1).match(/A-Za-z0-9]/))&&(h=" "+h),j=!1):(h=j||x.substr(-1).match(/[A-Za-z0-9]/)?n+t[h]:t[h],h+=void 0!==a[g+1]&&a[g+1].match(/[A-Za-z0-9]/)?n:"",j=!0),x+=h.replace(new RegExp("[^\\w\\s"+y+"_-]","g"),n);return x=x.replace(/\s+/g,n).replace(new RegExp("\\"+n+"+","g"),n).replace(new RegExp("(^\\"+n+"+|\\"+n+"+$)","g"),""),o&&x.length>o&&(f=x.charAt(o)===n,x=x.slice(0,o),f||(x=x.slice(0,x.lastIndexOf(n)))),k||l||l.length||(x=x.toLowerCase()),x},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",ъ:"",ы:"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"},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"},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"}};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.8.0 (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.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",β:"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",ъ:"",ы:"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"},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"},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"}};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){}}(); |
@@ -22,4 +22,8 @@ /* global describe,it */ | ||
getSlug('Foo > Bar ♥ Baz', { | ||
maintainCase: true | ||
}).should.eql('Foo-greater-than-Bar-love-Baz'); | ||
done(); | ||
}); | ||
}); |
@@ -43,4 +43,18 @@ /* global describe,it */ | ||
getSlug('Don\'t drink and drive', { | ||
titleCase: {} | ||
}).should.eql('Don-t-Drink-And-Drive'); | ||
getSlug('Don\'t drink and drive', { | ||
titleCase: { | ||
'drink': 'drive' | ||
} | ||
}).should.eql('Don-t-Drink-And-Drive'); | ||
getSlug('Don\'t drink and drive', { | ||
titleCase: 42 | ||
}).should.eql('Don-t-Drink-And-Drive'); | ||
done(); | ||
}); | ||
}); |
@@ -38,2 +38,18 @@ /* global describe,it */ | ||
getSlug('Foo Foo Bar Bar', { | ||
truncate: "foo" | ||
}).should.eql('foo-foo-bar-bar'); | ||
getSlug('Foo Foo Bar Bar', { | ||
truncate: false | ||
}).should.eql('foo-foo-bar-bar'); | ||
getSlug('Foo Foo Bar Bar', { | ||
truncate: true | ||
}).should.eql('foo-foo-bar-bar'); | ||
getSlug('a Foo', { | ||
truncate: true | ||
}).should.eql('a-foo'); | ||
done(); | ||
@@ -40,0 +56,0 @@ |
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
1839
276
82729
10