#using
Binds a path or value to a range variable so statements can modify it.
"#using(source as @variable) into 'name' | @variable": [ statements ]Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
source |
path | value |
The node to copy and modify. |
@variable |
variable |
The name statements operate on. |
Returns
Section titled “Returns”any — The modified copy.
Examples
Section titled “Examples”Remove, add and change properties
Section titled “Remove, add and change properties”{ "some": { "integerArray": [ 1, 2, 6, 10 ], "complexObject": { "some": { "path": 5 } } }}{ "#using($.some as @x) into 'result'": [ "#removeAt(@x.integerArray)", "#setAt(@x.complexObject.new.value, 3)", "#setAt(@x.complexObject.some.path, 20)" ]}{ "result": { "complexObject": { "new": { "value": 3 }, "some": { "path": 20 } } }}