shortid-extend
Version:
Alternative versión with options from Dylan Greene ShortId
16 lines (12 loc) • 348 B
JavaScript
;
var alphabet = require('./alphabet');
function isShortId(id) {
if (!id || typeof id !== 'string' || id.length < 6 ) {
return false;
}
var nonAlphabetic = new RegExp('[^' +
alphabet.get().replace(/[|\\{}()[\]^$+*?.-]/g, '\\$&') +
']');
return !nonAlphabetic.test(id);
}
module.exports = isShortId;