"use strict"; /** * Copyright (c) 2022 Amorphous * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.separateAtShorthand = void 0; const separateAtShorthand = (string) => { if (!string.startsWith('@')) { throw new Error('@ shorthand must begin with an @ symbol'); } const stringWithoutPrefix = string.slice(1); const divElements = stringWithoutPrefix.split('.'); const div = { classes: [], }; for (let str of divElements) { if (str.startsWith('#')) { div.id = str.slice(1); continue; } if (!div.classes) { div.classes = []; } div.classes.push(str); } return div; }; exports.separateAtShorthand = separateAtShorthand;