speakingurl
Advanced tools
Comparing version 0.2.20 to 0.2.21
{ | ||
"name": "speakingurl", | ||
"version": "0.2.20", | ||
"version": "0.2.21", | ||
"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,6 +12,8 @@ "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": [ | ||
@@ -18,0 +20,0 @@ "**/.*", |
@@ -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.2.20", | ||
"version": "0.2.21", | ||
"keywords": [ | ||
@@ -8,0 +8,0 @@ "slug", |
{ | ||
"name": "pid/speakingurl", | ||
"version": "0.2.20", | ||
"version": "0.2.21", | ||
"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,11 +79,10 @@ (function() { | ||
// process symbol chars | ||
symbol[ch] && !(uricFlag && uricChars.join('') | ||
.indexOf(ch) !== -1) && !(uricNoSlashFlag && uricNoSlashChars.join('') | ||
.indexOf(ch) !== -1) && !(markFlag && markChars.join('') | ||
.indexOf(ch) !== -1)) { | ||
// process symbol chars | ||
symbol[ch] && !(uricFlag && uricChars.join('').indexOf(ch) !== -1) && | ||
!(uricNoSlashFlag && uricNoSlashChars.join('').indexOf(ch) !== -1) && | ||
!(markFlag && markChars.join('').indexOf(ch) !== -1)) { | ||
ch = lastCharWasSymbol || result.substr(-1).match(/[A-Za-z0-9]/) ? separator + symbol[ch] : symbol[ch]; | ||
ch += input[i + 1].match(/[A-Za-z0-9]/) ? separator : ''; | ||
ch += input[i + 1] !== void 0 && input[i + 1].match(/[A-Za-z0-9]/) ? separator : ''; | ||
lastCharWasSymbol = true; | ||
@@ -90,0 +89,0 @@ } else { |
{ | ||
"name": "speakingurl", | ||
"version": "0.2.20", | ||
"version": "0.2.21", | ||
"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.", | ||
@@ -44,9 +44,9 @@ "homepage": "http://pid.github.io/speakingurl/", | ||
"grunt": "~0.4.1", | ||
"mocha": "~1.12.0", | ||
"should": "~1.2.2", | ||
"mocha": "~1.13.0", | ||
"should": "~1.3.0", | ||
"grunt-contrib-uglify": "~0.2.2", | ||
"grunt-contrib-jshint": "~0.6.0", | ||
"grunt-contrib-watch": "~0.5.1", | ||
"grunt-release": "~0.3.5", | ||
"grunt-bumpup": "~0.2.0", | ||
"grunt-release": "~0.5.1", | ||
"grunt-bumpup": "~0.4.1", | ||
"grunt-text-replace": "~0.3.6" | ||
@@ -53,0 +53,0 @@ }, |
@@ -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.2.20/speakingurl.min.js | ||
use //cdnjs.cloudflare.com/ajax/libs/speakingurl/0.2.21/speakingurl.min.js | ||
@@ -125,3 +125,3 @@ ## Usage | ||
var slug = getSlug('NEXUS4 only €299', {maintainCase: true}); | ||
console.log(slug); // Output: NEXUS-4-only-EUR-299 | ||
console.log(slug); // Output: NEXUS-4-only-EUR299 | ||
</script> | ||
@@ -128,0 +128,0 @@ ``` |
@@ -1,1 +0,1 @@ | ||
/* speakingurl v0.2.20 (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=[];if("string"!=typeof a)return"";for("string"==typeof b?k=b:"object"==typeof b&&(n&&(w=w.concat(s)),o&&(w=w.concat(t)),p&&(w=w.concat(u))),w=(w.join("")+k).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+=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","“":'"',"”":'"',"‘":"'","’":"'","∂":"d","ƒ":"f","™":"(TM)","©":"(C)","œ":"oe","Œ":"OE","®":"(R)","†":"+","℠":"(SM)","…":"...","˚":"o","º":"o","ª":"a","•":"*",$:"USD","€":"EUR","₢":"BRN","₣":"FRF","£":"GBP","₤":"ITL","₦":"NGN","₧":"ESP","₨":"INR","₩":"KRW","₪":"ILS","₫":"VND","₭":"LAK","₮":"MNT","₯":"GRD","₱":"ARS","₲":"PYG","₳":"ARA","₴":"UAH","₵":"GHS","¢":"cent","¥":"CNY","元":"CNY","円":"YEN","﷼":"IRR","₠":"EWE","฿":"THB"},d={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.2.21 (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=[];if("string"!=typeof a)return"";for("string"==typeof b?k=b:"object"==typeof b&&(n&&(w=w.concat(s)),o&&(w=w.concat(t)),p&&(w=w.concat(u))),w=(w.join("")+k).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","“":'"',"”":'"',"‘":"'","’":"'","∂":"d","ƒ":"f","™":"(TM)","©":"(C)","œ":"oe","Œ":"OE","®":"(R)","†":"+","℠":"(SM)","…":"...","˚":"o","º":"o","ª":"a","•":"*",$:"USD","€":"EUR","₢":"BRN","₣":"FRF","£":"GBP","₤":"ITL","₦":"NGN","₧":"ESP","₨":"INR","₩":"KRW","₪":"ILS","₫":"VND","₭":"LAK","₮":"MNT","₯":"GRD","₱":"ARS","₲":"PYG","₳":"ARA","₴":"UAH","₵":"GHS","¢":"cent","¥":"CNY","元":"CNY","円":"YEN","﷼":"IRR","₠":"EWE","฿":"THB"},d={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){}}(); |
@@ -84,3 +84,17 @@ /* global describe,it */ | ||
}); | ||
it('should not fail if symbol at the end', function(done) { | ||
getSlug('test &').should.eql('test-and'); | ||
getSlug('test & ').should.eql('test-and'); | ||
getSlug('test &', '_').should.eql('test_and'); | ||
getSlug('test ♥').should.eql('test-love'); | ||
getSlug('test ♥ ').should.eql('test-love'); | ||
getSlug('test ♥ ').should.eql('test-love'); | ||
done(); | ||
}); | ||
}); |
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
86948
35
1449
0