Socket
Socket
Sign inDemoInstall

@thi.ng/math

Package Overview
Dependencies
Maintainers
1
Versions
160
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/math - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

## [0.2.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/math@0.2.0...@thi.ng/math@0.2.1) (2018-11-20)
### Bug Fixes
* **math:** fix [#60](https://github.com/thi-ng/umbrella/issues/60), add range check for norm() ([143c47c](https://github.com/thi-ng/umbrella/commit/143c47c))
# [0.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/math@0.1.0...@thi.ng/math@0.2.0) (2018-10-21)

@@ -8,0 +19,0 @@

@@ -0,1 +1,9 @@

/**
* Returns normalized value of `x` WRT to interval `a .. b`. If `a`
* equals `b`, returns 0.
*
* @param x
* @param a
* @param b
*/
export declare const norm: (x: number, a: number, b: number) => number;

@@ -2,0 +10,0 @@ export declare const fit: (x: number, a: number, b: number, c: number, d: number) => number;

10

fit.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const interval_1 = require("./interval");
exports.norm = (x, a, b) => (x - a) / (b - a);
/**
* Returns normalized value of `x` WRT to interval `a .. b`. If `a`
* equals `b`, returns 0.
*
* @param x
* @param a
* @param b
*/
exports.norm = (x, a, b) => b !== a ? (x - a) / (b - a) : 0;
exports.fit = (x, a, b, c, d) => c + (d - c) * exports.norm(x, a, b);

@@ -6,0 +14,0 @@ exports.fitClamped = (x, a, b, c, d) => c + (d - c) * interval_1.clamp01(exports.norm(x, a, b));

4

package.json
{
"name": "@thi.ng/math",
"version": "0.2.0",
"version": "0.2.1",
"description": "Assorted common math functions & utilities",

@@ -42,3 +42,3 @@ "main": "./index.js",

},
"gitHead": "5bb513915cb3c533bd4278f6f365389b3664f4d1"
"gitHead": "e044a6a2548a372399444479153861da6a63e1dc"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc