New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.2.19 to 0.2.20

LICENSE

24

bower.json
{
"name": "speakingurl",
"version": "0.2.19",
"version": "0.2.20",
"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.",

@@ -10,15 +10,21 @@ "main": "speakingurl.min.js",

"type": "git",
"url": "https://github.com/pid/speakingurl.git"
"url": "git://github.com/pid/speakingurl.git"
},
"licenses": [
{
"type": "BSD",
"url": "https://raw.github.com/pid/speakingurl/master/LICENCE"
}
],
"licenses": [{
"type": "BSD",
"url": "https://raw.github.com/pid/speakingurl/master/LICENSE"
}],
"ignore": [
"**/.*",
"node_modules",
"components"
"component.json",
"composer.json",
"**/*.json",
"Makefile",
"lib/*",
"index.js",
"test",
"examples/node-*.js",
"Gruntfile.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.2.19",
"version": "0.2.20",
"keywords": [

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

{
"name": "pid/speakingurl",
"version": "0.2.19",
"version": "0.2.20",
"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.",

@@ -83,4 +83,6 @@ 'use strict';

slug = getSlug('NEXUS4 only €299', {maintainCase: true});
slug = getSlug('NEXUS4 only €299', {
maintainCase: true
});
console.log(slug); // Output: NEXUS-4-only-EUR-299
console.log("\n");

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

jshint: {
src: ['Gruntfile.js', '<%= sourceFiles %>', '<%= testFiles %>']
options: {},
src: ['Gruntfile.js', '<%= sourceFiles %>', '<%= jsonFiles %>', '<%= jsonFiles %>']
},

@@ -44,6 +45,5 @@

replacements: [{
from: /\d{1,1}\.\d{1,2}\.\d{1,2}/g,
to: '<%= pkg.version %>'
}
]
from: /\d{1,1}\.\d{1,2}\.\d{1,2}/g,
to: '<%= pkg.version %>'
}]
}

@@ -55,3 +55,4 @@ },

sourceFiles: 'lib/**/*.js',
testFiles: 'test/**/*.js'
testFiles: 'test/**/*.js',
jsonFiles: '*.json'
});

@@ -63,5 +64,5 @@

.exec('mocha', function(err, stdout) {
grunt.log.write(stdout);
done(err);
});
grunt.log.write(stdout);
done(err);
});
});

@@ -68,0 +69,0 @@

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

(function () {
(function() {
'use strict';

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

* getSlug
* @param {[string]} input input string
* @param {[object|string]} opts config object or separator string/char
* @param {string} input input string
* @param {object|string} opts config object or separator string/char
* @api public
* @return {[string]} sluggified string
* @return {string} sluggified string
*/

@@ -43,14 +43,11 @@ var getSlug = function getSlug(input, opts) {

if (uricFlag) {
allowedChars = allowedChars.concat(uricChars
);
allowedChars = allowedChars.concat(uricChars);
}
if (uricNoSlashFlag) {
allowedChars = allowedChars.concat(uricNoSlashChars
);
allowedChars = allowedChars.concat(uricNoSlashChars);
}
if (markFlag) {
allowedChars = allowedChars.concat(markChars
);
allowedChars = allowedChars.concat(markChars);
}

@@ -60,12 +57,6 @@ }

// escape all necessary chars
allowedChars = (allowedChars.join(''
) + separator)
.replace(/[-\\^$*+?.()|[\]{}\/]/g,
'\\$&'
);
allowedChars = (allowedChars.join('') + separator).replace(/[-\\^$*+?.()|[\]{}\/]/g, '\\$&');
// trim whitspaces
input = input.replace(/(^\s+|\s+$)/g,
''
);
input = input.replace(/(^\s+|\s+$)/g, '');

@@ -76,42 +67,31 @@ lastCharWasSymbol = false;

ch = input[i];
if (customChars[ch]) {
// process custom chars
ch = lastCharWasSymbol && customChars[ch].match(/[A-Za-z0-9]/
) ? ' ' + customChars[ch] : customChars[ch];
ch = lastCharWasSymbol && customChars[ch].match(/[A-Za-z0-9]/) ? ' ' + customChars[ch] : customChars[ch];
lastCharWasSymbol = false;
} else if (charMap[ch]) {
// process diactrics chars
ch = lastCharWasSymbol && charMap[ch].match(/[A-Za-z0-9]/
) ? ' ' + charMap[ch] : charMap[ch];
ch = lastCharWasSymbol && charMap[ch].match(/[A-Za-z0-9]/) ? ' ' + charMap[ch] : charMap[ch];
lastCharWasSymbol = false;
} else if (
// process symbol chars
symbol[ch] && !(uricFlag && uricChars.join(''
)
.indexOf(ch
) !== -1) && !(uricNoSlashFlag && uricNoSlashChars.join(''
)
.indexOf(ch
) !== -1) && !(markFlag && markChars.join(''
)
.indexOf(ch
) !== -1)) {
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 = lastCharWasSymbol || result.substr(-1).match(/[A-Za-z0-9]/) ? separator + symbol[ch] : symbol[ch];
ch += input[i + 1].match(/[A-Za-z0-9]/) ? separator : '';
lastCharWasSymbol = true;
} else {
// process latin chars
if (lastCharWasSymbol && (/[A-Za-z0-9]/.test(ch
) || result.substr(-1
)
.match(/A-Za-z0-9]/
))) {
if (lastCharWasSymbol && (/[A-Za-z0-9]/.test(ch) || result.substr(-1).match(/A-Za-z0-9]/))) {
ch = ' ' + ch;

@@ -123,36 +103,16 @@ }

// add allowed chars
result += ch.replace(new RegExp('[^\\w\\s' + allowedChars + '_-]',
'g'
),
separator
);
result += ch.replace(new RegExp('[^\\w\\s' + allowedChars + '_-]', 'g'), separator);
}
result = result.replace(/\s+/g,
separator
) // eliminate duplicate separators
.replace(new RegExp('\\' + separator + '+',
'g'
),
separator
) // add separator
.replace(new RegExp('(^\\' + separator + '+|\\' + separator + '+$)',
'g'
),
''
); // trim separators from start and end
result = result.replace(/\s+/g, separator) // eliminate duplicate separators
.replace(new RegExp('\\' + separator + '+', 'g'), separator) // add separator
.replace(new RegExp('(^\\' + separator + '+|\\' + separator + '+$)', 'g'), ''); // trim separators from start and end
if (truncate && result.length > truncate) {
lucky = result.charAt(truncate
) === separator;
result = result.slice(0,
truncate
);
lucky = result.charAt(truncate) === separator;
result = result.slice(0, truncate);
if (!lucky) {
result = result.slice(0,
result.lastIndexOf(separator
)
);
result = result.slice(0, result.lastIndexOf(separator));
}

@@ -162,4 +122,3 @@ }

if (!maintainCase) {
result = result.toLowerCase(
);
result = result.toLowerCase();
}

@@ -172,13 +131,11 @@

* createSlug curried(opts)(input)
* @param {[object]} opts config object
* @return {[function]} function getSlugWithConfig()
* @param {object} opts config object
* @return {function} function getSlugWithConfig()
* getSlugWithConfig
* @param {[string]} input input string
* @return {[string]} slug string
* @param {string} input string
* @return {string} slug string
*/
var createSlug = function createSlug(opts) {
return function getSlugWithConfig(input) {
return getSlug(input,
opts
);
return getSlug(input, opts);
};

@@ -481,3 +438,3 @@ };

'Ģ': 'G',
'Ī': 'i',
'Ī': 'I',
'Ķ': 'k',

@@ -492,4 +449,4 @@ 'Ļ': 'L',

'”': '"',
'‘': "'",
'’': "'",
'‘': '\'',
'’': '\'',
'∂': 'd',

@@ -510,3 +467,3 @@ 'ƒ': 'f',

// currency
"$": 'USD',
'$': 'USD',
'€': 'EUR',

@@ -607,11 +564,15 @@ '₢': 'BRN',

if (typeof module !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
// export functions for use in Node
module.exports = getSlug;
module.exports.createSlug = createSlug;
} else if (typeof define !== 'undefined') {
define([],
function () {
return getSlug;
}
);
} else if (typeof define !== 'undefined' && define.amd) {
// export function for use in AMD
define([], function() {
return getSlug;
});
} else {

@@ -626,7 +587,5 @@ // don't overwrite global if exists

}
} catch (e) {
}
} catch (e) {}
}
})(
);
})();
{
"name": "speakingurl",
"version": "0.2.19",
"version": "0.2.20",
"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.",
"homepage": "http://pid.github.io/speakingurl/",
"github": "https://github.com/pid/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": [

@@ -12,2 +23,3 @@ "slug",

"speakingurl",
"speaking url",
"nice url",

@@ -20,2 +32,5 @@ "static url"

],
"scripts": {
"test": "mocha"
},
"author": {

@@ -31,10 +46,10 @@ "name": "Sascha Droste",

"grunt": "~0.4.1",
"mocha": "~1.11.0",
"mocha": "~1.12.0",
"should": "~1.2.2",
"grunt-contrib-uglify": "~0.2.1",
"grunt-contrib-uglify": "~0.2.2",
"grunt-contrib-jshint": "~0.6.0",
"grunt-contrib-watch": "~0.4.4",
"grunt-release": "~0.3.4",
"grunt-contrib-watch": "~0.5.1",
"grunt-release": "~0.3.5",
"grunt-bumpup": "~0.2.0",
"grunt-text-replace": "~0.3.4"
"grunt-text-replace": "~0.3.6"
},

@@ -73,3 +88,6 @@ "testling": {

"deps": [],
"exports": "speakingurl"
"exports": [
"getSlug",
"createSlug"
]
},

@@ -82,21 +100,7 @@ "include": [

"volo": {
"url": "http://cdnjs.cloudflare.com/ajax/libs/speakingurl/{version}/speakingurl.min.js"
"url": "//cdnjs.cloudflare.com/ajax/libs/speakingurl/{version}/speakingurl.min.js"
},
"scripts": {
"test": "mocha"
},
"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/LICENCE"
}
],
"engines": {
"node": ">=0.8.0"
}
}
}
# 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)
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.
> 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.

@@ -9,2 +9,5 @@ This module aims to transliteration the input string.

[![Module Status](https://nodei.co/npm/speakingurl.png?downloads=true&stars=true)](https://npmjs.org/package/speakingurl)
## Installation

@@ -22,25 +25,16 @@ server-side:

$ # http://jamjs.org/
$ jam install speakingurl
or
$ # http://component.io/
$ component install pid/speakingurl
or
$ # http://getcomposer.org/
$ # https://packagist.org/packages/pid/speakingurl
or
$ # http://jamjs.org/
$ jam install speakingurl
$ # http://getcomposer.org/
$ # https://packagist.org/packages/pid/speakingurl
or
copy the file speakingurl.min.js to your script directory
or
use //cdnjs.cloudflare.com/ajax/libs/speakingurl/0.2.18/speakingurl.min.js
or use the CDN from Cloudflare
use //cdnjs.cloudflare.com/ajax/libs/speakingurl/0.2.20/speakingurl.min.js
## Usage

@@ -55,22 +49,21 @@ ### getSlug(input, [options]);

* ```maintainCase``` {boolean} default: false
* true => maintain case chars
* false => convert all chars to lower case
* true -> maintain case chars
* false -> convert all chars to lower case
* ```uric``` {boolean} default: false
* true => additionally allow chars: ";", "?", ":", "@", "&", "=", "+", "$", ",", "/"
* false => only Base64 chars allowed (/A-Za-z0-9-_/)
* true -> additionally allow chars: ";", "?", ":", "@", "&", "=", "+", "$", ",", "/"
* false -> only Base64 chars allowed (/A-Za-z0-9-_/)
* ```uricNoSlash``` {boolean} default: false
* true => additionally allow chars: ";", "?", ":", "@", "&", "=", "+", "$", ","
* false => only Base64 chars allowed (/A-Za-z0-9-_/)
* 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-_/)
* 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 ' }
* ```truncate``` {number} default: 0
* 0 => don't trim length
* >0 => trim to max length while not breaking any words
* 0 -> don't trim length
* &gt;= 1 -> trim to max length while not breaking any words
* ```options``` {string} separator
notes: default only Base64 chars are allowed (/A-Za-z0-9_-/), setting ```uric```, ```uricNoSlash``` or/and ```mark``` to ```true```will add the specified chars to the allowed chars. The separator-character is always allowed.
notes: default only Base64 chars are allowed (/A-Za-z0-9_-/), setting ```uric```, ```uricNoSlash``` or/and ```mark``` to ```true``` will add the specified chars to the list of allowed characters. The separator-character is always allowed.

@@ -179,2 +172,4 @@ ```javascript

[![Flattr](http://api.flattr.com/button/flattr-badge-large.png)](http://flattr.com/thing/1418477/pidspeakingurl-on-GitHub)
## [History](https://raw.github.com/pid/speakingurl/master/History.md)

@@ -192,3 +187,3 @@

## License
[BSD](https://raw.github.com/pid/speakingurl/master/LICENCE)
[BSD](https://raw.github.com/pid/speakingurl/master/LICENSE)

@@ -195,0 +190,0 @@ The BSD 3-Clause License (BSD3)

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

/* speakingurl v0.2.18 (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=a,module.exports.createSlug=b;else if("undefined"!=typeof define)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.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){}}();
/* global describe,it */
describe('getSlug create', function () {
describe('getSlug create', function() {
'use strict';
it('with symbols', function (done) {
it('with symbols', function(done) {
var getSlug = require('../lib').createSlug({

@@ -19,3 +19,3 @@ lang: 'en',

it('without options', function (done) {
it('without options', function(done) {
var getSlug = require('../lib').createSlug();

@@ -28,3 +28,3 @@

it('with empty options', function (done) {
it('with empty options', function(done) {
var getSlug = require('../lib').createSlug({});

@@ -37,3 +37,3 @@

it('with maintainCase', function (done) {
it('with maintainCase', function(done) {
var getSlug = require('../lib').createSlug({

@@ -48,3 +48,3 @@ maintainCase: true

it('with uric', function (done) {
it('with uric', function(done) {
var getSlug = require('../lib').createSlug({

@@ -59,3 +59,3 @@ uric: true

it('with uricNoSlash', function (done) {
it('with uricNoSlash', function(done) {
var getSlug = require('../lib').createSlug({

@@ -70,3 +70,3 @@ uricNoSlash: true

it('with mark', function (done) {
it('with mark', function(done) {
var getSlug = require('../lib').createSlug({

@@ -81,3 +81,3 @@ mark: true

it('with truncate', function (done) {
it('with truncate', function(done) {
var getSlug = require('../lib').createSlug({

@@ -92,3 +92,3 @@ truncate: 15

it('with separator', function (done) {
it('with separator', function(done) {
var getSlug = require('../lib').createSlug({

@@ -103,3 +103,3 @@ separator: '_'

it('with mark and maintainCase', function (done) {
it('with mark and maintainCase', function(done) {
var getSlug = require('../lib').createSlug({

@@ -115,5 +115,7 @@ mark: true,

it('with custom chars replacement', function (done) {
it('with custom chars replacement', function(done) {
var getSlug = require('../lib').createSlug({
custom: { '*': 'o'}
custom: {
'*': 'o'
}
});

@@ -126,5 +128,7 @@

it('with custom chars replacement with not allowed target char', function (done) {
it('with custom chars replacement with not allowed target char', function(done) {
var getSlug = require('../lib').createSlug({
custom: { 'o': '*'}
custom: {
'o': '*'
}
});

@@ -137,5 +141,7 @@

it('with custom chars replacement with allowed target char, option mark', function (done) {
it('with custom chars replacement with allowed target char, option mark', function(done) {
var getSlug = require('../lib').createSlug({
custom: { 'o': '*'},
custom: {
'o': '*'
},
mark: true

@@ -149,5 +155,7 @@ });

it('with custom chars replacement with option mark', function (done) {
it('with custom chars replacement with option mark', function(done) {
var getSlug = require('../lib').createSlug({
custom: { '*': 'o'},
custom: {
'*': 'o'
},
mark: true

@@ -154,0 +162,0 @@ });

@@ -5,6 +5,6 @@ /* global describe,it */

describe('getSlug defaults', function () {
describe('getSlug defaults', function() {
'use strict';
it('should replace whitespaces with separator', function (done) {
it('should replace whitespaces with separator', function(done) {

@@ -16,3 +16,3 @@ getSlug('foo bar baz').should.eql('foo-bar-baz');

it('should remove trailing space if any', function (done) {
it('should remove trailing space if any', function(done) {

@@ -24,3 +24,3 @@ getSlug(' foo bar baz ').should.eql('foo-bar-baz');

it('should remove multiple whitespaces', function (done) {
it('should remove multiple whitespaces', function(done) {

@@ -32,3 +32,3 @@ getSlug(' foo bar baz FOO BAR BAZ ').should.eql('foo-bar-baz-foo-bar-baz');

it('should remove multiple separators at start and end', function (done) {
it('should remove multiple separators at start and end', function(done) {

@@ -44,3 +44,3 @@ getSlug('-foo- bar -baz-').should.eql('foo-bar-baz');

it('should remove multple separators', function (done) {
it('should remove multple separators', function(done) {

@@ -52,3 +52,3 @@ getSlug('foo- bar -baz').should.eql('foo-bar-baz');

it('should remove non-base64 characters', function (done) {
it('should remove non-base64 characters', function(done) {

@@ -63,3 +63,3 @@ var nonBase64 = ['[', ']', ',', '*', '+', '~', '.', '(', ')', '\'', '"', '!', ':', '@'];

it('should remove trailing separator', function (done) {
it('should remove trailing separator', function(done) {

@@ -71,3 +71,3 @@ getSlug('C\'est un beau titre qui ne laisse rien à désirer ! ').should.eql('c-est-un-beau-titre-qui-ne-laisse-rien-a-desirer');

it('should handle whitespace after symbol', function (done) {
it('should handle whitespace after symbol', function(done) {

@@ -80,3 +80,5 @@ getSlug('∆299').should.eql('delta-299');

getSlug('(∆)299').should.eql('delta-299');
getSlug('(∆)299', {mark:true}).should.eql('(delta)299');
getSlug('(∆)299', {
mark: true
}).should.eql('(delta)299');

@@ -83,0 +85,0 @@ getSlug('∆299').should.eql('delta-299');

@@ -5,6 +5,6 @@ /* global describe,it */

describe('getSlug maintainCase', function () {
describe('getSlug maintainCase', function() {
'use strict';
it('should maintain case characters', function (done) {
it('should maintain case characters', function(done) {

@@ -11,0 +11,0 @@ getSlug('Foo, Bar Baz', {

@@ -5,6 +5,6 @@ /* global describe,it */

describe('getSlug rfc3986', function () {
describe('getSlug rfc3986', function() {
'use strict';
it('"uric" characters allowed', function (done) {
it('"uric" characters allowed', function(done) {

@@ -21,3 +21,3 @@ var chars = [';', '?', ':', '@', '&', '=', '+', ',', '/'];

it('"uricNoSlash" characters allowed', function (done) {
it('"uricNoSlash" characters allowed', function(done) {

@@ -35,3 +35,3 @@ var chars = [';', '?', ':', '@', '&', '=', '+', ','];

it('"mark" characters allowed', function (done) {
it('"mark" characters allowed', function(done) {

@@ -49,3 +49,3 @@ var chars = ['.', '!', '~', '*', '\'', '(', ')'];

it('"uric" characters allowed, separator ";"', function (done) {
it('"uric" characters allowed, separator ";"', function(done) {

@@ -64,3 +64,3 @@ var chars = ['?', ':', '@', '&', '=', '+', ',', '/'];

it('"uric" characters allowed, separator ";" included in input string', function (done) {
it('"uric" characters allowed, separator ";" included in input string', function(done) {

@@ -75,3 +75,3 @@ getSlug("foo ; bar baz", {

it('"uricNoSlash" characters allowed, separator ";"', function (done) {
it('"uricNoSlash" characters allowed, separator ";"', function(done) {

@@ -90,3 +90,3 @@ var chars = ['?', ':', '@', '&', '=', '+', ','];

it('"uricNoSlash" characters allowed, separator ";" included in input string', function (done) {
it('"uricNoSlash" characters allowed, separator ";" included in input string', function(done) {

@@ -101,3 +101,3 @@ getSlug("foo ; bar baz", {

it('"mark" characters allowed, separator "."', function (done) {
it('"mark" characters allowed, separator "."', function(done) {

@@ -116,3 +116,3 @@ var chars = ['!', '~', '*', '\'', '(', ')'];

it('"mark" characters allowed, separator "." included in input string', function (done) {
it('"mark" characters allowed, separator "." included in input string', function(done) {

@@ -119,0 +119,0 @@ getSlug("foo . bar baz", {

@@ -5,6 +5,6 @@ /* global describe,it */

describe('getSlug separator', function () {
describe('getSlug separator', function() {
'use strict';
it('should separate with non-whitespace', function (done) {
it('should separate with non-whitespace', function(done) {

@@ -33,3 +33,3 @@ getSlug('Foo Bar Baz', {

it('should separate with non-whitespace, with trailing spaces', function (done) {
it('should separate with non-whitespace, with trailing spaces', function(done) {

@@ -58,3 +58,3 @@ getSlug(' Foo Bar Baz ', {

it('should separate with trailing separator "-"', function (done) {
it('should separate with trailing separator "-"', function(done) {

@@ -82,3 +82,3 @@ getSlug('-Foo Bar Baz-', {

it('should separate with trailing separator "*"', function (done) {
it('should separate with trailing separator "*"', function(done) {

@@ -107,3 +107,3 @@ getSlug('*Foo Bar Baz*', {

it('should separate with trailing separator "_"', function (done) {
it('should separate with trailing separator "_"', function(done) {

@@ -131,3 +131,3 @@ getSlug('_Foo Bar Baz_', {

it('should remove trailing separator "*"', function (done) {
it('should remove trailing separator "*"', function(done) {

@@ -138,3 +138,4 @@ getSlug(' C\'est un beau titre qui ne laisse rien à désirer !', {

getSlug(' C\'est un beau titre qui ne laisse rien à désirer !', '*').should.eql('c*est*un*beau*titre*qui*ne*laisse*rien*a*desirer');
getSlug(' C\'est un beau titre qui ne laisse rien à désirer !', '*')
.should.eql('c*est*un*beau*titre*qui*ne*laisse*rien*a*desirer');

@@ -145,3 +146,3 @@ done();

it('should return empty string because of non string input', function (done) {
it('should return empty string because of non string input', function(done) {

@@ -148,0 +149,0 @@ getSlug(true).should.eql('');

@@ -5,6 +5,6 @@ /* global describe,it */

describe('getSlug config combinations', function () {
describe('getSlug config combinations', function() {
'use strict';
it('should separate with configured character, with non-Base64 separator', function (done) {
it('should separate with configured character, with non-Base64 separator', function(done) {

@@ -29,3 +29,3 @@ getSlug('Foo, Bar Baz', {

it('should separate with configured character, with only Base64 characters allowed', function (done) {
it('should separate with configured character, with only Base64 characters allowed', function(done) {

@@ -50,3 +50,3 @@ getSlug('Foo, Bar Baz', {

it('should separate with configured character, with smart trim', function (done) {
it('should separate with configured character, with smart trim', function(done) {

@@ -76,3 +76,3 @@ getSlug('Foobarbaz, Bar Baz', {

it('should maintain case characters, with non-Base64 separator', function (done) {
it('should maintain case characters, with non-Base64 separator', function(done) {

@@ -97,3 +97,3 @@ getSlug('Foo, Bar Baz', {

it('should maintain case characters, with only Base64 characters allowed', function (done) {
it('should maintain case characters, with only Base64 characters allowed', function(done) {

@@ -124,3 +124,3 @@ getSlug('Foo, Bar Baz', {

it('should maintain case characters, with smart trim', function (done) {
it('should maintain case characters, with smart trim', function(done) {

@@ -150,3 +150,3 @@ getSlug('Foobarbaz, Bar Baz', {

it('should prefer Base64 characters only', function (done) {
it('should prefer Base64 characters only', function(done) {

@@ -153,0 +153,0 @@ getSlug('Foo, Bar Baz', {

@@ -5,6 +5,6 @@ /* global describe,it */

describe('getSlug symbols', function () {
describe('getSlug symbols', function() {
'use strict';
it('should convert symbols', function (done) {
it('should convert symbols', function(done) {

@@ -36,3 +36,3 @@ getSlug('Foo & Bar | Baz').should.eql('foo-and-bar-or-baz');

it('should not convert symbols with uric flag true', function (done) {
it('should not convert symbols with uric flag true', function(done) {

@@ -65,3 +65,3 @@ getSlug('Foo & Bar | Baz', {

it('should not convert symbols with uricNoSlash flag true', function (done) {
it('should not convert symbols with uricNoSlash flag true', function(done) {

@@ -94,3 +94,3 @@ getSlug('Foo & Bar | Baz', {

it('should not convert symbols with mark flag true', function (done) {
it('should not convert symbols with mark flag true', function(done) {

@@ -130,3 +130,3 @@ getSlug('Foo (Bar) . Baz', {

it('should convert symbols with flags true', function (done) {
it('should convert symbols with flags true', function(done) {

@@ -179,3 +179,3 @@ getSlug('Foo (♥) ; Baz=Bar', {

it('should replace symbols (de)', function (done) {
it('should replace symbols (de)', function(done) {

@@ -194,3 +194,3 @@ getSlug('Äpfel & Birnen', {

it('should ignore not available language param', function (done) {
it('should ignore not available language param', function(done) {

@@ -204,9 +204,15 @@ getSlug('Äpfel & Birnen', {

it('should convert currency symbols to lowercase', function (done) {
it('should convert currency symbols to lowercase', function(done) {
getSlug('NEXUS4 only €199!', {maintainCase: false}).should.eql('nexus4-only-eur199');
getSlug('NEXUS4 only €199!', {
maintainCase: false
}).should.eql('nexus4-only-eur199');
getSlug('NEXUS4 only €299.93', {maintainCase: false}).should.eql('nexus4-only-eur299-93');
getSlug('NEXUS4 only €299.93', {
maintainCase: false
}).should.eql('nexus4-only-eur299-93');
getSlug('NEXUS4 only 円399.73', {maintainCase: false}).should.eql('nexus4-only-yen399-73');
getSlug('NEXUS4 only 円399.73', {
maintainCase: false
}).should.eql('nexus4-only-yen399-73');

@@ -216,9 +222,15 @@ done();

it('should convert currency symbols to uppercase', function (done) {
it('should convert currency symbols to uppercase', function(done) {
getSlug('NEXUS4 only €199!', {maintainCase: true}).should.eql('NEXUS4-only-EUR199');
getSlug('NEXUS4 only €199!', {
maintainCase: true
}).should.eql('NEXUS4-only-EUR199');
getSlug('NEXUS4 only €299.93', {maintainCase: true}).should.eql('NEXUS4-only-EUR299-93');
getSlug('NEXUS4 only €299.93', {
maintainCase: true
}).should.eql('NEXUS4-only-EUR299-93');
getSlug('NEXUS4 only 円399.73', {maintainCase: true}).should.eql('NEXUS4-only-YEN399-73');
getSlug('NEXUS4 only 円399.73', {
maintainCase: true
}).should.eql('NEXUS4-only-YEN399-73');

@@ -225,0 +237,0 @@ done();

@@ -5,6 +5,6 @@ /* global describe,it */

describe('getSlug smart truncate', function () {
describe('getSlug smart truncate', function() {
'use strict';
it('should maintain case characters, with smart truncate', function (done) {
it('should maintain case characters, with smart truncate', function(done) {

@@ -11,0 +11,0 @@ getSlug('Foobarbaz, Bar Baz', {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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