@nevware21/ts-utils
    Preparing search index...

    Function isMapLike

    • Checks if the type of value is Map-like (has essential Map methods).

      Type Parameters

      • K = any
      • V = any

      Parameters

      • value: any

        Value to be checked.

      Returns value is Map<K, V>

      True if the value implements the Map interface, false otherwise.

      isMapLike(new Map());                // true

      // Custom map-like implementation
      const myMap = {
      get: (key) => { return null; },
      set: (key, value) => { return myMap; },
      has: (key) => { return false; },
      delete: (key) => { return false; },
      size: 0
      };
      isMapLike(myMap); // true

      isMapLike({}); // false
      isMapLike(null); // false
      isMapLike(undefined); // false