Skip to content

pantoken-root / packages/core/src / dedupeByName

Függvény: dedupeByName() ​

dedupeByName(tokens): Token[]

Béta

Deduplikálja a tokeneket név szerint, az utolsó előfordulást megtartva (így az később megjelenő pluginok nyernek).

Paraméterek ​

tokens ​

Token[]

Visszatérési érték ​

Token[]

Példa ​

ts
import { dedupeByName } from "@pantoken/core";
import type { Token } from "@pantoken/model";

const tokens: Token[] = [
  { name: "--instui-x", syntax: "<color>", inherits: true, value: "#fff" },
  { name: "--instui-x", syntax: "<color>", inherits: true, value: "#000" },
];
dedupeByName(tokens); // → one token, value "#000" (the later wins)