mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-25 15:07:57 +00:00
Removed errors for stuff deprecated since v0.16.0
This commit is contained in:
parent
a7b24eca8c
commit
2730edfd60
@ -110,10 +110,6 @@ exports.format = function format(value, options) {
|
||||
case 'fixed':
|
||||
return exports.toFixed(value, precision);
|
||||
|
||||
// TODO: notation 'scientific' is deprecated since version 0.16.0, remove this some day
|
||||
case 'scientific':
|
||||
throw new Error('Format notation "scientific" is deprecated. Use "exponential" instead.');
|
||||
|
||||
case 'exponential':
|
||||
return exports.toExponential(value, precision);
|
||||
|
||||
@ -130,10 +126,6 @@ exports.format = function format(value, options) {
|
||||
upper = options.exponential.upper;
|
||||
}
|
||||
}
|
||||
else if (options && options.scientific) {
|
||||
// TODO: 'options.scientific' is deprecated since version 0.16.0, remove this some day
|
||||
throw new Error('options.scientific is deprecated, use options.exponential instead.');
|
||||
}
|
||||
|
||||
// adjust the configuration of the BigNumber constructor (yeah, this is quite tricky...)
|
||||
var oldConfig = value.constructor.config({});
|
||||
|
||||
@ -139,10 +139,6 @@ exports.format = function format(value, options) {
|
||||
case 'fixed':
|
||||
return exports.toFixed(value, precision);
|
||||
|
||||
// TODO: notation 'scientific' is deprecated since version 0.16.0, remove this some day
|
||||
case 'scientific':
|
||||
throw new Error('Format notation "scientific" is deprecated. Use "exponential" instead.');
|
||||
|
||||
case 'exponential':
|
||||
return exports.toExponential(value, precision);
|
||||
|
||||
@ -159,10 +155,6 @@ exports.format = function format(value, options) {
|
||||
upper = options.exponential.upper;
|
||||
}
|
||||
}
|
||||
else if (options && options.scientific) {
|
||||
// TODO: 'options.scientific' is deprecated since version 0.16.0, remove this some day
|
||||
throw new Error('options.scientific is deprecated, use options.exponential instead.');
|
||||
}
|
||||
|
||||
// handle special case zero
|
||||
if (value === 0) return '0';
|
||||
|
||||
@ -74,16 +74,4 @@ describe('deprecated stuff', function() {
|
||||
}, /Deprecated keyword "function"/);
|
||||
});
|
||||
|
||||
it ('should throw an error when using deprecated notation "scientific in number.format"', function () {
|
||||
assert.throws(function () {
|
||||
new number.format(2.3, {notation: 'scientific'});
|
||||
}, /Format notation "scientific" is deprecated/);
|
||||
});
|
||||
|
||||
it ('should throw an error when using deprecated option "scientific in number.format"', function () {
|
||||
assert.throws(function () {
|
||||
new number.format(2.3, {notation: 'auto', scientific: 5});
|
||||
}, /options.scientific is deprecated/);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@ -32,6 +32,11 @@ describe('Complex', function () {
|
||||
assert.throws(function () { new Complex(true, 2); });
|
||||
});
|
||||
|
||||
it('should throw an error if called with wrong type of arguments', function() {
|
||||
assert.throws(function () { new Complex(1, true); });
|
||||
assert.throws(function () { new Complex({}); }, /Object with the re and im or r and phi properties expected/);
|
||||
});
|
||||
|
||||
it('should throw an error if called without new operator', function() {
|
||||
assert.throws(function () { Complex(3, -4); });
|
||||
});
|
||||
@ -238,6 +243,11 @@ describe('Complex', function () {
|
||||
assert.throws(function() { Complex.fromPolar(1, true)});
|
||||
assert.throws(function() { Complex.fromPolar(1, {})});
|
||||
});
|
||||
|
||||
it('should throw an error in case of wrong number of arguments', function() {
|
||||
assert.throws(function() { Complex.fromPolar(1,2,3)}, /Wrong number of arguments/);
|
||||
assert.throws(function() { Complex.fromPolar()}, /Wrong number of arguments/);
|
||||
});
|
||||
});
|
||||
|
||||
describe('toPolar', function() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user