UNPKG

@atlaskit/adf-schema

Version:

Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs

25 lines (24 loc) 665 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.uuid = exports.generateUuid = void 0; /* eslint-disable no-bitwise */ var generateUuid = function generateUuid() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { var r = Math.random() * 16 | 0; return (c === 'x' ? r : r & 0x3 | 0x8).toString(16); }); }; /* eslint-enable no-bitwise */ exports.generateUuid = generateUuid; var staticValue = false; var uuid = { setStatic: function setStatic(value) { staticValue = value; }, generate: function generate() { return staticValue || generateUuid(); } }; exports.uuid = uuid;