From 1aa82662071b04d9d88e044712c2166cc4e37564 Mon Sep 17 00:00:00 2001 From: Harry Sarson Date: Mon, 21 May 2018 17:06:25 +0100 Subject: [PATCH] replace Object.assign with mathjs util map function. `Object.assign` is not supported in IE 11 and is used here to perform a shallow clone on objects. The `map` function from `utils/object.js` can be used instead for this cloning. --- lib/utils/bignumber/formatter.js | 5 ++++- lib/utils/number.js | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/utils/bignumber/formatter.js b/lib/utils/bignumber/formatter.js index 748207aac..ae8265714 100644 --- a/lib/utils/bignumber/formatter.js +++ b/lib/utils/bignumber/formatter.js @@ -1,4 +1,7 @@ 'use strict'; + +var objectUtils = require('../object'); + /** * Convert a BigNumber to a formatted string representation. * @@ -107,7 +110,7 @@ exports.format = function (value, options) { // TODO: clean up some day. Deprecated since: 2018-01-24 // @deprecated upper and lower are replaced with upperExp and lowerExp since v4.0.0 if (options && options.exponential && (options.exponential.lower !== undefined || options.exponential.upper !== undefined)) { - var fixedOptions = Object.assign({}, options); + var fixedOptions = objectUtils.map(options, function (x) { return x; }); fixedOptions.exponential = undefined; if (options.exponential.lower !== undefined) { fixedOptions.lowerExp = Math.round(Math.log(options.exponential.lower) / Math.LN10); diff --git a/lib/utils/number.js b/lib/utils/number.js index 1ffb49dfd..8bfc12cfc 100644 --- a/lib/utils/number.js +++ b/lib/utils/number.js @@ -1,5 +1,7 @@ 'use strict'; +var objectUtils = require('./object'); + /** * @typedef {{sign: '+' | '-' | '', coefficients: number[], exponent: number}} SplitValue */ @@ -162,7 +164,7 @@ exports.format = function(value, options) { // TODO: clean up some day. Deprecated since: 2018-01-24 // @deprecated upper and lower are replaced with upperExp and lowerExp since v4.0.0 if (options && options.exponential && (options.exponential.lower !== undefined || options.exponential.upper !== undefined)) { - var fixedOptions = Object.assign({}, options); + var fixedOptions = objectUtils.map(options, function(x) { return x; }); fixedOptions.exponential = undefined; if (options.exponential.lower !== undefined) { fixedOptions.lowerExp = Math.round(Math.log(options.exponential.lower) / Math.LN10);