MCPcopy Create free account
hub / github.com/ecomfe/tempad-dev / createProtectedFragments

Function createProtectedFragments

packages/extension/utils/css.ts:745–762  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

743}
744
745function createProtectedFragments() {
746 const fragments: string[] = []
747
748 return {
749 protect(value: string): string {
750 const index = fragments.length
751 fragments.push(value)
752 return `\\uE000RAW${index}\\uE000`
753 },
754 restore(value: string): string {
755 if (!fragments.length) return value
756 return value.replace(/\\uE000RAW(\d+)\\uE000/g, (match, index: string) => {
757 const fragment = fragments[Number(index)]
758 return fragment ?? match
759 })
760 }
761 }
762}
763
764export function serializeCSS(
765 style: Record<string, string>,

Callers 1

processValueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected