Jump to navigation

Namespace: json

Numbas.json

Methods

(static) tryGet(source, attr) → {*}

Try to load an attribute with the given name from source. The given name and its lower-case equivalent are tried.

Parameters:
Name Type Description
source object
attr string
Returns:
Type Description
*
Source:

(static) tryLoad(source, attrs, target, altnames)

Try to load an attribute with name from attr from source into target. Tries lower-case.

Parameters:
Name Type Description
source object

Object to load value(s) from.

attrs string | Array.<string>

The name, or list of names, of attributes to load.

target object

Object to set values in.

altnames string | Array.<string>

The name, or list of names, to set in the target object.

Source: