@khanacademy/kas 0.3.10 → 0.3.12

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.
@@ -0,0 +1,2 @@
1
+ import type { CompareOptions, CompareResult, Expression } from "./types";
2
+ export declare const compare: (expr1: Expression, expr2: Expression, options: CompareOptions) => CompareResult;
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.3.10";
6
+ const libVersion = "0.3.12";
7
7
  addLibraryVersionToPerseusDebug(libName, libVersion);
8
8
 
9
9
  // this is a @generated file
@@ -5817,15 +5817,27 @@ var derivedUnits = {
5817
5817
  const Zero = Num.Zero;
5818
5818
  const One = Num.One;
5819
5819
 
5820
- /* eslint-disable */
5820
+ function _extends() {
5821
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
5822
+ for (var i = 1; i < arguments.length; i++) {
5823
+ var source = arguments[i];
5824
+ for (var key in source) {
5825
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
5826
+ target[key] = source[key];
5827
+ }
5828
+ }
5829
+ }
5830
+ return target;
5831
+ };
5832
+ return _extends.apply(this, arguments);
5833
+ }
5821
5834
 
5822
5835
  // Assumes that both expressions have already been parsed
5823
5836
  // TODO(alex): be able to pass a random() function to compare()
5824
5837
  const compare = function compare(expr1, expr2, options) {
5825
- var defaults = {
5838
+ const defaults = {
5826
5839
  form: false,
5827
- // Check that the two expressions have the same form
5828
- simplify: false // Check that the second expression is simplified
5840
+ simplify: false
5829
5841
  };
5830
5842
 
5831
5843
  /* Options that could be added in the future:
@@ -5833,20 +5845,14 @@ const compare = function compare(expr1, expr2, options) {
5833
5845
  * like slope
5834
5846
  * - Allow student to choose their own variable names
5835
5847
  */
5836
-
5837
- if (options !== undefined) {
5838
- // eslint-disable-next-line no-undef
5839
- options = _.extend(defaults, options);
5840
- } else {
5841
- options = defaults;
5842
- }
5848
+ options = _extends({}, defaults, options);
5843
5849
 
5844
5850
  // TODO(CP-1614): Figure out how to make these messages translatable
5845
5851
 
5846
5852
  // Variable check
5847
- var vars = expr1.sameVars(expr2);
5853
+ const vars = expr1.sameVars(expr2);
5848
5854
  if (!vars.equal) {
5849
- var message;
5855
+ let message;
5850
5856
  if (vars.equalIgnoringCase) {
5851
5857
  message = "Check your variables; one or more are using " + "the wrong case (upper or lower).";
5852
5858
  } else {