mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Improve jsdoc of util.getObjectProperty to clarify thrown error
See #2703
This commit is contained in:
parent
a1ab00c93e
commit
6e5f115bd5
14
packages/node_modules/@node-red/util/lib/util.js
vendored
14
packages/node_modules/@node-red/util/lib/util.js
vendored
@ -318,9 +318,23 @@ function getMessageProperty(msg,expr) {
|
|||||||
/**
|
/**
|
||||||
* Gets a property of an object.
|
* Gets a property of an object.
|
||||||
*
|
*
|
||||||
|
* Given the object:
|
||||||
|
*
|
||||||
|
* {
|
||||||
|
* "pet": {
|
||||||
|
* "type": "cat"
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* - `pet.type` will return `"cat"`.
|
||||||
|
* - `pet.name` will return `undefined`
|
||||||
|
* - `car` will return `undefined`
|
||||||
|
* - `car.type` will throw an Error (as `car` does not exist)
|
||||||
|
*
|
||||||
* @param {Object} msg - the object
|
* @param {Object} msg - the object
|
||||||
* @param {String} expr - the property expression
|
* @param {String} expr - the property expression
|
||||||
* @return {any} the object property, or undefined if it does not exist
|
* @return {any} the object property, or undefined if it does not exist
|
||||||
|
* @throws Will throw an error if the *parent* of the property does not exist
|
||||||
* @memberof @node-red/util_util
|
* @memberof @node-red/util_util
|
||||||
*/
|
*/
|
||||||
function getObjectProperty(msg,expr) {
|
function getObjectProperty(msg,expr) {
|
||||||
|
Loading…
Reference in New Issue
Block a user