UNPKG

@zero-scripts/core

Version:

Framework for creating presets, configurations and extensions

17 lines 652 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.extractFirstPropChain = void 0; function extractFirstPropChain(str) { const result = str.match(/[a-zA-Z](\[([0-9]|[a-zA-Z])+\]|\.[a-zA-Z]+)+/gm); if (result && result.length > 0) { return result[0] .replace(/\[/g, '.') .replace(/\]/g, '') .split('.') .filter((_, i) => i !== 0) .join('.'); } throw new Error(`Can't parse property chain from string: "${str}"`); } exports.extractFirstPropChain = extractFirstPropChain; //# sourceMappingURL=extractFirstPropChain.js.map