toolkit.deref {shinylight}R Documentation

JavaScript function: Dereferences an object or array through multiple indices.

Description

deref(o, [a,b,c], d) is a safe way of doing o[a][b][c]. If that path does not exist, d is returned. If d is not supplied, null is returned. Any undefined values in path are ignored.

Arguments

object

object The object to be dereferenced.

path

Array The series of indices to be applied.

defaultValue

toolkit.any The default value to be returned if the path cannot be followed to the end.

Value

Object dereferenced, defaultValue, or null.


[Package shinylight version 1.2 Index]