speakingurl
Advanced tools
Comparing version 0.18.1 to 0.19.0
{ | ||
"name": "speakingurl", | ||
"version": "0.18.1", | ||
"version": "0.19.0", | ||
"description": "Generate a slug – transliteration with a lot of options", | ||
@@ -5,0 +5,0 @@ "main": "speakingurl.min.js", |
Changelog | ||
========= | ||
- v0.18.1 cleanup, update dev dependencies | ||
- v0.19.0 add support for burmese #44 | ||
- v0.18.1 cleanup, update dev dependencies | ||
- v0.18.0 fix #43; add chars to turkish langCharMap; language specific character transliteration | ||
@@ -6,0 +7,0 @@ - v0.17.0 pass global to anonymous function #42 |
@@ -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.18.1", | ||
"version": "0.19.0", | ||
"keywords": [ | ||
@@ -8,0 +8,0 @@ "slug", |
@@ -104,1 +104,7 @@ 'use strict'; | ||
console.log("\n"); | ||
slug = getSlug('မြန်မာစာ သာဓက', { | ||
lang: 'my' | ||
}); | ||
console.log(slug); // Output: myanma-thadak | ||
console.log('\n'); |
200
lib/index.js
@@ -31,2 +31,3 @@ (function (root) { | ||
var result = ''; | ||
var diatricString = ''; | ||
var lucky; | ||
@@ -38,2 +39,3 @@ var allowedChars = separator; | ||
var lastCharWasSymbol; | ||
var lastCharWasDiatric; | ||
@@ -98,8 +100,7 @@ if (titleCase && typeof titleCase.length === "number" && Array.prototype.toString.call(titleCase)) { | ||
lastCharWasSymbol = false; | ||
lastCharWasDiatric = false; | ||
for (i = 0, l = input.length; i < l; i++) { | ||
ch = input[i]; | ||
if (langChar[ch]) { | ||
// process language specific diactrics chars conversion | ||
@@ -110,8 +111,25 @@ ch = lastCharWasSymbol && langChar[ch].match(/[A-Za-z0-9]/) ? ' ' + langChar[ch] : langChar[ch]; | ||
} else if (ch in charMap) { | ||
// process diactrics chars | ||
ch = lastCharWasSymbol && charMap[ch].match(/[A-Za-z0-9]/) ? ' ' + charMap[ch] : charMap[ch]; | ||
// the transliteration changes entirely when some special characters are added | ||
if (i + 1 < l && lookAheadCharArray.indexOf(input[i + 1]) >= 0) { | ||
diatricString += ch; | ||
ch = ''; | ||
} else if (lastCharWasDiatric === true) { | ||
ch = diatricMap[diatricString] + charMap[ch]; | ||
diatricString = ''; | ||
} else { | ||
// process diactrics chars | ||
ch = lastCharWasSymbol && charMap[ch].match(/[A-Za-z0-9]/) ? ' ' + charMap[ch] : charMap[ch]; | ||
} | ||
lastCharWasSymbol = false; | ||
lastCharWasDiatric = false; | ||
} else if (ch in diatricMap) { | ||
diatricString += ch; | ||
ch = ''; | ||
// end of string, put the whole meaningful word | ||
if (i == l - 1) { | ||
ch = diatricMap[diatricString]; | ||
} | ||
lastCharWasDiatric = true; | ||
} else if ( | ||
// process symbol chars | ||
@@ -128,6 +146,8 @@ symbol[ch] && !(uricFlag && uricChars.join('') | ||
} else { | ||
// process latin chars | ||
if (lastCharWasSymbol && (/[A-Za-z0-9]/.test(ch) || result.substr(-1).match(/A-Za-z0-9]/))) { | ||
if (lastCharWasDiatric === true) { | ||
ch = diatricMap[diatricString] + ch; | ||
diatricString = ''; | ||
lastCharWasDiatric = false; | ||
} else if (lastCharWasSymbol && (/[A-Za-z0-9]/.test(ch) || result.substr(-1).match(/A-Za-z0-9]/))) { | ||
// process latin chars | ||
ch = ' ' + ch; | ||
@@ -340,6 +360,6 @@ } | ||
// 'Ç': 'C', // duplicate | ||
// 'ü': 'ue', // duplicate | ||
// 'Ü': 'Ue', // duplicate | ||
// 'ö': 'oe', // duplicate | ||
// 'Ö': 'Oe', // duplicate | ||
// 'ü': 'ue', // duplicate, see langCharMap | ||
// 'Ü': 'Ue', // duplicate, see langCharMap | ||
// 'ö': 'oe', // duplicate, see langCharMap | ||
// 'Ö': 'Oe', // duplicate, see langCharMap | ||
'ğ': 'g', | ||
@@ -589,2 +609,5 @@ 'Ğ': 'G', | ||
'•': '*', | ||
'၊': ',', | ||
'။': '.', | ||
// currency | ||
@@ -699,6 +722,143 @@ '$': 'USD', | ||
'ẵ': 'a', | ||
'Ẵ': 'A' | ||
'Ẵ': 'A', | ||
// burmese consonants | ||
'က': 'k', | ||
'ခ': 'kh', | ||
'ဂ': 'g', | ||
'ဃ': 'ga', | ||
'င': 'ng', | ||
'စ': 's', | ||
'ဆ': 'sa', | ||
'ဇ': 'z', | ||
'စျ': 'za', | ||
'ည': 'ny', | ||
'ဋ': 't', | ||
'ဌ': 'ta', | ||
'ဍ': 'd', | ||
'ဎ': 'da', | ||
'ဏ': 'na', | ||
'တ': 't', | ||
'ထ': 'ta', | ||
'ဒ': 'd', | ||
'ဓ': 'da', | ||
'န': 'n', | ||
'ပ': 'p', | ||
'ဖ': 'pa', | ||
'ဗ': 'b', | ||
'ဘ': 'ba', | ||
'မ': 'm', | ||
'ယ': 'y', | ||
'ရ': 'ya', | ||
'လ': 'l', | ||
'ဝ': 'w', | ||
'သ': 'th', | ||
'ဟ': 'h', | ||
'ဠ': 'la', | ||
'အ': 'a', | ||
// consonant character combos | ||
'ြ': 'y', | ||
'ျ': 'ya', | ||
'ွ': 'w', | ||
'ြွ': 'yw', | ||
'ျွ': 'ywa', | ||
'ှ': 'h', | ||
// independent vowels | ||
'ဧ': 'e', | ||
'၏': '-e', | ||
'ဣ': 'i', | ||
'ဤ': '-i', | ||
'ဉ': 'u', | ||
'ဦ': '-u', | ||
'ဩ': 'aw', | ||
'သြော': 'aw', | ||
'ဪ': 'aw', | ||
// numbers | ||
'၀': '0', | ||
'၁': '1', | ||
'၂': '2', | ||
'၃': '3', | ||
'၄': '4', | ||
'၅': '5', | ||
'၆': '6', | ||
'၇': '7', | ||
'၈': '8', | ||
'၉': '9', | ||
// virama and tone marks which are silent in transliteration | ||
'္': '', | ||
'့': '', | ||
'း': '' | ||
}; | ||
/** | ||
* special look ahead character array | ||
* These characters form with consonants to become 'single'/consonant combo | ||
* @type [Array] | ||
*/ | ||
var lookAheadCharArray = [ | ||
// burmese | ||
'်' | ||
]; | ||
/** | ||
* diatricMap for languages where transliteration changes entirely as more diatrics are added | ||
* @type {Object} | ||
*/ | ||
var diatricMap = { | ||
//burmese | ||
// dependent vowels | ||
'ာ': 'a', | ||
'ါ': 'a', | ||
'ေ': 'e', | ||
'ဲ': 'e', | ||
'ိ': 'i', | ||
'ီ': 'i', | ||
'ို': 'o', | ||
'ု': 'u', | ||
'ူ': 'u', | ||
'ေါင်': 'aung', | ||
'ော': 'aw', | ||
'ော်': 'aw', | ||
'ေါ': 'aw', | ||
'ေါ်': 'aw', | ||
'်': '်', // this is special case but the character will be converted to latin in the code | ||
'က်': 'et', | ||
'ိုက်': 'aik', | ||
'ောက်': 'auk', | ||
'င်': 'in', | ||
'ိုင်': 'aing', | ||
'ောင်': 'aung', | ||
'စ်': 'it', | ||
'ည်': 'i', | ||
'တ်': 'at', | ||
'ိတ်': 'eik', | ||
'ုတ်': 'ok', | ||
'ွတ်': 'ut', | ||
'ေတ်': 'it', | ||
'ဒ်': 'd', | ||
'ိုဒ်': 'ok', | ||
'ုဒ်': 'ait', | ||
'န်': 'an', | ||
'ာန်': 'an', | ||
'ိန်': 'ein', | ||
'ုန်': 'on', | ||
'ွန်': 'un', | ||
'ပ်': 'at', | ||
'ိပ်': 'eik', | ||
'ုပ်': 'ok', | ||
'ွပ်': 'ut', | ||
'န်ုပ်': 'nub', | ||
'မ်': 'an', | ||
'ိမ်': 'ein', | ||
'ုမ်': 'on', | ||
'ွမ်': 'un', | ||
'ယ်': 'e', | ||
'ိုလ်': 'ol', | ||
'ဉ်': 'in', | ||
'ံ': 'an', | ||
'ိံ': 'ein', | ||
'ုံ': 'on' | ||
}; | ||
/** | ||
* langCharMap language specific characters translations | ||
@@ -799,2 +959,14 @@ * @type {Object} | ||
'my': { | ||
'∆': 'kwahkhyaet', | ||
'∞': 'asaonasme', | ||
'♥': 'akhyait', | ||
'&': 'nhin', | ||
'|': 'tho', | ||
'<': 'ngethaw', | ||
'>': 'kyithaw', | ||
'∑': 'paungld', | ||
'¤': 'ngwekye' | ||
}, | ||
'nl': { | ||
@@ -801,0 +973,0 @@ '∆': 'delta', |
{ | ||
"name": "speakingurl", | ||
"version": "0.18.1", | ||
"version": "0.19.0", | ||
"description": "Generate a slug – transliteration with a lot of options", | ||
@@ -5,0 +5,0 @@ "homepage": "http://pid.github.io/speakingurl/", |
@@ -1,3 +0,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) [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/pid/speakingurl?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) | ||
=============================================================================================================================================================================================================================================================================================================================================================== | ||
SpeakingURL [![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) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/pid/speakingurl?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) | ||
================================================================================================================================================================================================================================================================================================================================================================ | ||
@@ -12,3 +12,3 @@ > 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. This module aims to transliterate the input string. | ||
1. Use a unique reference to the record – e.g. a unique key "12345" => /my-little-title-12345.html | ||
1. Use a unique reference to the record – e.g. a unique key "12345" =\> /my-little-title-12345.html | ||
2. Store all historical slugs in the page record; but you have to re-calculate the slug from all pages – every time you update speakingurl | ||
@@ -56,3 +56,3 @@ | ||
- available versions: http://cdnjs.com/libraries/speakingurl/ | ||
- use //cdnjs.cloudflare.com/ajax/libs/speakingurl/0.18.1/speakingurl.min.js | ||
- use //cdnjs.cloudflare.com/ajax/libs/speakingurl/0.19.0/speakingurl.min.js | ||
@@ -62,3 +62,3 @@ #### [CDN/maxcdn](https://www.maxcdn.com/) | ||
- available versions: http://www.jsdelivr.com/#!speakingurl | ||
- use //cdn.jsdelivr.net/speakingurl/0.18.1/speakingurl.min.js | ||
- use //cdn.jsdelivr.net/speakingurl/0.19.0/speakingurl.min.js | ||
@@ -79,26 +79,27 @@ Usage | ||
- `lang` {string} default: 'en' | ||
- language for symbol translation ('ar', 'cz', 'de', 'en', 'es', 'fr', 'it', 'nl', pt', 'ru', 'sk', 'tr' and 'vn'; more coming soon, please help!) | ||
- false -> don't convert symbols | ||
- language for symbol translation ('ar', 'cz', 'de', 'en', 'es', 'fr', 'it', 'my, 'nl', pt', 'ru', 'sk', 'tr' and 'vn'; 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 | ||
- 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 | ||
- 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 | ||
- 0 -\> don't trim length | ||
- \>= 1 -\> trim to max length while not breaking any words | ||
- `uric` {boolean} default: false | ||
- true -> additionally allow chars: ";", "?", ":", "@", "&", "=", "+", "$", ",", "/" | ||
- true -\> additionally allow chars: ";", "?", ":", "@", "&", "=", "+", "\$", ",", "/" | ||
- false | ||
- `uricNoSlash` {boolean} default: false | ||
- true -> additionally allow chars: ";", "?", ":", "@", "&", "=", "+", "$", "," | ||
- true -\> additionally allow chars: ";", "?", ":", "@", "&", "=", "+", "\$", "," | ||
- `mark` {boolean} default: false | ||
- true -> additionally allow chars: "-", "_", ".", "!", "~", "*", "'", "(", ")" | ||
- true -\> additionally allow chars: "-", "\_", ".", "!", "~", "\*", "'", "(", ")" | ||
- `custom` {object} default: {} | ||
- custom map for translation, overwrites all i.e. { '&': '#', '*': ' star ' } | ||
- custom map for translation, overwrites all i.e. { '&': '\#', '\*': ' star ' } | ||
- `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 list of allowed characters. 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. | ||
@@ -163,2 +164,7 @@ ##### Node.js | ||
slug = getSlug("မြန်မာ သာဓက", { | ||
lang: 'my' | ||
}); | ||
console.log(slug); // Output: myanma-thadak | ||
slug = getSlug("Apple & Pear!", { | ||
@@ -231,2 +237,3 @@ lang: 'en' // lang: "en" is default, just to clarify | ||
}; | ||
var mySlug = require('speakingurl').createSlug(options); | ||
@@ -250,2 +257,3 @@ // in browser: | ||
}; | ||
var mySlug = require('speakingurl').createSlug(options); | ||
@@ -262,3 +270,3 @@ // in browser: | ||
see [CHANGELOG.md](https://raw.github.com/pid/speakingurl/master/CHANGELOG.md) | ||
see[CHANGELOG.md](https://raw.github.com/pid/speakingurl/master/CHANGELOG.md) | ||
@@ -318,13 +326,12 @@ Tests | ||
Use in other environments | ||
------------------------- | ||
- [SpeakingURL with AngularJS](https://github.com/zappan/angular-speakingurl) | ||
- [SpeakingURL with Meteor](https://github.com/ongoworks/meteor-speakingurl) | ||
Ports | ||
----- | ||
- Java https://github.com/Weltraumschaf/speakingurl thanks to [@Weltraumschaf](https://github.com/Weltraumschaf/) | ||
- Java https://github.com/Weltraumschaf/speakingurl thanks to[@Weltraumschaf](https://github.com/Weltraumschaf/) | ||
@@ -331,0 +338,0 @@ Credits |
/** | ||
* speakingurl | ||
* @version v0.18.1 | ||
* @version v0.19.0 | ||
* @link http://pid.github.io/speakingurl/ | ||
* @license BSD | ||
* @author Sascha Droste | ||
*/!function(e){"use strict";var a=function(e,a){var o,l,u,s,c,m="object"==typeof a&&a.maintainCase||!1,g="object"==typeof a&&a.titleCase?a.titleCase:!1,f="object"==typeof a&&"object"==typeof a.custom&&a.custom?a.custom:{},d="object"==typeof a&&a.separator||"-",h="object"==typeof a&&+a.truncate>1&&a.truncate||!1,p="object"==typeof a&&a.uric||!1,y="object"==typeof a&&a.uricNoSlash||!1,A="object"==typeof a&&a.mark||!1,j="object"==typeof a&&a.lang&&r[a.lang]?r[a.lang]:"object"!=typeof a||a.lang!==!1&&a.lang!==!0?r.en:{},b="object"==typeof a&&a.lang&&i[a.lang]?i[a.lang]:"object"!=typeof a||a.lang!==!1&&a.lang!==!0?i.en:{},k=[";","?",":","@","&","=","+","$",",","/"],E=[";","?",":","@","&","=","+","$",","],O=[".","!","~","*","'","(",")"],S="",I=d;if(g&&"number"==typeof g.length&&Array.prototype.toString.call(g)&&g.forEach(function(e){f[e+""]=e+""}),"string"!=typeof e)return"";for("string"==typeof a?d=a:"object"==typeof a&&(p&&(I+=k.join("")),y&&(I+=E.join("")),A&&(I+=O.join(""))),Object.keys(f).forEach(function(a){var o;o=a.length>1?new RegExp("\\b"+t(a)+"\\b","gi"):new RegExp(t(a),"gi"),e=e.replace(o,f[a])}),g&&(e=e.replace(/(\w)(\S*)/g,function(e,a,o){var t=a.toUpperCase()+(null!==o?o:"");return Object.keys(f).indexOf(t.toLowerCase())<0?t:t.toLowerCase()})),I=t(I),e=e.replace(/(^\s+|\s+$)/g,""),c=!1,l=0,s=e.length;s>l;l++)u=e[l],b[u]?(u=c&&b[u].match(/[A-Za-z0-9]/)?" "+b[u]:b[u],c=!1):u in n?(u=c&&n[u].match(/[A-Za-z0-9]/)?" "+n[u]:n[u],c=!1):!j[u]||p&&-1!==k.join("").indexOf(u)||y&&-1!==E.join("").indexOf(u)||A&&-1!==O.join("").indexOf(u)?(c&&(/[A-Za-z0-9]/.test(u)||S.substr(-1).match(/A-Za-z0-9]/))&&(u=" "+u),c=!1):(u=c||S.substr(-1).match(/[A-Za-z0-9]/)?d+j[u]:j[u],u+=void 0!==e[l+1]&&e[l+1].match(/[A-Za-z0-9]/)?d:"",c=!0),S+=u.replace(new RegExp("[^\\w\\s"+I+"_-]","g"),d);return S=S.replace(/\s+/g,d).replace(new RegExp("\\"+d+"+","g"),d).replace(new RegExp("(^\\"+d+"+|\\"+d+"+$)","g"),""),h&&S.length>h&&(o=S.charAt(h)===d,S=S.slice(0,h),o||(S=S.slice(0,S.lastIndexOf(d)))),m||g||g.length||(S=S.toLowerCase()),S},o=function(e){return function(o){return a(o,e)}},t=function(e){return e.replace(/[-\\^$*+?.()|[\]{}\/]/g,"\\$&")},n={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"Ae","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"Oe","Ő":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"Ue","Ű":"U","Ý":"Y","Þ":"TH","ß":"ss","à":"a","á":"a","â":"a","ã":"a","ä":"ae","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"oe","ő":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"ue","ű":"u","ý":"y","þ":"th","ÿ":"y","ẞ":"SS","α":"a","β":"v","γ":"g","δ":"d","ε":"e","ζ":"z","η":"i","θ":"th","ι":"i","κ":"k","λ":"l","μ":"m","ν":"n","ξ":"ks","ο":"o","π":"p","ρ":"r","σ":"s","τ":"t","υ":"y","φ":"f","χ":"x","ψ":"ps","ω":"o","ά":"a","έ":"e","ί":"i","ό":"o","ύ":"y","ή":"i","ώ":"o","ς":"s","ϊ":"i","ΰ":"y","ϋ":"y","ΐ":"i","Α":"A","Β":"B","Γ":"G","Δ":"D","Ε":"E","Ζ":"Z","Η":"I","Θ":"TH","Ι":"I","Κ":"K","Λ":"L","Μ":"M","Ν":"N","Ξ":"KS","Ο":"O","Π":"P","Ρ":"R","Σ":"S","Τ":"T","Υ":"Y","Φ":"F","Χ":"X","Ψ":"PS","Ω":"W","Ά":"A","Έ":"E","Ί":"I","Ό":"O","Ύ":"Y","Ή":"I","Ώ":"O","Ϊ":"I","Ϋ":"Y","ş":"s","Ş":"S","ı":"i","İ":"I","ğ":"g","Ğ":"G","Ќ":"Kj","ќ":"kj","Љ":"Lj","љ":"lj","Њ":"Nj","њ":"nj","Тс":"Ts","тс":"ts","а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ё":"yo","ж":"zh","з":"z","и":"i","й":"j","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"h","ц":"c","ч":"ch","ш":"sh","щ":"sh","ъ":"","ы":"y","ь":"","э":"e","ю":"yu","я":"ya","А":"A","Б":"B","В":"V","Г":"G","Д":"D","Е":"E","Ё":"Yo","Ж":"Zh","З":"Z","И":"I","Й":"J","К":"K","Л":"L","М":"M","Н":"N","О":"O","П":"P","Р":"R","С":"S","Т":"T","У":"U","Ф":"F","Х":"H","Ц":"C","Ч":"Ch","Ш":"Sh","Щ":"Sh","Ъ":"","Ы":"Y","Ь":"","Э":"E","Ю":"Yu","Я":"Ya","Є":"Ye","І":"I","Ї":"Yi","Ґ":"G","є":"ye","і":"i","ї":"yi","ґ":"g","č":"c","ď":"d","ě":"e","ň":"n","ř":"r","š":"s","ť":"t","ů":"u","ž":"z","Č":"C","Ď":"D","Ě":"E","Ň":"N","Ř":"R","Š":"S","Ť":"T","Ů":"U","Ž":"Z","ľ":"l","ĺ":"l","ŕ":"r","Ľ":"L","Ĺ":"L","Ŕ":"R","ą":"a","ć":"c","ę":"e","ł":"l","ń":"n","ś":"s","ź":"z","ż":"z","Ą":"A","Ć":"C","Ę":"E","Ł":"L","Ń":"N","Ś":"S","Ź":"Z","Ż":"Z","ā":"a","ē":"e","ģ":"g","ī":"i","ķ":"k","ļ":"l","ņ":"n","ū":"u","Ā":"A","Ē":"E","Ģ":"G","Ī":"I","Ķ":"k","Ļ":"L","Ņ":"N","Ū":"U","ا":"a","أ":"a","إ":"i","آ":"aa","ؤ":"u","ئ":"e","ء":"a","ب":"b","ت":"t","ث":"th","ج":"j","ح":"h","خ":"kh","د":"d","ذ":"th","ر":"r","ز":"z","س":"s","ش":"sh","ص":"s","ض":"dh","ط":"t","ظ":"z","ع":"a","غ":"gh","ف":"f","ق":"q","ك":"k","ل":"l","م":"m","ن":"n","ه":"h","و":"w","ي":"y","ى":"a","ة":"h","ﻻ":"la","ﻷ":"laa","ﻹ":"lai","ﻵ":"laa","َ":"a","ً":"an","ِ":"e","ٍ":"en","ُ":"u","ٌ":"on","ْ":"","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","“":'"',"”":'"',"‘":"'","’":"'","∂":"d","ƒ":"f","™":"(TM)","©":"(C)","œ":"oe","Œ":"OE","®":"(R)","†":"+","℠":"(SM)","…":"...","˚":"o","º":"o","ª":"a","•":"*",$:"USD","€":"EUR","₢":"BRN","₣":"FRF","£":"GBP","₤":"ITL","₦":"NGN","₧":"ESP","₩":"KRW","₪":"ILS","₫":"VND","₭":"LAK","₮":"MNT","₯":"GRD","₱":"ARS","₲":"PYG","₳":"ARA","₴":"UAH","₵":"GHS","¢":"cent","¥":"CNY","元":"CNY","円":"YEN","﷼":"IRR","₠":"EWE","฿":"THB","₨":"INR","₹":"INR","₰":"PF","đ":"d","Đ":"D","ẹ":"e","Ẹ":"E","ẽ":"e","Ẽ":"E","ế":"e","Ế":"E","ề":"e","Ề":"E","ệ":"e","Ệ":"E","ễ":"e","Ễ":"E","ọ":"o","Ọ":"o","ố":"o","Ố":"O","ồ":"o","Ồ":"O","ộ":"o","Ộ":"O","ỗ":"o","Ỗ":"O","ơ":"o","Ơ":"O","ớ":"o","Ớ":"O","ờ":"o","Ờ":"O","ợ":"o","Ợ":"O","ỡ":"o","Ỡ":"O","ị":"i","Ị":"I","ĩ":"i","Ĩ":"I","ụ":"u","Ụ":"U","ũ":"u","Ũ":"U","ư":"u","Ư":"U","ứ":"u","Ứ":"U","ừ":"u","Ừ":"U","ự":"u","Ự":"U","ữ":"u","Ữ":"U","ỳ":"y","Ỳ":"Y","ỵ":"y","Ỵ":"Y","ỹ":"y","Ỹ":"Y","ạ":"a","Ạ":"A","ấ":"a","Ấ":"A","ầ":"a","Ầ":"A","ậ":"a","Ậ":"A","ẫ":"a","Ẫ":"A","ă":"a","Ă":"A","ắ":"a","Ắ":"A","ằ":"a","Ằ":"A","ặ":"a","Ặ":"A","ẵ":"a","Ẵ":"A"},i={en:{},sk:{"ä":"a","Ä":"A"},tr:{"Ü":"U","Ö":"O","ü":"u","ö":"o"}},r={ar:{"∆":"delta","∞":"la-nihaya","♥":"hob","&":"wa","|":"aw","<":"aqal-men",">":"akbar-men","∑":"majmou","¤":"omla"},cz:{"∆":"delta","∞":"nekonecno","♥":"laska","&":"a","|":"nebo","<":"mene jako",">":"vice jako","∑":"soucet","¤":"mena"},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"},nl:{"∆":"delta","∞":"oneindig","♥":"liefde","&":"en","|":"of","<":"kleiner dan",">":"groter dan","∑":"som","¤":"valuta"},it:{"∆":"delta","∞":"infinito","♥":"amore","&":"e","|":"o","<":"minore di",">":"maggiore di","∑":"somma","¤":"moneta"},pt:{"∆":"delta","∞":"infinito","♥":"amor","&":"e","|":"ou","<":"menor que",">":"maior que","∑":"soma","¤":"moeda"},ru:{"∆":"delta","∞":"beskonechno","♥":"lubov","&":"i","|":"ili","<":"menshe",">":"bolshe","∑":"summa","¤":"valjuta"},sk:{"∆":"delta","∞":"nekonecno","♥":"laska","&":"a","|":"alebo","<":"menej ako",">":"viac ako","∑":"sucet","¤":"mena"},tr:{"∆":"delta","∞":"sonsuzluk","♥":"ask","&":"ve","|":"veya","<":"kucuktur",">":"buyuktur","∑":"toplam","¤":"para birimi"},vn:{"∆":"delta","∞":"vo cuc","♥":"yeu","&":"va","|":"hoac","<":"nho hon",">":"lon hon","∑":"tong","¤":"tien te"}};if("undefined"!=typeof module&&module.exports)module.exports=a,module.exports.createSlug=o;else if("undefined"!=typeof define&&define.amd)define([],function(){return a});else try{if(e.getSlug||e.createSlug)throw"speakingurl: globals exists /(getSlug|createSlug)/";e.getSlug=a,e.createSlug=o}catch(l){}}(this); | ||
*/!function(e){"use strict";var a=function(e,a){var n,s,c,g,m,d,h="object"==typeof a&&a.maintainCase||!1,y="object"==typeof a&&a.titleCase?a.titleCase:!1,f="object"==typeof a&&"object"==typeof a.custom&&a.custom?a.custom:{},p="object"==typeof a&&a.separator||"-",k="object"==typeof a&&+a.truncate>1&&a.truncate||!1,b="object"==typeof a&&a.uric||!1,A="object"==typeof a&&a.uricNoSlash||!1,j="object"==typeof a&&a.mark||!1,E="object"==typeof a&&a.lang&&r[a.lang]?r[a.lang]:"object"!=typeof a||a.lang!==!1&&a.lang!==!0?r.en:{},O="object"==typeof a&&a.lang&&l[a.lang]?l[a.lang]:"object"!=typeof a||a.lang!==!1&&a.lang!==!0?l.en:{},w=[";","?",":","@","&","=","+","$",",","/"],S=[";","?",":","@","&","=","+","$",","],I=[".","!","~","*","'","(",")"],R="",U="",v=p;if(y&&"number"==typeof y.length&&Array.prototype.toString.call(y)&&y.forEach(function(e){f[e+""]=e+""}),"string"!=typeof e)return"";for("string"==typeof a?p=a:"object"==typeof a&&(b&&(v+=w.join("")),A&&(v+=S.join("")),j&&(v+=I.join(""))),Object.keys(f).forEach(function(a){var n;n=a.length>1?new RegExp("\\b"+o(a)+"\\b","gi"):new RegExp(o(a),"gi"),e=e.replace(n,f[a])}),y&&(e=e.replace(/(\w)(\S*)/g,function(e,a,n){var o=a.toUpperCase()+(null!==n?n:"");return Object.keys(f).indexOf(o.toLowerCase())<0?o:o.toLowerCase()})),v=o(v),e=e.replace(/(^\s+|\s+$)/g,""),m=!1,d=!1,s=0,g=e.length;g>s;s++)c=e[s],O[c]?(c=m&&O[c].match(/[A-Za-z0-9]/)?" "+O[c]:O[c],m=!1):c in t?(g>s+1&&i.indexOf(e[s+1])>=0?(U+=c,c=""):d===!0?(c=u[U]+t[c],U=""):c=m&&t[c].match(/[A-Za-z0-9]/)?" "+t[c]:t[c],m=!1,d=!1):c in u?(U+=c,c="",s==g-1&&(c=u[U]),d=!0):!E[c]||b&&-1!==w.join("").indexOf(c)||A&&-1!==S.join("").indexOf(c)||j&&-1!==I.join("").indexOf(c)?(d===!0?(c=u[U]+c,U="",d=!1):m&&(/[A-Za-z0-9]/.test(c)||R.substr(-1).match(/A-Za-z0-9]/))&&(c=" "+c),m=!1):(c=m||R.substr(-1).match(/[A-Za-z0-9]/)?p+E[c]:E[c],c+=void 0!==e[s+1]&&e[s+1].match(/[A-Za-z0-9]/)?p:"",m=!0),R+=c.replace(new RegExp("[^\\w\\s"+v+"_-]","g"),p);return R=R.replace(/\s+/g,p).replace(new RegExp("\\"+p+"+","g"),p).replace(new RegExp("(^\\"+p+"+|\\"+p+"+$)","g"),""),k&&R.length>k&&(n=R.charAt(k)===p,R=R.slice(0,k),n||(R=R.slice(0,R.lastIndexOf(p)))),h||y||y.length||(R=R.toLowerCase()),R},n=function(e){return function(n){return a(n,e)}},o=function(e){return e.replace(/[-\\^$*+?.()|[\]{}\/]/g,"\\$&")},t={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"Ae","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"Oe","Ő":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"Ue","Ű":"U","Ý":"Y","Þ":"TH","ß":"ss","à":"a","á":"a","â":"a","ã":"a","ä":"ae","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"oe","ő":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"ue","ű":"u","ý":"y","þ":"th","ÿ":"y","ẞ":"SS","α":"a","β":"v","γ":"g","δ":"d","ε":"e","ζ":"z","η":"i","θ":"th","ι":"i","κ":"k","λ":"l","μ":"m","ν":"n","ξ":"ks","ο":"o","π":"p","ρ":"r","σ":"s","τ":"t","υ":"y","φ":"f","χ":"x","ψ":"ps","ω":"o","ά":"a","έ":"e","ί":"i","ό":"o","ύ":"y","ή":"i","ώ":"o","ς":"s","ϊ":"i","ΰ":"y","ϋ":"y","ΐ":"i","Α":"A","Β":"B","Γ":"G","Δ":"D","Ε":"E","Ζ":"Z","Η":"I","Θ":"TH","Ι":"I","Κ":"K","Λ":"L","Μ":"M","Ν":"N","Ξ":"KS","Ο":"O","Π":"P","Ρ":"R","Σ":"S","Τ":"T","Υ":"Y","Φ":"F","Χ":"X","Ψ":"PS","Ω":"W","Ά":"A","Έ":"E","Ί":"I","Ό":"O","Ύ":"Y","Ή":"I","Ώ":"O","Ϊ":"I","Ϋ":"Y","ş":"s","Ş":"S","ı":"i","İ":"I","ğ":"g","Ğ":"G","Ќ":"Kj","ќ":"kj","Љ":"Lj","љ":"lj","Њ":"Nj","њ":"nj","Тс":"Ts","тс":"ts","а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ё":"yo","ж":"zh","з":"z","и":"i","й":"j","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"h","ц":"c","ч":"ch","ш":"sh","щ":"sh","ъ":"","ы":"y","ь":"","э":"e","ю":"yu","я":"ya","А":"A","Б":"B","В":"V","Г":"G","Д":"D","Е":"E","Ё":"Yo","Ж":"Zh","З":"Z","И":"I","Й":"J","К":"K","Л":"L","М":"M","Н":"N","О":"O","П":"P","Р":"R","С":"S","Т":"T","У":"U","Ф":"F","Х":"H","Ц":"C","Ч":"Ch","Ш":"Sh","Щ":"Sh","Ъ":"","Ы":"Y","Ь":"","Э":"E","Ю":"Yu","Я":"Ya","Є":"Ye","І":"I","Ї":"Yi","Ґ":"G","є":"ye","і":"i","ї":"yi","ґ":"g","č":"c","ď":"d","ě":"e","ň":"n","ř":"r","š":"s","ť":"t","ů":"u","ž":"z","Č":"C","Ď":"D","Ě":"E","Ň":"N","Ř":"R","Š":"S","Ť":"T","Ů":"U","Ž":"Z","ľ":"l","ĺ":"l","ŕ":"r","Ľ":"L","Ĺ":"L","Ŕ":"R","ą":"a","ć":"c","ę":"e","ł":"l","ń":"n","ś":"s","ź":"z","ż":"z","Ą":"A","Ć":"C","Ę":"E","Ł":"L","Ń":"N","Ś":"S","Ź":"Z","Ż":"Z","ā":"a","ē":"e","ģ":"g","ī":"i","ķ":"k","ļ":"l","ņ":"n","ū":"u","Ā":"A","Ē":"E","Ģ":"G","Ī":"I","Ķ":"k","Ļ":"L","Ņ":"N","Ū":"U","ا":"a","أ":"a","إ":"i","آ":"aa","ؤ":"u","ئ":"e","ء":"a","ب":"b","ت":"t","ث":"th","ج":"j","ح":"h","خ":"kh","د":"d","ذ":"th","ر":"r","ز":"z","س":"s","ش":"sh","ص":"s","ض":"dh","ط":"t","ظ":"z","ع":"a","غ":"gh","ف":"f","ق":"q","ك":"k","ل":"l","م":"m","ن":"n","ه":"h","و":"w","ي":"y","ى":"a","ة":"h","ﻻ":"la","ﻷ":"laa","ﻹ":"lai","ﻵ":"laa","َ":"a","ً":"an","ِ":"e","ٍ":"en","ُ":"u","ٌ":"on","ْ":"","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","“":'"',"”":'"',"‘":"'","’":"'","∂":"d","ƒ":"f","™":"(TM)","©":"(C)","œ":"oe","Œ":"OE","®":"(R)","†":"+","℠":"(SM)","…":"...","˚":"o","º":"o","ª":"a","•":"*","၊":",","။":".",$:"USD","€":"EUR","₢":"BRN","₣":"FRF","£":"GBP","₤":"ITL","₦":"NGN","₧":"ESP","₩":"KRW","₪":"ILS","₫":"VND","₭":"LAK","₮":"MNT","₯":"GRD","₱":"ARS","₲":"PYG","₳":"ARA","₴":"UAH","₵":"GHS","¢":"cent","¥":"CNY","元":"CNY","円":"YEN","﷼":"IRR","₠":"EWE","฿":"THB","₨":"INR","₹":"INR","₰":"PF","đ":"d","Đ":"D","ẹ":"e","Ẹ":"E","ẽ":"e","Ẽ":"E","ế":"e","Ế":"E","ề":"e","Ề":"E","ệ":"e","Ệ":"E","ễ":"e","Ễ":"E","ọ":"o","Ọ":"o","ố":"o","Ố":"O","ồ":"o","Ồ":"O","ộ":"o","Ộ":"O","ỗ":"o","Ỗ":"O","ơ":"o","Ơ":"O","ớ":"o","Ớ":"O","ờ":"o","Ờ":"O","ợ":"o","Ợ":"O","ỡ":"o","Ỡ":"O","ị":"i","Ị":"I","ĩ":"i","Ĩ":"I","ụ":"u","Ụ":"U","ũ":"u","Ũ":"U","ư":"u","Ư":"U","ứ":"u","Ứ":"U","ừ":"u","Ừ":"U","ự":"u","Ự":"U","ữ":"u","Ữ":"U","ỳ":"y","Ỳ":"Y","ỵ":"y","Ỵ":"Y","ỹ":"y","Ỹ":"Y","ạ":"a","Ạ":"A","ấ":"a","Ấ":"A","ầ":"a","Ầ":"A","ậ":"a","Ậ":"A","ẫ":"a","Ẫ":"A","ă":"a","Ă":"A","ắ":"a","Ắ":"A","ằ":"a","Ằ":"A","ặ":"a","Ặ":"A","ẵ":"a","Ẵ":"A","က":"k","ခ":"kh","ဂ":"g","ဃ":"ga","င":"ng","စ":"s","ဆ":"sa","ဇ":"z","စျ":"za","ည":"ny","ဋ":"t","ဌ":"ta","ဍ":"d","ဎ":"da","ဏ":"na","တ":"t","ထ":"ta","ဒ":"d","ဓ":"da","န":"n","ပ":"p","ဖ":"pa","ဗ":"b","ဘ":"ba","မ":"m","ယ":"y","ရ":"ya","လ":"l","ဝ":"w","သ":"th","ဟ":"h","ဠ":"la","အ":"a","ြ":"y","ျ":"ya","ွ":"w","ြွ":"yw","ျွ":"ywa","ှ":"h","ဧ":"e","၏":"-e","ဣ":"i","ဤ":"-i","ဉ":"u","ဦ":"-u","ဩ":"aw","သြော":"aw","ဪ":"aw","၀":"0","၁":"1","၂":"2","၃":"3","၄":"4","၅":"5","၆":"6","၇":"7","၈":"8","၉":"9","္":"","့":"","း":""},i=["်"],u={"ာ":"a","ါ":"a","ေ":"e","ဲ":"e","ိ":"i","ီ":"i","ို":"o","ု":"u","ူ":"u","ေါင်":"aung","ော":"aw","ော်":"aw","ေါ":"aw","ေါ်":"aw","်":"်","က်":"et","ိုက်":"aik","ောက်":"auk","င်":"in","ိုင်":"aing","ောင်":"aung","စ်":"it","ည်":"i","တ်":"at","ိတ်":"eik","ုတ်":"ok","ွတ်":"ut","ေတ်":"it","ဒ်":"d","ိုဒ်":"ok","ုဒ်":"ait","န်":"an","ာန်":"an","ိန်":"ein","ုန်":"on","ွန်":"un","ပ်":"at","ိပ်":"eik","ုပ်":"ok","ွပ်":"ut","န်ုပ်":"nub","မ်":"an","ိမ်":"ein","ုမ်":"on","ွမ်":"un","ယ်":"e","ိုလ်":"ol","ဉ်":"in","ံ":"an","ိံ":"ein","ုံ":"on"},l={en:{},sk:{"ä":"a","Ä":"A"},tr:{"Ü":"U","Ö":"O","ü":"u","ö":"o"}},r={ar:{"∆":"delta","∞":"la-nihaya","♥":"hob","&":"wa","|":"aw","<":"aqal-men",">":"akbar-men","∑":"majmou","¤":"omla"},cz:{"∆":"delta","∞":"nekonecno","♥":"laska","&":"a","|":"nebo","<":"mene jako",">":"vice jako","∑":"soucet","¤":"mena"},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"},my:{"∆":"kwahkhyaet","∞":"asaonasme","♥":"akhyait","&":"nhin","|":"tho","<":"ngethaw",">":"kyithaw","∑":"paungld","¤":"ngwekye"},nl:{"∆":"delta","∞":"oneindig","♥":"liefde","&":"en","|":"of","<":"kleiner dan",">":"groter dan","∑":"som","¤":"valuta"},it:{"∆":"delta","∞":"infinito","♥":"amore","&":"e","|":"o","<":"minore di",">":"maggiore di","∑":"somma","¤":"moneta"},pt:{"∆":"delta","∞":"infinito","♥":"amor","&":"e","|":"ou","<":"menor que",">":"maior que","∑":"soma","¤":"moeda"},ru:{"∆":"delta","∞":"beskonechno","♥":"lubov","&":"i","|":"ili","<":"menshe",">":"bolshe","∑":"summa","¤":"valjuta"},sk:{"∆":"delta","∞":"nekonecno","♥":"laska","&":"a","|":"alebo","<":"menej ako",">":"viac ako","∑":"sucet","¤":"mena"},tr:{"∆":"delta","∞":"sonsuzluk","♥":"ask","&":"ve","|":"veya","<":"kucuktur",">":"buyuktur","∑":"toplam","¤":"para birimi"},vn:{"∆":"delta","∞":"vo cuc","♥":"yeu","&":"va","|":"hoac","<":"nho hon",">":"lon hon","∑":"tong","¤":"tien te"}};if("undefined"!=typeof module&&module.exports)module.exports=a,module.exports.createSlug=n;else if("undefined"!=typeof define&&define.amd)define([],function(){return a});else try{if(e.getSlug||e.createSlug)throw"speakingurl: globals exists /(getSlug|createSlug)/";e.getSlug=a,e.createSlug=n}catch(s){}}(this); |
@@ -8,3 +8,3 @@ /* global describe,it */ | ||
it('should be ', function (done) { | ||
it('umlaut should be single letter transliteration', function (done) { | ||
@@ -11,0 +11,0 @@ getSlug('ÜÄÖüäö', { |
Sorry, the diff of this file is not supported yet
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
112798
29
2755
350