mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Rework jsdoc format and pull in jsdoc-nr-template
This commit is contained in:
parent
3f37e96f78
commit
48308db45b
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"opts": {
|
"opts": {
|
||||||
"template": "./node_modules/minami",
|
"template": "./node_modules/jsdoc-nr-template",
|
||||||
"destination": "./docs",
|
"destination": "./docs",
|
||||||
"recurse": true
|
"recurse": true
|
||||||
},
|
},
|
||||||
@ -17,7 +17,10 @@
|
|||||||
"systemName": "Node-RED Runtime API",
|
"systemName": "Node-RED Runtime API",
|
||||||
"theme":"yeti",
|
"theme":"yeti",
|
||||||
"footer": "",
|
"footer": "",
|
||||||
"copyright": "Released under the Apache License v2.0"
|
"copyright": "Released under the Apache License v2.0",
|
||||||
|
"default": {
|
||||||
|
"outputSourceFiles": false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"plugins": ["plugins/markdown"]
|
"plugins": ["plugins/markdown"]
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,8 @@
|
|||||||
"wdio-mocha-framework": "^0.6.2",
|
"wdio-mocha-framework": "^0.6.2",
|
||||||
"wdio-spec-reporter": "^0.1.5",
|
"wdio-spec-reporter": "^0.1.5",
|
||||||
"webdriverio": "^4.13.1",
|
"webdriverio": "^4.13.1",
|
||||||
"node-red-node-test-helper": "node-red/node-red-node-test-helper"
|
"node-red-node-test-helper": "node-red/node-red-node-test-helper",
|
||||||
|
"jsdoc-nr-template": "node-red/jsdoc-nr-template"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
|
11
packages/node_modules/@node-red/util/index.js
generated
vendored
11
packages/node_modules/@node-red/util/index.js
generated
vendored
@ -15,7 +15,7 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @namespace @node-red/util
|
* @module @node-red/util
|
||||||
*/
|
*/
|
||||||
const log = require("./lib/log");
|
const log = require("./lib/log");
|
||||||
const i18n = require("./lib/i18n");
|
const i18n = require("./lib/i18n");
|
||||||
@ -30,10 +30,19 @@ module.exports = {
|
|||||||
log.init(settings);
|
log.init(settings);
|
||||||
i18n.init();
|
i18n.init();
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Logging utilities
|
||||||
|
* @type module:@node-red/util-log
|
||||||
|
*/
|
||||||
log: log,
|
log: log,
|
||||||
|
/**
|
||||||
|
* Internationalization utilities
|
||||||
|
* @type module:@node-red/util-i18n
|
||||||
|
*/
|
||||||
i18n: i18n,
|
i18n: i18n,
|
||||||
/**
|
/**
|
||||||
* General utilities
|
* General utilities
|
||||||
|
* @type module:@node-red/util-util
|
||||||
*/
|
*/
|
||||||
util: util
|
util: util
|
||||||
}
|
}
|
||||||
|
45
packages/node_modules/@node-red/util/lib/util.js
generated
vendored
45
packages/node_modules/@node-red/util/lib/util.js
generated
vendored
@ -20,11 +20,11 @@ const jsonata = require("jsonata");
|
|||||||
const safeJSONStringify = require("json-stringify-safe");
|
const safeJSONStringify = require("json-stringify-safe");
|
||||||
const util = require("util");
|
const util = require("util");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a psuedo-unique-random id.
|
* Generates a psuedo-unique-random id.
|
||||||
*
|
|
||||||
* @return {String} a random-ish id
|
* @return {String} a random-ish id
|
||||||
* @memberof @node-red/util.util
|
* @memberof module:@node-red/util-util
|
||||||
*/
|
*/
|
||||||
function generateId() {
|
function generateId() {
|
||||||
return (1+Math.random()*4294967295).toString(16);
|
return (1+Math.random()*4294967295).toString(16);
|
||||||
@ -36,7 +36,7 @@ function generateId() {
|
|||||||
*
|
*
|
||||||
* @param {any} o - the property to convert to a String
|
* @param {any} o - the property to convert to a String
|
||||||
* @return {String} the stringified version
|
* @return {String} the stringified version
|
||||||
* @memberof @node-red/util.util
|
* @memberof module:@node-red/util-util
|
||||||
*/
|
*/
|
||||||
function ensureString(o) {
|
function ensureString(o) {
|
||||||
if (Buffer.isBuffer(o)) {
|
if (Buffer.isBuffer(o)) {
|
||||||
@ -55,7 +55,7 @@ function ensureString(o) {
|
|||||||
*
|
*
|
||||||
* @param {any} o - the property to convert to a Buffer
|
* @param {any} o - the property to convert to a Buffer
|
||||||
* @return {String} the Buffer version
|
* @return {String} the Buffer version
|
||||||
* @memberof @node-red/util.util
|
* @memberof module:@node-red/util-util
|
||||||
*/
|
*/
|
||||||
function ensureBuffer(o) {
|
function ensureBuffer(o) {
|
||||||
if (Buffer.isBuffer(o)) {
|
if (Buffer.isBuffer(o)) {
|
||||||
@ -74,7 +74,7 @@ function ensureBuffer(o) {
|
|||||||
*
|
*
|
||||||
* @param {any} msg - the message object to clone
|
* @param {any} msg - the message object to clone
|
||||||
* @return {Object} the cloned message
|
* @return {Object} the cloned message
|
||||||
* @memberof @node-red/util.util
|
* @memberof module:@node-red/util-util
|
||||||
*/
|
*/
|
||||||
function cloneMessage(msg) {
|
function cloneMessage(msg) {
|
||||||
// Temporary fix for #97
|
// Temporary fix for #97
|
||||||
@ -101,7 +101,7 @@ function cloneMessage(msg) {
|
|||||||
* @param {any} obj1
|
* @param {any} obj1
|
||||||
* @param {any} obj2
|
* @param {any} obj2
|
||||||
* @return {boolean} whether the two objects are the same
|
* @return {boolean} whether the two objects are the same
|
||||||
* @memberof @node-red/util.util
|
* @memberof module:@node-red/util-util
|
||||||
*/
|
*/
|
||||||
function compareObjects(obj1,obj2) {
|
function compareObjects(obj1,obj2) {
|
||||||
var i;
|
var i;
|
||||||
@ -178,7 +178,7 @@ function compareObjects(obj1,obj2) {
|
|||||||
*
|
*
|
||||||
* @param {String} str - the property expression
|
* @param {String} str - the property expression
|
||||||
* @return {Array} the normalised expression
|
* @return {Array} the normalised expression
|
||||||
* @memberof @node-red/util.util
|
* @memberof module:@node-red/util-util
|
||||||
*/
|
*/
|
||||||
function normalisePropertyExpression(str) {
|
function normalisePropertyExpression(str) {
|
||||||
// This must be kept in sync with validatePropertyExpression
|
// This must be kept in sync with validatePropertyExpression
|
||||||
@ -287,13 +287,13 @@ function normalisePropertyExpression(str) {
|
|||||||
/**
|
/**
|
||||||
* Gets a property of a message object.
|
* Gets a property of a message object.
|
||||||
*
|
*
|
||||||
* Unlike {@link @node-red/util.util.getObjectProperty}, this function will strip `msg.` from the
|
* Unlike {@link @node-red/util-util.getObjectProperty}, this function will strip `msg.` from the
|
||||||
* front of the property expression if present.
|
* front of the property expression if present.
|
||||||
*
|
*
|
||||||
* @param {Object} msg - the message object
|
* @param {Object} msg - the message object
|
||||||
* @param {String} str - the property expression
|
* @param {String} str - the property expression
|
||||||
* @return {any} the message property, or undefined if it does not exist
|
* @return {any} the message property, or undefined if it does not exist
|
||||||
* @memberof @node-red/util.util
|
* @memberof module:@node-red/util-util
|
||||||
*/
|
*/
|
||||||
function getMessageProperty(msg,expr) {
|
function getMessageProperty(msg,expr) {
|
||||||
if (expr.indexOf('msg.')===0) {
|
if (expr.indexOf('msg.')===0) {
|
||||||
@ -308,7 +308,7 @@ function getMessageProperty(msg,expr) {
|
|||||||
* @param {Object} msg - the object
|
* @param {Object} msg - the object
|
||||||
* @param {String} str - the property expression
|
* @param {String} str - 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
|
||||||
* @memberof @node-red/util.util
|
* @memberof module:@node-red/util-util
|
||||||
*/
|
*/
|
||||||
function getObjectProperty(msg,expr) {
|
function getObjectProperty(msg,expr) {
|
||||||
var result = null;
|
var result = null;
|
||||||
@ -324,14 +324,14 @@ function getObjectProperty(msg,expr) {
|
|||||||
/**
|
/**
|
||||||
* Sets a property of a message object.
|
* Sets a property of a message object.
|
||||||
*
|
*
|
||||||
* Unlike {@link @node-red/util.util.setObjectProperty}, this function will strip `msg.` from the
|
* Unlike {@link @node-red/util-util.setObjectProperty}, this function will strip `msg.` from the
|
||||||
* front of the property expression if present.
|
* front of the property expression if present.
|
||||||
*
|
*
|
||||||
* @param {Object} msg - the message object
|
* @param {Object} msg - the message object
|
||||||
* @param {String} prop - the property expression
|
* @param {String} prop - the property expression
|
||||||
* @param {any} value - the value to set
|
* @param {any} value - the value to set
|
||||||
* @param {boolean} createMissing - whether to create missing parent properties
|
* @param {boolean} createMissing - whether to create missing parent properties
|
||||||
* @memberof @node-red/util.util
|
* @memberof module:@node-red/util-util
|
||||||
*/
|
*/
|
||||||
function setMessageProperty(msg,prop,value,createMissing) {
|
function setMessageProperty(msg,prop,value,createMissing) {
|
||||||
if (prop.indexOf('msg.')===0) {
|
if (prop.indexOf('msg.')===0) {
|
||||||
@ -347,7 +347,7 @@ function setMessageProperty(msg,prop,value,createMissing) {
|
|||||||
* @param {String} prop - the property expression
|
* @param {String} prop - the property expression
|
||||||
* @param {any} value - the value to set
|
* @param {any} value - the value to set
|
||||||
* @param {boolean} createMissing - whether to create missing parent properties
|
* @param {boolean} createMissing - whether to create missing parent properties
|
||||||
* @memberof @node-red/util.util
|
* @memberof module:@node-red/util-util
|
||||||
*/
|
*/
|
||||||
function setObjectProperty(msg,prop,value,createMissing) {
|
function setObjectProperty(msg,prop,value,createMissing) {
|
||||||
if (typeof createMissing === 'undefined') {
|
if (typeof createMissing === 'undefined') {
|
||||||
@ -411,7 +411,7 @@ function setObjectProperty(msg,prop,value,createMissing) {
|
|||||||
* will return `Hello Joe!`.
|
* will return `Hello Joe!`.
|
||||||
* @param {String} value - the string to parse
|
* @param {String} value - the string to parse
|
||||||
* @return {String} The parsed string
|
* @return {String} The parsed string
|
||||||
* @memberof @node-red/util.util
|
* @memberof module:@node-red/util-util
|
||||||
*/
|
*/
|
||||||
function evaluateEnvProperty(value) {
|
function evaluateEnvProperty(value) {
|
||||||
if (/^\${[^}]+}$/.test(value)) {
|
if (/^\${[^}]+}$/.test(value)) {
|
||||||
@ -439,7 +439,7 @@ function evaluateEnvProperty(value) {
|
|||||||
*
|
*
|
||||||
* @param {String} value - the context property string to parse
|
* @param {String} value - the context property string to parse
|
||||||
* @return {Object} The parsed property
|
* @return {Object} The parsed property
|
||||||
* @memberof @node-red/util.util
|
* @memberof module:@node-red/util-util
|
||||||
*/
|
*/
|
||||||
function parseContextStore(key) {
|
function parseContextStore(key) {
|
||||||
var parts = {};
|
var parts = {};
|
||||||
@ -463,7 +463,7 @@ function parseContextStore(key) {
|
|||||||
* @param {Object} msg - the message object to evaluate against
|
* @param {Object} msg - the message object to evaluate against
|
||||||
* @param {Function} callback - (optional) called when the property is evaluated
|
* @param {Function} callback - (optional) called when the property is evaluated
|
||||||
* @return {any} The evaluted property, if no `callback` is provided
|
* @return {any} The evaluted property, if no `callback` is provided
|
||||||
* @memberof @node-red/util.util
|
* @memberof module:@node-red/util-util
|
||||||
*/
|
*/
|
||||||
function evaluateNodeProperty(value, type, node, msg, callback) {
|
function evaluateNodeProperty(value, type, node, msg, callback) {
|
||||||
var result = value;
|
var result = value;
|
||||||
@ -520,7 +520,7 @@ function evaluateNodeProperty(value, type, node, msg, callback) {
|
|||||||
* @param {String} value - the JSONata expression
|
* @param {String} value - the JSONata expression
|
||||||
* @param {Node} node - the node evaluating the property
|
* @param {Node} node - the node evaluating the property
|
||||||
* @return {Object} The JSONata expression that can be evaluated
|
* @return {Object} The JSONata expression that can be evaluated
|
||||||
* @memberof @node-red/util.util
|
* @memberof module:@node-red/util-util
|
||||||
*/
|
*/
|
||||||
function prepareJSONataExpression(value,node) {
|
function prepareJSONataExpression(value,node) {
|
||||||
var expr = jsonata(value);
|
var expr = jsonata(value);
|
||||||
@ -541,14 +541,14 @@ function prepareJSONataExpression(value,node) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Evaluates a JSONata expression.
|
* Evaluates a JSONata expression.
|
||||||
* The expression must have been prepared with {@link @node-red/util.util.prepareJSONataExpression}
|
* The expression must have been prepared with {@link @node-red/util-util.prepareJSONataExpression}
|
||||||
* before passing to this function.
|
* before passing to this function.
|
||||||
*
|
*
|
||||||
* @param {Object} expr - the prepared JSONata expression
|
* @param {Object} expr - the prepared JSONata expression
|
||||||
* @param {Object} msg - the message object to evaluate against
|
* @param {Object} msg - the message object to evaluate against
|
||||||
* @param {Function} callback - (optional) called when the expression is evaluated
|
* @param {Function} callback - (optional) called when the expression is evaluated
|
||||||
* @return {any} If no callback was provided, the result of the expression
|
* @return {any} If no callback was provided, the result of the expression
|
||||||
* @memberof @node-red/util.util
|
* @memberof module:@node-red/util-util
|
||||||
*/
|
*/
|
||||||
function evaluateJSONataExpression(expr,msg,callback) {
|
function evaluateJSONataExpression(expr,msg,callback) {
|
||||||
var context = msg;
|
var context = msg;
|
||||||
@ -593,7 +593,7 @@ function evaluateJSONataExpression(expr,msg,callback) {
|
|||||||
*
|
*
|
||||||
* @param {String} name - the node type
|
* @param {String} name - the node type
|
||||||
* @return {String} The normalised name
|
* @return {String} The normalised name
|
||||||
* @memberof @node-red/util.util
|
* @memberof module:@node-red/util-util
|
||||||
*/
|
*/
|
||||||
function normaliseNodeTypeName(name) {
|
function normaliseNodeTypeName(name) {
|
||||||
var result = name.replace(/[^a-zA-Z0-9]/g, " ");
|
var result = name.replace(/[^a-zA-Z0-9]/g, " ");
|
||||||
@ -617,7 +617,7 @@ function normaliseNodeTypeName(name) {
|
|||||||
* @param {Object} msg
|
* @param {Object} msg
|
||||||
* @param {Object} opts
|
* @param {Object} opts
|
||||||
* @return {Object} the encoded object
|
* @return {Object} the encoded object
|
||||||
* @memberof @node-red/util.util
|
* @memberof module:@node-red/util-util
|
||||||
*/
|
*/
|
||||||
function encodeObject(msg,opts) {
|
function encodeObject(msg,opts) {
|
||||||
var debuglength = 1000;
|
var debuglength = 1000;
|
||||||
@ -748,8 +748,7 @@ function encodeObject(msg,opts) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* General utilities
|
* General utilities
|
||||||
* @namespace util
|
* @module @node-red/util-util
|
||||||
* @memberof @node-red/util
|
|
||||||
*/
|
*/
|
||||||
module.exports = {
|
module.exports = {
|
||||||
encodeObject: encodeObject,
|
encodeObject: encodeObject,
|
||||||
|
Loading…
Reference in New Issue
Block a user