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

14 lines
428 B
JavaScript

"use strict";
const nanoidGenerate = require("nanoid/generate");
const uppercaseAlphabet = require("nanoid-dictionary/uppercase");
module.exports = function processDeviceId(deviceId) {
/* TODO: Add validation here, once it becomes clear what the formatting requirements for a Device ID are */
if (deviceId != null && deviceId.length > 0) {
return deviceId;
} else {
return nanoidGenerate(uppercaseAlphabet, 16);
}
};