@s-libs/js-core
    Preparing search index...

    Function mapAsKeys

    • Maps collection to be the keys of a new object, with the values determined by iteratee.

      mapAsKeys([1, 2, 3], (item) => item * item);
      // result: { 1: 1, 2: 4, 3: 9 }

      mapAsKeys({ a: "foo", b: "bar" }, (_item, key) => key.toUpperCase());
      // result: { foo: "A", bar: "B" }

      Type Parameters

      • K extends string | number | symbol
      • V

      Parameters

      • array: K[]
      • iteratee: ArrayIteratee<K, V>

      Returns Record<K, V>

    • Maps collection to be the keys of a new object, with the values determined by iteratee.

      mapAsKeys([1, 2, 3], (item) => item * item);
      // result: { 1: 1, 2: 4, 3: 9 }

      mapAsKeys({ a: "foo", b: "bar" }, (_item, key) => key.toUpperCase());
      // result: { foo: "A", bar: "B" }

      Type Parameters

      • K extends string | number | symbol
      • V

      Parameters

      • array: Nil | K[]
      • iteratee: ArrayIteratee<K, V>

      Returns EmptyObject | Record<K, V>

    • Maps collection to be the keys of a new object, with the values determined by iteratee.

      mapAsKeys([1, 2, 3], (item) => item * item);
      // result: { 1: 1, 2: 4, 3: 9 }

      mapAsKeys({ a: "foo", b: "bar" }, (_item, key) => key.toUpperCase());
      // result: { foo: "A", bar: "B" }

      Type Parameters

      • T extends Record<keyof T, string | number | symbol>
      • V

      Parameters

      • object: T
      • iteratee: ObjectIteratee<T, V>

      Returns Record<T[keyof T], V>

    • Maps collection to be the keys of a new object, with the values determined by iteratee.

      mapAsKeys([1, 2, 3], (item) => item * item);
      // result: { 1: 1, 2: 4, 3: 9 }

      mapAsKeys({ a: "foo", b: "bar" }, (_item, key) => key.toUpperCase());
      // result: { foo: "A", bar: "B" }

      Type Parameters

      • T extends Record<keyof T, string | number | symbol>
      • V

      Parameters

      • object: Nil | T
      • iteratee: ObjectIteratee<T, V>

      Returns EmptyObject | Record<T[keyof T], V>