You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

19 lines
464 B

'use strict';
var alphabet = require('./alphabet');
function isShortId(id) {
if (!id || typeof id !== 'string' || id.length < 6 ) {
return false;
}
var characters = alphabet.characters();
var invalidCharacters = id.split('').map(function(char){
if (characters.indexOf(char) === -1) {
return char;
}
}).join('').split('').join('');
return invalidCharacters.length === 0;
}
module.exports = isShortId;