MCPcopy Create free account
hub / github.com/GCWing/BitFun / resolveFamilyContract

Function resolveFamilyContract

scripts/audit-theme-colors.test.mjs:306–317  ·  view source on GitHub ↗
(key)

Source from the content-addressed store, hash-verified

304 const aliasKeys = new Set(aliasEntries.map(([key]) => key));
305 const explicitContractKeys = new Set(TOKEN_COMPATIBILITY_ALIAS_CONTRACTS.map(contract => contract.key));
306 const resolveFamilyContract = (key) => {
307 const family = TOKEN_COMPATIBILITY_ALIAS_FAMILY_CONTRACTS.find(contract => (
308 key.startsWith(contract.prefix) && key.length > contract.prefix.length
309 ));
310 if (!family) {
311 return null;
312 }
313 return {
314 key,
315 canonical: `${family.canonicalPrefix}${key.slice(family.prefix.length)}`,
316 };
317 };
318
319 assert.ok(aliasEntries.length > 0, 'widget iframe compatibility aliases must be explicit');
320 assert.equal(aliasKeys.size, aliasEntries.length, 'widget iframe compatibility aliases must be unique');

Callers 1

Calls 1

sliceMethod · 0.80

Tested by

no test coverage detected