www_hero/node_modules/tailwindcss/lib/util/toPath.js
sasha-astiadi 324d5960af hero_web
2024-05-03 06:39:20 +02:00

15 lines
470 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.toPath = toPath;
function toPath(path) {
if (Array.isArray(path)) return path;
let openBrackets = path.split("[").length - 1;
let closedBrackets = path.split("]").length - 1;
if (openBrackets !== closedBrackets) {
throw new Error(`Path is invalid. Has unbalanced brackets: ${path}`);
}
return path.split(/\.(?![^\[]*\])|[\[\]]/g).filter(Boolean);
}