1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.keyExtractPath = void 0;
|
4 | const DeriveJunction_js_1 = require("./DeriveJunction.js");
|
5 | const RE_JUNCTION = /\/(\/?)([^/]+)/g;
|
6 |
|
7 |
|
8 |
|
9 | function keyExtractPath(derivePath) {
|
10 | const parts = derivePath.match(RE_JUNCTION);
|
11 | const path = [];
|
12 | let constructed = '';
|
13 | if (parts) {
|
14 | constructed = parts.join('');
|
15 | for (const p of parts) {
|
16 | path.push(DeriveJunction_js_1.DeriveJunction.from(p.substring(1)));
|
17 | }
|
18 | }
|
19 | if (constructed !== derivePath) {
|
20 | throw new Error(`Re-constructed path "${constructed}" does not match input`);
|
21 | }
|
22 | return {
|
23 | parts,
|
24 | path
|
25 | };
|
26 | }
|
27 | exports.keyExtractPath = keyExtractPath;
|