UNPKG

@builder.io/mitosis

Version:

Write components once, run everywhere. Compiles to Vue, React, Solid, and Liquid. Import code from Figma and Builder.io

27 lines (26 loc) 805 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.stripQuotes = exports.insertAt = exports.uniqueName = void 0; // helper functions for strings const lodash_1 = require("lodash"); function uniqueName(existingItems, reference) { let index = 0; let match = false; while (false === match) { if (!existingItems.includes(reference)) { match = true; break; } index++; } return (0, lodash_1.camelCase)(`${reference}${index}`); } exports.uniqueName = uniqueName; function insertAt(string_, sub, pos) { return `${string_.slice(0, pos)}${sub}${string_.slice(pos)}`; } exports.insertAt = insertAt; function stripQuotes(string_) { return string_.replace(/["']+/g, ''); } exports.stripQuotes = stripQuotes;