This commit is contained in:
Jade (Rose) Rowland
2025-09-16 11:52:36 -04:00
parent 9cdba1a50e
commit 89b7eac789
3 changed files with 5 additions and 5 deletions
+2
View File
@@ -126,6 +126,8 @@ export const lcm = (...fractions) => {
);
};
export const isFraction = (x) => x instanceof Fraction;
fraction._original = Fraction;
export default fraction;
+2 -4
View File
@@ -5,8 +5,7 @@ This program is free software: you can redistribute it and/or modify it under th
*/
import TimeSpan from './timespan.mjs';
import Fraction, { lcm } from './fraction.mjs';
import FractionClass from 'fraction.js';
import Fraction, {isFraction, lcm } from './fraction.mjs';
import Hap from './hap.mjs';
import State from './state.mjs';
import { unionWithObj } from './value.mjs';
@@ -27,7 +26,6 @@ import {
} from './util.mjs';
import drawLine from './drawLine.mjs';
import { logger } from './logger.mjs';
import fraction from './fraction.mjs';
let stringParser;
@@ -1001,7 +999,7 @@ addToPrototype('weaveWith', function (t, ...funcs) {
// compose matrix functions
function _nonArrayObject(x) {
return !Array.isArray(x) && typeof x === 'object' && !(x instanceof FractionClass);
return !Array.isArray(x) && typeof x === 'object' && !isFraction(x);
}
function _composeOp(a, b, func) {
if (_nonArrayObject(a) || _nonArrayObject(b)) {
+1 -1
View File
@@ -877,7 +877,7 @@ describe('Pattern', () => {
.squeezeJoin()
.queryArc(3, 4)
.map((x) => x.value),
).toStrictEqual([3]);
).toStrictEqual([Fraction(3)]);
});
});
describe('ply', () => {