feat:node-modules

This commit is contained in:
houjunxiang
2025-11-24 10:26:18 +08:00
parent 753766893b
commit 8a3e48d856
8825 changed files with 567399 additions and 1 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,63 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createCompareTextNumber = exports.createCompareText = void 0;
var _string = require("../../utils/string.js");
var _factory = require("../../utils/factory.js");
var _matrixAlgorithmSuite = require("../../type/matrix/utils/matrixAlgorithmSuite.js");
const name = 'compareText';
const dependencies = ['typed', 'matrix', 'concat'];
_string.compareText.signature = 'any, any';
const createCompareText = exports.createCompareText = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
matrix,
concat
} = _ref;
const matrixAlgorithmSuite = (0, _matrixAlgorithmSuite.createMatrixAlgorithmSuite)({
typed,
matrix,
concat
});
/**
* Compare two strings lexically. Comparison is case sensitive.
* Returns 1 when x > y, -1 when x < y, and 0 when x == y.
*
* For matrices, the function is evaluated element wise.
*
* Syntax:
*
* math.compareText(x, y)
*
* Examples:
*
* math.compareText('B', 'A') // returns 1
* math.compareText('2', '10') // returns 1
* math.compare('2', '10') // returns -1
* math.compareNatural('2', '10') // returns -1
*
* math.compareText('B', ['A', 'B', 'C']) // returns [1, 0, -1]
*
* See also:
*
* equal, equalText, compare, compareNatural
*
* @param {string | Array | DenseMatrix} x First string to compare
* @param {string | Array | DenseMatrix} y Second string to compare
* @return {number | Array | DenseMatrix} Returns the result of the comparison:
* 1 when x > y, -1 when x < y, and 0 when x == y.
*/
return typed(name, _string.compareText, matrixAlgorithmSuite({
elop: _string.compareText,
Ds: true
}));
});
const createCompareTextNumber = exports.createCompareTextNumber = /* #__PURE__ */(0, _factory.factory)(name, ['typed'], _ref2 => {
let {
typed
} = _ref2;
return typed(name, _string.compareText);
});

View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createCompareUnits = void 0;
var _factory = require("../../utils/factory.js");
const createCompareUnits = exports.createCompareUnits = /* #__PURE__ */(0, _factory.factory)('compareUnits', ['typed'], _ref => {
let {
typed
} = _ref;
return {
'Unit, Unit': typed.referToSelf(self => (x, y) => {
if (!x.equalBase(y)) {
throw new Error('Cannot compare units with different base');
}
return typed.find(self, [x.valueType(), y.valueType()])(x.value, y.value);
})
};
});

View File

@@ -0,0 +1,80 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createDeepEqual = void 0;
var _factory = require("../../utils/factory.js");
const name = 'deepEqual';
const dependencies = ['typed', 'equal'];
const createDeepEqual = exports.createDeepEqual = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
equal
} = _ref;
/**
* Test element wise whether two matrices are equal.
* The function accepts both matrices and scalar values.
*
* Strings are compared by their numerical value.
*
* Syntax:
*
* math.deepEqual(x, y)
*
* Examples:
*
* math.deepEqual(2, 4) // returns false
*
* a = [2, 5, 1]
* b = [2, 7, 1]
*
* math.deepEqual(a, b) // returns false
* math.equal(a, b) // returns [true, false, true]
*
* See also:
*
* equal, unequal
*
* @param {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} x First matrix to compare
* @param {number | BigNumber | Fraction | Complex | Unit | Array | Matrix} y Second matrix to compare
* @return {number | BigNumber | Fraction | Complex | Unit | Array | Matrix}
* Returns true when the input matrices have the same size and each of their elements is equal.
*/
return typed(name, {
'any, any': function (x, y) {
return _deepEqual(x.valueOf(), y.valueOf());
}
});
/**
* Test whether two arrays have the same size and all elements are equal
* @param {Array | *} x
* @param {Array | *} y
* @return {boolean} Returns true if both arrays are deep equal
*/
function _deepEqual(x, y) {
if (Array.isArray(x)) {
if (Array.isArray(y)) {
const len = x.length;
if (len !== y.length) {
return false;
}
for (let i = 0; i < len; i++) {
if (!_deepEqual(x[i], y[i])) {
return false;
}
}
return true;
} else {
return false;
}
} else {
if (Array.isArray(y)) {
return false;
} else {
return equal(x, y);
}
}
}
});

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,62 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createEqualScalarNumber = exports.createEqualScalar = void 0;
var _nearlyEqual = require("../../utils/bignumber/nearlyEqual.js");
var _number = require("../../utils/number.js");
var _factory = require("../../utils/factory.js");
var _complex = require("../../utils/complex.js");
var _compareUnits = require("./compareUnits.js");
const name = 'equalScalar';
const dependencies = ['typed', 'config'];
const createEqualScalar = exports.createEqualScalar = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
config
} = _ref;
const compareUnits = (0, _compareUnits.createCompareUnits)({
typed
});
/**
* Test whether two scalar values are nearly equal.
*
* @param {number | BigNumber | bigint | Fraction | boolean | Complex | Unit} x First value to compare
* @param {number | BigNumber | bigint | Fraction | boolean | Complex} y Second value to compare
* @return {boolean} Returns true when the compared values are equal, else returns false
* @private
*/
return typed(name, {
'boolean, boolean': function (x, y) {
return x === y;
},
'number, number': function (x, y) {
return (0, _number.nearlyEqual)(x, y, config.relTol, config.absTol);
},
'BigNumber, BigNumber': function (x, y) {
return x.eq(y) || (0, _nearlyEqual.nearlyEqual)(x, y, config.relTol, config.absTol);
},
'bigint, bigint': function (x, y) {
return x === y;
},
'Fraction, Fraction': function (x, y) {
return x.equals(y);
},
'Complex, Complex': function (x, y) {
return (0, _complex.complexEquals)(x, y, config.relTol, config.absTol);
}
}, compareUnits);
});
const createEqualScalarNumber = exports.createEqualScalarNumber = (0, _factory.factory)(name, ['typed', 'config'], _ref2 => {
let {
typed,
config
} = _ref2;
return typed(name, {
'number, number': function (x, y) {
return (0, _number.nearlyEqual)(x, y, config.relTol, config.absTol);
}
});
});

View File

@@ -0,0 +1,47 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createEqualText = void 0;
var _factory = require("../../utils/factory.js");
const name = 'equalText';
const dependencies = ['typed', 'compareText', 'isZero'];
const createEqualText = exports.createEqualText = /* #__PURE__ */(0, _factory.factory)(name, dependencies, _ref => {
let {
typed,
compareText,
isZero
} = _ref;
/**
* Check equality of two strings. Comparison is case sensitive.
*
* For matrices, the function is evaluated element wise.
*
* Syntax:
*
* math.equalText(x, y)
*
* Examples:
*
* math.equalText('Hello', 'Hello') // returns true
* math.equalText('a', 'A') // returns false
* math.equal('2e3', '2000') // returns true
* math.equalText('2e3', '2000') // returns false
*
* math.equalText('B', ['A', 'B', 'C']) // returns [false, true, false]
*
* See also:
*
* equal, compareText, compare, compareNatural
*
* @param {string | Array | DenseMatrix} x First string to compare
* @param {string | Array | DenseMatrix} y Second string to compare
* @return {number | Array | DenseMatrix} Returns true if the values are equal, and false if not.
*/
return typed(name, {
'any, any': function (x, y) {
return isZero(compareText(x, y));
}
});
});

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More