Merge pull request #1107 from josdejong/object-assign

Ponyfill Object.assign
This commit is contained in:
Jos de Jong 2018-05-21 20:16:24 +02:00 committed by GitHub
commit ed2e7b5152
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -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);

View File

@ -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);