Setup Babel compilation (WIP)

This commit is contained in:
jos 2018-06-06 14:31:33 +02:00
parent 8d0f671391
commit f87ec1c6db
17 changed files with 1111 additions and 265 deletions

6
.babelrc Normal file
View File

@ -0,0 +1,6 @@
{
"presets": [
["env"]
],
"plugins": ["transform-object-assign"]
}

View File

@ -57,7 +57,7 @@ var PRECISION = 14; // decimals
* @return {*}
*/
function getMath () {
return require('../index');
return require('../dist/math.js');
}
/**

View File

@ -4,7 +4,7 @@
* This simply preloads mathjs and drops you into a REPL to
* help interactive debugging.
**/
math = require('../index');
math = require('../dist/math');
var repl = require('repl');
repl.start({useGlobal: true});

View File

@ -61,6 +61,15 @@ var webpackConfig = {
// new webpack.optimize.ModuleConcatenationPlugin()
// TODO: ModuleConcatenationPlugin seems not to work. https://medium.com/webpack/webpack-3-official-release-15fd2dd8f07b
],
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: "babel-loader"
}
]
},
optimization: {
minimize: false
},
@ -80,7 +89,7 @@ var uglifyConfig = {
// create a single instance of the compiler to allow caching
var compiler = webpack(webpackConfig);
gulp.task('bundle', ['validate'], function (cb) {
gulp.task('bundle', [], function (cb) {
// update the banner contents (has a date in it which should stay up to date)
bannerPlugin.banner = createBanner();
@ -123,7 +132,7 @@ gulp.task('minify', ['bundle'], function () {
});
// test whether the docs for the expression parser are complete
gulp.task('validate', function (cb) {
gulp.task('validate', ['minify'], function (cb) {
var child_process = require('child_process');
// this is run in a separate process as the modules need to be reloaded
@ -149,4 +158,4 @@ gulp.task('watch', ['bundle'], function () {
});
// The default task (called when you run `gulp`)
gulp.task('default', ['bundle', 'minify', 'docs']);
gulp.task('default', ['bundle', 'minify', 'validate', 'docs']);

View File

@ -1,10 +1,10 @@
'use strict';
'use strict'
var number = require('./number');
var string = require('./string');
import number from './number'
import string from './string'
var DimensionError = require('../error/DimensionError');
var IndexError = require('../error/IndexError');
import DimensionError from '../error/DimensionError'
import IndexError from'../error/IndexError'
/**
* Calculate the size of a multi dimensional array.
@ -13,16 +13,16 @@ var IndexError = require('../error/IndexError');
* @param {Array} x
* @Return {Number[]} size
*/
exports.size = function (x) {
var s = [];
export function size(x) {
let s = []
while (Array.isArray(x)) {
s.push(x.length);
x = x[0];
s.push(x.length)
x = x[0]
}
return s;
};
return s
}
/**
* Recursively validate whether each element in a multi dimensional array
@ -34,29 +34,29 @@ exports.size = function (x) {
* @private
*/
function _validate(array, size, dim) {
var i;
var len = array.length;
let i
const len = array.length
if (len != size[dim]) {
throw new DimensionError(len, size[dim]);
if (len !== size[dim]) {
throw new DimensionError(len, size[dim])
}
if (dim < size.length - 1) {
// recursively validate each child array
var dimNext = dim + 1;
const dimNext = dim + 1
for (i = 0; i < len; i++) {
var child = array[i];
const child = array[i]
if (!Array.isArray(child)) {
throw new DimensionError(size.length - 1, size.length, '<');
throw new DimensionError(size.length - 1, size.length, '<')
}
_validate(array[i], size, dimNext);
_validate(array[i], size, dimNext)
}
}
else {
// last dimension. none of the childs may be an array
for (i = 0; i < len; i++) {
if (Array.isArray(array[i])) {
throw new DimensionError(size.length + 1, size.length, '>');
throw new DimensionError(size.length + 1, size.length, '>')
}
}
}
@ -69,19 +69,19 @@ function _validate(array, size, dim) {
* @param {number[]} size Array with the size of each dimension
* @throws DimensionError
*/
exports.validate = function(array, size) {
var isScalar = (size.length == 0);
export function validate(array, size) {
const isScalar = (size.length === 0)
if (isScalar) {
// scalar
if (Array.isArray(array)) {
throw new DimensionError(array.length, 0);
throw new DimensionError(array.length, 0)
}
}
else {
// array
_validate(array, size, 0);
_validate(array, size, 0)
}
};
}
/**
* Test whether index is an integer number with index >= 0 and index < length
@ -91,12 +91,12 @@ exports.validate = function(array, size) {
*/
exports.validateIndex = function(index, length) {
if (!number.isNumber(index) || !number.isInteger(index)) {
throw new TypeError('Index must be an integer (value: ' + index + ')');
throw new TypeError('Index must be an integer (value: ' + index + ')')
}
if (index < 0 || (typeof length === 'number' && index >= length)) {
throw new IndexError(index, length);
throw new IndexError(index, length)
}
};
}
/**
* Resize a multi dimensional array. The resized array is returned.
@ -108,31 +108,31 @@ exports.validateIndex = function(index, length) {
* set.
* @return {Array} array The resized array
*/
exports.resize = function(array, size, defaultValue) {
export function resize(array, size, defaultValue) {
// TODO: add support for scalars, having size=[] ?
// check the type of the arguments
if (!Array.isArray(array) || !Array.isArray(size)) {
throw new TypeError('Array expected');
throw new TypeError('Array expected')
}
if (size.length === 0) {
throw new Error('Resizing to scalar is not supported');
throw new Error('Resizing to scalar is not supported')
}
// check whether size contains positive integers
size.forEach(function (value) {
if (!number.isNumber(value) || !number.isInteger(value) || value < 0) {
throw new TypeError('Invalid size, must contain positive integers ' +
'(size: ' + string.format(size) + ')');
'(size: ' + string.format(size) + ')')
}
});
})
// recursively resize the array
var _defaultValue = (defaultValue !== undefined) ? defaultValue : 0;
_resize(array, size, 0, _defaultValue);
const _defaultValue = (defaultValue !== undefined) ? defaultValue : 0
_resize(array, size, 0, _defaultValue)
return array;
};
return array
}
/**
* Recursively resize a multi dimensional array
@ -144,38 +144,38 @@ exports.resize = function(array, size, defaultValue) {
* @private
*/
function _resize (array, size, dim, defaultValue) {
var i;
var elem;
var oldLen = array.length;
var newLen = size[dim];
var minLen = Math.min(oldLen, newLen);
let i
let elem
const oldLen = array.length
const newLen = size[dim]
const minLen = Math.min(oldLen, newLen)
// apply new length
array.length = newLen;
array.length = newLen
if (dim < size.length - 1) {
// non-last dimension
var dimNext = dim + 1;
const dimNext = dim + 1
// resize existing child arrays
for (i = 0; i < minLen; i++) {
// resize child array
elem = array[i];
elem = array[i]
if (!Array.isArray(elem)) {
elem = [elem]; // add a dimension
array[i] = elem;
array[i] = elem
}
_resize(elem, size, dimNext, defaultValue);
_resize(elem, size, dimNext, defaultValue)
}
// create new child arrays
for (i = minLen; i < newLen; i++) {
// get child array
elem = [];
array[i] = elem;
elem = []
array[i] = elem
// resize new child array
_resize(elem, size, dimNext, defaultValue);
_resize(elem, size, dimNext, defaultValue)
}
}
else {
@ -184,13 +184,13 @@ function _resize (array, size, dim, defaultValue) {
// remove dimensions of existing values
for (i = 0; i < minLen; i++) {
while (Array.isArray(array[i])) {
array[i] = array[i][0];
array[i] = array[i][0]
}
}
// fill new elements with the default value
for (i = minLen; i < newLen; i++) {
array[i] = defaultValue;
array[i] = defaultValue
}
}
}
@ -205,35 +205,33 @@ function _resize (array, size, dim, defaultValue) {
* @throws {DimensionError} If the product of the new dimension sizes does
* not equal that of the old ones
*/
exports.reshape = function(array, sizes) {
var flatArray = exports.flatten(array);
var newArray;
export function reshape(array, sizes) {
const flatArray = exports.flatten(array)
let newArray
var product = function (arr) {
return arr.reduce(function (prev, curr) {
return prev * curr;
});
};
function product(arr) {
return arr.reduce((prev, curr) => prev * curr)
}
if (!Array.isArray(array) || !Array.isArray(sizes)) {
throw new TypeError('Array expected');
throw new TypeError('Array expected')
}
if (sizes.length === 0) {
throw new DimensionError(0, product(exports.size(array)), '!=');
throw new DimensionError(0, product(exports.size(array)), '!=')
}
try {
newArray = _reshape(flatArray, sizes);
newArray = _reshape(flatArray, sizes)
} catch (e) {
if (e instanceof DimensionError) {
throw new DimensionError(
product(sizes),
product(exports.size(array)),
'!='
);
)
}
throw e;
throw e
}
if (flatArray.length > 0) {
@ -241,11 +239,11 @@ exports.reshape = function(array, sizes) {
product(sizes),
product(exports.size(array)),
'!='
);
)
}
return newArray;
};
return newArray
}
/**
* Recursively re-shape a multi dimensional array to fit the specified dimensions
@ -258,19 +256,19 @@ exports.reshape = function(array, sizes) {
* not equal that of the old ones
*/
function _reshape(array, sizes) {
var accumulator = [];
var i;
let accumulator = []
let i
if (sizes.length === 0) {
if (array.length === 0) {
throw new DimensionError(null, null, '!=');
throw new DimensionError(null, null, '!=')
}
return array.shift();
return array.shift()
}
for (i = 0; i < sizes[0]; i += 1) {
accumulator.push(_reshape(array, sizes.slice(1)));
accumulator.push(_reshape(array, sizes.slice(1)))
}
return accumulator;
return accumulator
}
@ -281,28 +279,28 @@ function _reshape(array, sizes) {
* @returns {Array} returns the array itself
*/
exports.squeeze = function(array, size) {
var s = size || exports.size(array);
let s = size || exports.size(array)
// squeeze outer dimensions
while (Array.isArray(array) && array.length === 1) {
array = array[0];
s.shift();
array = array[0]
s.shift()
}
// find the first dimension to be squeezed
var dims = s.length;
let dims = s.length
while (s[dims - 1] === 1) {
dims--;
dims--
}
// squeeze inner dimensions
if (dims < s.length) {
array = _squeeze(array, dims, 0);
s.length = dims;
array = _squeeze(array, dims, 0)
s.length = dims
}
return array;
};
return array
}
/**
* Recursively squeeze a multi dimensional array
@ -313,21 +311,21 @@ exports.squeeze = function(array, size) {
* @private
*/
function _squeeze (array, dims, dim) {
var i, ii;
let i, ii
if (dim < dims) {
var next = dim + 1;
const next = dim + 1
for (i = 0, ii = array.length; i < ii; i++) {
array[i] = _squeeze(array[i], dims, next);
array[i] = _squeeze(array[i], dims, next)
}
}
else {
while (Array.isArray(array)) {
array = array[0];
array = array[0]
}
}
return array;
return array
}
/**
@ -342,25 +340,25 @@ function _squeeze (array, dims, dim) {
* @returns {Array} returns the array itself
* @private
*/
exports.unsqueeze = function(array, dims, outer, size) {
var s = size || exports.size(array);
export function unsqueeze(array, dims, outer, size) {
let s = size || exports.size(array)
// unsqueeze outer dimensions
if (outer) {
for (var i = 0; i < outer; i++) {
array = [array];
s.unshift(1);
for (let i = 0; i < outer; i++) {
array = [array]
s.unshift(1)
}
}
// unsqueeze inner dimensions
array = _unsqueeze(array, dims, 0);
array = _unsqueeze(array, dims, 0)
while (s.length < dims) {
s.push(1);
s.push(1)
}
return array;
};
return array
}
/**
* Recursively unsqueeze a multi dimensional array
@ -371,21 +369,21 @@ exports.unsqueeze = function(array, dims, outer, size) {
* @private
*/
function _unsqueeze (array, dims, dim) {
var i, ii;
let i, ii
if (Array.isArray(array)) {
var next = dim + 1;
const next = dim + 1
for (i = 0, ii = array.length; i < ii; i++) {
array[i] = _unsqueeze(array[i], dims, next);
array[i] = _unsqueeze(array[i], dims, next)
}
}
else {
for (var d = dim; d < dims; d++) {
array = [array];
for (let d = dim; d < dims; d++) {
array = [array]
}
}
return array;
return array
}
/**
* Flatten a multi dimensional array, put all elements in a one dimensional
@ -393,32 +391,32 @@ function _unsqueeze (array, dims, dim) {
* @param {Array} array A multi dimensional array
* @return {Array} The flattened array (1 dimensional)
*/
exports.flatten = function(array) {
export function flatten(array) {
if (!Array.isArray(array)) {
//if not an array, return as is
return array;
return array
}
var flat = [];
let flat = []
array.forEach(function callback(value) {
if (Array.isArray(value)) {
value.forEach(callback); //traverse through sub-arrays recursively
}
else {
flat.push(value);
flat.push(value)
}
});
})
return flat;
};
return flat
}
/**
* A safe map
* @param {Array} array
* @param {function} callback
*/
exports.map = function (array, callback) {
return Array.prototype.map.call(array, callback);
export function map(array, callback) {
return Array.prototype.map.call(array, callback)
}
/**
@ -426,8 +424,8 @@ exports.map = function (array, callback) {
* @param {Array} array
* @param {function} callback
*/
exports.forEach = function (array, callback) {
Array.prototype.forEach.call(array, callback);
export function forEach(array, callback) {
Array.prototype.forEach.call(array, callback)
}
/**
@ -435,12 +433,12 @@ exports.forEach = function (array, callback) {
* @param {Array} array
* @param {function} callback
*/
exports.filter = function (array, callback) {
export function filter(array, callback) {
if (exports.size(array).length !== 1) {
throw new Error('Only one dimensional matrices supported');
throw new Error('Only one dimensional matrices supported')
}
return Array.prototype.filter.call(array, callback);
return Array.prototype.filter.call(array, callback)
}
/**
@ -450,14 +448,12 @@ exports.filter = function (array, callback) {
* @return {Array} Returns the filtered array
* @private
*/
exports.filterRegExp = function (array, regexp) {
export function filterRegExp(array, regexp) {
if (exports.size(array).length !== 1) {
throw new Error('Only one dimensional matrices supported');
throw new Error('Only one dimensional matrices supported')
}
return Array.prototype.filter.call(array, function (entry) {
return regexp.test(entry);
});
return Array.prototype.filter.call(array, (entry) => regexp.test(entry))
}
/**
@ -465,8 +461,8 @@ exports.filterRegExp = function (array, regexp) {
* @param {Array} array
* @param {string} separator
*/
exports.join = function (array, separator) {
return Array.prototype.join.call(array, separator);
export function join(array, separator) {
return Array.prototype.join.call(array, separator)
}
/**
@ -474,49 +470,49 @@ exports.join = function (array, separator) {
* @param {Array} a An array
* @return {Array} An array of objects containing the original value and its identifier
*/
exports.identify = function(a) {
export function identify(a) {
if (!Array.isArray(a)) {
throw new TypeError('Array input expected');
throw new TypeError('Array input expected')
}
if (a.length === 0) {
return a;
return a
}
var b = [];
var count = 0;
b[0] = {value: a[0], identifier: 0};
for (var i=1; i<a.length; i++) {
let b = []
let count = 0
b[0] = {value: a[0], identifier: 0}
for (let i=1; i<a.length; i++) {
if (a[i] === a[i-1]) {
count++;
count++
}
else {
count = 0;
count = 0
}
b.push({value: a[i], identifier: count});
b.push({value: a[i], identifier: count})
}
return b;
return b
}
/**
* Remove the numeric identifier from the elements
* @param a An array
* @return An array of values without identifiers
* @param {array} a An array
* @return {array} An array of values without identifiers
*/
exports.generalize = function(a) {
if (!Array.isArray(a)) {
throw new TypeError('Array input expected');
throw new TypeError('Array input expected')
}
if (a.length === 0) {
return a;
return a
}
var b = [];
for (var i=0; i<a.length; i++) {
b.push(a[i].value);
let b = []
for (let i=0; i<a.length; i++) {
b.push(a[i].value)
}
return b;
return b
}
/**
@ -524,4 +520,4 @@ exports.generalize = function(a) {
* @param {*} value
* @return {boolean} isArray
*/
exports.isArray = Array.isArray;
exports.isArray = Array.isArray

828
package-lock.json generated
View File

@ -604,6 +604,589 @@
}
}
},
"babel-code-frame": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
"integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=",
"dev": true,
"requires": {
"chalk": "1.1.3",
"esutils": "2.0.2",
"js-tokens": "3.0.2"
}
},
"babel-core": {
"version": "6.26.3",
"resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.3.tgz",
"integrity": "sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA==",
"dev": true,
"requires": {
"babel-code-frame": "6.26.0",
"babel-generator": "6.26.1",
"babel-helpers": "6.24.1",
"babel-messages": "6.23.0",
"babel-register": "6.26.0",
"babel-runtime": "6.26.0",
"babel-template": "6.26.0",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0",
"babylon": "6.18.0",
"convert-source-map": "1.5.1",
"debug": "2.6.9",
"json5": "0.5.1",
"lodash": "4.17.10",
"minimatch": "3.0.4",
"path-is-absolute": "1.0.1",
"private": "0.1.8",
"slash": "1.0.0",
"source-map": "0.5.7"
}
},
"babel-generator": {
"version": "6.26.1",
"resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz",
"integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==",
"dev": true,
"requires": {
"babel-messages": "6.23.0",
"babel-runtime": "6.26.0",
"babel-types": "6.26.0",
"detect-indent": "4.0.0",
"jsesc": "1.3.0",
"lodash": "4.17.10",
"source-map": "0.5.7",
"trim-right": "1.0.1"
}
},
"babel-helper-builder-binary-assignment-operator-visitor": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz",
"integrity": "sha1-zORReto1b0IgvK6KAsKzRvmlZmQ=",
"dev": true,
"requires": {
"babel-helper-explode-assignable-expression": "6.24.1",
"babel-runtime": "6.26.0",
"babel-types": "6.26.0"
}
},
"babel-helper-call-delegate": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz",
"integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=",
"dev": true,
"requires": {
"babel-helper-hoist-variables": "6.24.1",
"babel-runtime": "6.26.0",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0"
}
},
"babel-helper-define-map": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.26.0.tgz",
"integrity": "sha1-pfVtq0GiX5fstJjH66ypgZ+Vvl8=",
"dev": true,
"requires": {
"babel-helper-function-name": "6.24.1",
"babel-runtime": "6.26.0",
"babel-types": "6.26.0",
"lodash": "4.17.10"
}
},
"babel-helper-explode-assignable-expression": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz",
"integrity": "sha1-8luCz33BBDPFX3BZLVdGQArCLKo=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0"
}
},
"babel-helper-function-name": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz",
"integrity": "sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=",
"dev": true,
"requires": {
"babel-helper-get-function-arity": "6.24.1",
"babel-runtime": "6.26.0",
"babel-template": "6.26.0",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0"
}
},
"babel-helper-get-function-arity": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz",
"integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0",
"babel-types": "6.26.0"
}
},
"babel-helper-hoist-variables": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz",
"integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0",
"babel-types": "6.26.0"
}
},
"babel-helper-optimise-call-expression": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz",
"integrity": "sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0",
"babel-types": "6.26.0"
}
},
"babel-helper-regex": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.26.0.tgz",
"integrity": "sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0",
"babel-types": "6.26.0",
"lodash": "4.17.10"
}
},
"babel-helper-remap-async-to-generator": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz",
"integrity": "sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=",
"dev": true,
"requires": {
"babel-helper-function-name": "6.24.1",
"babel-runtime": "6.26.0",
"babel-template": "6.26.0",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0"
}
},
"babel-helper-replace-supers": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz",
"integrity": "sha1-v22/5Dk40XNpohPKiov3S2qQqxo=",
"dev": true,
"requires": {
"babel-helper-optimise-call-expression": "6.24.1",
"babel-messages": "6.23.0",
"babel-runtime": "6.26.0",
"babel-template": "6.26.0",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0"
}
},
"babel-helpers": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz",
"integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0",
"babel-template": "6.26.0"
}
},
"babel-loader": {
"version": "7.1.4",
"resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-7.1.4.tgz",
"integrity": "sha512-/hbyEvPzBJuGpk9o80R0ZyTej6heEOr59GoEUtn8qFKbnx4cJm9FWES6J/iv644sYgrtVw9JJQkjaLW/bqb5gw==",
"dev": true,
"requires": {
"find-cache-dir": "1.0.0",
"loader-utils": "1.1.0",
"mkdirp": "0.5.1"
}
},
"babel-messages": {
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz",
"integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0"
}
},
"babel-plugin-check-es2015-constants": {
"version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz",
"integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0"
}
},
"babel-plugin-syntax-async-functions": {
"version": "6.13.0",
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz",
"integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=",
"dev": true
},
"babel-plugin-syntax-exponentiation-operator": {
"version": "6.13.0",
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz",
"integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=",
"dev": true
},
"babel-plugin-syntax-trailing-function-commas": {
"version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz",
"integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=",
"dev": true
},
"babel-plugin-transform-async-to-generator": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz",
"integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=",
"dev": true,
"requires": {
"babel-helper-remap-async-to-generator": "6.24.1",
"babel-plugin-syntax-async-functions": "6.13.0",
"babel-runtime": "6.26.0"
}
},
"babel-plugin-transform-es2015-arrow-functions": {
"version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz",
"integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0"
}
},
"babel-plugin-transform-es2015-block-scoped-functions": {
"version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz",
"integrity": "sha1-u8UbSflk1wy42OC5ToICRs46YUE=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0"
}
},
"babel-plugin-transform-es2015-block-scoping": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz",
"integrity": "sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0",
"babel-template": "6.26.0",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0",
"lodash": "4.17.10"
}
},
"babel-plugin-transform-es2015-classes": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz",
"integrity": "sha1-WkxYpQyclGHlZLSyo7+ryXolhNs=",
"dev": true,
"requires": {
"babel-helper-define-map": "6.26.0",
"babel-helper-function-name": "6.24.1",
"babel-helper-optimise-call-expression": "6.24.1",
"babel-helper-replace-supers": "6.24.1",
"babel-messages": "6.23.0",
"babel-runtime": "6.26.0",
"babel-template": "6.26.0",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0"
}
},
"babel-plugin-transform-es2015-computed-properties": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz",
"integrity": "sha1-b+Ko0WiV1WNPTNmZttNICjCBWbM=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0",
"babel-template": "6.26.0"
}
},
"babel-plugin-transform-es2015-destructuring": {
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz",
"integrity": "sha1-mXux8auWf2gtKwh2/jWNYOdlxW0=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0"
}
},
"babel-plugin-transform-es2015-duplicate-keys": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz",
"integrity": "sha1-c+s9MQypaePvnskcU3QabxV2Qj4=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0",
"babel-types": "6.26.0"
}
},
"babel-plugin-transform-es2015-for-of": {
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz",
"integrity": "sha1-9HyVsrYT3x0+zC/bdXNiPHUkhpE=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0"
}
},
"babel-plugin-transform-es2015-function-name": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz",
"integrity": "sha1-g0yJhTvDaxrw86TF26qU/Y6sqos=",
"dev": true,
"requires": {
"babel-helper-function-name": "6.24.1",
"babel-runtime": "6.26.0",
"babel-types": "6.26.0"
}
},
"babel-plugin-transform-es2015-literals": {
"version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz",
"integrity": "sha1-T1SgLWzWbPkVKAAZox0xklN3yi4=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0"
}
},
"babel-plugin-transform-es2015-modules-amd": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz",
"integrity": "sha1-Oz5UAXI5hC1tGcMBHEvS8AoA0VQ=",
"dev": true,
"requires": {
"babel-plugin-transform-es2015-modules-commonjs": "6.26.2",
"babel-runtime": "6.26.0",
"babel-template": "6.26.0"
}
},
"babel-plugin-transform-es2015-modules-commonjs": {
"version": "6.26.2",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.2.tgz",
"integrity": "sha512-CV9ROOHEdrjcwhIaJNBGMBCodN+1cfkwtM1SbUHmvyy35KGT7fohbpOxkE2uLz1o6odKK2Ck/tz47z+VqQfi9Q==",
"dev": true,
"requires": {
"babel-plugin-transform-strict-mode": "6.24.1",
"babel-runtime": "6.26.0",
"babel-template": "6.26.0",
"babel-types": "6.26.0"
}
},
"babel-plugin-transform-es2015-modules-systemjs": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz",
"integrity": "sha1-/4mhQrkRmpBhlfXxBuzzBdlAfSM=",
"dev": true,
"requires": {
"babel-helper-hoist-variables": "6.24.1",
"babel-runtime": "6.26.0",
"babel-template": "6.26.0"
}
},
"babel-plugin-transform-es2015-modules-umd": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz",
"integrity": "sha1-rJl+YoXNGO1hdq22B9YCNErThGg=",
"dev": true,
"requires": {
"babel-plugin-transform-es2015-modules-amd": "6.24.1",
"babel-runtime": "6.26.0",
"babel-template": "6.26.0"
}
},
"babel-plugin-transform-es2015-object-super": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz",
"integrity": "sha1-JM72muIcuDp/hgPa0CH1cusnj40=",
"dev": true,
"requires": {
"babel-helper-replace-supers": "6.24.1",
"babel-runtime": "6.26.0"
}
},
"babel-plugin-transform-es2015-parameters": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz",
"integrity": "sha1-V6w1GrScrxSpfNE7CfZv3wpiXys=",
"dev": true,
"requires": {
"babel-helper-call-delegate": "6.24.1",
"babel-helper-get-function-arity": "6.24.1",
"babel-runtime": "6.26.0",
"babel-template": "6.26.0",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0"
}
},
"babel-plugin-transform-es2015-shorthand-properties": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz",
"integrity": "sha1-JPh11nIch2YbvZmkYi5R8U3jiqA=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0",
"babel-types": "6.26.0"
}
},
"babel-plugin-transform-es2015-spread": {
"version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz",
"integrity": "sha1-1taKmfia7cRTbIGlQujdnxdG+NE=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0"
}
},
"babel-plugin-transform-es2015-sticky-regex": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz",
"integrity": "sha1-AMHNsaynERLN8M9hJsLta0V8zbw=",
"dev": true,
"requires": {
"babel-helper-regex": "6.26.0",
"babel-runtime": "6.26.0",
"babel-types": "6.26.0"
}
},
"babel-plugin-transform-es2015-template-literals": {
"version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz",
"integrity": "sha1-qEs0UPfp+PH2g51taH2oS7EjbY0=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0"
}
},
"babel-plugin-transform-es2015-typeof-symbol": {
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz",
"integrity": "sha1-3sCfHN3/lLUqxz1QXITfWdzOs3I=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0"
}
},
"babel-plugin-transform-es2015-unicode-regex": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz",
"integrity": "sha1-04sS9C6nMj9yk4fxinxa4frrNek=",
"dev": true,
"requires": {
"babel-helper-regex": "6.26.0",
"babel-runtime": "6.26.0",
"regexpu-core": "2.0.0"
}
},
"babel-plugin-transform-exponentiation-operator": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz",
"integrity": "sha1-KrDJx/MJj6SJB3cruBP+QejeOg4=",
"dev": true,
"requires": {
"babel-helper-builder-binary-assignment-operator-visitor": "6.24.1",
"babel-plugin-syntax-exponentiation-operator": "6.13.0",
"babel-runtime": "6.26.0"
}
},
"babel-plugin-transform-object-assign": {
"version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-object-assign/-/babel-plugin-transform-object-assign-6.22.0.tgz",
"integrity": "sha1-+Z0vZvGgsNSY40bFNZaEdAyqILo=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0"
}
},
"babel-plugin-transform-regenerator": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz",
"integrity": "sha1-4HA2lvveJ/Cj78rPi03KL3s6jy8=",
"dev": true,
"requires": {
"regenerator-transform": "0.10.1"
}
},
"babel-plugin-transform-strict-mode": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz",
"integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0",
"babel-types": "6.26.0"
}
},
"babel-preset-env": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.7.0.tgz",
"integrity": "sha512-9OR2afuKDneX2/q2EurSftUYM0xGu4O2D9adAhVfADDhrYDaxXV0rBbevVYoY9n6nyX1PmQW/0jtpJvUNr9CHg==",
"dev": true,
"requires": {
"babel-plugin-check-es2015-constants": "6.22.0",
"babel-plugin-syntax-trailing-function-commas": "6.22.0",
"babel-plugin-transform-async-to-generator": "6.24.1",
"babel-plugin-transform-es2015-arrow-functions": "6.22.0",
"babel-plugin-transform-es2015-block-scoped-functions": "6.22.0",
"babel-plugin-transform-es2015-block-scoping": "6.26.0",
"babel-plugin-transform-es2015-classes": "6.24.1",
"babel-plugin-transform-es2015-computed-properties": "6.24.1",
"babel-plugin-transform-es2015-destructuring": "6.23.0",
"babel-plugin-transform-es2015-duplicate-keys": "6.24.1",
"babel-plugin-transform-es2015-for-of": "6.23.0",
"babel-plugin-transform-es2015-function-name": "6.24.1",
"babel-plugin-transform-es2015-literals": "6.22.0",
"babel-plugin-transform-es2015-modules-amd": "6.24.1",
"babel-plugin-transform-es2015-modules-commonjs": "6.26.2",
"babel-plugin-transform-es2015-modules-systemjs": "6.24.1",
"babel-plugin-transform-es2015-modules-umd": "6.24.1",
"babel-plugin-transform-es2015-object-super": "6.24.1",
"babel-plugin-transform-es2015-parameters": "6.24.1",
"babel-plugin-transform-es2015-shorthand-properties": "6.24.1",
"babel-plugin-transform-es2015-spread": "6.22.0",
"babel-plugin-transform-es2015-sticky-regex": "6.24.1",
"babel-plugin-transform-es2015-template-literals": "6.22.0",
"babel-plugin-transform-es2015-typeof-symbol": "6.23.0",
"babel-plugin-transform-es2015-unicode-regex": "6.24.1",
"babel-plugin-transform-exponentiation-operator": "6.24.1",
"babel-plugin-transform-regenerator": "6.26.0",
"browserslist": "3.2.8",
"invariant": "2.2.4",
"semver": "5.5.0"
},
"dependencies": {
"semver": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz",
"integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==",
"dev": true
}
}
},
"babel-register": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz",
"integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=",
"dev": true,
"requires": {
"babel-core": "6.26.3",
"babel-runtime": "6.26.0",
"core-js": "2.5.6",
"home-or-tmp": "2.0.0",
"lodash": "4.17.10",
"mkdirp": "0.5.1",
"source-map-support": "0.4.18"
}
},
"babel-runtime": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",
@ -614,6 +1197,54 @@
"regenerator-runtime": "0.11.1"
}
},
"babel-template": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz",
"integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0",
"babylon": "6.18.0",
"lodash": "4.17.10"
}
},
"babel-traverse": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz",
"integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=",
"dev": true,
"requires": {
"babel-code-frame": "6.26.0",
"babel-messages": "6.23.0",
"babel-runtime": "6.26.0",
"babel-types": "6.26.0",
"babylon": "6.18.0",
"debug": "2.6.9",
"globals": "9.18.0",
"invariant": "2.2.4",
"lodash": "4.17.10"
}
},
"babel-types": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz",
"integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0",
"esutils": "2.0.2",
"lodash": "4.17.10",
"to-fast-properties": "1.0.3"
}
},
"babylon": {
"version": "6.18.0",
"resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz",
"integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==",
"dev": true
},
"backo2": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz",
@ -979,6 +1610,16 @@
"pako": "1.0.6"
}
},
"browserslist": {
"version": "3.2.8",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-3.2.8.tgz",
"integrity": "sha512-WHVocJYavUwVgVViC0ORikPHQquXwVh939TaelZ4WDqpWgTX/FsGhl/+P4qBUAGcRvtOgDgC+xftNWWp2RUTAQ==",
"dev": true,
"requires": {
"caniuse-lite": "1.0.30000849",
"electron-to-chromium": "1.3.48"
}
},
"browserstack": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/browserstack/-/browserstack-1.5.0.tgz",
@ -1211,6 +1852,12 @@
"dev": true,
"optional": true
},
"caniuse-lite": {
"version": "1.0.30000849",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000849.tgz",
"integrity": "sha512-hlkWpyGJTDjjim2m+nvvHiEqt2PZuPdB9yYRbys5P/T179Aq7YgMF6tnM489voTfqMLtJhqmOZNfghxWjjT8jg==",
"dev": true
},
"caseless": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
@ -1546,6 +2193,12 @@
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==",
"dev": true
},
"convert-source-map": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.1.tgz",
"integrity": "sha1-uCeAl7m8IpNl3lxiz1/K7YtVmeU=",
"dev": true
},
"cookie": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
@ -1872,6 +2525,15 @@
"integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=",
"dev": true
},
"detect-indent": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz",
"integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=",
"dev": true,
"requires": {
"repeating": "2.0.1"
}
},
"di": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/di/-/di-0.0.1.tgz",
@ -2004,6 +2666,12 @@
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=",
"dev": true
},
"electron-to-chromium": {
"version": "1.3.48",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.48.tgz",
"integrity": "sha1-07DYWTgUBE4JLs4hCPw6ya6kuQA=",
"dev": true
},
"elliptic": {
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz",
@ -3734,6 +4402,12 @@
"which": "1.3.0"
}
},
"globals": {
"version": "9.18.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz",
"integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==",
"dev": true
},
"globule": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/globule/-/globule-0.1.0.tgz",
@ -4102,6 +4776,16 @@
"integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=",
"dev": true
},
"home-or-tmp": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz",
"integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=",
"dev": true,
"requires": {
"os-homedir": "1.0.2",
"os-tmpdir": "1.0.2"
}
},
"homedir-polyfill": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz",
@ -4286,6 +4970,15 @@
"integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=",
"dev": true
},
"invariant": {
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz",
"integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==",
"dev": true,
"requires": {
"loose-envify": "1.3.1"
}
},
"iota-array": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/iota-array/-/iota-array-1.0.0.tgz",
@ -4409,6 +5102,15 @@
"integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",
"dev": true
},
"is-finite": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz",
"integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=",
"dev": true,
"requires": {
"number-is-nan": "1.0.1"
}
},
"is-glob": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz",
@ -4636,6 +5338,12 @@
"resolved": "https://registry.npmjs.org/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz",
"integrity": "sha1-+eIwPUUH9tdDVac2ZNFED7Wg71k="
},
"js-tokens": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
"integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=",
"dev": true
},
"js-yaml": {
"version": "3.11.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.11.0.tgz",
@ -4667,6 +5375,12 @@
"integrity": "sha512-ovGD9wE+wvudIIYxZGrRcZCxNyZ3Cl1N7Bzyp7/j4d/tA0BaUwcVM9bu0oZaSrefMiNwv6TwZ9X15gvZosteCQ==",
"dev": true
},
"jsesc": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz",
"integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=",
"dev": true
},
"json-parse-better-errors": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
@ -4892,6 +5606,12 @@
}
}
},
"karma-babel-preprocessor": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/karma-babel-preprocessor/-/karma-babel-preprocessor-7.0.0.tgz",
"integrity": "sha512-k8YUot8ZAAYhAeUxOsOGUEXW7AlB6SkoIVGfavEBCAdGHzWuraOBoR2wCxxdePUCvcItIxSUyQnOj6DuZdEJYA==",
"dev": true
},
"karma-browserstack-launcher": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/karma-browserstack-launcher/-/karma-browserstack-launcher-1.3.0.tgz",
@ -5463,6 +6183,15 @@
"integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=",
"dev": true
},
"loose-envify": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz",
"integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=",
"dev": true,
"requires": {
"js-tokens": "3.0.2"
}
},
"loud-rejection": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz",
@ -6205,6 +6934,12 @@
"remove-trailing-separator": "1.1.0"
}
},
"number-is-nan": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
"dev": true
},
"numericjs": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/numericjs/-/numericjs-1.2.6.tgz",
@ -6797,6 +7532,12 @@
"integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=",
"dev": true
},
"private": {
"version": "0.1.8",
"resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz",
"integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==",
"dev": true
},
"process": {
"version": "0.11.10",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
@ -7151,12 +7892,29 @@
"dev": true,
"optional": true
},
"regenerate": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz",
"integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==",
"dev": true
},
"regenerator-runtime": {
"version": "0.11.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==",
"dev": true
},
"regenerator-transform": {
"version": "0.10.1",
"resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.10.1.tgz",
"integrity": "sha512-PJepbvDbuK1xgIgnau7Y90cwaAmO/LCLMI2mPvaXq2heGMR3aWW5/BQvYrhJ8jgmQjXewXvBjzfqKcVOmhjZ6Q==",
"dev": true,
"requires": {
"babel-runtime": "6.26.0",
"babel-types": "6.26.0",
"private": "0.1.8"
}
},
"regex-cache": {
"version": "0.4.4",
"resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz",
@ -7176,6 +7934,40 @@
"safe-regex": "1.1.0"
}
},
"regexpu-core": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz",
"integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=",
"dev": true,
"requires": {
"regenerate": "1.4.0",
"regjsgen": "0.2.0",
"regjsparser": "0.1.5"
}
},
"regjsgen": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz",
"integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=",
"dev": true
},
"regjsparser": {
"version": "0.1.5",
"resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz",
"integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=",
"dev": true,
"requires": {
"jsesc": "0.5.0"
},
"dependencies": {
"jsesc": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz",
"integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=",
"dev": true
}
}
},
"remove-trailing-separator": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz",
@ -7194,6 +7986,15 @@
"integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=",
"dev": true
},
"repeating": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz",
"integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=",
"dev": true,
"requires": {
"is-finite": "1.0.2"
}
},
"replace-ext": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz",
@ -7444,6 +8245,12 @@
"requestretry": "1.13.0"
}
},
"slash": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz",
"integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=",
"dev": true
},
"slice-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/slice-stream/-/slice-stream-1.0.0.tgz",
@ -7714,6 +8521,15 @@
"urix": "0.1.0"
}
},
"source-map-support": {
"version": "0.4.18",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz",
"integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==",
"dev": true,
"requires": {
"source-map": "0.5.7"
}
},
"source-map-url": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz",
@ -8138,6 +8954,12 @@
"integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=",
"dev": true
},
"to-fast-properties": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz",
"integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=",
"dev": true
},
"to-object-path": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz",
@ -8205,6 +9027,12 @@
"integrity": "sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk=",
"dev": true
},
"trim-right": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz",
"integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=",
"dev": true
},
"tsscmp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.5.tgz",

View File

@ -105,6 +105,10 @@
"typed-function": "1.0.3"
},
"devDependencies": {
"babel-loader": "7.1.4",
"babel-core": "6.26.3",
"babel-plugin-transform-object-assign": "6.22.0",
"babel-preset-env": "1.7.0",
"benchmark": "2.1.4",
"expr-eval": "1.2.1",
"glob": "7.1.2",
@ -113,6 +117,7 @@
"istanbul": "0.4.5",
"jsep": "0.3.4",
"karma": "2.0.2",
"karma-babel-preprocessor": "7.0.0",
"karma-browserstack-launcher": "1.3.0",
"karma-firefox-launcher": "1.1.0",
"karma-mocha": "1.3.0",
@ -138,21 +143,21 @@
},
"main": "./index",
"files": [
"dist",
"lib",
"src",
"bin",
"core.js",
"index.js",
"docs",
"examples",
"CONTRIBUTING.md"
"dist",
"lib",
"src",
"bin",
"core.js",
"index.js",
"docs",
"examples",
"CONTRIBUTING.md"
],
"scripts": {
"build": "gulp",
"watch": "gulp watch",
"docs": "gulp docs",
"test": "mocha test node-test --recursive",
"test": "mocha test node-test --recursive --compilers js:babel-core/register",
"test:browser": "karma start ./browser-test-config/local-karma.js",
"test:browserstack": "karma start ./browser-test-config/browserstack-karma.js",
"coverage": "istanbul cover _mocha -- test --recursive; echo \"\nCoverage report is available at ./coverage/lcov-report/index.html\"",

View File

@ -156,12 +156,12 @@ describe('divide', function() {
});
it('should divide each elements in a matrix by a number', function() {
assert.deepEqual(divide([2,4,6], 2), [1,2,3]);
a = math.matrix([[1,2],[3,4]]);
assert.deepEqual(divide(a, 2), math.matrix([[0.5,1],[1.5,2]]));
assert.deepEqual(divide(a.valueOf(), 2), [[0.5,1],[1.5,2]]);
assert.deepEqual(divide([], 2), []);
assert.deepEqual(divide([], 2), []);
assert.deepEqual(divide([2,4,6], 2), [1,2,3])
const a = math.matrix([[1,2],[3,4]])
assert.deepEqual(divide(a, 2), math.matrix([[0.5,1],[1.5,2]]))
assert.deepEqual(divide(a.valueOf(), 2), [[0.5,1],[1.5,2]])
assert.deepEqual(divide([], 2), [])
assert.deepEqual(divide([], 2), [])
});
it('should divide 1 over a matrix (matrix inverse)', function() {
@ -177,9 +177,9 @@ describe('divide', function() {
});
it('should perform matrix division', function() {
a = math.matrix([[1,2],[3,4]]);
b = math.matrix([[5,6],[7,8]]);
assert.deepEqual(divide(a, b), math.matrix([[3,-2], [2,-1]]));
const a = math.matrix([[1,2],[3,4]])
const b = math.matrix([[5,6],[7,8]])
assert.deepEqual(divide(a, b), math.matrix([[3,-2], [2,-1]]))
});
it('should divide a matrix by a matrix containing a scalar', function() {

View File

@ -31,12 +31,12 @@ describe('unaryMinus', function() {
});
it('should perform unary minus of a fraction', function() {
var a = fraction(0.5);
assert(math.unaryMinus(a) instanceof math.type.Fraction);
assert.equal(a.toString(), '0.5');
const a = fraction(0.5)
assert(math.unaryMinus(a) instanceof math.type.Fraction)
assert.equal(a.toString(), '0.5')
assert.equal(math.unaryMinus(fraction(0.5)).toString(), '-0.5');
assert.equal(math.unaryMinus(fraction(-0.5)).toString(), '0.5');
assert.equal(math.unaryMinus(fraction(0.5)).toString(), '-0.5')
assert.equal(math.unaryMinus(fraction(-0.5)).toString(), '0.5')
});
it('should perform unary minus of a complex number', function() {
@ -53,12 +53,12 @@ describe('unaryMinus', function() {
});
it('should perform element-wise unary minus on a matrix', function() {
a2 = math.matrix([[1,2],[3,4]]);
var a7 = math.unaryMinus(a2);
assert.ok(a7 instanceof math.type.Matrix);
assert.deepEqual(a7.size(), [2,2]);
assert.deepEqual(a7.valueOf(), [[-1,-2],[-3,-4]]);
assert.deepEqual(math.unaryMinus([[1,2],[3,4]]), [[-1,-2],[-3,-4]]);
const a2 = math.matrix([[1,2],[3,4]])
const a7 = math.unaryMinus(a2)
assert.ok(a7 instanceof math.type.Matrix)
assert.deepEqual(a7.size(), [2,2])
assert.deepEqual(a7.valueOf(), [[-1,-2],[-3,-4]])
assert.deepEqual(math.unaryMinus([[1,2],[3,4]]), [[-1,-2],[-3,-4]])
});
it('should throw an error in case of invalid number of arguments', function() {

View File

@ -73,12 +73,12 @@ describe('unaryPlus', function() {
});
it('should perform element-wise unary plus on a matrix', function() {
a2 = math.matrix([[1,2],[3,4]]);
var a7 = math.unaryPlus(a2);
assert.ok(a7 instanceof math.type.Matrix);
assert.deepEqual(a7.size(), [2,2]);
assert.deepEqual(a7.valueOf(), [[1,2],[3,4]]);
assert.deepEqual(math.unaryPlus([[1,2],[3,4]]), [[1,2],[3,4]]);
const a2 = math.matrix([[1,2],[3,4]])
const a7 = math.unaryPlus(a2)
assert.ok(a7 instanceof math.type.Matrix)
assert.deepEqual(a7.size(), [2,2])
assert.deepEqual(a7.valueOf(), [[1,2],[3,4]])
assert.deepEqual(math.unaryPlus([[1,2],[3,4]]), [[1,2],[3,4]])
});
it('should throw an error in case of invalid number of arguments', function() {

View File

@ -36,11 +36,11 @@ describe('bitNot', function () {
});
it('should perform element-wise bitwise not on a matrix', function () {
a2 = math.matrix([[1,2],[3,4]]);
var a7 = bitNot(a2);
assert.ok(a7 instanceof math.type.Matrix);
assert.deepEqual(a7.size(), [2,2]);
assert.deepEqual(a7.valueOf(), [[-2,-3],[-4,-5]]);
const a2 = math.matrix([[1,2],[3,4]])
const a7 = bitNot(a2)
assert.ok(a7 instanceof math.type.Matrix)
assert.deepEqual(a7.size(), [2,2])
assert.deepEqual(a7.valueOf(), [[-2,-3],[-4,-5]])
});
it('should perform element-wise bitwise not on an array', function () {

View File

@ -1,8 +1,8 @@
// test expm
var assert = require('assert'),
approx = require('../../../tools/approx');
math = require('../../../index'),
expm = math.expm;
const assert = require('assert')
const approx = require('../../../tools/approx')
const math = require('../../../index')
const expm = math.expm
describe('expm', function() {

View File

@ -81,11 +81,11 @@ describe('kron', function() {
});
it('should throw an error for invalid kronecker product of matrix', function() {
y = math.matrix([[[]]]);
x = math.matrix([[[1,1], [1,1]], [[1,1], [1,1]]]);
assert.throws(function () { math.kron(y, x) });
});
});
const y = math.matrix([[[]]])
const x = math.matrix([[[1,1], [1,1]], [[1,1], [1,1]]])
assert.throws(function () { math.kron(y, x) })
})
})
describe('SparseMatrix', function () {
it('should calculate the kronecker product of a 2d matrix', function() {

View File

@ -7,11 +7,11 @@ var Complex = math.type.Complex;
describe('Complex', function () {
assertComplex = function(complex, re, im) {
function assertComplex(complex, re, im) {
assert(complex instanceof Complex);
assert.strictEqual(complex.re, re);
assert.strictEqual(complex.im, im);
};
}
describe('constructor', function() {

View File

@ -82,15 +82,15 @@ describe('Unit', function() {
assert.throws(function () { new Unit(0, 3); });
});
it('should flag unit as already simplified', function() {
unit1 = new Unit(9.81, "kg m/s^2");
assert.equal(unit1.isUnitListSimplified, true);
assert.equal(unit1.toString(), "9.81 (kg m) / s^2");
it('should flag unit as already simplified', function() {
const unit1 = new Unit(9.81, "kg m/s^2")
assert.equal(unit1.isUnitListSimplified, true)
assert.equal(unit1.toString(), "9.81 (kg m) / s^2")
unit1 = new Unit(null, "kg m/s^2");
assert.equal(unit1.isUnitListSimplified, true);
assert.equal(unit1.toString(), "(kg m) / s^2");
});
const unit2 = new Unit(null, "kg m/s^2")
assert.equal(unit2.isUnitListSimplified, true)
assert.equal(unit2.toString(), "(kg m) / s^2")
})
});
@ -879,38 +879,38 @@ describe('Unit', function() {
});
it('should parse expressions with nested parentheses correctly', function() {
unit1 = Unit.parse('8.314 kg (m^2 / (s^2 / (K^-1 / mol)))');
approx.equal(unit1.value, 8.314);
assert.equal(unit1.units[0].unit.name, 'g');
assert.equal(unit1.units[1].unit.name, 'm');
assert.equal(unit1.units[2].unit.name, 's');
assert.equal(unit1.units[3].unit.name, 'K');
assert.equal(unit1.units[4].unit.name, 'mol');
assert.equal(unit1.units[0].power, 1);
assert.equal(unit1.units[1].power, 2);
assert.equal(unit1.units[2].power, -2);
assert.equal(unit1.units[3].power, -1);
assert.equal(unit1.units[4].power, -1);
assert.equal(unit1.units[0].prefix.name, 'k');
let unit1 = Unit.parse('8.314 kg (m^2 / (s^2 / (K^-1 / mol)))')
approx.equal(unit1.value, 8.314)
assert.equal(unit1.units[0].unit.name, 'g')
assert.equal(unit1.units[1].unit.name, 'm')
assert.equal(unit1.units[2].unit.name, 's')
assert.equal(unit1.units[3].unit.name, 'K')
assert.equal(unit1.units[4].unit.name, 'mol')
assert.equal(unit1.units[0].power, 1)
assert.equal(unit1.units[1].power, 2)
assert.equal(unit1.units[2].power, -2)
assert.equal(unit1.units[3].power, -1)
assert.equal(unit1.units[4].power, -1)
assert.equal(unit1.units[0].prefix.name, 'k')
unit1 = Unit.parse('1 (m / ( s / ( kg mol ) / ( lbm / h ) K ) )');
assert.equal(unit1.units[0].unit.name, 'm');
assert.equal(unit1.units[1].unit.name, 's');
assert.equal(unit1.units[2].unit.name, 'g');
assert.equal(unit1.units[3].unit.name, 'mol');
assert.equal(unit1.units[4].unit.name, 'lbm');
assert.equal(unit1.units[5].unit.name, 'h');
assert.equal(unit1.units[6].unit.name, 'K');
assert.equal(unit1.units[0].power, 1);
assert.equal(unit1.units[1].power, -1);
assert.equal(unit1.units[2].power, 1);
assert.equal(unit1.units[3].power, 1);
assert.equal(unit1.units[4].power, 1);
assert.equal(unit1.units[5].power, -1);
assert.equal(unit1.units[6].power, -1);
unit1 = Unit.parse('1 (m / ( s / ( kg mol ) / ( lbm / h ) K ) )')
assert.equal(unit1.units[0].unit.name, 'm')
assert.equal(unit1.units[1].unit.name, 's')
assert.equal(unit1.units[2].unit.name, 'g')
assert.equal(unit1.units[3].unit.name, 'mol')
assert.equal(unit1.units[4].unit.name, 'lbm')
assert.equal(unit1.units[5].unit.name, 'h')
assert.equal(unit1.units[6].unit.name, 'K')
assert.equal(unit1.units[0].power, 1)
assert.equal(unit1.units[1].power, -1)
assert.equal(unit1.units[2].power, 1)
assert.equal(unit1.units[3].power, 1)
assert.equal(unit1.units[4].power, 1)
assert.equal(unit1.units[5].power, -1)
assert.equal(unit1.units[6].power, -1)
unit2 = Unit.parse('1(m/(s/(kg mol)/(lbm/h)K))');
assert.deepEqual(unit1, unit2);
const unit2 = Unit.parse('1(m/(s/(kg mol)/(lbm/h)K))')
assert.deepEqual(unit1, unit2)
});
it('should parse units with correct precedence', function() {

View File

@ -190,15 +190,15 @@ describe('format', function () {
it('should format bignumbers in fixed notation with precision', function() {
options = {
const options = {
notation: 'fixed',
precision: 2
};
assert.deepEqual(formatter.format(new BigNumber('1.23456'), options), '1.23');
assert.deepEqual(formatter.format(new BigNumber('12345678'), options), '12345678.00');
assert.deepEqual(formatter.format(new BigNumber('12e18'), options), '12000000000000000000.00');
assert.deepEqual(formatter.format(new BigNumber('12e30'), options), '12000000000000000000000000000000.00');
});
}
assert.deepEqual(formatter.format(new BigNumber('1.23456'), options), '1.23')
assert.deepEqual(formatter.format(new BigNumber('12345678'), options), '12345678.00')
assert.deepEqual(formatter.format(new BigNumber('12e18'), options), '12000000000000000000.00')
assert.deepEqual(formatter.format(new BigNumber('12e30'), options), '12000000000000000000000000000000.00')
})
it('should throw an error on unknown notation', function () {
assert.throws(function () {

View File

@ -1,49 +1,51 @@
/**
* Validate whether all functions in math.js are documented in math.expression.docs
* we use the minified bundle to also check whether that bundle is valid.
*/
var gutil = require('gulp-util'),
math = require('../index'),
prop;
const gutil = require('gulp-util')
const math = require('../dist/math.min.js')
let prop
// names to ignore
var ignore = [
const ignore = [
// functions not supported or relevant for the parser:
'create', 'typed', 'config',
'on', 'off', 'emit', 'once',
'compile', 'parse', 'parser',
'chain', 'print', 'uninitialized'
];
'chain', 'print', 'uninitialized',
'eye'
]
// test whether all functions are documented
var undocumentedCount = 0;
let undocumentedCount = 0
for (prop in math) {
if (math.hasOwnProperty(prop)) {
var obj = math[prop];
if (math['typeof'](obj) != 'Object') {
if (!math.expression.docs[prop] && (ignore.indexOf(prop) == -1)) {
gutil.log('WARNING: Function ' + prop + ' is undocumented');
undocumentedCount++;
const obj = math[prop]
if (math['typeof'](obj) !== 'Object') {
if (!math.expression.docs[prop] && (ignore.indexOf(prop) === -1)) {
gutil.log('WARNING: Function ' + prop + ' is undocumented')
undocumentedCount++
}
}
}
}
// test whether there is documentation for non existing functions
var nonExistingCount = 0;
var docs = math.expression.docs;
let nonExistingCount = 0
const docs = math.expression.docs
for (prop in docs) {
if (docs.hasOwnProperty(prop)) {
if (math[prop] === undefined && !math.type[prop]) {
gutil.log('WARNING: Documentation for a non-existing function "' + prop + '"');
nonExistingCount++;
gutil.log('WARNING: Documentation for a non-existing function "' + prop + '"')
nonExistingCount++
}
}
}
// done. Output results
if (undocumentedCount == 0 && nonExistingCount == 0) {
gutil.log('Validation successful: all functions are documented.');
if (undocumentedCount === 0 && nonExistingCount === 0) {
gutil.log('Validation successful: all functions are documented.')
}
else {
gutil.log('Validation failed: not all functions are documented.');
gutil.log('Validation failed: not all functions are documented.')
}