UNPKG

@podlite/schema

Version:

AST tools for Podlite markup language

19 lines 787 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.makeAttrs = exports.getSafeNodeId = exports.getNodeId = void 0; const config_1 = __importDefault(require("./helpers/config")); const getNodeId = (node, ctx) => { const conf = (0, config_1.default)(node, ctx); if (conf.exists('id')) { return conf.getFirstValue('id'); } return node.id; }; exports.getNodeId = getNodeId; const getSafeNodeId = (node, ctx) => (0, exports.getNodeId)(node, ctx)?.toString().replace(/\s/g, '-'); exports.getSafeNodeId = getSafeNodeId; exports.makeAttrs = config_1.default; //# sourceMappingURL=ast-helpers.js.map