Skip to content

pantoken-root / packages/core/src / dedupeByName

फंक्शन: dedupeByName() ​

dedupeByName(tokens): Token[]

बीटा

नाम के आधार पर टोकनों की डुप्लिकेट प्रविष्टियाँ हटाएँ, अंतिम उपस्थिति रखें (ताकि बाद के प्लगइन्स जीतें)।

पैरामीटर ​

tokens ​

Token[]

वापसी ​

Token[]

उदाहरण ​

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)