slug asserts

This commit is contained in:
Dave Eddy 2015-09-04 20:33:31 -04:00
parent 072f0ec864
commit 789fb4f7e5

View File

@ -321,6 +321,10 @@ function normShortId(s) {
* to use for caching
*/
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 url = o.url.replace(/^https?:\/\//, '');
var s = format('%s@%s', acct, url).replace(/[!#$%\^&\*:'"\?\/\\\.]/g, '_');