## "Fossies" - the Fresh Open Source Software Archive

### Member "Atom/resources/app/apm/node_modules/es5-ext/math/hypot/shim.js" (7 Feb 2017, 899 Bytes) of archive /windows/misc/atom-windows.zip:

As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

```    1 // Thanks for hints: https://github.com/paulmillr/es6-shim
2
3 'use strict';
4
5 var some = Array.prototype.some, abs = Math.abs, sqrt = Math.sqrt
6
7   , compare = function (a, b) hlOpen(7,1);{ return b - a; hlClose(1, 7);}
8   , divide = function (x) hlOpen(8,1);{ return x / this; hlClose(2, 8);}
9   , add = function (sum, number) hlOpen(9,1);{ return sum + number * number; hlClose(3, 9);};
10
11 module.exports = function (val1, val2/*, …valn*/) hlOpen(11,1);{
12     var result, numbers;
13     if (!arguments.length) return 0;
14     some.call(arguments, function (val) hlOpen(14,2);{
15         if (isNaN(val)) hlOpen(15,3);{
16             result = NaN;
17             return;
18         hlClose(6, 18);}
19         if (!isFinite(val)) hlOpen(19,3);{
20             result = Infinity;
21             return true;
22         hlClose(7, 22);}
23         if (result !== undefined) return;
24         val = Number(val);
25         if (val === 0) return;
26         if (!numbers) numbers = [abs(val)];
27         else numbers.push(abs(val));
28     hlClose(5, 28);});
29     if (result !== undefined) return result;
30     if (!numbers) return 0;
31
32     numbers.sort(compare);
33     return numbers[0] * sqrt(numbers.map(divide, numbers[0]).reduce(add, 0));
34 hlClose(4, 34);};
```