pt-id
Version:
Validate and generate Portuguese specific identity numbers
18 lines (14 loc) • 311 B
JavaScript
function getRandomElement(array) {
return array[Math.floor(Math.random() * array.length)];
}
function pad(value, length) {
var result = value + '';
while (result.length < length) {
result = '0' + result;
}
return result;
}
module.exports = {
pad: pad,
getRandomElement: getRandomElement
};