1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", { value: true });
|
4 | exports.parseKey = exports.createPrefix = void 0;
|
5 | function createPrefix(index) {
|
6 | return `_${index}_`;
|
7 | }
|
8 | exports.createPrefix = createPrefix;
|
9 | function parseKey(prefixedKey) {
|
10 | const match = /^_([\d]+)_(.*)$/.exec(prefixedKey);
|
11 | if (match && match.length === 3 && !isNaN(Number(match[1])) && match[2]) {
|
12 | return { index: Number(match[1]), originalKey: match[2] };
|
13 | }
|
14 | throw new Error(`Key ${prefixedKey} is not correctly prefixed`);
|
15 | }
|
16 | exports.parseKey = parseKey;
|