mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-25 15:07:57 +00:00
Merge pull request #1107 from josdejong/object-assign
Ponyfill Object.assign
This commit is contained in:
commit
ed2e7b5152
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user