|
@@ -31,7 +31,7 @@ const SUBST = {
|
|
|
'-':'-dash-'
|
|
'-':'-dash-'
|
|
|
};
|
|
};
|
|
|
const UNSUBST = Object.assign({}, ...Object.entries(SUBST).map(([a,b]) => ({[b]: a})))
|
|
const UNSUBST = Object.assign({}, ...Object.entries(SUBST).map(([a,b]) => ({[b]: a})))
|
|
|
-const FORW = new RegExp(/[:\/\\?#\[\]@~ _‐-]/, 'g');
|
|
|
|
|
|
|
+const FORW = new RegExp(/[:/\\?#[\]@~ _‐-]/, 'g');
|
|
|
const BACK = new RegExp(`(${Object.values(SUBST).join('|')})`,'g');
|
|
const BACK = new RegExp(`(${Object.values(SUBST).join('|')})`,'g');
|
|
|
//export function slugify(str) { return str && encodeURI(str.replace(FORW, e=>SUBST[e])) }
|
|
//export function slugify(str) { return str && encodeURI(str.replace(FORW, e=>SUBST[e])) }
|
|
|
//export function unslugify(str) { return str && decodeURI(str).replace(BACK, e=>UNSUBST[e]) }
|
|
//export function unslugify(str) { return str && decodeURI(str).replace(BACK, e=>UNSUBST[e]) }
|