Skip to content

pantoken / packages/core/src / decodeIconSvg

Funksjon: decodeIconSvg()

decodeIconSvg(value): string

Beta

Avkode verdien til eit ikon-token sitt url('data:…') tilbake til inline SVG.

Parametrar

value

string

Returnerer

string

Døme

ts
import { decodeIconSvg } from "@pantoken/core";

const svg = "<svg viewBox='0 0 24 24'><path d='M1 1'/></svg>";
const value = `url('data:image/svg+xml;utf8,${encodeURIComponent(svg)}')`;
decodeIconSvg(value); // → "<svg viewBox='0 0 24 24'><path d='M1 1'/></svg>"