Options
All
  • Public
  • Public/Protected
  • All
Menu

@inventory/debug-prop - v0.0.4

Index

Functions

Functions

debugProp

  • debugProp<Prop, ValType>(prop: Prop, format?: function): applyDebugger
  • desc

    Easily debug property changes on an object.

    example
    const debugCount = debugState('count')
    
    const obj1 = { count: 1 }
    debugCount(obj1, 'debug-prop:obj1')
    obj1.count++
    
    const obj2 = { count: 1 }
    debugCount(obj2, 'debug-prop:obj2')
    obj2.count++
    
    // logs => debug-prop:obj1 state = 2
    // logs => debug-prop:obj2 state = 2

    Type parameters

    • Prop: string

    • ValType: any

    Parameters

    • prop: Prop

      Name of property to begin logging changes for

    • Default value format: function = val => `${prop} = ${val}`

      Format the value to be logged

        • (val: ValType): any
        • Parameters

          • val: ValType

          Returns any

    Returns applyDebugger

Generated using TypeDoc