slug asserts
This commit is contained in:
parent
072f0ec864
commit
789fb4f7e5
@ -321,6 +321,10 @@ function normShortId(s) {
|
|||||||
* to use for caching
|
* to use for caching
|
||||||
*/
|
*/
|
||||||
function slug(o) {
|
function slug(o) {
|
||||||
|
assert.object(o, 'o');
|
||||||
|
assert.string(o.account, 'o.account');
|
||||||
|
assert.string(o.url, 'o.url');
|
||||||
|
|
||||||
var acct = o.account.replace(/[@]/g, '_');
|
var acct = o.account.replace(/[@]/g, '_');
|
||||||
var url = o.url.replace(/^https?:\/\//, '');
|
var url = o.url.replace(/^https?:\/\//, '');
|
||||||
var s = format('%s@%s', acct, url).replace(/[!#$%\^&\*:'"\?\/\\\.]/g, '_');
|
var s = format('%s@%s', acct, url).replace(/[!#$%\^&\*:'"\?\/\\\.]/g, '_');
|
||||||
|
Reference in New Issue
Block a user