UNPKG

@itsmworkbench/utils

Version:

The usual utility functions

13 lines (12 loc) 414 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.findIdKeyAndPath = void 0; function findIdKeyAndPath(s) { const index = s.indexOf(':'); if (index === -1) throw Error(`Invalid id no ':' in ${s}]`); const key = s.slice(0, index); const path = s.slice(index + 1).replace(/:/g, '/'); return { key, path }; } exports.findIdKeyAndPath = findIdKeyAndPath;