08-27-周三_17-09-29
This commit is contained in:
25
node_modules/github-slugid/index.js
generated
vendored
Normal file
25
node_modules/github-slugid/index.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
var SYMBOLS = [
|
||||
'[', ']', '!', '"', '\'', '#',
|
||||
'$', '%', '&', '(', ')', '*', '+', ',', '.', '/', ':', ';', '<', '=',
|
||||
'>', '?', '@', '', '', '^', '_', '`', '{', '|', '}', '~',
|
||||
'©', '∑', '®', '†', '“', '”', '‘', '’', '∂', 'ƒ', '™', '℠', '…',
|
||||
'œ', 'Œ','˚', 'º', 'ª', '•', '∆', '∞', '♥', '&', '|'
|
||||
];
|
||||
|
||||
|
||||
function slug(content, separator) {
|
||||
separator = separator || '-';
|
||||
|
||||
var re = new RegExp('[\\'+SYMBOLS.join('\\')+']+', 'g');
|
||||
var s = content
|
||||
.replace(re, '')
|
||||
.replace(/ /g, separator)
|
||||
.toLowerCase();
|
||||
|
||||
if (s[0] == separator) s = s.slice(1);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
module.exports = slug;
|
Reference in New Issue
Block a user