diff --git a/src/expression/embeddedDocs/embeddedDocs.js b/src/expression/embeddedDocs/embeddedDocs.js index e3232c89c1..ee9b2ba13c 100644 --- a/src/expression/embeddedDocs/embeddedDocs.js +++ b/src/expression/embeddedDocs/embeddedDocs.js @@ -231,12 +231,55 @@ import { cloneDocs } from './function/utils/clone.js' import { formatDocs } from './function/utils/format.js' import { hasNumericValueDocs } from './function/utils/hasNumericValue.js' import { hexDocs } from './function/utils/hex.js' +import { isAccessorNodeDocs } from './function/utils/isAccessorNode.js' +import { isArrayDocs } from './function/utils/isArray.js' +import { isArrayNodeDocs } from './function/utils/isArrayNode.js' +import { isAssignmentNodeDocs } from './function/utils/isAssignmentNode.js' +import { isBigIntDocs } from './function/utils/isBigInt.js' +import { isBigNumberDocs } from './function/utils/isBigNumber.js' +import { isBlockNodeDocs } from './function/utils/isBlockNode.js' +import { isBooleanDocs } from './function/utils/isBoolean.js' +import { isChainDocs } from './function/utils/isChain.js' +import { isCollectionDocs } from './function/utils/isCollection.js' +import { isComplexDocs } from './function/utils/isComplex.js' +import { isConditionalNodeDocs } from './function/utils/isConditionalNode.js' +import { isConstantNodeDocs } from './function/utils/isConstantNode.js' +import { isDateDocs } from './function/utils/isDate.js' +import { isDenseMatrixDocs } from './function/utils/isDenseMatrix.js' +import { isFractionDocs } from './function/utils/isFraction.js' +import { isFunctionDocs } from './function/utils/isFunction.js' +import { isFunctionAssignmentNodeDocs } from './function/utils/isFunctionAssignmentNode.js' +import { isFunctionNodeDocs } from './function/utils/isFunctionNode.js' +import { isHelpDocs } from './function/utils/isHelp.js' +import { isIndexDocs } from './function/utils/isIndex.js' +import { isIndexNodeDocs } from './function/utils/isIndexNode.js' import { isIntegerDocs } from './function/utils/isInteger.js' +import { isMapDocs } from './function/utils/isMap.js' +import { isMatrixDocs } from './function/utils/isMatrix.js' import { isNaNDocs } from './function/utils/isNaN.js' import { isNegativeDocs } from './function/utils/isNegative.js' +import { isNodeDocs } from './function/utils/isNode.js' +import { isNullDocs } from './function/utils/isNull.js' +import { isNumberDocs } from './function/utils/isNumber.js' import { isNumericDocs } from './function/utils/isNumeric.js' +import { isObjectDocs } from './function/utils/isObject.js' +import { isObjectNodeDocs } from './function/utils/isObjectNode.js' +import { isObjectWrappingMapDocs } from './function/utils/isObjectWrappingMap.js' +import { isOperatorNodeDocs } from './function/utils/isOperatorNode.js' +import { isParenthesisNodeDocs } from './function/utils/isParenthesisNode.js' +import { isPartitionedMapDocs } from './function/utils/isPartitionedMap.js' import { isPositiveDocs } from './function/utils/isPositive.js' import { isPrimeDocs } from './function/utils/isPrime.js' +import { isRangeDocs } from './function/utils/isRange.js' +import { isRangeNodeDocs } from './function/utils/isRangeNode.js' +import { isRegExpDocs } from './function/utils/isRegExp.js' +import { isRelationalNodeDocs } from './function/utils/isRelationalNode.js' +import { isResultSetDocs } from './function/utils/isResultSet.js' +import { isSparseMatrixDocs } from './function/utils/isSparseMatrix.js' +import { isStringDocs } from './function/utils/isString.js' +import { isSymbolNodeDocs } from './function/utils/isSymbolNode.js' +import { isUndefinedDocs } from './function/utils/isUndefined.js' +import { isUnitDocs } from './function/utils/isUnit.js' import { isZeroDocs } from './function/utils/isZero.js' import { numericDocs } from './function/utils/numeric.js' import { octDocs } from './function/utils/oct.js' @@ -596,5 +639,48 @@ export const embeddedDocs = { isZero: isZeroDocs, print: printDocs, typeOf: typeOfDocs, - numeric: numericDocs + numeric: numericDocs, + isNumber: isNumberDocs, + isComplex: isComplexDocs, + isBigNumber: isBigNumberDocs, + isBigInt: isBigIntDocs, + isFraction: isFractionDocs, + isUnit: isUnitDocs, + isString: isStringDocs, + isArray: isArrayDocs, + isMatrix: isMatrixDocs, + isCollection: isCollectionDocs, + isDenseMatrix: isDenseMatrixDocs, + isSparseMatrix: isSparseMatrixDocs, + isRange: isRangeDocs, + isIndex: isIndexDocs, + isBoolean: isBooleanDocs, + isResultSet: isResultSetDocs, + isHelp: isHelpDocs, + isFunction: isFunctionDocs, + isDate: isDateDocs, + isRegExp: isRegExpDocs, + isObject: isObjectDocs, + isMap: isMapDocs, + isPartitionedMap: isPartitionedMapDocs, + isObjectWrappingMap: isObjectWrappingMapDocs, + isNull: isNullDocs, + isUndefined: isUndefinedDocs, + isAccessorNode: isAccessorNodeDocs, + isArrayNode: isArrayNodeDocs, + isAssignmentNode: isAssignmentNodeDocs, + isBlockNode: isBlockNodeDocs, + isConditionalNode: isConditionalNodeDocs, + isConstantNode: isConstantNodeDocs, + isFunctionAssignmentNode: isFunctionAssignmentNodeDocs, + isFunctionNode: isFunctionNodeDocs, + isIndexNode: isIndexNodeDocs, + isNode: isNodeDocs, + isObjectNode: isObjectNodeDocs, + isOperatorNode: isOperatorNodeDocs, + isParenthesisNode: isParenthesisNodeDocs, + isRangeNode: isRangeNodeDocs, + isRelationalNode: isRelationalNodeDocs, + isSymbolNode: isSymbolNodeDocs, + isChain: isChainDocs } diff --git a/src/expression/embeddedDocs/function/utils/isAccessorNode.js b/src/expression/embeddedDocs/function/utils/isAccessorNode.js new file mode 100644 index 0000000000..211fef965c --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isAccessorNode.js @@ -0,0 +1,25 @@ +/** + * Test whether a node is a AccessorNode. + * + * Syntax: + * + * math.isAccessorNode(x) + * + * Examples: + * + * math.isAccessorNode() + * + * See also: + * isNode + * + * @param {*} x Node to be tested + * @return {boolean} Returns true when `x` is a accessor node, false otherwise. + */ +export const isAccessorNodeDocs = { + name: 'isAccessorNode', + category: 'Type Checks', + syntax: ['isAccessorNode(x)'], + description: 'Test whether a value is an AccessorNode.', + examples: ['isAccessorNode(math.parse("a[0]"))'], + seealso: ['isNode'] +} diff --git a/src/expression/embeddedDocs/function/utils/isArray.js b/src/expression/embeddedDocs/function/utils/isArray.js new file mode 100644 index 0000000000..f150460994 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isArray.js @@ -0,0 +1,27 @@ +/** + * Test whether a value is an array. + * + * Syntax: + * + * math.isArray(x) + * + * Examples: + * + * math.isArray([1, 2, 3]) // returns true + * math.isArray('123') // returns false + * + * See also: + * + * isMatrix, isCollection + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is an array, false otherwise. + */ +export const isArrayDocs = { + name: 'isArray', + category: 'Type Checks', + syntax: ['isArray(x)'], + description: 'Test whether a value is an array.', + examples: ['isArray([1, 2, 3])', 'isArray("123")'], + seealso: ['isMatrix', 'isCollection'] +} diff --git a/src/expression/embeddedDocs/function/utils/isArrayNode.js b/src/expression/embeddedDocs/function/utils/isArrayNode.js new file mode 100644 index 0000000000..edacc2e78b --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isArrayNode.js @@ -0,0 +1,27 @@ +/** + * Check if a value is an ArrayNode + * + * Syntax: + * + * math.isArrayNode(x) + * + * Examples: + * + * math.isArrayNode(math.parse("[1,2,3]")) // returns true + * + * See also: + * + * isNode + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is an ArrayNode, false otherwise. + */ + +export const isArrayNodeDocs = { + name: 'isArrayNode', + category: 'Type Checks', + syntax: ['isArrayNode(x)'], + description: 'Test whether a value is an ArrayNode.', + examples: ['isArrayNode(math.parse("[1,2,3]"))'], + seealso: ['isNode'] +} diff --git a/src/expression/embeddedDocs/function/utils/isAssignmentNode.js b/src/expression/embeddedDocs/function/utils/isAssignmentNode.js new file mode 100644 index 0000000000..02fbd10f94 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isAssignmentNode.js @@ -0,0 +1,26 @@ +/** + * Check if a value is an AssignmentNode. + * + * Syntax: + * + * math.isAssignmentNode(x) + * + * Examples: + * + * math.isAssignmentNode(math.parse("a=3")) // returns true + * + * See also: + * + * isNode + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is an AssignmentNode, false otherwise. + */ +export const isAssignmentNodeDocs = { + name: 'isAssignmentNode', + category: 'Type Checks', + syntax: ['isAssignmentNode(x)'], + description: 'Test whether a value is an AssignmentNode.', + examples: ['isAssignmentNode(math.parse("a=3"))'], + seealso: ['isNode'] +} diff --git a/src/expression/embeddedDocs/function/utils/isBigInt.js b/src/expression/embeddedDocs/function/utils/isBigInt.js new file mode 100644 index 0000000000..763d6a5340 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isBigInt.js @@ -0,0 +1,27 @@ +/** + * Test whether a value is a BigInt. + * + * Syntax: + * + * math.isBigInt(x) + * + * Examples: + * + * math.isBigInt(10n) // returns true + * math.isBigInt(42) // returns false + * + * See also: + * + * isNumber, isBigNumber + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a BigInt, false otherwise. + */ +export const isBigIntDocs = { + name: 'isBigInt', + category: 'Type Checks', + syntax: ['isBigInt(x)'], + description: 'Test whether a value is a BigInt.', + examples: ['isBigInt(10n)', 'isBigInt(42)'], + seealso: ['isNumber', 'isBigNumber'] +} diff --git a/src/expression/embeddedDocs/function/utils/isBigNumber.js b/src/expression/embeddedDocs/function/utils/isBigNumber.js new file mode 100644 index 0000000000..0c074688e6 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isBigNumber.js @@ -0,0 +1,27 @@ +/** + * Test whether a value is a BigNumber. + * + * Syntax: + * + * math.isBigNumber(x) + * + * Examples: + * + * math.isBigNumber(math.bignumber(42)) // returns true + * math.isBigNumber(42) // returns false + * + * See also: + * + * isNumber, isFraction + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a BigNumber, false otherwise. + */ +export const isBigNumberDocs = { + name: 'isBigNumber', + category: 'Type Checks', + syntax: ['isBigNumber(x)'], + description: 'Test whether a value is a BigNumber.', + examples: ['isBigNumber(math.bignumber(42))', 'isBigNumber(42)'], + seealso: ['isNumber', 'isFraction'] +} diff --git a/src/expression/embeddedDocs/function/utils/isBlockNode.js b/src/expression/embeddedDocs/function/utils/isBlockNode.js new file mode 100644 index 0000000000..50d968a170 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isBlockNode.js @@ -0,0 +1,27 @@ +/** + * Check if a value is a BlockNode. + * + * Syntax: + * + * math.isBlockNode(x) + * + * Examples: + * + * math.isBlockNode(new math.BlockNode([])) // returns true + * + * See also: + * + * isNode + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a BlockNode, false otherwise. + * + */ +export const isBlockNodeDocs = { + name: 'isBlockNode', + category: 'Type Checks', + syntax: ['isBlockNode(x)'], + description: 'Test whether a value is a BlockNode.', + examples: ['isBlockNode(new math.BlockNode([]))))'], + seealso: ['isNode'] +} diff --git a/src/expression/embeddedDocs/function/utils/isBoolean.js b/src/expression/embeddedDocs/function/utils/isBoolean.js new file mode 100644 index 0000000000..36fd89d383 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isBoolean.js @@ -0,0 +1,25 @@ +/** + * Test whether a value is a boolean. + * + * Syntax: + * + * math.isBoolean(x) + * + * Examples: + * + * math.isBoolean(true) + * + * See also: + * isNumber, isString, isArray, isObject + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a boolean, false otherwise. + */ +export const isBooleanDocs = { + name: 'isBoolean', + category: 'Type Checks', + syntax: ['isBoolean(x)'], + description: 'Check if a value is a boolean.', + examples: ['isBoolean(true)', 'isBoolean(false)'], + seealso: ['isNumber', 'isString', 'isArray', 'isObject'] +} diff --git a/src/expression/embeddedDocs/function/utils/isChain.js b/src/expression/embeddedDocs/function/utils/isChain.js new file mode 100644 index 0000000000..0c6587ebf3 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isChain.js @@ -0,0 +1,26 @@ +/** + * Test whether a value is a Chain (used for chained operations). + * + * Syntax: + * + * math.isChain(x) + * + * Examples: + * + * math.isChain(math.chain(3)) + * + * See also: + * chain + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a Chain, false otherwise. + * + */ +export const isChainDocs = { + name: 'isChain', + category: 'Type Checks', + syntax: ['isChain(x)'], + description: 'Test whether a value is a Chain (used for chained operations).', + examples: ['isChain(math.chain(3))', 'isChain(3)'], + seealso: ['chain'] +} diff --git a/src/expression/embeddedDocs/function/utils/isCollection.js b/src/expression/embeddedDocs/function/utils/isCollection.js new file mode 100644 index 0000000000..14af2c7fe7 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isCollection.js @@ -0,0 +1,27 @@ +/** + * Test whether a value is a Collection. + * + * Syntax: + * + * math.isCollection(x) + * + * Examples: + * + * math.isCollection([1, 2, 3]) // returns true + * math.isCollection(42) // returns false + * + * See also: + * + * isArray, isMatrix + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a Collection, false otherwise. + */ +export const isCollectionDocs = { + name: 'isCollection', + category: 'Type Checks', + syntax: ['isCollection(x)'], + description: 'Test whether a value is a Collection.', + examples: ['isCollection([1,2,3])', 'isCollection(42)'], + seealso: ['isArray', 'isMatrix'] +} diff --git a/src/expression/embeddedDocs/function/utils/isComplex.js b/src/expression/embeddedDocs/function/utils/isComplex.js new file mode 100644 index 0000000000..3dca9ec1b2 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isComplex.js @@ -0,0 +1,27 @@ +/** + * Test whether a value is a complex number. + * + * Syntax: + * + * math.isComplex(x) + * + * Examples: + * + * math.isComplex(math.complex("2-3i")) // returns true + * math.isComplex(3) // returns false + * + * See also: + * + * isNumber, isBigNumber + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a complex number, false otherwise. + */ +export const isComplexDocs = { + name: 'isComplex', + category: 'Type Checks', + syntax: ['isComplex(x)'], + description: 'Test whether a value is a Complex number.', + examples: ['isComplex(math.complex("2-3i"))', 'isComplex(3)'], + seealso: ['isNumber', 'isBigNumber'] +} diff --git a/src/expression/embeddedDocs/function/utils/isConditionalNode.js b/src/expression/embeddedDocs/function/utils/isConditionalNode.js new file mode 100644 index 0000000000..dd100635b4 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isConditionalNode.js @@ -0,0 +1,30 @@ +/** + * Check if the given value is a ConditionalNode. + * + * Syntax: + * + * math.isConditionalNode(x) + * + * Examples: + * + * math.isConditionalNode() // returns false + * + * See also: + * + * isNode + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a ConditionalNode, false otherwise. + * + */ +export const isConditionalNodeDocs = { + name: 'isConditionalNode', + category: 'Type Checks', + syntax: ['isConditionalNode(x)'], + description: 'Test whether a value is a ConditionalNode.', + examples: [ + 'isConditionalNode(new math.ConditionalNode())', + 'isConditionalNode(new math.FunctionNode())' + ], + seealso: ['isNode'] +} diff --git a/src/expression/embeddedDocs/function/utils/isConstantNode.js b/src/expression/embeddedDocs/function/utils/isConstantNode.js new file mode 100644 index 0000000000..fedf566941 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isConstantNode.js @@ -0,0 +1,25 @@ +/** + * Test whether a node is a constant node. + * + * Syntax: + * + * math.isConstantNode(x) + * + * Examples: + * + * math.isConstantNode(new math.ConstantNode(1)) // returns true + * + * See also: + * isNode + * + * @param {*} x Node to be tested + * @return {boolean} Returns true when `x` is a constant node, false otherwise. + */ +export const isConstantNodeDocs = { + name: 'isConstantNode', + category: 'Expression Nodes', + syntax: ['isConstantNode(x)'], + description: 'Check if a node is a constant node.', + examples: ['isConstantNode(new math.ConstantNode(1))'], + seealso: ['isNode'] +} diff --git a/src/expression/embeddedDocs/function/utils/isDate.js b/src/expression/embeddedDocs/function/utils/isDate.js new file mode 100644 index 0000000000..887f1483b2 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isDate.js @@ -0,0 +1,25 @@ +/** + * Test whether a value is a Date. + * + * Syntax: + * + * math.isDate(x) + * + * Examples: + * + * math.isDate(new Date()) + * + * See also: + * isNumber + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a Date, false otherwise. + */ +export const isDateDocs = { + name: 'isDate', + category: 'Type Checks', + syntax: ['isDate(x)'], + description: 'Check if a value is a Date object.', + examples: ['isDate(new Date())'], + seealso: ['isNumber'] +} diff --git a/src/expression/embeddedDocs/function/utils/isDenseMatrix.js b/src/expression/embeddedDocs/function/utils/isDenseMatrix.js new file mode 100644 index 0000000000..385af69fad --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isDenseMatrix.js @@ -0,0 +1,30 @@ +/** + * Test whether a value is a Dense Matrix. + * + * Syntax: + * + * math.isDenseMatrix(x) + * + * Examples: + * + * math.isDenseMatrix(new math.DenseMatrix([1,2,3])) + * math.isDenseMatrix(new math.SparseMatrix([1,2,3])) + * + * See also: + * + * isMatrix, isSparseMatrix + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a Dense Matrix, false otherwise. + */ +export const isDenseMatrixDocs = { + name: 'isDenseMatrix', + category: 'Type Checks', + syntax: ['isDenseMatrix(x)'], + description: 'Test whether a value is a Dense Matrix.', + examples: [ + 'isDenseMatrix(new math.DenseMatrix([1,2,3]))', + 'isDenseMatrix(new math.SparseMatrix([1,2,3]))' + ], + seealso: ['isMatrix', 'isSparseMatrix'] +} diff --git a/src/expression/embeddedDocs/function/utils/isFraction.js b/src/expression/embeddedDocs/function/utils/isFraction.js new file mode 100644 index 0000000000..3e8c80f012 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isFraction.js @@ -0,0 +1,27 @@ +/** + * Test whether a value is a Fraction. + * + * Syntax: + * + * math.isFraction(x) + * + * Examples: + * + * math.isFraction(math.fraction(1, 2)) // returns true + * math.isFraction(0.5) // returns false + * + * See also: + * + * isNumber, isBigNumber, isBigInt + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a Fraction, false otherwise. + */ +export const isFractionDocs = { + name: 'isFraction', + category: 'Type Checks', + syntax: ['isFraction(x)'], + description: 'Test whether a value is a Fraction.', + examples: ['isFraction(math.fraction(1, 2))', 'isFraction(0.5)'], + seealso: ['isNumber', 'isBigNumber', 'isBigInt'] +} diff --git a/src/expression/embeddedDocs/function/utils/isFunction.js b/src/expression/embeddedDocs/function/utils/isFunction.js new file mode 100644 index 0000000000..34409bc7c4 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isFunction.js @@ -0,0 +1,26 @@ +/** + * Test whether a value is a function. + * + * Syntax: + * + * math.isFunction(x) + * + * Examples: + * + * math.isFunction(sin) + * + * See also: + * + * isNode, isObject, isBoolean, isString, isArray + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a function, false otherwise. + */ +export const isFunctionDocs = { + name: 'isFunction', + category: 'Type Checks', + syntax: ['isFunction(x)'], + description: 'Check if a value is a function.', + examples: ['isFunction(sin)'], + seealso: ['isNode', 'isObject', 'isBoolean', 'isString', 'isArray'] +} diff --git a/src/expression/embeddedDocs/function/utils/isFunctionAssignmentNode.js b/src/expression/embeddedDocs/function/utils/isFunctionAssignmentNode.js new file mode 100644 index 0000000000..a1e4ff9e30 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isFunctionAssignmentNode.js @@ -0,0 +1,25 @@ +/** + * Test whether a node is a function assignment node. + * + * Syntax: + * + * math.isFunctionAssignmentNode(x) + * + * Examples: + * + * math.isFunctionAssignmentNode() + * + * See also: + * isFunction + * + * @param {*} x Node to be tested + * @return {boolean} Returns true when `x` is a function assignment node, false otherwise. + */ +export const isFunctionAssignmentNodeDocs = { + name: 'isFunctionAssignmentNode', + category: 'Expression Nodes', + syntax: ['isFunctionAssignmentNode(x)'], + description: 'Check if a node is a function assignment node.', + examples: ['isFunctionAssignmentNode(/* example node */)'], + seealso: ['isFunction'] +} diff --git a/src/expression/embeddedDocs/function/utils/isFunctionNode.js b/src/expression/embeddedDocs/function/utils/isFunctionNode.js new file mode 100644 index 0000000000..245f0bba02 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isFunctionNode.js @@ -0,0 +1,25 @@ +/** + * Test whether a node is a function node. + * + * Syntax: + * + * math.isFunctionNode(x) + * + * Examples: + * + * math.isFunctionNode() + * + * See also: + * isFunction, isFunctionAssignmentNode + * + * @param {*} x Node to be tested + * @return {boolean} Returns true when `x` is a function node, false otherwise. + */ +export const isFunctionNodeDocs = { + name: 'isFunctionNode', + category: 'Expression Nodes', + syntax: ['isFunctionNode(x)'], + description: 'Check if a node is a function node.', + examples: ['isFunctionNode(n)'], + seealso: ['isFunction', 'isFunctionAssignmentNode'] +} diff --git a/src/expression/embeddedDocs/function/utils/isHelp.js b/src/expression/embeddedDocs/function/utils/isHelp.js new file mode 100644 index 0000000000..989b7caf6a --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isHelp.js @@ -0,0 +1,25 @@ +/** + * Test whether a value requests help. + * + * Syntax: + * + * math.isHelp(x) + * + * Examples: + * + * math.isHelp() + * + * See also: + * help + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a help request, false otherwise. + */ +export const isHelpDocs = { + name: 'isHelp', + category: 'Type Checks', + syntax: ['isHelp(x)'], + description: 'Check if a value requests help.', + examples: ['isHelp(/* example value */)'], + seealso: ['help'] +} diff --git a/src/expression/embeddedDocs/function/utils/isIndex.js b/src/expression/embeddedDocs/function/utils/isIndex.js new file mode 100644 index 0000000000..4d59460c1f --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isIndex.js @@ -0,0 +1,25 @@ +/** + * Test whether a value is an index. + * + * Syntax: + * + * math.isIndex(x) + * + * Examples: + * + * math.isIndex(math.index(1)) // returns true + * + * See also: + * index + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is an index, false otherwise. + */ +export const isIndexDocs = { + name: 'isIndex', + category: 'Type Checks', + syntax: ['isIndex(x)'], + description: 'Check if a value is an index.', + examples: ['isIndex(math.index(1))'], + seealso: ['index'] +} diff --git a/src/expression/embeddedDocs/function/utils/isIndexNode.js b/src/expression/embeddedDocs/function/utils/isIndexNode.js new file mode 100644 index 0000000000..6989c3ab50 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isIndexNode.js @@ -0,0 +1,25 @@ +/** + * Test whether a node is an index node. + * + * Syntax: + * + * math.isIndexNode(x) + * + * Examples: + * + * math.isIndexNode() + * + * See also: + * isIndex + * + * @param {*} x Node to be tested + * @return {boolean} Returns true when `x` is an index node, false otherwise. + */ +export const isIndexNodeDocs = { + name: 'isIndexNode', + category: 'Expression Nodes', + syntax: ['isIndexNode(x)'], + description: 'Check if a node is an index node.', + examples: ['isIndexNode(/* example node */)'], + seealso: ['isIndex'] +} diff --git a/src/expression/embeddedDocs/function/utils/isMap.js b/src/expression/embeddedDocs/function/utils/isMap.js new file mode 100644 index 0000000000..911ca87591 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isMap.js @@ -0,0 +1,25 @@ +/** + * Test whether a value is a Map. + * + * Syntax: + * + * math.isMap(x) + * + * Examples: + * + * math.isMap(new Map()) + * + * See also: + * isObject + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a Map, false otherwise. + */ +export const isMapDocs = { + name: 'isMap', + category: 'Type Checks', + syntax: ['isMap(x)'], + description: 'Check if a value is a Map.', + examples: ['isMap(new Map())'], + seealso: ['isObject'] +} diff --git a/src/expression/embeddedDocs/function/utils/isMatrix.js b/src/expression/embeddedDocs/function/utils/isMatrix.js new file mode 100644 index 0000000000..8f793cdaef --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isMatrix.js @@ -0,0 +1,27 @@ +/** + * Test whether a value is a Matrix. + * + * Syntax: + * + * math.isMatrix(x) + * + * Examples: + * + * math.isMatrix(math.matrix([1, 2, 3])) // returns true + * math.isMatrix([1, 2, 3]) // returns false + * + * See also: + * + * isArray, isDenseMatrix, isSparseMatrix + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a Matrix, false otherwise. + */ +export const isMatrixDocs = { + name: 'isMatrix', + category: 'Type Checks', + syntax: ['isMatrix(x)'], + description: 'Test whether a value is a Matrix.', + examples: ['isMatrix(math.matrix([1,2,3]))', 'isMatrix([1,2,3])'], + seealso: ['isArray', 'isDenseMatrix', 'isSparseMatrix'] +} diff --git a/src/expression/embeddedDocs/function/utils/isNode.js b/src/expression/embeddedDocs/function/utils/isNode.js new file mode 100644 index 0000000000..dbd7d1d45c --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isNode.js @@ -0,0 +1,25 @@ +/** + * Test whether a value is a node. + * + * Syntax: + * + * math.isNode(x) + * + * Examples: + * + * math.isNode() + * + * See also: + * Node + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a node, false otherwise. + */ +export const isNodeDocs = { + name: 'isNode', + category: 'Expression Nodes', + syntax: ['isNode(x)'], + description: 'Check if a value is a node.', + examples: ['isNode(/* example node */)'], + seealso: ['Node'] +} diff --git a/src/expression/embeddedDocs/function/utils/isNull.js b/src/expression/embeddedDocs/function/utils/isNull.js new file mode 100644 index 0000000000..733e60f6db --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isNull.js @@ -0,0 +1,25 @@ +/** + * Test whether a value is null. + * + * Syntax: + * + * math.isNull(x) + * + * Examples: + * + * math.isNull(null) + * + * See also: + * isUndefined + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is null, false otherwise. + */ +export const isNullDocs = { + name: 'isNull', + category: 'Type Checks', + syntax: ['isNull(x)'], + description: 'Check if a value is null.', + examples: ['isNull(null)'], + seealso: ['isUndefined'] +} diff --git a/src/expression/embeddedDocs/function/utils/isNumber.js b/src/expression/embeddedDocs/function/utils/isNumber.js new file mode 100644 index 0000000000..8c56b4b935 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isNumber.js @@ -0,0 +1,27 @@ +/** + * Test whether a value is of type number. + * + * Syntax: + * + * math.isNumber(x) + * + * Examples: + * + * math.isNumber(42) // returns true + * math.isNumber("42") // returns false + * + * See also: + * + * isBigNumber, isBigInt, isFraction + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a number, false otherwise. + */ +export const isNumberDocs = { + name: 'isNumber', + category: 'Type Checks', + syntax: ['isNumber(x)'], + description: 'Check if a value is of type number.', + examples: ['isNumber(42)', 'isNumber("42")'], + seealso: ['isBigNumber', 'isBigInt', 'isFraction'] +} diff --git a/src/expression/embeddedDocs/function/utils/isObject.js b/src/expression/embeddedDocs/function/utils/isObject.js new file mode 100644 index 0000000000..e4726df07d --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isObject.js @@ -0,0 +1,25 @@ +/** + * Test whether a value is an object. + * + * Syntax: + * + * math.isObject(x) + * + * Examples: + * + * math.isObject({ a: 1 }) + * + * See also: + * isArray + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is an object, false otherwise. + */ +export const isObjectDocs = { + name: 'isObject', + category: 'Type Checks', + syntax: ['isObject(x)'], + description: 'Check if a value is an object.', + examples: ['isObject({ a: 1 })'], + seealso: ['isArray'] +} diff --git a/src/expression/embeddedDocs/function/utils/isObjectNode.js b/src/expression/embeddedDocs/function/utils/isObjectNode.js new file mode 100644 index 0000000000..b6552d72c3 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isObjectNode.js @@ -0,0 +1,25 @@ +/** + * Test whether a node is an object node. + * + * Syntax: + * + * math.isObjectNode(x) + * + * Examples: + * + * math.isObjectNode() + * + * See also: + * ObjectNode + * + * @param {*} x Node to be tested + * @return {boolean} Returns true when `x` is an object node, false otherwise. + */ +export const isObjectNodeDocs = { + name: 'isObjectNode', + category: 'Expression Nodes', + syntax: ['isObjectNode(x)'], + description: 'Check if a node is an object node.', + examples: ['isObjectNode(/* example node */)'], + seealso: ['ObjectNode'] +} diff --git a/src/expression/embeddedDocs/function/utils/isObjectWrappingMap.js b/src/expression/embeddedDocs/function/utils/isObjectWrappingMap.js new file mode 100644 index 0000000000..10a3b65ccf --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isObjectWrappingMap.js @@ -0,0 +1,25 @@ +/** + * Test whether a value is an object wrapping a map. + * + * Syntax: + * + * math.isObjectWrappingMap(x) + * + * Examples: + * + * math.isObjectWrappingMap() + * + * See also: + * isMap + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is an object wrapping a map, false otherwise. + */ +export const isObjectWrappingMapDocs = { + name: 'isObjectWrappingMap', + category: 'Type Checks', + syntax: ['isObjectWrappingMap(x)'], + description: 'Check if a value is an object wrapping a map.', + examples: ['isObjectWrappingMap(/* example value */)'], + seealso: ['isMap'] +} diff --git a/src/expression/embeddedDocs/function/utils/isOperatorNode.js b/src/expression/embeddedDocs/function/utils/isOperatorNode.js new file mode 100644 index 0000000000..e7ade138a8 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isOperatorNode.js @@ -0,0 +1,25 @@ +/** + * Test whether a node is an operator node. + * + * Syntax: + * + * math.isOperatorNode(x) + * + * Examples: + * + * math.isOperatorNode() + * + * See also: + * OperatorNode + * + * @param {*} x Node to be tested + * @return {boolean} Returns true when `x` is an operator node, false otherwise. + */ +export const isOperatorNodeDocs = { + name: 'isOperatorNode', + category: 'Expression Nodes', + syntax: ['isOperatorNode(x)'], + description: 'Check if a node is an operator node.', + examples: ['isOperatorNode(/* example node */)'], + seealso: ['OperatorNode'] +} diff --git a/src/expression/embeddedDocs/function/utils/isParenthesisNode.js b/src/expression/embeddedDocs/function/utils/isParenthesisNode.js new file mode 100644 index 0000000000..d447586a29 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isParenthesisNode.js @@ -0,0 +1,25 @@ +/** + * Test whether a node is a parenthesis node. + * + * Syntax: + * + * math.isParenthesisNode(x) + * + * Examples: + * + * math.isParenthesisNode() + * + * See also: + * ParenthesisNode + * + * @param {*} x Node to be tested + * @return {boolean} Returns true when `x` is a parenthesis node, false otherwise. + */ +export const isParenthesisNodeDocs = { + name: 'isParenthesisNode', + category: 'Expression Nodes', + syntax: ['isParenthesisNode(x)'], + description: 'Check if a node is a parenthesis node.', + examples: ['isParenthesisNode(/* example node */)'], + seealso: ['ParenthesisNode'] +} diff --git a/src/expression/embeddedDocs/function/utils/isPartitionedMap.js b/src/expression/embeddedDocs/function/utils/isPartitionedMap.js new file mode 100644 index 0000000000..76e0a15ddd --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isPartitionedMap.js @@ -0,0 +1,25 @@ +/** + * Test whether a value is a partitioned map. + * + * Syntax: + * + * math.isPartitionedMap(x) + * + * Examples: + * + * math.isPartitionedMap() + * + * See also: + * isMap + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a partitioned map, false otherwise. + */ +export const isPartitionedMapDocs = { + name: 'isPartitionedMap', + category: 'Type Checks', + syntax: ['isPartitionedMap(x)'], + description: 'Check if a value is a partitioned map.', + examples: ['isPartitionedMap(/* example value */)'], + seealso: ['isMap'] +} diff --git a/src/expression/embeddedDocs/function/utils/isRange.js b/src/expression/embeddedDocs/function/utils/isRange.js new file mode 100644 index 0000000000..26ab90ec2e --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isRange.js @@ -0,0 +1,25 @@ +/** + * Test whether a value is a range. + * + * Syntax: + * + * math.isRange(x) + * + * Examples: + * + * math.isRange(new math.Range(1, 10)) // returns true + * + * See also: + * Range + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a range, false otherwise. + */ +export const isRangeDocs = { + name: 'isRange', + category: 'Type Checks', + syntax: ['isRange(x)'], + description: 'Check if a value is a range.', + examples: ['isRange(new math.Range(1, 10))'], + seealso: ['Range'] +} diff --git a/src/expression/embeddedDocs/function/utils/isRangeNode.js b/src/expression/embeddedDocs/function/utils/isRangeNode.js new file mode 100644 index 0000000000..01f0c5b06f --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isRangeNode.js @@ -0,0 +1,26 @@ +/** + * Test whether a value is a RangeNode. + * + * Syntax: + * + * math.isRangeNode(x) + * + * Examples: + * + * math.isRangeNode(math.parse("1:10")) // returns true + * + * See also: + * + * isFunctionNode, isOperatorNode, isNode, isSymbolNode + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a RangeNode, false otherwise. + */ +export const isRangeNodeDocs = { + name: 'isRangeNode', + category: 'Type Checks', + syntax: ['isRangeNode(x)'], + description: 'Test whether a value is a RangeNode.', + examples: ['isRangeNode(math.parse("1:10"))'], + seealso: ['isNode'] +} diff --git a/src/expression/embeddedDocs/function/utils/isRegExp.js b/src/expression/embeddedDocs/function/utils/isRegExp.js new file mode 100644 index 0000000000..a9c6d284a4 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isRegExp.js @@ -0,0 +1,25 @@ +/** + * Test whether a value is a regular expression. + * + * Syntax: + * + * math.isRegExp(x) + * + * Examples: + * + * math.isRegExp(/abc/) + * + * See also: + * isString + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a RegExp, false otherwise. + */ +export const isRegExpDocs = { + name: 'isRegExp', + category: 'Type Checks', + syntax: ['isRegExp(x)'], + description: 'Check if a value is a regular expression.', + examples: ['isRegExp(/abc/)'], + seealso: ['isString'] +} diff --git a/src/expression/embeddedDocs/function/utils/isRelationalNode.js b/src/expression/embeddedDocs/function/utils/isRelationalNode.js new file mode 100644 index 0000000000..ab621e0411 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isRelationalNode.js @@ -0,0 +1,26 @@ +/** + * Test whether a value is a relationalNode. + * + * Syntax: + * + * math.isRelationalNode(x) + * + * Examples: + * + * math.isRelationalNode(new RelationalNode('<=', [new ConstantNode(2), new ConstantNode(3)])) + * + * See also: + * + * isOperatorNode + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a RelationalNode, false otherwise. + */ +export const isRelationalNodeDocs = { + name: 'isRelationalNode', + category: 'Type Checks', + syntax: ['isRelationalNode(x)'], + description: 'Test whether a value is a RelationalNode.', + examples: ['isRelationalNode(math.parse("2<3"))'], + seealso: ['isOperatorNode'] +} diff --git a/src/expression/embeddedDocs/function/utils/isResultSet.js b/src/expression/embeddedDocs/function/utils/isResultSet.js new file mode 100644 index 0000000000..f3008f7753 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isResultSet.js @@ -0,0 +1,25 @@ +/** + * Test whether a value is a result set. + * + * Syntax: + * + * math.isResultSet(x) + * + * Examples: + * + * math.isResultSet() + * + * See also: + * ResultSet + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a result set, false otherwise. + */ +export const isResultSetDocs = { + name: 'isResultSet', + category: 'Type Checks', + syntax: ['isResultSet(x)'], + description: 'Check if a value is a result set.', + examples: ['isResultSet(/* example value */)'], + seealso: ['ResultSet'] +} diff --git a/src/expression/embeddedDocs/function/utils/isSparseMatrix.js b/src/expression/embeddedDocs/function/utils/isSparseMatrix.js new file mode 100644 index 0000000000..e4909a317e --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isSparseMatrix.js @@ -0,0 +1,31 @@ +/** + * Test whether a value is a Sparse Matrix. + * + * Syntax: + * + * math.isSparseMatrix(x) + * + * Examples: + * + * math.isSparseMatrix(new math.SparseMatrix([1,2,3])) // returns true + * math.isSparseMatrix(new math.DenseMatrix([1,2,3])) // returns false + * + * See also: + * + * isMatrix, isDenseMatrix + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a Sparse Matrix, false otherwise. + * + */ +export const isSparseMatrixDocs = { + name: 'isSparseMatrix', + category: 'Type Checks', + syntax: ['isSparseMatrix(x)'], + description: 'Test whether a value is a Sparse Matrix.', + examples: [ + 'isSparseMatrix(new math.SparseMatrix([1,2,3]))', + 'isSparseMatrix(new math.DenseMatrix([1,2,3]))' + ], + seealso: ['isMatrix', 'isDenseMatrix'] +} diff --git a/src/expression/embeddedDocs/function/utils/isString.js b/src/expression/embeddedDocs/function/utils/isString.js new file mode 100644 index 0000000000..3da00a3148 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isString.js @@ -0,0 +1,28 @@ +/** + * Test whether a value is a String. + * + * Syntax: + * + * math.isString(x) + * + * Examples: + * + * math.isString('hello') // returns true + * math.isString(123) // returns false + * + * See also: + * + * isNumber, isArray + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a string, false otherwise. + * + */ +export const isStringDocs = { + name: 'isString', + category: 'Type Checks', + syntax: ['isString(x)'], + description: 'Test whether a value is a String.', + examples: ['isString("hello")', 'isString(123)'], + seealso: ['isNumber', 'isArray'] +} diff --git a/src/expression/embeddedDocs/function/utils/isSymbolNode.js b/src/expression/embeddedDocs/function/utils/isSymbolNode.js new file mode 100644 index 0000000000..a9f9263ada --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isSymbolNode.js @@ -0,0 +1,26 @@ +/** + * Test whether a value is a SymbolNode. + * + * Syntax: + * + * math.isSymbolNode(x) + * + * Examples: + * + * math.isSymbolNode(math.parse("x")) // returns true + * + * See also: + * + * isNode + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a SymbolNode, false otherwise. + */ +export const isSymbolNodeDocs = { + name: 'isSymbolNode', + category: 'Type Checks', + syntax: ['isSymbolNode(x)'], + description: 'Test whether a value is a SymbolNode.', + examples: ['isSymbolNode(math.parse("x"))'], + seealso: ['isNode'] +} diff --git a/src/expression/embeddedDocs/function/utils/isUndefined.js b/src/expression/embeddedDocs/function/utils/isUndefined.js new file mode 100644 index 0000000000..b894bc8538 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isUndefined.js @@ -0,0 +1,25 @@ +/** + * Test whether a value is undefined. + * + * Syntax: + * + * math.isUndefined(x) + * + * Examples: + * + * math.isUndefined(undefined) + * + * See also: + * isNull + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is undefined, false otherwise. + */ +export const isUndefinedDocs = { + name: 'isUndefined', + category: 'Type Checks', + syntax: ['isUndefined(x)'], + description: 'Check if a value is undefined.', + examples: ['isUndefined(undefined)'], + seealso: ['isNull'] +} diff --git a/src/expression/embeddedDocs/function/utils/isUnit.js b/src/expression/embeddedDocs/function/utils/isUnit.js new file mode 100644 index 0000000000..e95ad46c87 --- /dev/null +++ b/src/expression/embeddedDocs/function/utils/isUnit.js @@ -0,0 +1,27 @@ +/** + * Test whether a value is a Unit. + * + * Syntax: + * + * math.isUnit(x) + * + * Examples: + * + * math.isUnit(math.unit('5cm')) // returns true + * math.isUnit(5) // returns false + * + * See also: + * + * Unit + * + * @param {*} x Value to be tested + * @return {boolean} Returns true when `x` is a unit, false otherwise. + */ +export const isUnitDocs = { + name: 'isUnit', + category: 'Type Checks', + syntax: ['isUnit(x)'], + description: 'Test whether a value is a Unit.', + examples: ['isUnit(math.unit("5cm"))', 'isUnit(5)'], + seealso: ['Unit'] +} diff --git a/test/node-tests/doc.test.js b/test/node-tests/doc.test.js index b5995a42d6..dc8ad0c820 100644 --- a/test/node-tests/doc.test.js +++ b/test/node-tests/doc.test.js @@ -170,49 +170,6 @@ const OKundocumented = new Set([ const knownUndocumented = new Set([ 'all', - 'isNumber', - 'isComplex', - 'isBigNumber', - 'isBigInt', - 'isFraction', - 'isUnit', - 'isString', - 'isArray', - 'isMatrix', - 'isCollection', - 'isDenseMatrix', - 'isSparseMatrix', - 'isRange', - 'isIndex', - 'isBoolean', - 'isResultSet', - 'isHelp', - 'isFunction', - 'isDate', - 'isRegExp', - 'isObject', - 'isMap', - 'isPartitionedMap', - 'isObjectWrappingMap', - 'isNull', - 'isUndefined', - 'isAccessorNode', - 'isArrayNode', - 'isAssignmentNode', - 'isBlockNode', - 'isConditionalNode', - 'isConstantNode', - 'isFunctionAssignmentNode', - 'isFunctionNode', - 'isIndexNode', - 'isNode', - 'isObjectNode', - 'isOperatorNode', - 'isParenthesisNode', - 'isRangeNode', - 'isRelationalNode', - 'isSymbolNode', - 'isChain', 'on', 'off', 'once', diff --git a/tools/docgenerator.js b/tools/docgenerator.js index de962797c9..cee09d6313 100644 --- a/tools/docgenerator.js +++ b/tools/docgenerator.js @@ -545,7 +545,7 @@ export function cleanup (outputPath, outputRoot) { * giving the relevant information */ export function collectDocs (functionNames, inputPath) { - function normalizeWindowsPath(path) { + function normalizeWindowsPath (path) { return path.replace(/\\/g, '/') }