Permalink
Browse files

Update standard to the latest version 🚀 (#1226)

* chore(package): update standard to version 12.0.0

* update to new lint version with --fix

I believe this mainly adds whitespace to `{}`'s.

* Replace assert.equal with assert.strictEqual

This breaks a lot of tests which I will endevour to fix in the next
commits.

* Fix most errors due to assert.strictEquals

Some instances of `strictEquals` are replaced by `deepEquals`.
`toString` has been used to make some string comparisions explicit.
Tests will still fail untill #1236 and #1237 are fixed.

* Fix assertion erros due to -0

With node 10, assert.strictEqual no longer considers `0 === -0`.
I missed these first time round as I was using node 8.

* Put toString correct side of bracket

I was converting the constructor to a string rather
than the result of the computation. Oops.

* Fixed #1236: quantileSeq has inconsistant return

* Update package-lock

* Fixed #1237: norm sometimes returning a complex number instead of number

* Fix cli tests

* More changes for standardjs, and fixes in unit tests
  • Loading branch information...
greenkeeper[bot] authored and josdejong committed Sep 8, 2018
1 parent dec78c5 commit c5971b371a5610caf37de0d6507a1c7150280f09
Showing 339 changed files with 8,993 additions and 8,984 deletions.
@@ -5,6 +5,9 @@
- Fixed a typo in the docs of `parse`. Thanks @mathiasvr.
- Fixed #1222: a typo in the docs of `subset`.
- Fixed #1236: quantileSeq has inconsistant return.
- Fixed #1237: norm sometimes returning a complex number instead of
number.
- Upgraded devDependencies (`uglify-js@3.4.8`, `webpack@4.17.1`).
@@ -18,7 +18,7 @@ function pad (text) {
}
const expr = '2 + 3 * sin(pi / 4) - 4x'
let scope = {x: 2}
let scope = { x: 2 }
const compiled = math.parse(expr).compile(math, {})
const sin = getSafeProperty(math, 'sin')
@@ -78,6 +78,6 @@ suite
function assertApproxEqual (actual, expected, tolerance) {
const diff = Math.abs(expected - actual)
if (diff > tolerance) assert.equal(actual, expected)
if (diff > tolerance) assert.strictEqual(actual, expected)
else assert.ok(diff <= tolerance, actual + ' === ' + expected)
}
@@ -251,7 +251,7 @@ function runStream (input, output, mode, parenthesis) {
case 'string':
try {
const string = math.parse(expr).toString({parenthesis: parenthesis})
const string = math.parse(expr).toString({ parenthesis: parenthesis })
console.log(string)
} catch (err) {
console.log(err.toString())
@@ -260,7 +260,7 @@ function runStream (input, output, mode, parenthesis) {
case 'tex':
try {
const tex = math.parse(expr).toTex({parenthesis: parenthesis})
const tex = math.parse(expr).toTex({ parenthesis: parenthesis })
console.log(tex)
} catch (err) {
console.log(err.toString())
@@ -397,7 +397,7 @@ process.argv.forEach(function (arg, index) {
parenthesis = 'all'
break
// TODO: implement configuration via command line arguments
// TODO: implement configuration via command line arguments
default:
scripts.push(arg)
@@ -7,4 +7,4 @@
global.math = require('../index')
const repl = require('repl')
repl.start({useGlobal: true})
repl.start({ useGlobal: true })
@@ -16,7 +16,7 @@ const core = require('../../core')
const math = core.create()
// Configure to use fractions by default
math.config({number: 'Fraction'})
math.config({ number: 'Fraction' })
// Add a conversion from Faction -> BigNumber
// this conversion:
@@ -28,7 +28,7 @@ math.import({
'parse': function () { throw new Error('Function parse is disabled') },
'simplify': function () { throw new Error('Function simplify is disabled') },
'derivative': function () { throw new Error('Function derivative is disabled') }
}, {override: true})
}, { override: true })
console.log(limitedEval('sqrt(16)')) // Ok, 4
console.log(limitedEval('parse("2+3")')) // Error: Function parse is disabled
@@ -5,7 +5,7 @@ const workerpool = require('workerpool')
function noImport () {
throw new Error('function import is disabled.')
}
math.import({'import': noImport}, {override: true})
math.import({ 'import': noImport }, { override: true })
/**
* Evaluate an expression
@@ -11,15 +11,15 @@ const math = require('../index')
console.log('simplify expressions')
console.log(math.simplify('3 + 2 / 4').toString()) // '7 / 2'
console.log(math.simplify('2x + 3x').toString()) // '5 * x'
console.log(math.simplify('2 * 3 * x', {x: 4}).toString()) // '24'
console.log(math.simplify('2 * 3 * x', { x: 4 }).toString()) // '24'
console.log(math.simplify('x^2 + x + 3 + x^2').toString()) // '2 * x ^ 2 + x + 3'
console.log(math.simplify('x * y * -x / (x ^ 2)').toString()) // '-y'
// work with an expression tree, evaluate results
const f = math.parse('2x + x')
const simplified = math.simplify(f)
console.log(simplified.toString()) // '3 * x'
console.log(simplified.eval({x: 4})) // 12
console.log(simplified.eval({ x: 4 })) // 12
console.log()
// calculate a derivative
@@ -31,4 +31,4 @@ console.log(math.derivative('sin(2x)', 'x').toString()) // '2 * cos(2 * x)'
const h = math.parse('x^2 + x')
const dh = math.derivative(h, 'x')
console.log(dh.toString()) // '2 * x + 1'
console.log(dh.eval({x: 3})) // '7'
console.log(dh.eval({ x: 3 })) // '7'
@@ -38,7 +38,7 @@ console.log()
// create a complex number from polar coordinates
console.log('create complex numbers with polar coordinates')
const c = math.complex({r: math.sqrt(2), phi: math.pi / 4})
const c = math.complex({ r: math.sqrt(2), phi: math.pi / 4 })
print(c) // 1 + i
// get polar coordinates of a complex number
@@ -46,8 +46,8 @@ console.log()
console.log('output formatting of fractions')
const a = math.fraction('2/3')
console.log(math.format(a)) // Fraction, 2/3
console.log(math.format(a, {fraction: 'ratio'})) // Fraction, 2/3
console.log(math.format(a, {fraction: 'decimal'})) // Fraction, 0.(6)
console.log(math.format(a, { fraction: 'ratio' })) // Fraction, 2/3
console.log(math.format(a, { fraction: 'decimal' })) // Fraction, 0.(6)
console.log(a.toString()) // Fraction, 0.(6)
console.log()
@@ -57,7 +57,7 @@ console.log()
* @param {*} value
*/
function printRatio (value) {
console.log(math.format(value, {fraction: 'ratio'}))
console.log(math.format(value, { fraction: 'ratio' }))
}
/**
@@ -66,5 +66,5 @@ function printRatio (value) {
* @param {*} value
*/
function print (value) {
console.log(math.format(value, {fraction: 'decimal'}))
console.log(math.format(value, { fraction: 'decimal' }))
}
@@ -34,7 +34,7 @@ try {
const numbers = require('numbers')
// import the numbers.js library into math.js
math.import(numbers, {wrap: true, silent: true})
math.import(numbers, { wrap: true, silent: true })
if (math.fibonacci) {
// calculate fibonacci
@@ -56,7 +56,7 @@ try {
const numeric = require('numeric')
// import the numeric.js library into math.js
math.import(numeric, {wrap: true, silent: true})
math.import(numeric, { wrap: true, silent: true })
if (math.eig) {
// calculate eigenvalues of a matrix
Oops, something went wrong.

0 comments on commit c5971b3

Please sign in to comment.