UNPKG

starkinfra

Version:

SDK to facilitate Node integrations with Stark Infra

23 lines (18 loc) 628 B
exports.create = function (ispb) { var count = 11; var _sym = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890'; let str = 'E' + ispb + dateTime(); for (var i = 0; i < count; i++) { str += _sym[parseInt(Math.random() * (_sym.length))]; } return str; } dateTime = function(){ var today = new Date(); var day = ('0' + today.getDate()).slice(-2); var month = ('0' + (today.getMonth() + 1)).slice(-2); var year = today.getFullYear(); var hours = ('0' + today.getHours()).slice(-2); var minutes = ('0' + today.getMinutes()).slice(-2); return (year + month + day + hours + minutes); }