mwg API
    Preparing search index...

    Function checkPackagePolicy

    • Evaluates a package against what a game accepts and returns readable refusals; an empty list means accepted. Nothing is executed or fetched: the decision rests on the declared requests.

      Parameters

      Returns string[]

      import { checkPackagePolicy, parsePackageDocument } from '@datamoc/mwg/mwl';

      const document = parsePackageDocument(
      "[{ tag: 'package', id: 'marta', version: '1.0.0', requires: { capabilities: ['script'] } }]",
      );
      console.log(checkPackagePolicy(document, { allow: ['audio'] })); // ['asks for the "script" capability, which this game does not allow']