1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const TAG = '~';
|
4 | const TAG_SPLIT_REGEX = RegExp(`^([^${TAG}]*)(?:${TAG}([^.]+))?(.*)$`, 'u');
|
5 | function splitTaggedFilename(name) {
|
6 | const split = TAG_SPLIT_REGEX.exec(name);
|
7 | if (split == null) {
|
8 | throw new Error(`Could not parse filename ${JSON.stringify(String(name))}`);
|
9 | }
|
10 | const [before, tag, after] = split.slice(1);
|
11 | return { tag, basename: before + after };
|
12 | }
|
13 | exports.default = splitTaggedFilename;
|