UNPKG

@pmwcs/base

Version:
17 lines (14 loc) 483 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.randomId = void 0; /** * Generates a pseudo random string for DOM ids * Will return 'test' in the NODE test-env so things like storyshots doesnt break. */ var randomId = function randomId(prefix) { var id = process.env.NODE_ENV === 'test' ? 'test' : (Math.random() + Math.random() + 1).toString(36).substring(2); return "".concat(prefix, "-").concat(id); }; exports.randomId = randomId;