Properties extraction

API ReferenceUtilsProperties extraction

Source


utils.get()

Static method of
utils
Parameters
  • object — Object
  • path — String
  • target — OptionsArrayoptional
Returns
Any

Extracts property, deep property or an array of possible properties from the given object.

var obj = {prop: 1};
console.log(utils.get(obj, 'prop'));
// 1

var obj = {prop: {deep: 1}};
console.log(utils.get(obj, 'prop.deep'));
// 1

var obj = {prop: [{deep: 1}, {deep: 2}]};
console.log(utils.get(obj, 'prop[].deep'));
// [1, 2]
// 'utils.get.OptionsArray' instance ...

var obj = {prop: [{deep: 1}, {deep: 2}]};
console.log(utils.get(obj, 'prop[]'));
// [{deep: 1}, {deep: 2}]
// 'utils.get.OptionsArray' instance ...

var obj = {prop: [{deep: {}}, {deep: {result: 1}}]};
console.log(utils.get(obj, 'prop[].deep.result'));
// [1]
// 'utils.get.OptionsArray' instance ...

Source

Class utils.get.OptionsArray()

Special version of an Array, returned if the result of the utils.get() function is a list of the possible values.

Source


utils.isStringArray()

Static method of
utils
Parameters
  • value — String
Returns
Boolean

Checks whether the given string references into an array according to the notation in the utils.get() function.

Source

results matching ""

    No results matching ""