import { dropByPriority, fitShareLink } from '@datamoc/mwg/core';
const loadout = { seed: 7, equipment: ['sword', 'lamp'], decoration: 'banner' };
const ladder = dropByPriority(loadout, ['seed', 'equipment', 'decoration']);
const { link, reductions } = await fitShareLink('state', 'game@1.0.0', ladder, { maxChars: 600 });
console.log(link.length <= 600, reductions); // true 0
Makes a link from the first of
candidatesthat fits, listed from the fullest content to the leanest;reductionstells the receiver how many steps were dropped. Throws when even the last does not fit.dropByPrioritybuilds such a list from a record.