@ntix/bind
    Preparing search index...

    Function setValue

    • Set a value on the context object by path, will build the object as it goes

      *nb not idempotent will change the value passed in, see below for idempotent call

      Parameters

      • rootContext: any

        context object to set value on

      • path: string

        property path to value

      • value: any

        value to set

      Returns any

      the root context again (for convenience)

      
      
      • const data = {}; setValue(data, 'p[0].p', 'v');

      ==> data : { p: [{ p: 'v' }] }

      // get a new object, idempotent call const data = {}; const newData = setValue({...data}, 'p[0].p', 'v');

      ==> data : { } ==> newData : { p: [{ p: 'v' }] }