An ESnext spec-compliant Math.hypot
shim/polyfill/replacement that works as far down as ES3.
This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the spec.
npm install --save math.hypot
console.log(Math.hypot(3, 4)); // 5
console.log(Math.hypot(5, 7)); // 8.602325267042627
console.log(Math.hypot(2, 3, 6)); // 7
console.log(Math.hypot(-5)); // 5
Simply clone the repo, npm install
, and run npm test