@khanacademy/kas 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/index.js +14 -4
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/dist/nodes.d.ts +1 -1
- package/package.json +1 -1
package/dist/es/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import _ from 'underscore';
|
|
|
3
3
|
|
|
4
4
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
5
5
|
const libName = "@khanacademy/kas";
|
|
6
|
-
const libVersion = "0.4.
|
|
6
|
+
const libVersion = "0.4.2";
|
|
7
7
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
8
8
|
|
|
9
9
|
function _extends() {
|
|
@@ -2877,6 +2877,7 @@ class Expr {
|
|
|
2877
2877
|
|
|
2878
2878
|
// return the child nodes of this node
|
|
2879
2879
|
exprArgs() {
|
|
2880
|
+
// @ts-expect-error: Type 'string | number | Expr | undefined' is not assignable to type 'string | Expr'.
|
|
2880
2881
|
return this.args().filter(isExpr);
|
|
2881
2882
|
}
|
|
2882
2883
|
|
|
@@ -3303,7 +3304,9 @@ class Add extends Seq {
|
|
|
3303
3304
|
return Mul.createOrAppend(left, right).flatten();
|
|
3304
3305
|
}
|
|
3305
3306
|
reduce(options) {
|
|
3306
|
-
return _.reduce(this.terms,
|
|
3307
|
+
return _.reduce(this.terms,
|
|
3308
|
+
// @ts-expect-error: Type 'Expr' is not assignable to type 'Num'.
|
|
3309
|
+
(memo, term) => {
|
|
3307
3310
|
return memo.add(term, options);
|
|
3308
3311
|
}, this.identity);
|
|
3309
3312
|
}
|
|
@@ -3684,7 +3687,9 @@ class Mul extends Seq {
|
|
|
3684
3687
|
}
|
|
3685
3688
|
}
|
|
3686
3689
|
reduce(options) {
|
|
3687
|
-
return _.reduce(this.terms,
|
|
3690
|
+
return _.reduce(this.terms,
|
|
3691
|
+
// @ts-expect-error: Type 'Expr' is not assignable to type 'Num'.
|
|
3692
|
+
(memo, term) => {
|
|
3688
3693
|
return memo.mul(term, options);
|
|
3689
3694
|
}, this.identity);
|
|
3690
3695
|
}
|
|
@@ -3885,9 +3890,14 @@ class Mul extends Seq {
|
|
|
3885
3890
|
var posOrNeg = function posOrNeg(num) {
|
|
3886
3891
|
return pos(num) || neg(num);
|
|
3887
3892
|
};
|
|
3893
|
+
|
|
3894
|
+
// @ts-expect-error: Type 'Expr' is not assignable to type 'Num'.
|
|
3888
3895
|
const posNum = numbers.find(pos);
|
|
3896
|
+
// @ts-expect-error: Type 'Expr' is not assignable to type 'Num'.
|
|
3889
3897
|
const negNum = numbers.find(neg);
|
|
3890
|
-
if (numbers.length > 1 && negNum && posNum &&
|
|
3898
|
+
if (numbers.length > 1 && negNum && posNum &&
|
|
3899
|
+
// @ts-expect-error: Type 'Expr' is not assignable to type 'Num'.
|
|
3900
|
+
_.every(numbers, posOrNeg)) {
|
|
3891
3901
|
var firstNeg = _.indexOf(expr.terms, negNum);
|
|
3892
3902
|
var firstNum = _.indexOf(expr.terms, posNum);
|
|
3893
3903
|
|