object-shape-tester - v5.3.0
    Preparing search index...

    Function isValidShape

    • Check if a variable matches the given shape.

      Type Parameters

      Parameters

      Returns subject is Shape["runtimeType"]

      true or false

      import {defineShape, isValidShape} from 'object-shape-tester';

      const myShape = defineShape({
      a: '',
      });

      isValidShape({a: 'hi'}, myShape); // `true`
      isValidShape({a: 3}, myShape); // `false`
      isValidShape({a: 'hi', b: 'bye'}, {allowExtraKeys: true}, myShape); // `true`