mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-03 06:32:19 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
10
web/node_modules/es5-ext/math/hypot/implement.js
generated
vendored
Normal file
10
web/node_modules/es5-ext/math/hypot/implement.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
"use strict";
|
||||
|
||||
if (!require("./is-implemented")()) {
|
||||
Object.defineProperty(Math, "hypot", {
|
||||
value: require("./shim"),
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
});
|
||||
}
|
3
web/node_modules/es5-ext/math/hypot/index.js
generated
vendored
Normal file
3
web/node_modules/es5-ext/math/hypot/index.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = require("./is-implemented")() ? Math.hypot : require("./shim");
|
7
web/node_modules/es5-ext/math/hypot/is-implemented.js
generated
vendored
Normal file
7
web/node_modules/es5-ext/math/hypot/is-implemented.js
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = function () {
|
||||
var hypot = Math.hypot;
|
||||
if (typeof hypot !== "function") return false;
|
||||
return hypot(3, 4) === 5;
|
||||
};
|
37
web/node_modules/es5-ext/math/hypot/shim.js
generated
vendored
Normal file
37
web/node_modules/es5-ext/math/hypot/shim.js
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
// Thanks for hints: https://github.com/paulmillr/es6-shim
|
||||
|
||||
"use strict";
|
||||
|
||||
var some = Array.prototype.some
|
||||
, abs = Math.abs
|
||||
, sqrt = Math.sqrt
|
||||
, compare = function (val1, val2) { return val2 - val1; }
|
||||
, divide = function (value) { return value / this; }
|
||||
, add = function (sum, number) { return sum + number * number; };
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
module.exports = function (val1, val2/*, …valn*/) {
|
||||
var result, numbers;
|
||||
if (!arguments.length) return 0;
|
||||
some.call(arguments, function (val) {
|
||||
if (isNaN(val)) {
|
||||
result = NaN;
|
||||
return false;
|
||||
}
|
||||
if (!isFinite(val)) {
|
||||
result = Infinity;
|
||||
return true;
|
||||
}
|
||||
if (result !== undefined) return false;
|
||||
val = Number(val);
|
||||
if (val === 0) return false;
|
||||
if (numbers) numbers.push(abs(val));
|
||||
else numbers = [abs(val)];
|
||||
return false;
|
||||
});
|
||||
if (result !== undefined) return result;
|
||||
if (!numbers) return 0;
|
||||
|
||||
numbers.sort(compare);
|
||||
return numbers[0] * sqrt(numbers.map(divide, numbers[0]).reduce(add, 0));
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue