Skip to content

pantoken / packages/core/src / dedupeByName

Mahi: dedupeByName()

dedupeByName(tokens): Token[]

Beta

Whakakorehia ngā tārite o ngā token rānei mā te ingoa, ā, puritia te whakaaturanga whakamutunga (nā reira ka toa ngā mono kei muri).

Ngā Tawhā

tokens

Token[]

Whakahokia

Token[]

Tauira

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)