Options
All
  • Public
  • Public/Protected
  • All
Menu

Module object/each

Index

References

Functions

References

Renames and re-exports each

Functions

  • each<O>(fn: ObjVoid<keyof O, O[keyof O]>, obj: O): void
  • each<K, V>(fn: ObjVoid<K, V>): (obj: Record<K, V>) => void
  • Iterate over an input object, calling a provided function fn for each key and value in the object.

    example
     var printKeyConcatValue = (value, key) => console.log(key + ':' + value);
    each(printKeyConcatValue, {x: 1, y: 2}); //=> {x: 1, y: 2}
    // logs x:1
    // logs y:2

    Type parameters

    • O: Record<any, any>

    Parameters

    • fn: ObjVoid<keyof O, O[keyof O]>

      The function to invoke. Receives three argument, value, key, obj.

    • obj: O

      The object to iterate over.

    Returns void

    The original object.

  • Iterate over an input object, calling a provided function fn for each key and value in the object.

    example
     var printKeyConcatValue = (value, key) => console.log(key + ':' + value);
    each(printKeyConcatValue, {x: 1, y: 2}); //=> {x: 1, y: 2}
    // logs x:1
    // logs y:2

    Type parameters

    • K: string

    • V

    Parameters

    • fn: ObjVoid<K, V>

      The function to invoke. Receives three argument, value, key, obj.

    Returns (obj: Record<K, V>) => void

    The original object.

      • (obj: Record<K, V>): void
      • Parameters

        • obj: Record<K, V>

        Returns void

Generated using TypeDoc