Skip to content
This repository was archived by the owner on Jun 2, 2025. It is now read-only.

Commit dca250d

Browse files
committed
Fixed math functions
1 parent 72bd85b commit dca250d

File tree

6 files changed

+21
-21
lines changed

6 files changed

+21
-21
lines changed

dist/display.es6.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -569,10 +569,10 @@ class DisplayJS {
569569
return tmp;
570570
}
571571
sum(array) {
572-
return array.reduce((a, b) => this.math().add(a, b), 0);
572+
return array.reduce((a, b) => this.math.add(a, b), 0);
573573
}
574574
multiply(array) {
575-
return array.reduce((a, b) => this.math().mul(a, b), 0);
575+
return array.reduce((a, b) => this.math.mul(a, b), 0);
576576
}
577577
flatten(array) {
578578
return array.reduce((a, b) => a.concat(b), []);
@@ -600,17 +600,17 @@ class DisplayJS {
600600
}
601601
average(array) {
602602
const summed = this.sum(array);
603-
const average = this.math().div(summed, array.length);
603+
const average = this.math.div(summed, array.length);
604604
return average;
605605
}
606606
median(array) {
607-
array.sort( (a, b) => this.math().sub(a, b) );
608-
const half = Math.floor(this.math().div(array.length,2));
607+
array.sort( (a, b) => this.math.sub(a, b) );
608+
const half = Math.floor(this.math.div(array.length,2));
609609
if(array.length % 2) {
610610
return array[half];
611611
}
612612
else {
613-
return this.math().div(this.math().add(array[half-1], array[half]), 2.0);
613+
return this.math.div(this.math.add(array[half-1], array[half]), 2.0);
614614
}
615615
}
616616
predict(array, val, text=false) {

dist/display.es6.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/display.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ var DisplayJS = function () {
734734
var _this6 = this;
735735

736736
return array.reduce(function (a, b) {
737-
return _this6.math().add(a, b);
737+
return _this6.math.add(a, b);
738738
}, 0);
739739
}
740740
}, {
@@ -743,7 +743,7 @@ var DisplayJS = function () {
743743
var _this7 = this;
744744

745745
return array.reduce(function (a, b) {
746-
return _this7.math().mul(a, b);
746+
return _this7.math.mul(a, b);
747747
}, 0);
748748
}
749749
}, {
@@ -784,7 +784,7 @@ var DisplayJS = function () {
784784
key: "average",
785785
value: function average(array) {
786786
var summed = this.sum(array);
787-
var average = this.math().div(summed, array.length);
787+
var average = this.math.div(summed, array.length);
788788
return average;
789789
}
790790
}, {
@@ -793,13 +793,13 @@ var DisplayJS = function () {
793793
var _this8 = this;
794794

795795
array.sort(function (a, b) {
796-
return _this8.math().sub(a, b);
796+
return _this8.math.sub(a, b);
797797
});
798-
var half = Math.floor(this.math().div(array.length, 2));
798+
var half = Math.floor(this.math.div(array.length, 2));
799799
if (array.length % 2) {
800800
return array[half];
801801
} else {
802-
return this.math().div(this.math().add(array[half - 1], array[half]), 2.0);
802+
return this.math.div(this.math.add(array[half - 1], array[half]), 2.0);
803803
}
804804
}
805805
}, {

dist/display.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "display.js",
3-
"version": "v1.2.0",
3+
"version": "v1.2.1",
44
"description": "A simple JavaScript framework for building ambitious UIs",
55
"main": "dist/display.min.js",
66
"directories": {

src/display.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -569,10 +569,10 @@ class DisplayJS {
569569
return tmp;
570570
}
571571
sum(array) {
572-
return array.reduce((a, b) => this.math().add(a, b), 0);
572+
return array.reduce((a, b) => this.math.add(a, b), 0);
573573
}
574574
multiply(array) {
575-
return array.reduce((a, b) => this.math().mul(a, b), 0);
575+
return array.reduce((a, b) => this.math.mul(a, b), 0);
576576
}
577577
flatten(array) {
578578
return array.reduce((a, b) => a.concat(b), []);
@@ -600,17 +600,17 @@ class DisplayJS {
600600
}
601601
average(array) {
602602
const summed = this.sum(array);
603-
const average = this.math().div(summed, array.length);
603+
const average = this.math.div(summed, array.length);
604604
return average;
605605
}
606606
median(array) {
607-
array.sort( (a, b) => this.math().sub(a, b) );
608-
const half = Math.floor(this.math().div(array.length,2));
607+
array.sort( (a, b) => this.math.sub(a, b) );
608+
const half = Math.floor(this.math.div(array.length,2));
609609
if(array.length % 2) {
610610
return array[half];
611611
}
612612
else {
613-
return this.math().div(this.math().add(array[half-1], array[half]), 2.0);
613+
return this.math.div(this.math.add(array[half-1], array[half]), 2.0);
614614
}
615615
}
616616
predict(array, val, text=false) {

0 commit comments

Comments
 (0)