mathjs
Version:
Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with dif
35 lines • 1.04 kB
JavaScript
import { createAnd } from '../../function/logical/and.js';
import { factory } from '../../utils/factory.js';
import { isCollection } from '../../utils/is.js';
var name = 'and';
var dependencies = ['typed', 'matrix', 'zeros', 'add', 'equalScalar', 'isZero', 'not', 'concat'];
export var createAndTransform = /* #__PURE__ */factory(name, dependencies, _ref => {
var typed = _ref.typed,
matrix = _ref.matrix,
equalScalar = _ref.equalScalar,
isZero = _ref.isZero,
zeros = _ref.zeros,
not = _ref.not,
concat = _ref.concat;
var and = createAnd({
typed,
matrix,
equalScalar,
isZero,
zeros,
not,
concat
});
function andTransform(args, math, scope) {
var condition1 = args[0].compile().evaluate(scope);
if (!isCollection(condition1) && !and(condition1, true)) {
return false;
}
var condition2 = args[1].compile().evaluate(scope);
return and(condition1, condition2);
}
andTransform.rawArgs = true;
return andTransform;
}, {
isTransformFunction: true
});