simplify _composeOp

This commit is contained in:
Felix Roos 2024-03-01 00:32:45 +01:00
parent 4f55144232
commit bf343eb499

View File

@ -896,16 +896,15 @@ addToPrototype('weaveWith', function (t, ...funcs) {
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// compose matrix functions // compose matrix functions
// TODO - adopt value.mjs fully.. function _nonArrayObject(x) {
return !Array.isArray(x) && typeof x === 'object';
}
function _composeOp(a, b, func) { function _composeOp(a, b, func) {
function _nonFunctionObject(x) { if (_nonArrayObject(a) || _nonArrayObject(b)) {
return x instanceof Object && !(x instanceof Function); if (!_nonArrayObject(a)) {
}
if (_nonFunctionObject(a) || _nonFunctionObject(b)) {
if (!_nonFunctionObject(a)) {
a = { value: a }; a = { value: a };
} }
if (!_nonFunctionObject(b)) { if (!_nonArrayObject(b)) {
b = { value: b }; b = { value: b };
} }
return unionWithObj(a, b, func); return unionWithObj(a, b, func);