UNPKG

softkave-js-utils

Version:

JavaScript & Typescript utility functions, types, and classes

9 lines 503 B
import { nanoid } from 'nanoid'; import { kSoftkaveJsUtilsConstants } from '../constants.js'; // TODO: write validation schema/regex export function getNewIdWithShortName(shortName, opts = {}) { const { nanoidLength = kSoftkaveJsUtilsConstants.resource.nanoidLength, id = nanoid(nanoidLength), shortNameIdSeparator = kSoftkaveJsUtilsConstants.resource .shortNameIdSeparator, } = opts; return `${shortName}${shortNameIdSeparator}${id}`; } //# sourceMappingURL=getNewIdWithShortName.js.map