@pie-lib/graphing-utils 1.1.18 → 1.1.21

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/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [1.1.18](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.17...@pie-lib/graphing-utils@1.1.18) (2021-02-15)
6
+ ## [1.1.21](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.20...@pie-lib/graphing-utils@1.1.21) (2022-11-23)
7
7
 
8
8
  **Note:** Version bump only for package @pie-lib/graphing-utils
9
9
 
@@ -11,151 +11,88 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
11
 
12
12
 
13
13
 
14
- ## [1.1.17](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.15...@pie-lib/graphing-utils@1.1.17) (2021-02-15)
14
+ ## [1.1.20](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.18...@pie-lib/graphing-utils@1.1.20) (2021-06-25)
15
15
 
16
16
  **Note:** Version bump only for package @pie-lib/graphing-utils
17
17
 
18
+ ## [1.1.18](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.17...@pie-lib/graphing-utils@1.1.18) (2021-02-15)
18
19
 
20
+ **Note:** Version bump only for package @pie-lib/graphing-utils
19
21
 
22
+ ## [1.1.17](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.15...@pie-lib/graphing-utils@1.1.17) (2021-02-15)
20
23
 
24
+ **Note:** Version bump only for package @pie-lib/graphing-utils
21
25
 
22
26
  ## [1.1.15](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.14...@pie-lib/graphing-utils@1.1.15) (2020-04-14)
23
27
 
24
28
  **Note:** Version bump only for package @pie-lib/graphing-utils
25
29
 
26
-
27
-
28
-
29
-
30
30
  ## [1.1.14](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.13...@pie-lib/graphing-utils@1.1.14) (2020-04-08)
31
31
 
32
32
  **Note:** Version bump only for package @pie-lib/graphing-utils
33
33
 
34
-
35
-
36
-
37
-
38
34
  ## [1.1.13](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.12...@pie-lib/graphing-utils@1.1.13) (2020-03-31)
39
35
 
40
36
  **Note:** Version bump only for package @pie-lib/graphing-utils
41
37
 
42
-
43
-
44
-
45
-
46
38
  ## [1.1.12](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.11...@pie-lib/graphing-utils@1.1.12) (2020-03-31)
47
39
 
48
40
  **Note:** Version bump only for package @pie-lib/graphing-utils
49
41
 
50
-
51
-
52
-
53
-
54
42
  ## [1.1.11](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.10...@pie-lib/graphing-utils@1.1.11) (2020-03-31)
55
43
 
56
44
  **Note:** Version bump only for package @pie-lib/graphing-utils
57
45
 
58
-
59
-
60
-
61
-
62
46
  ## [1.1.10](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.9...@pie-lib/graphing-utils@1.1.10) (2020-03-30)
63
47
 
64
48
  **Note:** Version bump only for package @pie-lib/graphing-utils
65
49
 
66
-
67
-
68
-
69
-
70
50
  ## [1.1.9](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.8...@pie-lib/graphing-utils@1.1.9) (2020-03-30)
71
51
 
72
52
  **Note:** Version bump only for package @pie-lib/graphing-utils
73
53
 
74
-
75
-
76
-
77
-
78
54
  ## [1.1.8](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.7...@pie-lib/graphing-utils@1.1.8) (2020-03-30)
79
55
 
80
56
  **Note:** Version bump only for package @pie-lib/graphing-utils
81
57
 
82
-
83
-
84
-
85
-
86
58
  ## [1.1.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.6...@pie-lib/graphing-utils@1.1.7) (2020-03-30)
87
59
 
88
60
  **Note:** Version bump only for package @pie-lib/graphing-utils
89
61
 
90
-
91
-
92
-
93
-
94
62
  ## [1.1.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.5...@pie-lib/graphing-utils@1.1.6) (2020-03-30)
95
63
 
96
64
  **Note:** Version bump only for package @pie-lib/graphing-utils
97
65
 
98
-
99
-
100
-
101
-
102
66
  ## [1.1.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.4...@pie-lib/graphing-utils@1.1.5) (2020-03-30)
103
67
 
104
68
  **Note:** Version bump only for package @pie-lib/graphing-utils
105
69
 
106
-
107
-
108
-
109
-
110
70
  ## [1.1.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.3...@pie-lib/graphing-utils@1.1.4) (2020-03-30)
111
71
 
112
-
113
72
  ### Bug Fixes
114
73
 
115
- * add module prop to package.json ([12db87f](https://github.com/pie-framework/pie-lib/commit/12db87f))
116
-
117
-
118
-
119
-
74
+ - add module prop to package.json ([12db87f](https://github.com/pie-framework/pie-lib/commit/12db87f))
120
75
 
121
76
  ## [1.1.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.2...@pie-lib/graphing-utils@1.1.3) (2020-03-18)
122
77
 
123
-
124
78
  ### Bug Fixes
125
79
 
126
- * 4136: Parabola graphing is amiss ([f915685](https://github.com/pie-framework/pie-lib/commit/f915685))
127
-
128
-
129
-
130
-
80
+ - 4136: Parabola graphing is amiss ([f915685](https://github.com/pie-framework/pie-lib/commit/f915685))
131
81
 
132
82
  ## [1.1.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.1...@pie-lib/graphing-utils@1.1.2) (2019-07-08)
133
83
 
134
84
  **Note:** Version bump only for package @pie-lib/graphing-utils
135
85
 
136
-
137
-
138
-
139
-
140
86
  ## [1.1.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/graphing-utils@1.1.0...@pie-lib/graphing-utils@1.1.1) (2019-07-05)
141
87
 
142
88
  **Note:** Version bump only for package @pie-lib/graphing-utils
143
89
 
144
-
145
-
146
-
147
-
148
90
  # 1.1.0 (2019-07-02)
149
91
 
150
-
151
92
  ### Features
152
93
 
153
- * moved utils into their own package ([280341d](https://github.com/pie-framework/pie-lib/commit/280341d))
154
- * moved utils into their own package ([c0b8e00](https://github.com/pie-framework/pie-lib/commit/c0b8e00))
155
- * moved utils into their own package ([c9a7d40](https://github.com/pie-framework/pie-lib/commit/c9a7d40))
156
-
157
-
158
-
159
-
94
+ - moved utils into their own package ([280341d](https://github.com/pie-framework/pie-lib/commit/280341d))
95
+ - moved utils into their own package ([c0b8e00](https://github.com/pie-framework/pie-lib/commit/c0b8e00))
96
+ - moved utils into their own package ([c9a7d40](https://github.com/pie-framework/pie-lib/commit/c9a7d40))
160
97
 
161
98
  # Change Log
package/lib/index.js CHANGED
@@ -1,9 +1,13 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
- exports.buildDataPoints = exports.parabola = exports.pointsToABC = exports.parabolaFromThreePoints = exports.parabolaFromTwoPoints = exports.sinY = exports.xPoints = exports.getAmplitudeAndFreq = exports.FREQ_DIVIDER = void 0;
8
+ exports.xPoints = exports.sinY = exports.pointsToABC = exports.parabolaFromTwoPoints = exports.parabolaFromThreePoints = exports.parabola = exports.getAmplitudeAndFreq = exports.buildDataPoints = exports.FREQ_DIVIDER = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
7
11
 
8
12
  var _debug = _interopRequireDefault(require("debug"));
9
13
 
@@ -11,13 +15,9 @@ var _pointGeometry = _interopRequireDefault(require("@mapbox/point-geometry"));
11
15
 
12
16
  var _lodash = _interopRequireDefault(require("lodash"));
13
17
 
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
-
16
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
17
-
18
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
18
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
19
19
 
20
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
20
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
21
21
 
22
22
  var log = (0, _debug["default"])('pie-lib:graphing:tools:utils');
23
23
  var FREQ_DIVIDER = 16;
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["log","FREQ_DIVIDER","getAmplitudeAndFreq","root","edge","freq","amplitude","x","r","Point","y","e","d","sub","xPoints","min","max","Math","abs","leftpoints","_","rangeRight","rightpoints","range","concat","sinY","shift","phase","vertical","TWO_PI","PI","num","frac","sin","sinFloat","parseFloat","toFixed","parabolaFromTwoPoints","mirrorEdge","parabolaFromThreePoints","one","two","three","pointsToABC","a","b","c","parabola","a1","pow","b1","d1","a2","b2","d2","bMult","a3","d3","buildDataPoints","interval","yFn","minX","maxX","leftSpace","rightSpace","xs","map","v"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;;;;;AACA,IAAMA,GAAG,GAAG,uBAAM,8BAAN,CAAZ;AAEO,IAAMC,YAAY,GAAG,EAArB;;;AAEA,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAsB,CAACC,IAAD,EAAOC,IAAP,EAAgB;AACjD,MAAI,CAACA,IAAL,EAAW;AACT,WAAO;AAAEC,MAAAA,IAAI,EAAE,CAAR;AAAWC,MAAAA,SAAS,EAAE;AAAtB,KAAP;AACD;;AAED,MAAIH,IAAI,CAACI,CAAL,IAAUH,IAAI,CAACG,CAAnB,EAAsB;AACpB,WAAO;AAAEF,MAAAA,IAAI,EAAE,CAAR;AAAWC,MAAAA,SAAS,EAAE;AAAtB,KAAP;AACD;;AAED,MAAME,CAAC,GAAG,IAAIC,yBAAJ,CAAUN,IAAI,CAACI,CAAf,EAAkBJ,IAAI,CAACO,CAAvB,CAAV;AACA,MAAMC,CAAC,GAAG,IAAIF,yBAAJ,CAAUL,IAAI,CAACG,CAAf,EAAkBH,IAAI,CAACM,CAAvB,CAAV;AACA,MAAME,CAAC,GAAGD,CAAC,CAACE,GAAF,CAAML,CAAN,CAAV,CAXiD,CAYjD;;AACA,SAAO;AAAEH,IAAAA,IAAI,EAAEO,CAAC,CAACL,CAAF,GAAM,CAAd;AAAiBD,IAAAA,SAAS,E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B,CAAJ;AAAA,GAAR,CAAP;AACD,CAVM","sourcesContent":["import debug from 'debug';\nimport Point from '@mapbox/point-geometry';\nimport _ from 'lodash';\nconst log = debug('pie-lib:graphing:tools:utils');\n\nexport const FREQ_DIVIDER = 16;\n\nexport const getAmplitudeAndFreq = (root, edge) => {\n if (!edge) {\n return { freq: 0, amplitude: 0 };\n }\n\n if (root.x == edge.x) {\n return { freq: 0, amplitude: 0 };\n }\n\n const r = new Point(root.x, root.y);\n const e = new Point(edge.x, edge.y);\n const d = e.sub(r);\n // edge point describes 1/4 of the freq\n return { freq: d.x * 4, amplitude: d.y };\n};\n\n/**\n * build the x points with root as the anchor.\n */\nexport const xPoints = (root, freq, min, max) => {\n freq = Math.abs(freq);\n log('[xPoints] root:', root, 'freq:', freq, ' min:', min, ' max:', max);\n const leftpoints = _.rangeRight(root, min - freq, freq * -1);\n const rightpoints = _.range(root + freq, max + freq, freq);\n\n return _.concat(leftpoints, rightpoints);\n};\n\n/**\n * Calculate y for x value using amp, freq and shift\n * https://www.desmos.com/calculator/f1psfoiiv6\n */\nexport const sinY = (amplitude, freq, shift) => x => {\n shift = { phase: 0, vertical: 0, ...shift };\n const TWO_PI = Math.PI * 2;\n const num = TWO_PI * (x - shift.phase);\n const frac = num / freq;\n const sin = Math.sin(frac);\n const sinFloat = parseFloat(sin).toFixed(10);\n return amplitude * sinFloat + shift.vertical;\n};\n\n/**\n * You need three points for the quadratic eq, so we mirror the edge point\n * https://www.desmos.com/calculator/xhz1xqgpca\n */\nexport const parabolaFromTwoPoints = (root, edge) => {\n edge = edge || { ...root };\n const mirrorEdge = { x: root.x - (edge.x - root.x), y: edge.y };\n return parabolaFromThreePoints(root, edge, mirrorEdge);\n};\n\nexport const parabolaFromThreePoints = (one, two, three) => {\n log(one, two, three);\n const { a, b, c } = pointsToABC(one, two, three);\n log(a, b, c);\n return parabola(a, b, c);\n};\n/** derive a,b,c from the 3 points */\nexport const pointsToABC = (one, two, three) => {\n const a1 = Math.pow(one.x, 2) * -1 + Math.pow(two.x, 2);\n const b1 = one.x * -1 + two.x;\n const d1 = one.y * -1 + two.y;\n const a2 = Math.pow(two.x, 2) * -1 + Math.pow(three.x, 2);\n const b2 = two.x * -1 + three.x;\n const d2 = two.y * -1 + three.y;\n const bMult = (b2 / b1) * -1;\n const a3 = bMult * a1 + a2;\n const d3 = bMult * d1 + d2;\n const a = d3 / a3;\n const b = (d1 - a1 * a) / b1;\n const c = one.y - a * Math.pow(one.x, 2) - b * one.x;\n return { a, b, c };\n};\n\n/**\n * y=ax^2+bx+c\n */\nexport const parabola = (a, b, c) => x => a * Math.pow(x, 2) + b * x + c;\n\n/**\n * Generate a set of data points, add spacing before min and after max if there is space between minx + min and maxX and max\n * @param {*} min\n * @param {*} max\n * @param {*} root\n * @param {*} edge\n * @param {*} interval\n * @param {*} yFn\n */\nexport const buildDataPoints = (min, max, root, edge, interval, yFn) => {\n log('[buildDataPoints] min:', min, 'max:', max, 'root:', root);\n edge = edge ? edge : { ...root };\n const minX = Math.min(root.x, edge.x);\n const maxX = Math.max(root.x, edge.x);\n const leftSpace = min - minX;\n const rightSpace = max - maxX;\n const xs = xPoints(minX, interval, min - rightSpace, max - leftSpace);\n log('[buildDataPoints]:xs:', xs);\n return xs.map(v => new Point(v, yFn(v)));\n};\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":["log","FREQ_DIVIDER","getAmplitudeAndFreq","root","edge","freq","amplitude","x","r","Point","y","e","d","sub","xPoints","min","max","Math","abs","leftpoints","_","rangeRight","rightpoints","range","concat","sinY","shift","phase","vertical","TWO_PI","PI","num","frac","sin","sinFloat","parseFloat","toFixed","parabolaFromTwoPoints","mirrorEdge","parabolaFromThreePoints","one","two","three","pointsToABC","a","b","c","parabola","a1","pow","b1","d1","a2","b2","d2","bMult","a3","d3","buildDataPoints","interval","yFn","minX","maxX","leftSpace","rightSpace","xs","map","v"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;;;;;AACA,IAAMA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vB,EAAiCC,GAAjC,EAAyC;AACtE5D,EAAAA,GAAG,CAAC,wBAAD,EAA2Be,GAA3B,EAAgC,MAAhC,EAAwCC,GAAxC,EAA6C,OAA7C,EAAsDb,IAAtD,CAAH;AACAC,EAAAA,IAAI,GAAGA,IAAI,GAAGA,IAAH,qBAAeD,IAAf,CAAX;AACA,MAAM0D,IAAI,GAAG5C,IAAI,CAACF,GAAL,CAASZ,IAAI,CAACI,CAAd,EAAiBH,IAAI,CAACG,CAAtB,CAAb;AACA,MAAMuD,IAAI,GAAG7C,IAAI,CAACD,GAAL,CAASb,IAAI,CAACI,CAAd,EAAiBH,IAAI,CAACG,CAAtB,CAAb;AACA,MAAMwD,SAAS,GAAGhD,GAAG,GAAG8C,IAAxB;AACA,MAAMG,UAAU,GAAGhD,GAAG,GAAG8C,IAAzB;AACA,MAAMG,EAAE,GAAGnD,OAAO,CAAC+C,IAAD,EAAOF,QAAP,EAAiB5C,GAAG,GAAGiD,UAAvB,EAAmChD,GAAG,GAAG+C,SAAzC,CAAlB;AACA/D,EAAAA,GAAG,CAAC,uBAAD,EAA0BiE,EAA1B,CAAH;AACA,SAAOA,EAAE,CAACC,GAAH,CAAO,UAACC,CAAD;AAAA,WAAO,IAAI1D,yBAAJ,CAAU0D,CAAV,EAAaP,GAAG,CAACO,CAAD,CAAhB,CAAP;AAAA,GAAP,CAAP;AACD,CAVM","sourcesContent":["import debug from 'debug';\nimport Point from '@mapbox/point-geometry';\nimport _ from 'lodash';\nconst log = debug('pie-lib:graphing:tools:utils');\n\nexport const FREQ_DIVIDER = 16;\n\nexport const getAmplitudeAndFreq = (root, edge) => {\n if (!edge) {\n return { freq: 0, amplitude: 0 };\n }\n\n if (root.x == edge.x) {\n return { freq: 0, amplitude: 0 };\n }\n\n const r = new Point(root.x, root.y);\n const e = new Point(edge.x, edge.y);\n const d = e.sub(r);\n // edge point describes 1/4 of the freq\n return { freq: d.x * 4, amplitude: d.y };\n};\n\n/**\n * build the x points with root as the anchor.\n */\nexport const xPoints = (root, freq, min, max) => {\n freq = Math.abs(freq);\n log('[xPoints] root:', root, 'freq:', freq, ' min:', min, ' max:', max);\n const leftpoints = _.rangeRight(root, min - freq, freq * -1);\n const rightpoints = _.range(root + freq, max + freq, freq);\n\n return _.concat(leftpoints, rightpoints);\n};\n\n/**\n * Calculate y for x value using amp, freq and shift\n * https://www.desmos.com/calculator/f1psfoiiv6\n */\nexport const sinY = (amplitude, freq, shift) => (x) => {\n shift = { phase: 0, vertical: 0, ...shift };\n const TWO_PI = Math.PI * 2;\n const num = TWO_PI * (x - shift.phase);\n const frac = num / freq;\n const sin = Math.sin(frac);\n const sinFloat = parseFloat(sin).toFixed(10);\n return amplitude * sinFloat + shift.vertical;\n};\n\n/**\n * You need three points for the quadratic eq, so we mirror the edge point\n * https://www.desmos.com/calculator/xhz1xqgpca\n */\nexport const parabolaFromTwoPoints = (root, edge) => {\n edge = edge || { ...root };\n const mirrorEdge = { x: root.x - (edge.x - root.x), y: edge.y };\n return parabolaFromThreePoints(root, edge, mirrorEdge);\n};\n\nexport const parabolaFromThreePoints = (one, two, three) => {\n log(one, two, three);\n const { a, b, c } = pointsToABC(one, two, three);\n log(a, b, c);\n return parabola(a, b, c);\n};\n/** derive a,b,c from the 3 points */\nexport const pointsToABC = (one, two, three) => {\n const a1 = Math.pow(one.x, 2) * -1 + Math.pow(two.x, 2);\n const b1 = one.x * -1 + two.x;\n const d1 = one.y * -1 + two.y;\n const a2 = Math.pow(two.x, 2) * -1 + Math.pow(three.x, 2);\n const b2 = two.x * -1 + three.x;\n const d2 = two.y * -1 + three.y;\n const bMult = (b2 / b1) * -1;\n const a3 = bMult * a1 + a2;\n const d3 = bMult * d1 + d2;\n const a = d3 / a3;\n const b = (d1 - a1 * a) / b1;\n const c = one.y - a * Math.pow(one.x, 2) - b * one.x;\n return { a, b, c };\n};\n\n/**\n * y=ax^2+bx+c\n */\nexport const parabola = (a, b, c) => (x) => a * Math.pow(x, 2) + b * x + c;\n\n/**\n * Generate a set of data points, add spacing before min and after max if there is space between minx + min and maxX and max\n * @param {*} min\n * @param {*} max\n * @param {*} root\n * @param {*} edge\n * @param {*} interval\n * @param {*} yFn\n */\nexport const buildDataPoints = (min, max, root, edge, interval, yFn) => {\n log('[buildDataPoints] min:', min, 'max:', max, 'root:', root);\n edge = edge ? edge : { ...root };\n const minX = Math.min(root.x, edge.x);\n const maxX = Math.max(root.x, edge.x);\n const leftSpace = min - minX;\n const rightSpace = max - maxX;\n const xs = xPoints(minX, interval, min - rightSpace, max - leftSpace);\n log('[buildDataPoints]:xs:', xs);\n return xs.map((v) => new Point(v, yFn(v)));\n};\n"],"file":"index.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-lib/graphing-utils",
3
- "version": "1.1.18",
3
+ "version": "1.1.21",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "src/index.js",
@@ -14,6 +14,6 @@
14
14
  "debug": "^4.1.1",
15
15
  "lodash": "^4.17.11"
16
16
  },
17
- "gitHead": "e6de0d62291ecfdeb3a62b988c526d97ee41eaa6",
17
+ "gitHead": "f81076118e63884db5f5d65a41cff9aad111137e",
18
18
  "scripts": {}
19
19
  }
package/src/index.js CHANGED
@@ -37,7 +37,7 @@ export const xPoints = (root, freq, min, max) => {
37
37
  * Calculate y for x value using amp, freq and shift
38
38
  * https://www.desmos.com/calculator/f1psfoiiv6
39
39
  */
40
- export const sinY = (amplitude, freq, shift) => x => {
40
+ export const sinY = (amplitude, freq, shift) => (x) => {
41
41
  shift = { phase: 0, vertical: 0, ...shift };
42
42
  const TWO_PI = Math.PI * 2;
43
43
  const num = TWO_PI * (x - shift.phase);
@@ -83,7 +83,7 @@ export const pointsToABC = (one, two, three) => {
83
83
  /**
84
84
  * y=ax^2+bx+c
85
85
  */
86
- export const parabola = (a, b, c) => x => a * Math.pow(x, 2) + b * x + c;
86
+ export const parabola = (a, b, c) => (x) => a * Math.pow(x, 2) + b * x + c;
87
87
 
88
88
  /**
89
89
  * Generate a set of data points, add spacing before min and after max if there is space between minx + min and maxX and max
@@ -103,5 +103,5 @@ export const buildDataPoints = (min, max, root, edge, interval, yFn) => {
103
103
  const rightSpace = max - maxX;
104
104
  const xs = xPoints(minX, interval, min - rightSpace, max - leftSpace);
105
105
  log('[buildDataPoints]:xs:', xs);
106
- return xs.map(v => new Point(v, yFn(v)));
106
+ return xs.map((v) => new Point(v, yFn(v)));
107
107
  };