UNPKG

968 BJavaScriptView Raw
1"use strict";
2// Copyright IBM Corp. and LoopBack contributors 2018,2020. All Rights Reserved.
3// Node module: @loopback/context
4// This file is licensed under the MIT License.
5// License text available at https://opensource.org/licenses/MIT
6Object.defineProperty(exports, "__esModule", { value: true });
7exports.UNIQUE_ID_PATTERN = exports.generateUniqueId = void 0;
8const tslib_1 = require("tslib");
9const hyperid_1 = tslib_1.__importDefault(require("hyperid"));
10/**
11 * Generate a (globally) unique identifier in a very fast way.
12 * Please note the ids ARE NOT formatted as UUID and have variable length.
13 * The format of generated values may change in the future.
14 *
15 * @internal
16 */
17exports.generateUniqueId = (0, hyperid_1.default)({
18 fixedLength: false,
19 urlSafe: true,
20});
21/**
22 * A regular expression for testing values generated by generateUniqueId.
23 * @internal
24 */
25exports.UNIQUE_ID_PATTERN = /[A-Za-z0-9-_]+-\d+/;
26//# sourceMappingURL=unique-id.js.map
\No newline at end of file