mwg API
    Preparing search index...

    Function fitShareLink

    • Makes a link from the first of candidates that fits, listed from the fullest content to the leanest; reductions tells the receiver how many steps were dropped. Throws when even the last does not fit. dropByPriority builds such a list from a record.

      Parameters

      Returns Promise<FittedShareLink>

      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