scopesigil
$$.get
$$.get(aPath) : Object
Given aObject it will try to parse the aPath and retrieve the corresponding object under that path. Example:
var a = { a : 1, b : { c: 2, d: [0, 1] } };
print($$(a).get("b.c")); // 2
sprint($$(a).get("b.d")); // [0, 1]
print($$(a).get("b.d[0]")); // 0
$$.getI
$$.getI(aPath) : Object
Given aObject it will try to parse the aPath (in a case-insensitive way) and retrieve the corresponding object under that path. Example:
var a = { a : 1, b : { c: 2, d: [0, 1] } };
print($$(a).getI("b.C")); // 2
sprint($$(a).getI("B.d")); // [0, 1]
print($$(a).getI("B.D[0]")); // 0
$$.set
$$.set(aPath, aNewValue) : Object
Given aObject it will try to parse the aPath and set the corresponding object under that path to aNewValue. Example:
var a = { a : 1, b : { c: 2, d: [0, 1] } };
sprint($$(a).set("b.c", 123)); // { a : 1, b : { c: 123, d: [0, 1] } }
$$.unset
$$.unset(aPath) : Object
Example formatting/syntax corrected against the implementation; the signature is unchanged.
Given aObject it will try to parse the aPath and unset the corresponding object under that path. Example:
var a = { a : 1, b : { c: 2, d: [0, 1] } };
sprint($$(a).unset("b.c")); // { a : 1, b : { d: [0, 1] } }
_$
_$(aObject, anErrorMessagePrefix)
Shortcut to facilitate argument pre-validation and promote defensive programming.
-
.default(aNewObject):aObjectChecks ifaObjectis defined and returnsaObject. If it’s not defined it will returnaNewObject(the default value). -
$_(aMessage):aObjectThrows an exception withaMessageifaObjectis not defined otherwise returnsaObject.