feat:node-modules
This commit is contained in:
30
node_modules/mathjs/lib/esm/function/utils/clone.js
generated
vendored
Normal file
30
node_modules/mathjs/lib/esm/function/utils/clone.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import { clone as objectClone } from '../../utils/object.js';
|
||||
import { factory } from '../../utils/factory.js';
|
||||
var name = 'clone';
|
||||
var dependencies = ['typed'];
|
||||
export var createClone = /* #__PURE__ */factory(name, dependencies, _ref => {
|
||||
var {
|
||||
typed
|
||||
} = _ref;
|
||||
/**
|
||||
* Clone an object. Will make a deep copy of the data.
|
||||
*
|
||||
* Syntax:
|
||||
*
|
||||
* math.clone(x)
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* math.clone(3.5) // returns number 3.5
|
||||
* math.clone(math.complex('2-4i')) // returns Complex 2 - 4i
|
||||
* math.clone(math.unit(45, 'deg')) // returns Unit 45 deg
|
||||
* math.clone([[1, 2], [3, 4]]) // returns Array [[1, 2], [3, 4]]
|
||||
* math.clone("hello world") // returns string "hello world"
|
||||
*
|
||||
* @param {*} x Object to be cloned
|
||||
* @return {*} A clone of object x
|
||||
*/
|
||||
return typed(name, {
|
||||
any: objectClone
|
||||
});
|
||||
});
|
||||
50
node_modules/mathjs/lib/esm/function/utils/hasNumericValue.js
generated
vendored
Normal file
50
node_modules/mathjs/lib/esm/function/utils/hasNumericValue.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
import { factory } from '../../utils/factory.js';
|
||||
var name = 'hasNumericValue';
|
||||
var dependencies = ['typed', 'isNumeric'];
|
||||
export var createHasNumericValue = /* #__PURE__ */factory(name, dependencies, _ref => {
|
||||
var {
|
||||
typed,
|
||||
isNumeric
|
||||
} = _ref;
|
||||
/**
|
||||
* Test whether a value is an numeric value.
|
||||
*
|
||||
* In case of a string, true is returned if the string contains a numeric value.
|
||||
*
|
||||
* Syntax:
|
||||
*
|
||||
* math.hasNumericValue(x)
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* math.hasNumericValue(2) // returns true
|
||||
* math.hasNumericValue('2') // returns true
|
||||
* math.isNumeric('2') // returns false
|
||||
* math.hasNumericValue(0) // returns true
|
||||
* math.hasNumericValue(math.bignumber('500')) // returns true
|
||||
* math.hasNumericValue(math.bigint('42')) // returns true
|
||||
* math.hasNumericValue(42n) // returns true
|
||||
* math.hasNumericValue(math.fraction(4)) // returns true
|
||||
* math.hasNumericValue(math.complex('2-4i')) // returns false
|
||||
* math.hasNumericValue(false) // returns true
|
||||
* math.hasNumericValue([2.3, 'foo', false]) // returns [true, false, true]
|
||||
*
|
||||
* See also:
|
||||
*
|
||||
* isZero, isPositive, isNegative, isInteger, isNumeric
|
||||
*
|
||||
* @param {*} x Value to be tested
|
||||
* @return {boolean} Returns true when `x` is a `number`, `BigNumber`,
|
||||
* `Fraction`, `Boolean`, or a `String` containing number. Returns false for other types.
|
||||
* Throws an error in case of unknown types.
|
||||
*/
|
||||
return typed(name, {
|
||||
boolean: () => true,
|
||||
string: function string(x) {
|
||||
return x.trim().length > 0 && !isNaN(Number(x));
|
||||
},
|
||||
any: function any(x) {
|
||||
return isNumeric(x);
|
||||
}
|
||||
});
|
||||
});
|
||||
54
node_modules/mathjs/lib/esm/function/utils/isInteger.js
generated
vendored
Normal file
54
node_modules/mathjs/lib/esm/function/utils/isInteger.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
import { deepMap } from '../../utils/collection.js';
|
||||
import { isInteger as isIntegerNumber } from '../../utils/number.js';
|
||||
import { factory } from '../../utils/factory.js';
|
||||
var name = 'isInteger';
|
||||
var dependencies = ['typed'];
|
||||
export var createIsInteger = /* #__PURE__ */factory(name, dependencies, _ref => {
|
||||
var {
|
||||
typed
|
||||
} = _ref;
|
||||
/**
|
||||
* Test whether a value is an integer number.
|
||||
* The function supports `number`, `BigNumber`, and `Fraction`.
|
||||
*
|
||||
* The function is evaluated element-wise in case of Array or Matrix input.
|
||||
*
|
||||
* Syntax:
|
||||
*
|
||||
* math.isInteger(x)
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* math.isInteger(2) // returns true
|
||||
* math.isInteger(0) // returns true
|
||||
* math.isInteger(0.5) // returns false
|
||||
* math.isInteger(math.bignumber(500)) // returns true
|
||||
* math.isInteger(math.fraction(4)) // returns true
|
||||
* math.isInteger('3') // returns true
|
||||
* math.isInteger([3, 0.5, -2]) // returns [true, false, true]
|
||||
* math.isInteger(math.complex('2-4i')) // throws an error
|
||||
*
|
||||
* See also:
|
||||
*
|
||||
* isNumeric, isPositive, isNegative, isZero
|
||||
*
|
||||
* @param {number | BigNumber | bigint | Fraction | Array | Matrix} x Value to be tested
|
||||
* @return {boolean} Returns true when `x` contains a numeric, integer value.
|
||||
* Throws an error in case of an unknown data type.
|
||||
*/
|
||||
return typed(name, {
|
||||
number: isIntegerNumber,
|
||||
// TODO: what to do with isInteger(add(0.1, 0.2)) ?
|
||||
|
||||
BigNumber: function BigNumber(x) {
|
||||
return x.isInt();
|
||||
},
|
||||
bigint: function bigint(x) {
|
||||
return true;
|
||||
},
|
||||
Fraction: function Fraction(x) {
|
||||
return x.d === 1 && isFinite(x.n);
|
||||
},
|
||||
'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))
|
||||
});
|
||||
});
|
||||
58
node_modules/mathjs/lib/esm/function/utils/isNaN.js
generated
vendored
Normal file
58
node_modules/mathjs/lib/esm/function/utils/isNaN.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
import { deepMap } from '../../utils/collection.js';
|
||||
import { factory } from '../../utils/factory.js';
|
||||
import { isNaNNumber } from '../../plain/number/index.js';
|
||||
var name = 'isNaN';
|
||||
var dependencies = ['typed'];
|
||||
export var createIsNaN = /* #__PURE__ */factory(name, dependencies, _ref => {
|
||||
var {
|
||||
typed
|
||||
} = _ref;
|
||||
/**
|
||||
* Test whether a value is NaN (not a number).
|
||||
* The function supports types `number`, `BigNumber`, `Fraction`, `Unit` and `Complex`.
|
||||
*
|
||||
* The function is evaluated element-wise in case of Array or Matrix input.
|
||||
*
|
||||
* Syntax:
|
||||
*
|
||||
* math.isNaN(x)
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* math.isNaN(3) // returns false
|
||||
* math.isNaN(NaN) // returns true
|
||||
* math.isNaN(0) // returns false
|
||||
* math.isNaN(math.bignumber(NaN)) // returns true
|
||||
* math.isNaN(math.bignumber(0)) // returns false
|
||||
* math.isNaN(math.fraction(-2, 5)) // returns false
|
||||
* math.isNaN('-2') // returns false
|
||||
* math.isNaN([2, 0, -3, NaN]) // returns [false, false, false, true]
|
||||
*
|
||||
* See also:
|
||||
*
|
||||
* isNumeric, isNegative, isPositive, isZero, isInteger
|
||||
*
|
||||
* @param {number | BigNumber | bigint | Fraction | Unit | Array | Matrix} x Value to be tested
|
||||
* @return {boolean} Returns true when `x` is NaN.
|
||||
* Throws an error in case of an unknown data type.
|
||||
*/
|
||||
return typed(name, {
|
||||
number: isNaNNumber,
|
||||
BigNumber: function BigNumber(x) {
|
||||
return x.isNaN();
|
||||
},
|
||||
bigint: function bigint(x) {
|
||||
return false;
|
||||
},
|
||||
Fraction: function Fraction(x) {
|
||||
return false;
|
||||
},
|
||||
Complex: function Complex(x) {
|
||||
return x.isNaN();
|
||||
},
|
||||
Unit: function Unit(x) {
|
||||
return Number.isNaN(x.value);
|
||||
},
|
||||
'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))
|
||||
});
|
||||
});
|
||||
52
node_modules/mathjs/lib/esm/function/utils/isNegative.js
generated
vendored
Normal file
52
node_modules/mathjs/lib/esm/function/utils/isNegative.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
import { deepMap } from '../../utils/collection.js';
|
||||
import { factory } from '../../utils/factory.js';
|
||||
import { isNegativeNumber } from '../../plain/number/index.js';
|
||||
import { nearlyEqual as bigNearlyEqual } from '../../utils/bignumber/nearlyEqual.js';
|
||||
import { nearlyEqual } from '../../utils/number.js';
|
||||
var name = 'isNegative';
|
||||
var dependencies = ['typed', 'config'];
|
||||
export var createIsNegative = /* #__PURE__ */factory(name, dependencies, _ref => {
|
||||
var {
|
||||
typed,
|
||||
config
|
||||
} = _ref;
|
||||
/**
|
||||
* Test whether a value is negative: smaller than zero.
|
||||
* The function supports types `number`, `BigNumber`, `Fraction`, and `Unit`.
|
||||
*
|
||||
* The function is evaluated element-wise in case of Array or Matrix input.
|
||||
*
|
||||
* Syntax:
|
||||
*
|
||||
* math.isNegative(x)
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* math.isNegative(3) // returns false
|
||||
* math.isNegative(-2) // returns true
|
||||
* math.isNegative(0) // returns false
|
||||
* math.isNegative(-0) // returns false
|
||||
* math.isNegative(math.bignumber(2)) // returns false
|
||||
* math.isNegative(math.fraction(-2, 5)) // returns true
|
||||
* math.isNegative('-2') // returns true
|
||||
* math.isNegative([2, 0, -3]) // returns [false, false, true]
|
||||
*
|
||||
* See also:
|
||||
*
|
||||
* isNumeric, isPositive, isZero, isInteger
|
||||
*
|
||||
* @param {number | BigNumber | bigint | Fraction | Unit | Array | Matrix} x Value to be tested
|
||||
* @return {boolean} Returns true when `x` is larger than zero.
|
||||
* Throws an error in case of an unknown data type.
|
||||
*/
|
||||
return typed(name, {
|
||||
number: x => nearlyEqual(x, 0, config.relTol, config.absTol) ? false : isNegativeNumber(x),
|
||||
BigNumber: x => bigNearlyEqual(x, new x.constructor(0), config.relTol, config.absTol) ? false : x.isNeg() && !x.isZero() && !x.isNaN(),
|
||||
bigint: x => x < 0n,
|
||||
Fraction: x => x.s < 0,
|
||||
// It's enough to decide on the sign
|
||||
|
||||
Unit: typed.referToSelf(self => x => typed.find(self, x.valueType())(x.value)),
|
||||
'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))
|
||||
});
|
||||
});
|
||||
44
node_modules/mathjs/lib/esm/function/utils/isNumeric.js
generated
vendored
Normal file
44
node_modules/mathjs/lib/esm/function/utils/isNumeric.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
import { deepMap } from '../../utils/collection.js';
|
||||
import { factory } from '../../utils/factory.js';
|
||||
var name = 'isNumeric';
|
||||
var dependencies = ['typed'];
|
||||
export var createIsNumeric = /* #__PURE__ */factory(name, dependencies, _ref => {
|
||||
var {
|
||||
typed
|
||||
} = _ref;
|
||||
/**
|
||||
* Test whether a value is an numeric value.
|
||||
*
|
||||
* The function is evaluated element-wise in case of Array or Matrix input.
|
||||
*
|
||||
* Syntax:
|
||||
*
|
||||
* math.isNumeric(x)
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* math.isNumeric(2) // returns true
|
||||
* math.isNumeric('2') // returns false
|
||||
* math.hasNumericValue('2') // returns true
|
||||
* math.isNumeric(0) // returns true
|
||||
* math.isNumeric(math.bignumber('42')) // returns true
|
||||
* math.isNumeric(math.bigint('42')) // returns true
|
||||
* math.isNumeric(math.fraction(4)) // returns true
|
||||
* math.isNumeric(math.complex('2-4i')) // returns false
|
||||
* math.isNumeric([2.3, 'foo', false]) // returns [true, false, true]
|
||||
*
|
||||
* See also:
|
||||
*
|
||||
* isZero, isPositive, isNegative, isInteger, hasNumericValue
|
||||
*
|
||||
* @param {*} x Value to be tested
|
||||
* @return {boolean} Returns true when `x` is a `number`, `BigNumber`,
|
||||
* `Fraction`, or `boolean`. Returns false for other types.
|
||||
* Throws an error in case of unknown types.
|
||||
*/
|
||||
return typed(name, {
|
||||
'number | BigNumber | bigint | Fraction | boolean': () => true,
|
||||
'Complex | Unit | string | null | undefined | Node': () => false,
|
||||
'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))
|
||||
});
|
||||
});
|
||||
52
node_modules/mathjs/lib/esm/function/utils/isPositive.js
generated
vendored
Normal file
52
node_modules/mathjs/lib/esm/function/utils/isPositive.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
import { deepMap } from '../../utils/collection.js';
|
||||
import { factory } from '../../utils/factory.js';
|
||||
import { isPositiveNumber } from '../../plain/number/index.js';
|
||||
import { nearlyEqual as bigNearlyEqual } from '../../utils/bignumber/nearlyEqual.js';
|
||||
import { nearlyEqual } from '../../utils/number.js';
|
||||
var name = 'isPositive';
|
||||
var dependencies = ['typed', 'config'];
|
||||
export var createIsPositive = /* #__PURE__ */factory(name, dependencies, _ref => {
|
||||
var {
|
||||
typed,
|
||||
config
|
||||
} = _ref;
|
||||
/**
|
||||
* Test whether a value is positive: larger than zero.
|
||||
* The function supports types `number`, `BigNumber`, `Fraction`, and `Unit`.
|
||||
*
|
||||
* The function is evaluated element-wise in case of Array or Matrix input.
|
||||
*
|
||||
* Syntax:
|
||||
*
|
||||
* math.isPositive(x)
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* math.isPositive(3) // returns true
|
||||
* math.isPositive(-2) // returns false
|
||||
* math.isPositive(0) // returns false
|
||||
* math.isPositive(-0) // returns false
|
||||
* math.isPositive(0.5) // returns true
|
||||
* math.isPositive(math.bignumber(2)) // returns true
|
||||
* math.isPositive(math.fraction(-2, 5)) // returns false
|
||||
* math.isPositive(math.fraction(1, 3)) // returns true
|
||||
* math.isPositive('2') // returns true
|
||||
* math.isPositive([2, 0, -3]) // returns [true, false, false]
|
||||
*
|
||||
* See also:
|
||||
*
|
||||
* isNumeric, isZero, isNegative, isInteger
|
||||
*
|
||||
* @param {number | BigNumber | bigint | Fraction | Unit | Array | Matrix} x Value to be tested
|
||||
* @return {boolean} Returns true when `x` is larger than zero.
|
||||
* Throws an error in case of an unknown data type.
|
||||
*/
|
||||
return typed(name, {
|
||||
number: x => nearlyEqual(x, 0, config.relTol, config.absTol) ? false : isPositiveNumber(x),
|
||||
BigNumber: x => bigNearlyEqual(x, new x.constructor(0), config.relTol, config.absTol) ? false : !x.isNeg() && !x.isZero() && !x.isNaN(),
|
||||
bigint: x => x > 0n,
|
||||
Fraction: x => x.s > 0 && x.n > 0,
|
||||
Unit: typed.referToSelf(self => x => typed.find(self, x.valueType())(x.value)),
|
||||
'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))
|
||||
});
|
||||
});
|
||||
130
node_modules/mathjs/lib/esm/function/utils/isPrime.js
generated
vendored
Normal file
130
node_modules/mathjs/lib/esm/function/utils/isPrime.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
49
node_modules/mathjs/lib/esm/function/utils/isZero.js
generated
vendored
Normal file
49
node_modules/mathjs/lib/esm/function/utils/isZero.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
import { deepMap } from '../../utils/collection.js';
|
||||
import { factory } from '../../utils/factory.js';
|
||||
var name = 'isZero';
|
||||
var dependencies = ['typed', 'equalScalar'];
|
||||
export var createIsZero = /* #__PURE__ */factory(name, dependencies, _ref => {
|
||||
var {
|
||||
typed,
|
||||
equalScalar
|
||||
} = _ref;
|
||||
/**
|
||||
* Test whether a value is zero.
|
||||
* The function can check for zero for types `number`, `BigNumber`, `Fraction`,
|
||||
* `Complex`, and `Unit`.
|
||||
*
|
||||
* The function is evaluated element-wise in case of Array or Matrix input.
|
||||
*
|
||||
* Syntax:
|
||||
*
|
||||
* math.isZero(x)
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* math.isZero(0) // returns true
|
||||
* math.isZero(2) // returns false
|
||||
* math.isZero(0.5) // returns false
|
||||
* math.isZero(math.bignumber(0)) // returns true
|
||||
* math.isZero(math.fraction(0)) // returns true
|
||||
* math.isZero(math.fraction(1,3)) // returns false
|
||||
* math.isZero(math.complex('2 - 4i')) // returns false
|
||||
* math.isZero(math.complex('0i')) // returns true
|
||||
* math.isZero('0') // returns true
|
||||
* math.isZero('2') // returns false
|
||||
* math.isZero([2, 0, -3]) // returns [false, true, false]
|
||||
*
|
||||
* See also:
|
||||
*
|
||||
* isNumeric, isPositive, isNegative, isInteger
|
||||
*
|
||||
* @param {number | BigNumber | bigint | Complex | Fraction | Unit | Array | Matrix} x Value to be tested
|
||||
* @return {boolean} Returns true when `x` is zero.
|
||||
* Throws an error in case of an unknown data type.
|
||||
*/
|
||||
return typed(name, {
|
||||
'number | BigNumber | Complex | Fraction': x => equalScalar(x, 0),
|
||||
bigint: x => x === 0n,
|
||||
Unit: typed.referToSelf(self => x => typed.find(self, x.valueType())(x.value)),
|
||||
'Array | Matrix': typed.referToSelf(self => x => deepMap(x, self))
|
||||
});
|
||||
});
|
||||
75
node_modules/mathjs/lib/esm/function/utils/numeric.js
generated
vendored
Normal file
75
node_modules/mathjs/lib/esm/function/utils/numeric.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
import { typeOf } from '../../utils/is.js';
|
||||
import { factory } from '../../utils/factory.js';
|
||||
import { noBignumber, noFraction } from '../../utils/noop.js';
|
||||
var name = 'numeric';
|
||||
var dependencies = ['number', '?bignumber', '?fraction'];
|
||||
export var createNumeric = /* #__PURE__ */factory(name, dependencies, _ref => {
|
||||
var {
|
||||
number: _number,
|
||||
bignumber,
|
||||
fraction
|
||||
} = _ref;
|
||||
var validInputTypes = {
|
||||
string: true,
|
||||
number: true,
|
||||
BigNumber: true,
|
||||
Fraction: true
|
||||
};
|
||||
|
||||
// Load the conversion functions for each output type
|
||||
var validOutputTypes = {
|
||||
number: x => _number(x),
|
||||
BigNumber: bignumber ? x => bignumber(x) : noBignumber,
|
||||
bigint: x => BigInt(x),
|
||||
Fraction: fraction ? x => fraction(x) : noFraction
|
||||
};
|
||||
|
||||
/**
|
||||
* Convert a numeric input to a specific numeric type: number, BigNumber, bigint, or Fraction.
|
||||
*
|
||||
* Syntax:
|
||||
*
|
||||
* math.numeric(x)
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* math.numeric('4') // returns 4
|
||||
* math.numeric('4', 'number') // returns 4
|
||||
* math.numeric('4', 'bigint') // returns 4n
|
||||
* math.numeric('4', 'BigNumber') // returns BigNumber 4
|
||||
* math.numeric('4', 'Fraction') // returns Fraction 4
|
||||
* math.numeric(4, 'Fraction') // returns Fraction 4
|
||||
* math.numeric(math.fraction(2, 5), 'number') // returns 0.4
|
||||
*
|
||||
* See also:
|
||||
*
|
||||
* number, fraction, bignumber, bigint, string, format
|
||||
*
|
||||
* @param {string | number | BigNumber | bigint | Fraction } value
|
||||
* A numeric value or a string containing a numeric value
|
||||
* @param {string} outputType
|
||||
* Desired numeric output type.
|
||||
* Available values: 'number', 'BigNumber', or 'Fraction'
|
||||
* @return {number | BigNumber | bigint | Fraction}
|
||||
* Returns an instance of the numeric in the requested type
|
||||
*/
|
||||
return function numeric(value) {
|
||||
var outputType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'number';
|
||||
var check = arguments.length > 2 ? arguments[2] : undefined;
|
||||
if (check !== undefined) {
|
||||
throw new SyntaxError('numeric() takes one or two arguments');
|
||||
}
|
||||
var inputType = typeOf(value);
|
||||
if (!(inputType in validInputTypes)) {
|
||||
throw new TypeError('Cannot convert ' + value + ' of type "' + inputType + '"; valid input types are ' + Object.keys(validInputTypes).join(', '));
|
||||
}
|
||||
if (!(outputType in validOutputTypes)) {
|
||||
throw new TypeError('Cannot convert ' + value + ' to type "' + outputType + '"; valid output types are ' + Object.keys(validOutputTypes).join(', '));
|
||||
}
|
||||
if (outputType === inputType) {
|
||||
return value;
|
||||
} else {
|
||||
return validOutputTypes[outputType](value);
|
||||
}
|
||||
};
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user