beetleshine 0.0.14 → 0.0.15

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/lib/xmath.js CHANGED
@@ -4,6 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Xmath = void 0;
7
- var Xmath = {};
7
+ var Xmath = {
8
+ map_range: function map_range(val, in_min, in_max, out_min, out_max) {
9
+ if (in_min === in_max) {
10
+ throw new Error("Xmath.map_range: in_min と in_max が同じなので計算できません");
11
+ }
12
+ var ratio = (val - in_min) / (in_max - in_min);
13
+ return ratio * (out_max - out_min) + out_min;
14
+ }
15
+ };
8
16
  exports.Xmath = Xmath;
9
17
  //# sourceMappingURL=xmath.js.map
package/lib/xmath.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"xmath.js","names":["Xmath","exports"],"sources":["../src/xmath.js"],"sourcesContent":["export const Xmath = {\n}\n"],"mappings":";;;;;;AAAO,IAAMA,KAAK,GAAG,CACrB,CAAC;AAAAC,OAAA,CAAAD,KAAA,GAAAA,KAAA"}
1
+ {"version":3,"file":"xmath.js","names":["Xmath","map_range","val","in_min","in_max","out_min","out_max","Error","ratio","exports"],"sources":["../src/xmath.js"],"sourcesContent":["export const Xmath = {\n map_range(val, in_min, in_max, out_min, out_max) {\n if (in_min === in_max) {\n throw new Error(\"Xmath.map_range: in_min と in_max が同じなので計算できません\")\n }\n const ratio = (val - in_min) / (in_max - in_min)\n return ratio * (out_max - out_min) + out_min\n }\n}\n"],"mappings":";;;;;;AAAO,IAAMA,KAAK,GAAG;EACnBC,SAAS,WAAAA,UAACC,GAAG,EAAEC,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAE;IAC/C,IAAIH,MAAM,KAAKC,MAAM,EAAE;MACrB,MAAM,IAAIG,KAAK,CAAC,gDAAgD,CAAC;IACnE;IACA,IAAMC,KAAK,GAAG,CAACN,GAAG,GAAGC,MAAM,KAAKC,MAAM,GAAGD,MAAM,CAAC;IAChD,OAAOK,KAAK,IAAIF,OAAO,GAAGD,OAAO,CAAC,GAAGA,OAAO;EAC9C;AACF,CAAC;AAAAI,OAAA,CAAAT,KAAA,GAAAA,KAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "beetleshine",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "description": "A simple library",
5
5
  "keywords": "small library",
6
6
  "author": "Akira Ikeda <pinpon.ikeda@gmail.com>",