mwg API
    Preparing search index...

    Function validateWorld

    • Checks a decoded value really is a world, and throws by name when it is not. Also rejects a __proto__/constructor/prototype key anywhere in the value (assertNoForbiddenKeys): MwlRuntime.restore merges this result into its own world with Object.assign, which would otherwise let such a key substitute the target's prototype instead of merely setting a value.

      Parameters

      • value: unknown

      Returns MwlWorld

      import { createWorld, validateWorld } from '@datamoc/mw_games/mwl';

      console.log(validateWorld(createWorld()).turn); // 1