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.
12 lines
342 B
JavaScript
12 lines
342 B
JavaScript
"use strict";
|
|
|
|
const defaultValue = require("default-value");
|
|
const insecureNanoid = require("nanoid/non-secure").nanoid;
|
|
const useGuaranteedMemo = require("./use-guaranteed-memo");
|
|
|
|
module.exports = function useID(explicitID) {
|
|
let generatedID = useGuaranteedMemo(() => insecureNanoid());
|
|
|
|
return defaultValue(explicitID, generatedID);
|
|
};
|