built-in-math-eval 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,7 +3,6 @@
3
3
  [![Build Status][travis-image]][travis-url]
4
4
  [![NPM][npm-image]][npm-url]
5
5
  [![Coverage Status][coveralls-image]][coveralls-url]
6
- [![Stability](https://img.shields.io/badge/stability-unstable-yellow.svg)]()
7
6
 
8
7
  [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
9
8
 
@@ -24,7 +23,7 @@
24
23
 
25
24
  ## Description
26
25
 
27
- This module evaluates the generated code from [math-codegen](https://github.com/maurizzzio/math-codegen)
26
+ This module evaluates the generated code from [math-codegen](https://github.com/mauriciopoppe/math-codegen)
28
27
  for the built in `Math` namespace providing the necessary adapter methods
29
28
 
30
29
  ## Installation
@@ -59,7 +58,7 @@ all variables are casted to `Number`
59
58
 
60
59
  ## Examples
61
60
 
62
- Also have a look at [test/index.js](https://github.com/maurizzzio/built-in-math-eval/blob/master/test/index.js)
61
+ Also have a look at [test/index.js](https://github.com/mauriciopoppe/built-in-math-eval/blob/master/test/index.js)
63
62
 
64
63
  ```javascript
65
64
  var compile = require('built-in-math-eval');
@@ -87,7 +86,7 @@ compile('PI').eval()
87
86
 
88
87
  [npm-image]: https://img.shields.io/npm/v/built-in-math-eval.svg?style=flat
89
88
  [npm-url]: https://npmjs.org/package/built-in-math-eval
90
- [travis-image]: https://travis-ci.org/maurizzzio/built-in-math-eval.svg?branch=master
91
- [travis-url]: https://travis-ci.org/maurizzzio/built-in-math-eval
92
- [coveralls-image]: https://coveralls.io/repos/maurizzzio/built-in-math-eval/badge.svg
93
- [coveralls-url]: https://coveralls.io/r/maurizzzio/built-in-math-eval
89
+ [travis-image]: https://travis-ci.org/mauriciopoppe/built-in-math-eval.svg?branch=master
90
+ [travis-url]: https://travis-ci.org/mauriciopoppe/built-in-math-eval
91
+ [coveralls-image]: https://coveralls.io/repos/mauriciopoppe/built-in-math-eval/badge.svg
92
+ [coveralls-url]: https://coveralls.io/r/mauriciopoppe/built-in-math-eval
package/lib/adapter.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
  module.exports = function () {
3
- var math = Object.create(Math)
3
+ const math = Object.create(Math)
4
4
 
5
5
  math.factory = function (a) {
6
6
  if (typeof a !== 'number') {
@@ -25,8 +25,8 @@ module.exports = function () {
25
25
  return a % b
26
26
  }
27
27
  math.factorial = function (a) {
28
- var res = 1
29
- for (var i = 2; i <= a; i += 1) {
28
+ let res = 1
29
+ for (let i = 2; i <= a; i += 1) {
30
30
  res *= i
31
31
  }
32
32
  return res
@@ -34,7 +34,7 @@ module.exports = function () {
34
34
 
35
35
  // taken from https://github.com/josdejong/mathjs/blob/master/lib/function/arithmetic/nthRoot.js
36
36
  math.nthRoot = function (a, root) {
37
- var inv = root < 0
37
+ const inv = root < 0
38
38
  if (inv) {
39
39
  root = -root
40
40
  }
@@ -54,7 +54,7 @@ module.exports = function () {
54
54
  return inv ? 0 : a
55
55
  }
56
56
 
57
- var x = Math.pow(Math.abs(a), 1 / root)
57
+ let x = Math.pow(Math.abs(a), 1 / root)
58
58
  // If a < 0, we require that root is an odd integer,
59
59
  // so (-1) ^ (1/root) = -1
60
60
  x = a < 0 ? -x : x
@@ -68,7 +68,7 @@ module.exports = function () {
68
68
  math.logicalXOR = function (a, b) {
69
69
  /* eslint-disable */
70
70
  return a != b
71
- /* eslint-enable*/
71
+ /* eslint-enable */
72
72
  }
73
73
  math.logicalAND = function (a, b) {
74
74
  return a && b
@@ -78,17 +78,17 @@ module.exports = function () {
78
78
  math.bitwiseOR = function (a, b) {
79
79
  /* eslint-disable */
80
80
  return a | b
81
- /* eslint-enable*/
81
+ /* eslint-enable */
82
82
  }
83
83
  math.bitwiseXOR = function (a, b) {
84
84
  /* eslint-disable */
85
85
  return a ^ b
86
- /* eslint-enable*/
86
+ /* eslint-enable */
87
87
  }
88
88
  math.bitwiseAND = function (a, b) {
89
89
  /* eslint-disable */
90
90
  return a & b
91
- /* eslint-enable*/
91
+ /* eslint-enable */
92
92
  }
93
93
 
94
94
  // relational
@@ -107,7 +107,7 @@ module.exports = function () {
107
107
  math.equal = function (a, b) {
108
108
  /* eslint-disable */
109
109
  return a == b
110
- /* eslint-enable*/
110
+ /* eslint-enable */
111
111
  }
112
112
  math.strictlyEqual = function (a, b) {
113
113
  return a === b
@@ -115,7 +115,7 @@ module.exports = function () {
115
115
  math.notEqual = function (a, b) {
116
116
  /* eslint-disable */
117
117
  return a != b
118
- /* eslint-enable*/
118
+ /* eslint-enable */
119
119
  }
120
120
  math.strictlyNotEqual = function (a, b) {
121
121
  return a !== b
package/lib/eval.js CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict'
2
2
 
3
- var CodeGenerator = require('math-codegen')
4
- var math = require('./adapter')()
3
+ const CodeGenerator = require('math-codegen')
4
+ const math = require('./adapter')()
5
5
 
6
6
  function processScope (scope) {
7
7
  Object.keys(scope).forEach(function (k) {
8
- var value = scope[k]
8
+ const value = scope[k]
9
9
  scope[k] = math.factory(value)
10
10
  })
11
11
  }
package/package.json CHANGED
@@ -1,40 +1,37 @@
1
1
  {
2
2
  "name": "built-in-math-eval",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Evaluate mathematical expression with the built-in math object",
5
- "bugs": "https://github.com/maurizzzio/built-in-math-eval/issues",
5
+ "bugs": "https://github.com/mauriciopoppe/built-in-math-eval/issues",
6
6
  "license": "MIT",
7
7
  "main": "index.js",
8
- "author": "Mauricio Poppe <mauricio.poppe@gmail.com>",
8
+ "author": "Mauricio Poppe (https://mauriciopoppe.com)",
9
9
  "files": [
10
10
  "index.js",
11
11
  "lib",
12
+ "package-lock.json",
12
13
  "LICENSE"
13
14
  ],
14
15
  "repository": {
15
16
  "type": "git",
16
- "url": "https://github.com/maurizzzio/built-in-math-eval"
17
+ "url": "https://github.com/mauriciopoppe/built-in-math-eval"
17
18
  },
18
19
  "keywords": [
19
20
  "built-in-math-eval"
20
21
  ],
21
22
  "dependencies": {
22
- "math-codegen": "^0.3.5"
23
+ "math-codegen": "^0.4.1"
23
24
  },
24
25
  "devDependencies": {
25
- "coveralls": "^2.11.2",
26
- "doctoc": "^0.13.0",
27
- "eslint": "^0.21.0",
28
- "istanbul": "^0.3.8",
29
- "mocha": "^2.2.1",
30
- "mocha-lcov-reporter": "^0.0.2",
31
- "nodemon": "^1.3.7",
32
- "standard": "^4.5.4"
26
+ "doctoc": "^2.2.0",
27
+ "jest": "^29.0.2",
28
+ "nodemon": "^2.0.19",
29
+ "standard": "^17.0.0"
33
30
  },
34
31
  "scripts": {
35
- "istanbul": "istanbul cover _mocha --report lcovonly -- -R spec test/",
32
+ "coverage": "jest --coverage",
36
33
  "lint": "standard",
37
- "test": "mocha -R spec test/",
34
+ "test": "jest",
38
35
  "test:watch": "nodemon --watch lib --watch test --watch index.js --exec 'npm test'",
39
36
  "start": "npm run test:watch",
40
37
  "toc": "doctoc ."