Comparing version 1.11.0 to 1.12.0
@@ -0,1 +1,10 @@ | ||
v1.12.0 | ||
======= | ||
2018-05-12T08:35:00Z | ||
- `web.request` now supports redirection. | ||
- Add an experimental `web.Socket` class, but just for browser. In the future we'll make it run on Node.js. | ||
- In the compilation process of this project, we use Babel 6 instead of Babel 5. Now only the ES imports and exports are converted by Babel. Others are not converted. | ||
v1.11.0 | ||
@@ -2,0 +11,0 @@ ======= |
@@ -6,3 +6,3 @@ # Compile | ||
```bash | ||
rm -Rf target && rm -Rf test-target && fus c lib target && node node_modules/babel/bin/babel -d target target && fus c test test-target && node node_modules/babel/bin/babel -d test-target test-target | ||
rm -Rf target && rm -Rf test-target && fus lc lib target && npx babel --plugins=transform-es2015-modules-commonjs -d target target && fus lc test test-target && npx babel --plugins=transform-es2015-modules-commonjs -d test-target test-target | ||
``` | ||
@@ -9,0 +9,0 @@ |
{ | ||
"name": "fus-ext", | ||
"version": "1.11.0", | ||
"version": "1.12.0", | ||
"description": "FutureScript Extension", | ||
@@ -25,6 +25,6 @@ "keywords": [ | ||
"devDependencies": { | ||
"babel": "5.x", | ||
"babel-polyfill": "6.x" | ||
"babel-cli": "6.x", | ||
"babel-plugin-transform-es2015-modules-commonjs": "6.x" | ||
}, | ||
"main": "./target/main" | ||
} |
@@ -1,20 +0,18 @@ | ||
"use strict";Object.defineProperty(exports, "__esModule", { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.insertAfter = exports.insertBeforeIndex = exports.insertBefore = exports.removeAllMatch = exports.removeMatch = exports.removeAll = exports.remove = exports.removeAt = exports.takeRandom = exports.takeRandomOne = exports.random = exports.randomOne = exports.join = exports.toObject = exports.asyncMap = exports.asyncEvery = exports.asyncSome = exports.asyncForEach = exports.forEach = exports.flatten = exports.intersect = exports.union = exports.distinct = exports.except = exports.reverse = exports.sortDescending = exports.sort = exports._sort = exports.group = exports.product = exports.median = exports.average = exports.sum = exports.min = exports.max = exports.withMin = exports.withMax = exports.singleOrVoid = exports.singleOrNull = exports.single = exports.lastOrVoid = exports.lastOrNull = exports.last = exports.firstOrVoid = exports.firstOrNull = exports.first = exports.contains = exports.includes = exports.atOrVoid = exports.atOrNull = exports.at = exports.portion = exports.bound = exports.isEmpty = exports.clone = exports._amountToLength = exports._positionToIndex = exports._reverseToIndex = exports._ratioToLength = exports._ratioToIndex = undefined; | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } } | ||
var _main = require("./main"); | ||
var ok_573300145710716007 = function ok_573300145710716007(a) { | ||
var ok_573300145710716007 = function (a) { | ||
return a !== undefined && a !== null; | ||
};var dotDotCalc_573300145710716007 = function dotDotCalc_573300145710716007(dotDot, a, b, c) { | ||
var _dotDot; | ||
return (_dotDot = dotDot(a))[b].apply(_dotDot, [a].concat(_toConsumableArray(c))); | ||
};var dotDotCalc_573300145710716007 = function (dotDot, a, b, c) { | ||
return dotDot(a)[b](a, ...c); | ||
};var _elementOrUseSelector, _ratioToIndex, _ratioToLength, _reverseToIndex, _positionToIndex, _amountToLength, clone, isEmpty, bound, portion, at, atOrNull, atOrVoid, includes, contains, first, firstOrNull, firstOrVoid, last, lastOrNull, lastOrVoid, single, singleOrNull, singleOrVoid, withMax, withMin, max, min, sum, average, median, product, group, _sort, sort, sortDescending, reverse, except, distinct, union, intersect, flatten, forEach, asyncForEach, asyncSome, asyncEvery, asyncMap, toObject, join, randomOne, random, takeRandomOne, takeRandom, removeAt, remove, removeAll, removeMatch, removeAllMatch, insertBefore, insertBeforeIndex, insertAfter;_elementOrUseSelector = function (element, selector) { | ||
return (function () { | ||
return ok_573300145710716007(selector) ? (function () { | ||
return (() => { | ||
return ok_573300145710716007(selector) ? (() => { | ||
return selector(element); | ||
})() : (function () { | ||
})() : (() => { | ||
return element; | ||
@@ -24,9 +22,9 @@ })(); | ||
};exports._ratioToIndex = _ratioToIndex = function (arr, ratio) { | ||
return (function () { | ||
var r;r = Math.round(ratio * arr.length - 0.5);return r <= 0 ? (function () { | ||
return (() => { | ||
var r;r = Math.round(ratio * arr.length - 0.5);return r <= 0 ? (() => { | ||
return 0; | ||
})() : (function () { | ||
return r > arr.length - 1 ? (function () { | ||
})() : (() => { | ||
return r > arr.length - 1 ? (() => { | ||
return arr.length - 1; | ||
})() : (function () { | ||
})() : (() => { | ||
return r; | ||
@@ -37,9 +35,9 @@ })(); | ||
};exports._ratioToLength = _ratioToLength = function (arr, ratio) { | ||
return (function () { | ||
var r;r = Math.round(ratio * (arr.length + 1) - 0.5);return r <= 0 ? (function () { | ||
return (() => { | ||
var r;r = Math.round(ratio * (arr.length + 1) - 0.5);return r <= 0 ? (() => { | ||
return 0; | ||
})() : (function () { | ||
return r > arr.length ? (function () { | ||
})() : (() => { | ||
return r > arr.length ? (() => { | ||
return arr.length; | ||
})() : (function () { | ||
})() : (() => { | ||
return r; | ||
@@ -50,15 +48,15 @@ })(); | ||
};exports._reverseToIndex = _reverseToIndex = function (arr, reverseIndex) { | ||
return (function () { | ||
return (() => { | ||
return arr.length - 1 - reverseIndex; | ||
})(); | ||
};exports._positionToIndex = _positionToIndex = function (arr, pos) { | ||
return (function () { | ||
var var_573300145710716007_2, var_573300145710716007_3;typeof pos === "number" ? (function () { | ||
return 0 < (var_573300145710716007_2 = pos) && var_573300145710716007_2 < 1 ? (function () { | ||
return (() => { | ||
var var_573300145710716007_2, var_573300145710716007_3;typeof pos === "number" ? (() => { | ||
return 0 < (var_573300145710716007_2 = pos) && var_573300145710716007_2 < 1 ? (() => { | ||
pos = { Ratio: pos }; | ||
})() : (function () { | ||
return -1 < (var_573300145710716007_3 = pos) && var_573300145710716007_3 < 0 ? (function () { | ||
})() : (() => { | ||
return -1 < (var_573300145710716007_3 = pos) && var_573300145710716007_3 < 0 ? (() => { | ||
pos = { Reverse: { Ratio: -pos } }; | ||
})() : (function () { | ||
return pos < 0 ? (function () { | ||
})() : (() => { | ||
return pos < 0 ? (() => { | ||
pos = { Reverse: -pos - 1 }; | ||
@@ -68,14 +66,14 @@ })() : undefined; | ||
})(); | ||
})() : undefined;return typeof pos === "number" ? (function () { | ||
})() : undefined;return typeof pos === "number" ? (() => { | ||
return pos; | ||
})() : (function () { | ||
return ok_573300145710716007(pos) && ok_573300145710716007(pos.Reverse) && ok_573300145710716007(pos.Reverse.Ratio) ? (function () { | ||
})() : (() => { | ||
return ok_573300145710716007(pos) && ok_573300145710716007(pos.Reverse) && ok_573300145710716007(pos.Reverse.Ratio) ? (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "_reverseToIndex", [dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "_ratioToIndex", [pos.Reverse.Ratio])]); | ||
})() : (function () { | ||
return ok_573300145710716007(pos) && ok_573300145710716007(pos.Reverse) ? (function () { | ||
})() : (() => { | ||
return ok_573300145710716007(pos) && ok_573300145710716007(pos.Reverse) ? (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "_reverseToIndex", [pos.Reverse]); | ||
})() : (function () { | ||
return ok_573300145710716007(pos) && ok_573300145710716007(pos.Ratio) ? (function () { | ||
})() : (() => { | ||
return ok_573300145710716007(pos) && ok_573300145710716007(pos.Ratio) ? (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "_ratioToIndex", [pos.Ratio]); | ||
})() : (function () { | ||
})() : (() => { | ||
return (0, _main.fail)(); | ||
@@ -88,13 +86,13 @@ })(); | ||
};exports._amountToLength = _amountToLength = function (arr, amount) { | ||
return (function () { | ||
var var_573300145710716007_4;typeof amount === "number" ? (function () { | ||
return 0 < (var_573300145710716007_4 = amount) && var_573300145710716007_4 < 1 ? (function () { | ||
return (() => { | ||
var var_573300145710716007_4;typeof amount === "number" ? (() => { | ||
return 0 < (var_573300145710716007_4 = amount) && var_573300145710716007_4 < 1 ? (() => { | ||
amount = { Ratio: amount }; | ||
})() : undefined; | ||
})() : undefined;return typeof amount === "number" ? (function () { | ||
})() : undefined;return typeof amount === "number" ? (() => { | ||
return amount; | ||
})() : (function () { | ||
return ok_573300145710716007(amount) && ok_573300145710716007(amount.Ratio) ? (function () { | ||
})() : (() => { | ||
return ok_573300145710716007(amount) && ok_573300145710716007(amount.Ratio) ? (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "_ratioToLength", [amount.Ratio]); | ||
})() : (function () { | ||
})() : (() => { | ||
return (0, _main.fail)(); | ||
@@ -105,25 +103,25 @@ })(); | ||
};exports.clone = clone = function (arr) { | ||
return (function () { | ||
return (() => { | ||
return arr.slice(); | ||
})(); | ||
};exports.isEmpty = isEmpty = function (arr) { | ||
return (function () { | ||
return (() => { | ||
return arr.length === 0; | ||
})(); | ||
};exports.bound = bound = function (arr) { | ||
return (function () { | ||
return (() => { | ||
return arr.length - 1; | ||
})(); | ||
};exports.portion = portion = function (arr, startIndex, length, endIndex) { | ||
return (function () { | ||
startIndex = dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "_positionToIndex", [startIndex]);ok_573300145710716007(length) ? (function () { | ||
return (() => { | ||
startIndex = dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "_positionToIndex", [startIndex]);ok_573300145710716007(length) ? (() => { | ||
length = dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "_amountToLength", [length]); | ||
})() : undefined;ok_573300145710716007(endIndex) ? (function () { | ||
})() : undefined;ok_573300145710716007(endIndex) ? (() => { | ||
endIndex = dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "_positionToIndex", [endIndex]); | ||
})() : undefined;return arr.slice(startIndex, ok_573300145710716007(length) ? (function () { | ||
})() : undefined;return arr.slice(startIndex, ok_573300145710716007(length) ? (() => { | ||
return startIndex + length; | ||
})() : (function () { | ||
return ok_573300145710716007(endIndex) ? (function () { | ||
})() : (() => { | ||
return ok_573300145710716007(endIndex) ? (() => { | ||
return endIndex + 1; | ||
})() : (function () { | ||
})() : (() => { | ||
return undefined; | ||
@@ -134,14 +132,14 @@ })(); | ||
};exports.at = at = function (arr, index) { | ||
return (function () { | ||
return (() => { | ||
var var_573300145710716007_5;index = dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "_positionToIndex", [index]);(0, _main.assert)(Number.isInteger(index) && 0 <= (var_573300145710716007_5 = index) && var_573300145710716007_5 < arr.length);return arr[index]; | ||
})(); | ||
};exports.atOrNull = atOrNull = function (arr, index) { | ||
return (function () { | ||
return (function () { | ||
return (() => { | ||
return (() => { | ||
try { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "at", [index]); | ||
})(); | ||
} catch (catch_573300145710716007) { | ||
return (function () { | ||
return (() => { | ||
return null; | ||
@@ -153,10 +151,10 @@ })(); | ||
};exports.atOrVoid = atOrVoid = function (arr, index) { | ||
return (function () { | ||
return (function () { | ||
return (() => { | ||
return (() => { | ||
try { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "at", [index]); | ||
})(); | ||
} catch (catch_573300145710716007) { | ||
return (function () { | ||
return (() => { | ||
return undefined; | ||
@@ -168,10 +166,10 @@ })(); | ||
};exports.includes = includes = function (arr, value) { | ||
return (function () { | ||
return (() => { | ||
return arr.indexOf(value) >= 0; | ||
})(); | ||
};exports.contains = contains = includes;exports.first = first = function (arr, predicate) { | ||
return (function () { | ||
var queryResult;queryResult = ok_573300145710716007(predicate) ? (function () { | ||
return (() => { | ||
var queryResult;queryResult = ok_573300145710716007(predicate) ? (() => { | ||
return arr.filter(predicate); | ||
})() : (function () { | ||
})() : (() => { | ||
return arr; | ||
@@ -181,10 +179,10 @@ })();return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, queryResult, "at", [0]); | ||
};exports.firstOrNull = firstOrNull = function (arr, predicate) { | ||
return (function () { | ||
return (function () { | ||
return (() => { | ||
return (() => { | ||
try { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "first", [predicate]); | ||
})(); | ||
} catch (catch_573300145710716007) { | ||
return (function () { | ||
return (() => { | ||
return null; | ||
@@ -196,10 +194,10 @@ })(); | ||
};exports.firstOrVoid = firstOrVoid = function (arr, predicate) { | ||
return (function () { | ||
return (function () { | ||
return (() => { | ||
return (() => { | ||
try { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "first", [predicate]); | ||
})(); | ||
} catch (catch_573300145710716007) { | ||
return (function () { | ||
return (() => { | ||
return undefined; | ||
@@ -211,6 +209,6 @@ })(); | ||
};exports.last = last = function (arr, predicate) { | ||
return (function () { | ||
var queryResult;queryResult = ok_573300145710716007(predicate) ? (function () { | ||
return (() => { | ||
var queryResult;queryResult = ok_573300145710716007(predicate) ? (() => { | ||
return arr.filter(predicate); | ||
})() : (function () { | ||
})() : (() => { | ||
return arr; | ||
@@ -220,10 +218,10 @@ })();return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, queryResult, "at", [queryResult.length - 1]); | ||
};exports.lastOrNull = lastOrNull = function (arr, predicate) { | ||
return (function () { | ||
return (function () { | ||
return (() => { | ||
return (() => { | ||
try { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "last", [predicate]); | ||
})(); | ||
} catch (catch_573300145710716007) { | ||
return (function () { | ||
return (() => { | ||
return null; | ||
@@ -235,10 +233,10 @@ })(); | ||
};exports.lastOrVoid = lastOrVoid = function (arr, predicate) { | ||
return (function () { | ||
return (function () { | ||
return (() => { | ||
return (() => { | ||
try { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "last", [predicate]); | ||
})(); | ||
} catch (catch_573300145710716007) { | ||
return (function () { | ||
return (() => { | ||
return undefined; | ||
@@ -250,6 +248,6 @@ })(); | ||
};exports.single = single = function (arr, predicate) { | ||
return (function () { | ||
var queryResult;queryResult = ok_573300145710716007(predicate) ? (function () { | ||
return (() => { | ||
var queryResult;queryResult = ok_573300145710716007(predicate) ? (() => { | ||
return arr.filter(predicate); | ||
})() : (function () { | ||
})() : (() => { | ||
return arr; | ||
@@ -259,10 +257,10 @@ })();(0, _main.assert)(queryResult.length === 1);return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, queryResult, "at", [0]); | ||
};exports.singleOrNull = singleOrNull = function (arr, predicate) { | ||
return (function () { | ||
return (function () { | ||
return (() => { | ||
return (() => { | ||
try { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "single", [predicate]); | ||
})(); | ||
} catch (catch_573300145710716007) { | ||
return (function () { | ||
return (() => { | ||
return null; | ||
@@ -274,10 +272,10 @@ })(); | ||
};exports.singleOrVoid = singleOrVoid = function (arr, predicate) { | ||
return (function () { | ||
return (function () { | ||
return (() => { | ||
return (() => { | ||
try { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "single", [predicate]); | ||
})(); | ||
} catch (catch_573300145710716007) { | ||
return (function () { | ||
return (() => { | ||
return undefined; | ||
@@ -289,8 +287,8 @@ })(); | ||
};exports.withMax = withMax = function (arr, selector) { | ||
return (function () { | ||
return (() => { | ||
return arr.reduce(function (a, b, index) { | ||
return (function () { | ||
return _elementOrUseSelector(a, selector) > _elementOrUseSelector(b, selector) ? (function () { | ||
return (() => { | ||
return _elementOrUseSelector(a, selector) > _elementOrUseSelector(b, selector) ? (() => { | ||
return a; | ||
})() : (function () { | ||
})() : (() => { | ||
return b; | ||
@@ -302,8 +300,8 @@ })(); | ||
};exports.withMin = withMin = function (arr, selector) { | ||
return (function () { | ||
return (() => { | ||
return arr.reduce(function (a, b, index) { | ||
return (function () { | ||
return _elementOrUseSelector(a, selector) < _elementOrUseSelector(b, selector) ? (function () { | ||
return (() => { | ||
return _elementOrUseSelector(a, selector) < _elementOrUseSelector(b, selector) ? (() => { | ||
return a; | ||
})() : (function () { | ||
})() : (() => { | ||
return b; | ||
@@ -315,19 +313,19 @@ })(); | ||
};exports.max = max = function (arr, selector) { | ||
return (function () { | ||
return (() => { | ||
return _elementOrUseSelector(dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "withMax", [selector]), selector); | ||
})(); | ||
};exports.min = min = function (arr, selector) { | ||
return (function () { | ||
return (() => { | ||
return _elementOrUseSelector(dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "withMin", [selector]), selector); | ||
})(); | ||
};exports.sum = sum = function (arr, selector) { | ||
return (function () { | ||
return arr.length === 1 ? (function () { | ||
return (() => { | ||
return arr.length === 1 ? (() => { | ||
return _elementOrUseSelector(dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "first", []), selector); | ||
})() : (function () { | ||
})() : (() => { | ||
return arr.reduce(function (a, b, index) { | ||
return (function () { | ||
return (index === 1 ? (function () { | ||
return (() => { | ||
return (index === 1 ? (() => { | ||
return _elementOrUseSelector(a, selector); | ||
})() : (function () { | ||
})() : (() => { | ||
return a; | ||
@@ -340,19 +338,19 @@ })()) + _elementOrUseSelector(b, selector); | ||
};exports.average = average = function (arr, selector) { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "sum", [selector]) / arr.length; | ||
})(); | ||
};exports.median = median = function (arr, selector) { | ||
return (function () { | ||
return (() => { | ||
var sorted, a, b, m, n;sorted = dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "sort", [selector]);a = dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, sorted, "at", [0.5 - Number.EPSILON]);b = dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, sorted, "at", [0.5 + Number.EPSILON]);m = _elementOrUseSelector(a, selector);n = _elementOrUseSelector(b, selector);return (m + n) / 2; | ||
})(); | ||
};exports.product = product = function (arr, selector) { | ||
return (function () { | ||
return arr.length === 1 ? (function () { | ||
return (() => { | ||
return arr.length === 1 ? (() => { | ||
return _elementOrUseSelector(dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "first", []), selector); | ||
})() : (function () { | ||
})() : (() => { | ||
return arr.reduce(function (a, b, index) { | ||
return (function () { | ||
return (index === 1 ? (function () { | ||
return (() => { | ||
return (index === 1 ? (() => { | ||
return _elementOrUseSelector(a, selector); | ||
})() : (function () { | ||
})() : (() => { | ||
return a; | ||
@@ -365,9 +363,9 @@ })()) * _elementOrUseSelector(b, selector); | ||
};exports.group = group = function (arr, keySelector, valueSelector) { | ||
return (function () { | ||
var sorted, results, comparedKey, elements;return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "isEmpty", []) ? (function () { | ||
return (() => { | ||
var sorted, results, comparedKey, elements;return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "isEmpty", []) ? (() => { | ||
return []; | ||
})() : (function () { | ||
})() : (() => { | ||
sorted = dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "sort", [keySelector]);results = [];comparedKey = _elementOrUseSelector(dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, sorted, "first", []), keySelector);elements = [];sorted.forEach(function (m) { | ||
return (function () { | ||
var key;key = _elementOrUseSelector(m, keySelector);key !== comparedKey ? (function () { | ||
return (() => { | ||
var key;key = _elementOrUseSelector(m, keySelector);key !== comparedKey ? (() => { | ||
results.push([comparedKey, _elementOrUseSelector(elements, valueSelector)]);comparedKey = key;elements = []; | ||
@@ -380,19 +378,19 @@ })() : undefined;return elements.push(m); | ||
};exports._sort = _sort = function (arr, keySelector, isDescending) { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "clone", []).sort(function (a, b) { | ||
return (function () { | ||
var a1, b1;a1 = _elementOrUseSelector(a, keySelector);b1 = _elementOrUseSelector(b, keySelector);return a1 < b1 ? (function () { | ||
return isDescending ? (function () { | ||
return (() => { | ||
var a1, b1;a1 = _elementOrUseSelector(a, keySelector);b1 = _elementOrUseSelector(b, keySelector);return a1 < b1 ? (() => { | ||
return isDescending ? (() => { | ||
return 1; | ||
})() : (function () { | ||
})() : (() => { | ||
return -1; | ||
})(); | ||
})() : (function () { | ||
return a1 > b1 ? (function () { | ||
return isDescending ? (function () { | ||
})() : (() => { | ||
return a1 > b1 ? (() => { | ||
return isDescending ? (() => { | ||
return -1; | ||
})() : (function () { | ||
})() : (() => { | ||
return 1; | ||
})(); | ||
})() : (function () { | ||
})() : (() => { | ||
return 0; | ||
@@ -405,11 +403,11 @@ })(); | ||
};exports.sort = sort = function (arr, keySelector) { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "_sort", [keySelector, false]); | ||
})(); | ||
};exports.sortDescending = sortDescending = function (arr, keySelector) { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "_sort", [keySelector, true]); | ||
})(); | ||
};exports.reverse = reverse = function (arr) { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "clone", []).reverse(); | ||
@@ -420,11 +418,11 @@ })(); | ||
equalityComparer = function (a, b) { | ||
return (function () { | ||
return (() => { | ||
return a === b; | ||
})(); | ||
}; | ||
}return (function () { | ||
}return (() => { | ||
return arr.filter(function (m) { | ||
return (function () { | ||
return (() => { | ||
return !array.some(function (n) { | ||
return (function () { | ||
return (() => { | ||
return equalityComparer(n, m); | ||
@@ -439,14 +437,14 @@ })(); | ||
equalityComparer = function (a, b) { | ||
return (function () { | ||
return (() => { | ||
return a === b; | ||
})(); | ||
}; | ||
}return (function () { | ||
}return (() => { | ||
var r;r = [];arr.forEach(function (m) { | ||
return (function () { | ||
return (() => { | ||
return !r.some(function (n) { | ||
return (function () { | ||
return (() => { | ||
return equalityComparer(n, m); | ||
})(); | ||
}) ? (function () { | ||
}) ? (() => { | ||
return r.push(m); | ||
@@ -458,3 +456,3 @@ })() : undefined; | ||
};exports.union = union = function (arr, array, equalityComparer) { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr.concat(array), "distinct", [equalityComparer]); | ||
@@ -465,14 +463,14 @@ })(); | ||
equalityComparer = function (a, b) { | ||
return (function () { | ||
return (() => { | ||
return a === b; | ||
})(); | ||
}; | ||
}return (function () { | ||
}return (() => { | ||
var r;r = [];dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "distinct", [equalityComparer]).forEach(function (m) { | ||
return (function () { | ||
return (() => { | ||
return array.some(function (n) { | ||
return (function () { | ||
return (() => { | ||
return equalityComparer(n, m); | ||
})(); | ||
}) ? (function () { | ||
}) ? (() => { | ||
return r.push(m); | ||
@@ -484,29 +482,29 @@ })() : undefined; | ||
};exports.flatten = flatten = function (arr, level) { | ||
return (function () { | ||
var r, canContinue;return level <= 0 ? (function () { | ||
return (() => { | ||
var r, canContinue;return level <= 0 ? (() => { | ||
return (0, _main.fail)(); | ||
})() : (function () { | ||
})() : (() => { | ||
r = [];canContinue = false;arr.forEach(function (m) { | ||
return (function () { | ||
return m instanceof Array ? (function () { | ||
return (() => { | ||
return m instanceof Array ? (() => { | ||
canContinue = true;return m.forEach(function (n) { | ||
return (function () { | ||
return (() => { | ||
return r.push(n); | ||
})(); | ||
}); | ||
})() : (function () { | ||
})() : (() => { | ||
return r.push(m); | ||
})(); | ||
})(); | ||
});return canContinue ? (function () { | ||
return ok_573300145710716007(level) ? (function () { | ||
return level === 1 ? (function () { | ||
});return canContinue ? (() => { | ||
return ok_573300145710716007(level) ? (() => { | ||
return level === 1 ? (() => { | ||
return r; | ||
})() : (function () { | ||
})() : (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, r, "flatten", [level - 1]); | ||
})(); | ||
})() : (function () { | ||
})() : (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, r, "flatten", []); | ||
})(); | ||
})() : (function () { | ||
})() : (() => { | ||
return r; | ||
@@ -517,8 +515,8 @@ })(); | ||
};exports.forEach = forEach = function (arr, callback) { | ||
return (function () { | ||
return (() => { | ||
arr.every(function (element, index) { | ||
return (function () { | ||
return callback(element, index) === _main["break"] ? (function () { | ||
return (() => { | ||
return callback(element, index) === _main.break ? (() => { | ||
return false; | ||
})() : (function () { | ||
})() : (() => { | ||
return true; | ||
@@ -530,10 +528,10 @@ })(); | ||
};exports.asyncForEach = asyncForEach = function (arr, callback) { | ||
return (function () { | ||
return (() => { | ||
var promise;promise = Promise.resolve();arr.forEach(function (element, index) { | ||
return (function () { | ||
return (() => { | ||
promise = promise.then(function (value) { | ||
return (function () { | ||
return value === _main["break"] ? (function () { | ||
return _main["break"]; | ||
})() : (function () { | ||
return (() => { | ||
return value === _main.break ? (() => { | ||
return _main.break; | ||
})() : (() => { | ||
return callback(element, index); | ||
@@ -545,14 +543,14 @@ })(); | ||
});return promise.then(function () { | ||
var arg_573300145710716007 = arguments;return (function () {})(); | ||
var arg_573300145710716007 = arguments;return (() => {})(); | ||
}); | ||
})(); | ||
};exports.asyncSome = asyncSome = function (arr, callback) { | ||
return (function () { | ||
return (() => { | ||
var promise;promise = Promise.resolve(false);arr.forEach(function (element, index) { | ||
return (function () { | ||
return (() => { | ||
promise = promise.then(function (value) { | ||
return (function () { | ||
return value ? (function () { | ||
return (() => { | ||
return value ? (() => { | ||
return true; | ||
})() : (function () { | ||
})() : (() => { | ||
return callback(element, index); | ||
@@ -564,6 +562,6 @@ })(); | ||
});return promise.then(function (m) { | ||
return (function () { | ||
return m ? (function () { | ||
return (() => { | ||
return m ? (() => { | ||
return true; | ||
})() : (function () { | ||
})() : (() => { | ||
return false; | ||
@@ -575,10 +573,10 @@ })(); | ||
};exports.asyncEvery = asyncEvery = function (arr, callback) { | ||
return (function () { | ||
return (() => { | ||
var promise;promise = Promise.resolve(true);arr.forEach(function (element, index) { | ||
return (function () { | ||
return (() => { | ||
promise = promise.then(function (value) { | ||
return (function () { | ||
return !value ? (function () { | ||
return (() => { | ||
return !value ? (() => { | ||
return false; | ||
})() : (function () { | ||
})() : (() => { | ||
return callback(element, index); | ||
@@ -590,6 +588,6 @@ })(); | ||
});return promise.then(function (m) { | ||
return (function () { | ||
return m ? (function () { | ||
return (() => { | ||
return m ? (() => { | ||
return true; | ||
})() : (function () { | ||
})() : (() => { | ||
return false; | ||
@@ -601,11 +599,11 @@ })(); | ||
};exports.asyncMap = asyncMap = function (arr, callback) { | ||
return (function () { | ||
var r, promise;r = [];return arr.length === 0 ? (function () { | ||
return (() => { | ||
var r, promise;r = [];return arr.length === 0 ? (() => { | ||
return Promise.resolve(r); | ||
})() : (function () { | ||
})() : (() => { | ||
promise = Promise.resolve();arr.forEach(function (element, index) { | ||
return (function () { | ||
return (() => { | ||
promise = promise.then(function (value) { | ||
return (function () { | ||
index > 0 ? (function () { | ||
return (() => { | ||
index > 0 ? (() => { | ||
return r.push(value); | ||
@@ -617,3 +615,3 @@ })() : undefined;return callback(element, index); | ||
});return promise.then(function (value) { | ||
return (function () { | ||
return (() => { | ||
r.push(value);return r; | ||
@@ -625,5 +623,5 @@ })(); | ||
};exports.toObject = toObject = function (arr) { | ||
return (function () { | ||
return (() => { | ||
var r;r = {};arr.forEach(function (element) { | ||
return (function () { | ||
return (() => { | ||
r[element[0]] = element[1]; | ||
@@ -633,15 +631,11 @@ })(); | ||
})(); | ||
};exports.join = join = function (arr) { | ||
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
return (function () { | ||
args[0] instanceof Array ? (function () { | ||
};exports.join = join = function (arr, ...args) { | ||
return (() => { | ||
args[0] instanceof Array ? (() => { | ||
args = args[0]; | ||
})() : undefined;return args.length <= 1 ? (function () { | ||
})() : undefined;return args.length <= 1 ? (() => { | ||
return arr.join(args[0]); | ||
})() : (function () { | ||
})() : (() => { | ||
return arr.map(function (m) { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, m, "join", [args.slice(0, -1)]); | ||
@@ -653,19 +647,19 @@ })(); | ||
};exports.randomOne = randomOne = function (arr) { | ||
return (function () { | ||
return (() => { | ||
return arr[dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Math, "randomInt", [arr.length])]; | ||
})(); | ||
};exports.random = random = function (arr, count) { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "clone", []), "takeRandom", [count]); | ||
})(); | ||
};exports.takeRandomOne = takeRandomOne = function (arr) { | ||
return (function () { | ||
return (() => { | ||
var index, r;index = dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Math, "randomInt", [arr.length]);r = arr[index];dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "removeAt", [index]);return r; | ||
})(); | ||
};exports.takeRandom = takeRandom = function (arr, count) { | ||
return (function () { | ||
return (() => { | ||
if (count === undefined || count === null) { | ||
count = arr.length; | ||
};count = dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "_amountToLength", [count]);return (0, _main.repeat)(count, function () { | ||
var arg_573300145710716007 = arguments;return (function () { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "takeRandomOne", []); | ||
@@ -676,16 +670,16 @@ })(); | ||
};exports.removeAt = removeAt = function (arr, index) { | ||
return (function () { | ||
return (() => { | ||
arr.splice(index, 1);return arr; | ||
})(); | ||
};exports.remove = remove = function (arr, element) { | ||
return (function () { | ||
return (() => { | ||
var index;index = arr.indexOf(element);(0, _main.assert)(index > -1);return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "removeAt", [index]); | ||
})(); | ||
};exports.removeAll = removeAll = function (arr, element) { | ||
return (function () { | ||
return (() => { | ||
(0, _main.loop)(function () { | ||
return (function () { | ||
var index;index = arr.indexOf(element);return index === -1 ? (function () { | ||
return _main["break"]; | ||
})() : (function () { | ||
return (() => { | ||
var index;index = arr.indexOf(element);return index === -1 ? (() => { | ||
return _main.break; | ||
})() : (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "removeAt", [index]); | ||
@@ -697,12 +691,12 @@ })(); | ||
};exports.removeMatch = removeMatch = function (arr, predicate) { | ||
return (function () { | ||
return (() => { | ||
var index;index = arr.findIndex(predicate);(0, _main.assert)(index > -1);return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "removeAt", [index]); | ||
})(); | ||
};exports.removeAllMatch = removeAllMatch = function (arr, predicate) { | ||
return (function () { | ||
return (() => { | ||
(0, _main.loop)(function () { | ||
return (function () { | ||
var index;index = arr.findIndex(predicate);return index === -1 ? (function () { | ||
return _main["break"]; | ||
})() : (function () { | ||
return (() => { | ||
var index;index = arr.findIndex(predicate);return index === -1 ? (() => { | ||
return _main.break; | ||
})() : (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "removeAt", [index]); | ||
@@ -713,25 +707,13 @@ })(); | ||
})(); | ||
};exports.insertBefore = insertBefore = function (arr, element) { | ||
for (var _len2 = arguments.length, elements = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { | ||
elements[_key2 - 2] = arguments[_key2]; | ||
} | ||
return (function () { | ||
var index;index = arr.indexOf(element);(0, _main.assert)(index > -1);return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "insertBeforeIndex", [index].concat(elements)); | ||
};exports.insertBefore = insertBefore = function (arr, element, ...elements) { | ||
return (() => { | ||
var index;index = arr.indexOf(element);(0, _main.assert)(index > -1);return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "insertBeforeIndex", [index, ...elements]); | ||
})(); | ||
};exports.insertBeforeIndex = insertBeforeIndex = function (arr, index) { | ||
for (var _len3 = arguments.length, elements = Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) { | ||
elements[_key3 - 2] = arguments[_key3]; | ||
} | ||
return (function () { | ||
arr.splice.apply(arr, [index, 0].concat(elements));return arr; | ||
};exports.insertBeforeIndex = insertBeforeIndex = function (arr, index, ...elements) { | ||
return (() => { | ||
arr.splice(index, 0, ...elements);return arr; | ||
})(); | ||
};exports.insertAfter = insertAfter = function (arr, element) { | ||
for (var _len4 = arguments.length, elements = Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) { | ||
elements[_key4 - 2] = arguments[_key4]; | ||
} | ||
return (function () { | ||
var index;index = arr.indexOf(element);(0, _main.assert)(index > -1);return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "insertBeforeIndex", [index + 1].concat(elements)); | ||
};exports.insertAfter = insertAfter = function (arr, element, ...elements) { | ||
return (() => { | ||
var index;index = arr.indexOf(element);(0, _main.assert)(index > -1);return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "insertBeforeIndex", [index + 1, ...elements]); | ||
})(); | ||
@@ -738,0 +720,0 @@ };exports._ratioToIndex = _ratioToIndex; |
@@ -1,41 +0,39 @@ | ||
"use strict";Object.defineProperty(exports, "__esModule", { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.atan = exports.asin = exports.acos = exports.tan = exports.sin = exports.cos = exports.sqrt = exports.pow = exports.log = exports.exp = exports.distance = exports.divide = exports.multiply = exports.subtract = exports.add = exports.phaseInDegrees = exports.phase = exports.abs = exports.conjugate = exports.reciprocal = exports.opposite = exports.approxEquals = exports.equals = undefined; | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } } | ||
var _main = require("./main"); | ||
var dotDotCalc_573300145710716007 = function dotDotCalc_573300145710716007(dotDot, a, b, c) { | ||
var _dotDot; | ||
return (_dotDot = dotDot(a))[b].apply(_dotDot, [a].concat(_toConsumableArray(c))); | ||
var dotDotCalc_573300145710716007 = function (dotDot, a, b, c) { | ||
return dotDot(a)[b](a, ...c); | ||
};var equals, approxEquals, opposite, reciprocal, conjugate, abs, phase, phaseInDegrees, add, subtract, multiply, divide, distance, exp, log, pow, sqrt, cos, sin, tan, acos, asin, atan;exports.equals = equals = function (a, b) { | ||
return (function () { | ||
return (() => { | ||
a = _main.Point.from(a);b = _main.Point.from(b);return a.x === b.x && a.y === b.y; | ||
})(); | ||
};exports.approxEquals = approxEquals = function (a, b) { | ||
return (function () { | ||
return (() => { | ||
a = _main.Point.from(a);b = _main.Point.from(b);return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, a.x, "approxEquals", [b.x]) && dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, a.y, "approxEquals", [b.y]); | ||
})(); | ||
};exports.opposite = opposite = function (p) { | ||
return (function () { | ||
return (() => { | ||
p = _main.Point.from(p);return new _main.Point(-p.x, -p.y); | ||
})(); | ||
};exports.reciprocal = reciprocal = function (p) { | ||
return (function () { | ||
return (() => { | ||
var n;p = _main.Point.from(p);n = p.x * p.x + p.y * p.y;return new _main.Point(p.x / n, -p.y / n); | ||
})(); | ||
};exports.conjugate = conjugate = function (p) { | ||
return (function () { | ||
return (() => { | ||
p = _main.Point.from(p);return new _main.Point(p.x, -p.y); | ||
})(); | ||
};exports.abs = abs = function (p) { | ||
return (function () { | ||
p = _main.Point.from(p);return p.x === 0 ? (function () { | ||
return (() => { | ||
p = _main.Point.from(p);return p.x === 0 ? (() => { | ||
return Math.abs(p.y); | ||
})() : (function () { | ||
return p.y === 0 ? (function () { | ||
})() : (() => { | ||
return p.y === 0 ? (() => { | ||
return Math.abs(p.x); | ||
})() : (function () { | ||
})() : (() => { | ||
return Math.sqrt(p.x * p.x + p.y * p.y); | ||
@@ -46,25 +44,25 @@ })(); | ||
};exports.phase = phase = function (p) { | ||
return (function () { | ||
return (() => { | ||
p = _main.Point.from(p);return Math.atan2(p.y, p.x); | ||
})(); | ||
};exports.phaseInDegrees = phaseInDegrees = function (p) { | ||
return (function () { | ||
var d;p = _main.Point.from(p);return p.x === 0 && p.y === 0 ? (function () { | ||
return (() => { | ||
var d;p = _main.Point.from(p);return p.x === 0 && p.y === 0 ? (() => { | ||
return 0; | ||
})() : (function () { | ||
return p.x === 0 && p.y > 0 ? (function () { | ||
})() : (() => { | ||
return p.x === 0 && p.y > 0 ? (() => { | ||
return 90; | ||
})() : (function () { | ||
return p.x === 0 && p.y < 0 ? (function () { | ||
})() : (() => { | ||
return p.x === 0 && p.y < 0 ? (() => { | ||
return -90; | ||
})() : (function () { | ||
return p.x > 0 && p.y === 0 ? (function () { | ||
})() : (() => { | ||
return p.x > 0 && p.y === 0 ? (() => { | ||
return 0; | ||
})() : (function () { | ||
return p.x < 0 && p.y === 0 ? (function () { | ||
})() : (() => { | ||
return p.x < 0 && p.y === 0 ? (() => { | ||
return 180; | ||
})() : (function () { | ||
d = dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Math, "radiansToDegrees", [_main.cmath.phase(p)]);return d <= -180 ? (function () { | ||
})() : (() => { | ||
d = dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Math, "radiansToDegrees", [_main.cmath.phase(p)]);return d <= -180 ? (() => { | ||
return 180; | ||
})() : (function () { | ||
})() : (() => { | ||
return d; | ||
@@ -79,59 +77,59 @@ })(); | ||
};exports.add = add = function (a, b) { | ||
return (function () { | ||
return (() => { | ||
a = _main.Point.from(a);b = _main.Point.from(b);return new _main.Point(a.x + b.x, a.y + b.y); | ||
})(); | ||
};exports.subtract = subtract = function (a, b) { | ||
return (function () { | ||
return (() => { | ||
return _main.cmath.add(a, _main.cmath.opposite(b)); | ||
})(); | ||
};exports.multiply = multiply = function (a, b) { | ||
return (function () { | ||
return (() => { | ||
a = _main.Point.from(a);b = _main.Point.from(b);return new _main.Point(a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x); | ||
})(); | ||
};exports.divide = divide = function (a, b) { | ||
return (function () { | ||
return (() => { | ||
var z;a = _main.Point.from(a);b = _main.Point.from(b);z = b.x * b.x + b.y * b.y;return new _main.Point((a.x * b.x + a.y * b.y) / z, (a.y * b.x - a.x * b.y) / z); | ||
})(); | ||
};exports.distance = distance = function (a, b) { | ||
return (function () { | ||
return (() => { | ||
return _main.cmath.abs(_main.cmath.subtract(a, b)); | ||
})(); | ||
};exports.exp = exp = function (p) { | ||
return (function () { | ||
return (() => { | ||
p = _main.Point.from(p);return _main.Point.fromPolar(Math.exp(p.x), p.y); | ||
})(); | ||
};exports.log = log = function (p) { | ||
return (function () { | ||
return (() => { | ||
return new _main.Point(Math.log(_main.cmath.abs(p)), _main.cmath.phase(p)); | ||
})(); | ||
};exports.pow = pow = function (a, b) { | ||
return (function () { | ||
return (() => { | ||
return _main.cmath.exp(_main.cmath.multiply(_main.cmath.log(a), b)); | ||
})(); | ||
};exports.sqrt = sqrt = function (p) { | ||
return (function () { | ||
return (() => { | ||
var r;p = _main.Point.from(p);r = _main.cmath.abs(p);return new _main.Point(Math.sqrt((r + p.x) / 2), Math.sign(p.y) * Math.sqrt((r - p.x) / 2)); | ||
})(); | ||
};exports.cos = cos = function (p) { | ||
return (function () { | ||
return (() => { | ||
return _main.cmath.divide(_main.cmath.add(_main.cmath.exp(_main.cmath.multiply(p, new _main.Point(0, 1))), _main.cmath.exp(_main.cmath.multiply(_main.cmath.opposite(p), new _main.Point(0, 1)))), 2); | ||
})(); | ||
};exports.sin = sin = function (p) { | ||
return (function () { | ||
return (() => { | ||
return _main.cmath.divide(_main.cmath.subtract(_main.cmath.exp(_main.cmath.multiply(p, new _main.Point(0, 1))), _main.cmath.exp(_main.cmath.multiply(_main.cmath.opposite(p), new _main.Point(0, 1)))), new _main.Point(0, 2)); | ||
})(); | ||
};exports.tan = tan = function (p) { | ||
return (function () { | ||
return (() => { | ||
return _main.cmath.divide(_main.cmath.sin(p), _main.cmath.cos(p)); | ||
})(); | ||
};exports.acos = acos = function (p) { | ||
return (function () { | ||
return (() => { | ||
return _main.cmath.opposite(_main.cmath.multiply(_main.cmath.log(_main.cmath.add(p, _main.cmath.multiply(_main.cmath.sqrt(_main.cmath.add(_main.cmath.opposite(_main.cmath.multiply(p, p)), 1)), new _main.Point(0, 1)))), new _main.Point(0, 1))); | ||
})(); | ||
};exports.asin = asin = function (p) { | ||
return (function () { | ||
return (() => { | ||
return _main.cmath.opposite(_main.cmath.multiply(_main.cmath.log(_main.cmath.add(_main.cmath.multiply(p, new _main.Point(0, 1)), _main.cmath.sqrt(_main.cmath.add(_main.cmath.opposite(_main.cmath.multiply(p, p)), 1)))), new _main.Point(0, 1))); | ||
})(); | ||
};exports.atan = atan = function (p) { | ||
return (function () { | ||
return (() => { | ||
return _main.cmath.multiply(_main.cmath.subtract(_main.cmath.log(_main.cmath.subtract(1, _main.cmath.multiply(p, new _main.Point(0, 1)))), _main.cmath.log(_main.cmath.add(1, _main.cmath.multiply(p, new _main.Point(0, 1))))), new _main.Point(0, 0.5)); | ||
@@ -138,0 +136,0 @@ })(); |
@@ -1,15 +0,13 @@ | ||
"use strict";Object.defineProperty(exports, "__esModule", { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.logt = undefined; | ||
var _main = require("./main"); | ||
var logt;exports.logt = logt = function (ns) { | ||
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
return (function () { | ||
var logt;exports.logt = logt = function (ns, ...args) { | ||
return (() => { | ||
return console.log.apply(console, [new Date().toISOString()].concat(args)); | ||
})(); | ||
};exports.logt = logt; |
@@ -1,4 +0,6 @@ | ||
"use strict";Object.defineProperty(exports, "__esModule", { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.equals = exports.subtract = exports.add = undefined; | ||
@@ -8,10 +10,10 @@ var _main = require("./main"); | ||
var add, subtract, equals;exports.add = add = function (date, x) { | ||
return (function () { | ||
return (() => { | ||
return new Date(date - -x); | ||
})(); | ||
};exports.subtract = subtract = function (date, x) { | ||
return (function () { | ||
return typeof x === "number" ? (function () { | ||
return (() => { | ||
return typeof x === "number" ? (() => { | ||
return new Date(date - x); | ||
})() : (function () { | ||
})() : (() => { | ||
return date - x; | ||
@@ -21,3 +23,3 @@ })(); | ||
};exports.equals = equals = function (date, x) { | ||
return (function () { | ||
return (() => { | ||
var var_573300145710716007_2;return x <= (var_573300145710716007_2 = date) && var_573300145710716007_2 <= x; | ||
@@ -24,0 +26,0 @@ })(); |
@@ -1,4 +0,6 @@ | ||
"use strict";Object.defineProperty(exports, "__esModule", { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.clone = undefined; | ||
@@ -8,5 +10,5 @@ var _main = require("./main"); | ||
var clone;exports.clone = clone = function (ns, x) { | ||
return (function () { | ||
return (() => { | ||
return JSON.parse(JSON.stringify(x)); | ||
})(); | ||
};exports.clone = clone; |
1294
target/main.js
@@ -1,19 +0,7 @@ | ||
"use strict";Object.defineProperty(exports, "__esModule", { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.dotDot_573300145710716007 = exports.Point = exports.Observer = exports.IntervalTimer = exports.Timer = exports.clearImmediate = exports.setImmediate = exports.eventField = exports.spread = exports.assert = exports.compose = exports.fail = exports.enum = exports.break = exports.loop = exports.repeat = exports.fePromiseStatic = exports.feUint8ArrayStatic = exports.feUint8Array = exports.feConsole = exports.feDate = exports.feJson = exports.feMath = exports.feArray = exports.feObject = exports.feString = exports.feNumberStatic = exports.feNumber = exports.cmath = exports.web = exports.sys = undefined; | ||
var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; })(); | ||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } } | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var _sys = require("./sys"); | ||
@@ -79,12 +67,12 @@ | ||
var ok_573300145710716007 = function ok_573300145710716007(a) { | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
var ok_573300145710716007 = function (a) { | ||
return a !== undefined && a !== null; | ||
};var dotDotCalc_573300145710716007 = function dotDotCalc_573300145710716007(dotDot, a, b, c) { | ||
var _dotDot; | ||
return (_dotDot = dotDot(a))[b].apply(_dotDot, [a].concat(_toConsumableArray(c))); | ||
};var formattedRegex_573300145710716007 = function formattedRegex_573300145710716007(pattern, flags) { | ||
};var dotDotCalc_573300145710716007 = function (dotDot, a, b, c) { | ||
return dotDot(a)[b](a, ...c); | ||
};var formattedRegex_573300145710716007 = function (pattern, flags) { | ||
var s = pattern; | ||
var lines = s.split("\n"); | ||
lines = lines.map(function (line) { | ||
lines = lines.map(line => { | ||
var commentPos = line.indexOf(" #"); | ||
@@ -102,10 +90,10 @@ var r; | ||
};var internalLoop, repeat, loop, fail, compose, assert, spread, eventField, setImmediate, clearImmediate, Timer, IntervalTimer, Observer, Point, dotDot_573300145710716007, var_573300145710716007_0, var_573300145710716007_1;internalLoop = function (data, enablesReturns) { | ||
return (function () { | ||
var theBreak, results, step, startIndex, endIndex, var_573300145710716007_16, var_573300145710716007_17, var_573300145710716007_18;theBreak = var_573300145710716007_0;results = enablesReturns ? (function () { | ||
return (() => { | ||
var theBreak, results, step, startIndex, endIndex, var_573300145710716007_16, var_573300145710716007_17, var_573300145710716007_18;theBreak = var_573300145710716007_0;results = enablesReturns ? (() => { | ||
return []; | ||
})() : (function () { | ||
})() : (() => { | ||
return undefined; | ||
})();return typeof data === "number" ? (function () { | ||
return (function () { | ||
for (var i = 0; i < data; i++) { | ||
})();return typeof data === "number" ? (() => { | ||
return (() => { | ||
for (let i = 0; i < data; i++) { | ||
if (enablesReturns) results.push(i); | ||
@@ -115,8 +103,8 @@ } | ||
})(); | ||
})() : (function () { | ||
return data instanceof Function ? (function () { | ||
return (function () { | ||
var i = 0; | ||
})() : (() => { | ||
return data instanceof Function ? (() => { | ||
return (() => { | ||
let i = 0; | ||
while (true) { | ||
var r = data(i); | ||
let r = data(i); | ||
if (r === theBreak) break; | ||
@@ -128,7 +116,7 @@ if (enablesReturns) results.push(r); | ||
})(); | ||
})() : (function () { | ||
return data instanceof Array ? (function () { | ||
return (function () { | ||
for (var i = 0; i < data[0]; i++) { | ||
var r = data[1] === undefined ? i : data[1](i); | ||
})() : (() => { | ||
return data instanceof Array ? (() => { | ||
return (() => { | ||
for (let i = 0; i < data[0]; i++) { | ||
let r = data[1] === undefined ? i : data[1](i); | ||
if (r === theBreak) break; | ||
@@ -139,7 +127,7 @@ if (enablesReturns) results.push(r); | ||
})(); | ||
})() : (function () { | ||
return data instanceof Object ? (function () { | ||
step = (var_573300145710716007_16 = data.by) === undefined ? 1 : var_573300145710716007_16;startIndex = (var_573300145710716007_17 = data.from) === undefined ? data[""] : var_573300145710716007_17;endIndex = (var_573300145710716007_18 = data.to) === undefined ? Infinity : var_573300145710716007_18;return (function () { | ||
for (var i = startIndex; step >= 0 ? i <= endIndex : i >= endIndex; i += step) { | ||
var r = data["for"] === undefined ? i : data["for"](i); | ||
})() : (() => { | ||
return data instanceof Object ? (() => { | ||
step = (var_573300145710716007_16 = data.by) === undefined ? 1 : var_573300145710716007_16;startIndex = (var_573300145710716007_17 = data.from) === undefined ? data[""] : var_573300145710716007_17;endIndex = (var_573300145710716007_18 = data.to) === undefined ? Infinity : var_573300145710716007_18;return (() => { | ||
for (let i = startIndex; step >= 0 ? i <= endIndex : i >= endIndex; i += step) { | ||
let r = data.for === undefined ? i : data.for(i); | ||
if (r === theBreak) break; | ||
@@ -150,3 +138,3 @@ if (enablesReturns) results.push(r); | ||
})(); | ||
})() : (function () { | ||
})() : (() => { | ||
throw new Error("`repeat` syntax error."); | ||
@@ -159,6 +147,6 @@ })(); | ||
};exports.repeat = repeat = function (a, b) { | ||
return (function () { | ||
return internalLoop(b === undefined ? (function () { | ||
return (() => { | ||
return internalLoop(b === undefined ? (() => { | ||
return a; | ||
})() : (function () { | ||
})() : (() => { | ||
return [a, b]; | ||
@@ -168,13 +156,13 @@ })(), true); | ||
};exports.loop = loop = function (a, b) { | ||
return (function () { | ||
return internalLoop(b === undefined ? (function () { | ||
return (() => { | ||
return internalLoop(b === undefined ? (() => { | ||
return a; | ||
})() : (function () { | ||
})() : (() => { | ||
return [a, b]; | ||
})(), false); | ||
})(); | ||
};exports["break"] = var_573300145710716007_0 = Symbol();exports["enum"] = var_573300145710716007_1 = function () { | ||
var arg_573300145710716007 = arguments;return (function () { | ||
};exports.break = var_573300145710716007_0 = Symbol();exports.enum = var_573300145710716007_1 = function () { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
var k, r;k = 0;r = {};Object.keys(arg_573300145710716007[0]).forEach(function () { | ||
var arg_573300145710716007 = arguments;return (function () { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
r[arg_573300145710716007[0]] = k;k = k + 1; | ||
@@ -185,23 +173,13 @@ })(); | ||
};exports.fail = fail = function (errorMessage) { | ||
return (function () { | ||
return (() => { | ||
throw new Error(errorMessage); | ||
})(); | ||
};exports.compose = compose = function () { | ||
for (var _len = arguments.length, functions = Array(_len), _key = 0; _key < _len; _key++) { | ||
functions[_key] = arguments[_key]; | ||
} | ||
return (function () { | ||
functions[0] instanceof Array ? (function () { | ||
};exports.compose = compose = function (...functions) { | ||
return (() => { | ||
functions[0] instanceof Array ? (() => { | ||
functions = functions[0]; | ||
})() : undefined;return function () { | ||
var _this = this; | ||
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
return (function () { | ||
var var_573300145710716007_2;var_573300145710716007_2 = _this;functions.forEach(function (m) { | ||
return (function () { | ||
})() : undefined;return function (...args) { | ||
return (() => { | ||
var var_573300145710716007_2;var_573300145710716007_2 = this;functions.forEach(function (m) { | ||
return (() => { | ||
args = [m.apply(var_573300145710716007_2, args)]; | ||
@@ -214,4 +192,4 @@ })(); | ||
};exports.assert = assert = function (condition, message) { | ||
return (function () { | ||
return !condition ? (function () { | ||
return (() => { | ||
return !condition ? (() => { | ||
return fail(message); | ||
@@ -221,5 +199,5 @@ })() : undefined; | ||
};exports.spread = spread = function (value, count) { | ||
return (function () { | ||
return (() => { | ||
return repeat(count, function () { | ||
return (function () { | ||
return (() => { | ||
return value; | ||
@@ -230,20 +208,18 @@ })(); | ||
};exports.eventField = eventField = function () { | ||
return (function () { | ||
return (() => { | ||
var f;f = function (method, arg) { | ||
var _this2 = this; | ||
return (function () { | ||
method instanceof Function ? (function () { | ||
return (() => { | ||
method instanceof Function ? (() => { | ||
arg = method;method = "bind"; | ||
})() : undefined;assert(typeof method === "string");var base_573300145710716007 = f;if (base_573300145710716007._holder === undefined || base_573300145710716007._holder === null) { | ||
base_573300145710716007._holder = _this2; | ||
};f[method](arg);return _this2; | ||
base_573300145710716007._holder = this; | ||
};f[method](arg);return this; | ||
})(); | ||
};f._holder = null;f._listeners = [];f.getListeners = function () { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(dotDot_573300145710716007, f._listeners, "clone", []); | ||
})(); | ||
};f.bind = function (listener) { | ||
return (function () { | ||
f._listeners.indexOf(listener) < 0 ? (function () { | ||
return (() => { | ||
f._listeners.indexOf(listener) < 0 ? (() => { | ||
return f._listeners.push(listener); | ||
@@ -253,16 +229,16 @@ })() : undefined;return f; | ||
};f.unbind = function (listener) { | ||
return (function () { | ||
return (() => { | ||
dotDotCalc_573300145710716007(dotDot_573300145710716007, f._listeners, "removeAll", [listener]);return f; | ||
})(); | ||
};f.unbindAll = function () { | ||
return (function () { | ||
return (() => { | ||
f._listeners = [];return f; | ||
})(); | ||
};f.fire = function (arg) { | ||
return (function () { | ||
return (() => { | ||
f._listeners.every(function (listener) { | ||
return (function () { | ||
return ok_573300145710716007(arg) && arg.blocksListeners ? (function () { | ||
return (() => { | ||
return ok_573300145710716007(arg) && arg.blocksListeners ? (() => { | ||
return false; | ||
})() : (function () { | ||
})() : (() => { | ||
listener(arg, f._holder);return true; | ||
@@ -274,8 +250,8 @@ })(); | ||
};f.asyncFire = function (arg) { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(dotDot_573300145710716007, f._listeners, "asyncForEach", [function (listener) { | ||
return (function () { | ||
return ok_573300145710716007(arg) && arg.blocksListeners ? (function () { | ||
return (() => { | ||
return ok_573300145710716007(arg) && arg.blocksListeners ? (() => { | ||
return var_573300145710716007_0; | ||
})() : (function () { | ||
})() : (() => { | ||
return listener(arg, f._holder); | ||
@@ -289,202 +265,127 @@ })(); | ||
};exports.setImmediate = setImmediate = function (callback, args) { | ||
return (function () { | ||
return (() => { | ||
return setTimeout(callback, 0, args); | ||
})(); | ||
};exports.clearImmediate = clearImmediate = clearTimeout;exports.Timer = Timer = (function () { | ||
var var_573300145710716007_3 = Symbol();var var_573300145710716007_4 = Symbol();var var_573300145710716007_5 = Symbol();var var_573300145710716007_6 = Symbol();var var_573300145710716007_7 = Symbol();var var_573300145710716007_8 = Symbol();var var_573300145710716007_9 = Symbol();var var_573300145710716007_10 = Symbol();var var_573300145710716007_11 = Symbol();var class_573300145710716007 = (function () { | ||
_createClass(class_573300145710716007, null, [{ | ||
key: var_573300145710716007_5, | ||
value: function value() { | ||
var _arguments2 = arguments, | ||
_this3 = this; | ||
return (function () { | ||
var arg_573300145710716007 = _arguments2;return (function () { | ||
var base_573300145710716007 = _this3;if (base_573300145710716007[var_573300145710716007_6] === undefined || base_573300145710716007[var_573300145710716007_6] === null) { | ||
base_573300145710716007[var_573300145710716007_6] = setInterval(function () { | ||
return (function () { | ||
return _this3[var_573300145710716007_7].fire(); | ||
})(); | ||
}, _this3[var_573300145710716007_4]); | ||
}; | ||
})(); | ||
};exports.clearImmediate = clearImmediate = clearTimeout;exports.Timer = Timer = (() => { | ||
var var_573300145710716007_3 = Symbol();var var_573300145710716007_4 = Symbol();var var_573300145710716007_5 = Symbol();var var_573300145710716007_6 = Symbol();var var_573300145710716007_7 = Symbol();var var_573300145710716007_8 = Symbol();var var_573300145710716007_9 = Symbol();var var_573300145710716007_10 = Symbol();var var_573300145710716007_11 = Symbol();var class_573300145710716007 = class { | ||
static [var_573300145710716007_5]() { | ||
return (() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
var base_573300145710716007 = this;if (base_573300145710716007[var_573300145710716007_6] === undefined || base_573300145710716007[var_573300145710716007_6] === null) { | ||
base_573300145710716007[var_573300145710716007_6] = setInterval(() => { | ||
return (() => { | ||
return this[var_573300145710716007_7].fire(); | ||
})(); | ||
}, this[var_573300145710716007_4]); | ||
}; | ||
})(); | ||
} | ||
}, { | ||
key: var_573300145710716007_8, | ||
value: function value() { | ||
var _arguments3 = arguments, | ||
_this4 = this; | ||
return (function () { | ||
var arg_573300145710716007 = _arguments3;return (function () { | ||
ok_573300145710716007(_this4[var_573300145710716007_6]) ? (function () { | ||
return clearInterval(_this4[var_573300145710716007_6]); | ||
})() : undefined;_this4[var_573300145710716007_6] = null; | ||
})(); | ||
})(); | ||
}static [var_573300145710716007_8]() { | ||
return (() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
ok_573300145710716007(this[var_573300145710716007_6]) ? (() => { | ||
return clearInterval(this[var_573300145710716007_6]); | ||
})() : undefined;this[var_573300145710716007_6] = null; | ||
})(); | ||
} | ||
}, { | ||
key: "setPrecision", | ||
value: function setPrecision(precision) { | ||
var _this5 = this; | ||
return (function (precision) { | ||
return (function () { | ||
ok_573300145710716007(_this5[var_573300145710716007_6]) ? (function () { | ||
_this5[var_573300145710716007_8]();_this5[var_573300145710716007_4] = precision;return _this5[var_573300145710716007_5](); | ||
})() : (function () { | ||
_this5[var_573300145710716007_4] = precision; | ||
})();return undefined; | ||
})(); | ||
})(precision); | ||
} | ||
}, { | ||
key: "getPrecision", | ||
value: function getPrecision() { | ||
var _arguments4 = arguments, | ||
_this6 = this; | ||
return (function () { | ||
var arg_573300145710716007 = _arguments4;return (function () { | ||
return _this6[var_573300145710716007_4]; | ||
})(); | ||
})(); | ||
}static setPrecision(precision) { | ||
return (precision => { | ||
return (() => { | ||
ok_573300145710716007(this[var_573300145710716007_6]) ? (() => { | ||
this[var_573300145710716007_8]();this[var_573300145710716007_4] = precision;return this[var_573300145710716007_5](); | ||
})() : (() => { | ||
this[var_573300145710716007_4] = precision; | ||
})();return undefined; | ||
})(); | ||
} | ||
}, { | ||
key: "getEndOfTime", | ||
value: function getEndOfTime() { | ||
var _arguments5 = arguments, | ||
_this7 = this; | ||
return (function () { | ||
var arg_573300145710716007 = _arguments5;return (function () { | ||
return _this7[var_573300145710716007_3]; | ||
})(); | ||
})(precision); | ||
}static getPrecision() { | ||
return (() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
return this[var_573300145710716007_4]; | ||
})(); | ||
} | ||
}]); | ||
function class_573300145710716007(options) { | ||
var _this8 = this; | ||
_classCallCheck(this, class_573300145710716007); | ||
(function (options) { | ||
return (function () { | ||
var o, var_573300145710716007_19;o = dotDotCalc_573300145710716007(dotDot_573300145710716007, Object, "absorb", [dotDotCalc_573300145710716007(dotDot_573300145710716007, Object, "clone", [(var_573300145710716007_19 = options) === undefined ? {} : var_573300145710716007_19]), { targetTime: _this8.constructor[var_573300145710716007_3], allowsEqual: true }]);_this8.targetTime = o.targetTime;_this8.allowsEqual = o.allowsEqual;_this8[var_573300145710716007_9] = 0;_this8[var_573300145710716007_10] = false;_this8.onArrive = eventField();return _this8.run(); | ||
})(); | ||
}static getEndOfTime() { | ||
return (() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
return this[var_573300145710716007_3]; | ||
})(); | ||
})(); | ||
}constructor(options) { | ||
(options => { | ||
return (() => { | ||
var o, var_573300145710716007_19;o = dotDotCalc_573300145710716007(dotDot_573300145710716007, Object, "absorb", [dotDotCalc_573300145710716007(dotDot_573300145710716007, Object, "clone", [(var_573300145710716007_19 = options) === undefined ? {} : var_573300145710716007_19]), { targetTime: this.constructor[var_573300145710716007_3], allowsEqual: true }]);this.targetTime = o.targetTime;this.allowsEqual = o.allowsEqual;this[var_573300145710716007_9] = 0;this[var_573300145710716007_10] = false;this.onArrive = eventField();return this.run(); | ||
})(); | ||
})(options); | ||
} | ||
_createClass(class_573300145710716007, [{ | ||
key: "run", | ||
value: function run() { | ||
var _arguments6 = arguments, | ||
_this9 = this; | ||
return (function () { | ||
var arg_573300145710716007 = _arguments6;return (function () { | ||
!_this9[var_573300145710716007_10] ? (function () { | ||
_this9[var_573300145710716007_10] = true;_this9.constructor[var_573300145710716007_5]();_this9[var_573300145710716007_11] = function () { | ||
var arg_573300145710716007 = _arguments6;return (function () { | ||
var nowTime, lastTargetTime;nowTime = new Date();return (_this9.allowsEqual ? (function () { | ||
return nowTime >= _this9.targetTime; | ||
})() : (function () { | ||
return nowTime > _this9.targetTime; | ||
})()) ? (function () { | ||
var base_573300145710716007 = _this9;base_573300145710716007[var_573300145710716007_9] = base_573300145710716007[var_573300145710716007_9] + 1;lastTargetTime = _this9.targetTime;_this9.targetTime = _this9.constructor[var_573300145710716007_3];return _this9.onArrive.fire({ idealTime: lastTargetTime, nowTime: nowTime, index: _this9[var_573300145710716007_9] - 1 }); | ||
})() : undefined; | ||
})(); | ||
};return _this9.constructor[var_573300145710716007_7].bind(_this9[var_573300145710716007_11]); | ||
})() : undefined;return _this9; | ||
})(); | ||
}run() { | ||
return (() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
!this[var_573300145710716007_10] ? (() => { | ||
this[var_573300145710716007_10] = true;this.constructor[var_573300145710716007_5]();this[var_573300145710716007_11] = () => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
var nowTime, lastTargetTime;nowTime = new Date();return (this.allowsEqual ? (() => { | ||
return nowTime >= this.targetTime; | ||
})() : (() => { | ||
return nowTime > this.targetTime; | ||
})()) ? (() => { | ||
var base_573300145710716007 = this;base_573300145710716007[var_573300145710716007_9] = base_573300145710716007[var_573300145710716007_9] + 1;lastTargetTime = this.targetTime;this.targetTime = this.constructor[var_573300145710716007_3];return this.onArrive.fire({ idealTime: lastTargetTime, nowTime: nowTime, index: this[var_573300145710716007_9] - 1 }); | ||
})() : undefined; | ||
})(); | ||
};return this.constructor[var_573300145710716007_7].bind(this[var_573300145710716007_11]); | ||
})() : undefined;return this; | ||
})(); | ||
} | ||
}, { | ||
key: "stop", | ||
value: function stop() { | ||
var _arguments7 = arguments, | ||
_this10 = this; | ||
return (function () { | ||
var arg_573300145710716007 = _arguments7;return (function () { | ||
_this10[var_573300145710716007_10] ? (function () { | ||
_this10[var_573300145710716007_10] = false;_this10.constructor[var_573300145710716007_7].unbind(_this10[var_573300145710716007_11]);return dotDotCalc_573300145710716007(dotDot_573300145710716007, _this10.constructor[var_573300145710716007_7].getListeners(), "isEmpty", []) ? (function () { | ||
return _this10.constructor[var_573300145710716007_8](); | ||
})() : undefined; | ||
})() : undefined;return _this10; | ||
})(); | ||
})(); | ||
}stop() { | ||
return (() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
this[var_573300145710716007_10] ? (() => { | ||
this[var_573300145710716007_10] = false;this.constructor[var_573300145710716007_7].unbind(this[var_573300145710716007_11]);return dotDotCalc_573300145710716007(dotDot_573300145710716007, this.constructor[var_573300145710716007_7].getListeners(), "isEmpty", []) ? (() => { | ||
return this.constructor[var_573300145710716007_8](); | ||
})() : undefined; | ||
})() : undefined;return this; | ||
})(); | ||
} | ||
}, { | ||
key: "getRunning", | ||
value: function getRunning() { | ||
var _arguments8 = arguments, | ||
_this11 = this; | ||
return (function () { | ||
var arg_573300145710716007 = _arguments8;return (function () { | ||
return _this11[var_573300145710716007_10]; | ||
})(); | ||
})(); | ||
}getRunning() { | ||
return (() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
return this[var_573300145710716007_10]; | ||
})(); | ||
} | ||
}, { | ||
key: "resetCounter", | ||
value: function resetCounter() { | ||
var _arguments9 = arguments, | ||
_this12 = this; | ||
return (function () { | ||
var arg_573300145710716007 = _arguments9;return (function () { | ||
_this12[var_573300145710716007_9] = 0;return _this12; | ||
})(); | ||
})(); | ||
}resetCounter() { | ||
return (() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
this[var_573300145710716007_9] = 0;return this; | ||
})(); | ||
} | ||
}, { | ||
key: "getCounter", | ||
value: function getCounter() { | ||
var _arguments10 = arguments, | ||
_this13 = this; | ||
return (function () { | ||
var arg_573300145710716007 = _arguments10;return (function () { | ||
return _this13[var_573300145710716007_9]; | ||
})(); | ||
})(); | ||
}getCounter() { | ||
return (() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
return this[var_573300145710716007_9]; | ||
})(); | ||
} | ||
}]); | ||
return class_573300145710716007; | ||
})();class_573300145710716007[var_573300145710716007_3] = new Date("9999-12-30T00:00:00Z");class_573300145710716007[var_573300145710716007_4] = 30;class_573300145710716007[var_573300145710716007_7] = eventField();return class_573300145710716007; | ||
})();exports.IntervalTimer = IntervalTimer = (function () { | ||
var var_573300145710716007_12 = Symbol();var class_573300145710716007 = (function (_Timer) { | ||
_inherits(class_573300145710716007, _Timer); | ||
function class_573300145710716007(options) { | ||
var _this14 = this; | ||
_classCallCheck(this, class_573300145710716007); | ||
(function (options) { | ||
return (function () { | ||
var o, var_573300145710716007_20;_get(Object.getPrototypeOf(class_573300145710716007.prototype), "constructor", _this14).call(_this14, options);o = dotDotCalc_573300145710716007(dotDot_573300145710716007, Object, "absorb", [dotDotCalc_573300145710716007(dotDot_573300145710716007, Object, "clone", [(var_573300145710716007_20 = options) === undefined ? {} : var_573300145710716007_20]), { interval: 1000, startTime: new Date(), endTime: dotDotCalc_573300145710716007(dotDot_573300145710716007, _this14.constructor.getEndOfTime(), "subtract", [1000]), includesStart: true, includesEnd: false, skipsPast: false }]);_this14.interval = o.interval;_this14.startTime = o.startTime;_this14.endTime = o.endTime;_this14.includesStart = o.includesStart;_this14.includesEnd = o.includesEnd;_this14.skipsPast = o.skipsPast;_this14.targetTime = _this14.startTime;_this14[var_573300145710716007_12] = false;_this14.onStart = eventField();return _this14.onArrive.bind(function (event) { | ||
return (function () { | ||
var now;return _this14.interval < _this14.constructor.getPrecision() * 2 ? (function () { | ||
return _this14.stop(); | ||
})() : (function () { | ||
now = new Date();_this14.targetTime = _this14.skipsPast ? (function () { | ||
return now - (now - event.idealTime) % _this14.interval + _this14.interval; | ||
})() : (function () { | ||
return dotDotCalc_573300145710716007(dotDot_573300145710716007, event.idealTime, "add", [_this14.interval]); | ||
})();!_this14[var_573300145710716007_12] ? (function () { | ||
_this14[var_573300145710716007_12] = true;!_this14.includesStart ? (function () { | ||
_this14.resetCounter();event.blocksListeners = true; | ||
})() : undefined;return _this14.onStart.fire(); | ||
})() : undefined;return (_this14.includesEnd ? (function () { | ||
return _this14.targetTime > _this14.endTime; | ||
})() : (function () { | ||
return _this14.targetTime >= _this14.endTime; | ||
})()) ? (function () { | ||
return _this14.stop(); | ||
})(); | ||
} | ||
};class_573300145710716007[var_573300145710716007_3] = new Date("9999-12-30T00:00:00Z");class_573300145710716007[var_573300145710716007_4] = 30;class_573300145710716007[var_573300145710716007_7] = eventField();return class_573300145710716007; | ||
})();exports.IntervalTimer = IntervalTimer = (() => { | ||
var var_573300145710716007_12 = Symbol();var class_573300145710716007 = class extends Timer { | ||
constructor(options) { | ||
(options => { | ||
return (() => { | ||
var o, var_573300145710716007_20;super(options);o = dotDotCalc_573300145710716007(dotDot_573300145710716007, Object, "absorb", [dotDotCalc_573300145710716007(dotDot_573300145710716007, Object, "clone", [(var_573300145710716007_20 = options) === undefined ? {} : var_573300145710716007_20]), { interval: 1000, startTime: new Date(), endTime: dotDotCalc_573300145710716007(dotDot_573300145710716007, this.constructor.getEndOfTime(), "subtract", [1000]), includesStart: true, includesEnd: false, skipsPast: false }]);this.interval = o.interval;this.startTime = o.startTime;this.endTime = o.endTime;this.includesStart = o.includesStart;this.includesEnd = o.includesEnd;this.skipsPast = o.skipsPast;this.targetTime = this.startTime;this[var_573300145710716007_12] = false;this.onStart = eventField();return this.onArrive.bind(event => { | ||
return (() => { | ||
var now;return this.interval < this.constructor.getPrecision() * 2 ? (() => { | ||
return this.stop(); | ||
})() : (() => { | ||
now = new Date();this.targetTime = this.skipsPast ? (() => { | ||
return now - (now - event.idealTime) % this.interval + this.interval; | ||
})() : (() => { | ||
return dotDotCalc_573300145710716007(dotDot_573300145710716007, event.idealTime, "add", [this.interval]); | ||
})();!this[var_573300145710716007_12] ? (() => { | ||
this[var_573300145710716007_12] = true;!this.includesStart ? (() => { | ||
this.resetCounter();event.blocksListeners = true; | ||
})() : undefined;return this.onStart.fire(); | ||
})() : undefined;return (this.includesEnd ? (() => { | ||
return this.targetTime > this.endTime; | ||
})() : (() => { | ||
return this.targetTime >= this.endTime; | ||
})()) ? (() => { | ||
return this.stop(); | ||
})() : undefined; | ||
@@ -497,39 +398,15 @@ })(); | ||
} | ||
return class_573300145710716007; | ||
})(Timer);return class_573300145710716007; | ||
})();exports.Observer = Observer = (function () { | ||
var var_573300145710716007_13 = Symbol();var var_573300145710716007_14 = Symbol();var var_573300145710716007_15 = Symbol();var class_573300145710716007 = (function (_IntervalTimer) { | ||
_inherits(class_573300145710716007, _IntervalTimer); | ||
function class_573300145710716007() { | ||
var _this15 = this, | ||
_arguments11 = arguments; | ||
for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { | ||
args[_key3] = arguments[_key3]; | ||
} | ||
_classCallCheck(this, class_573300145710716007); | ||
(function () { | ||
for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { | ||
args[_key4] = arguments[_key4]; | ||
} | ||
return (function () { | ||
var options, fn, clonedOptions; | ||
var _ref = args[0] instanceof Function ? (function () { | ||
};return class_573300145710716007; | ||
})();exports.Observer = Observer = (() => { | ||
var var_573300145710716007_13 = Symbol();var var_573300145710716007_14 = Symbol();var var_573300145710716007_15 = Symbol();var class_573300145710716007 = class extends IntervalTimer { | ||
constructor(...args) { | ||
((...args) => { | ||
return (() => { | ||
var options, fn, clonedOptions;[options, fn] = args[0] instanceof Function ? (() => { | ||
return [args[1], args[0]]; | ||
})() : (function () { | ||
})() : (() => { | ||
return [args[0], args[1]]; | ||
})(); | ||
var _ref2 = _slicedToArray(_ref, 2); | ||
options = _ref2[0]; | ||
fn = _ref2[1]; | ||
clonedOptions = ok_573300145710716007(options) ? (function () { | ||
})();clonedOptions = ok_573300145710716007(options) ? (() => { | ||
return dotDotCalc_573300145710716007(dotDot_573300145710716007, Object, "clone", [options]); | ||
})() : (function () { | ||
})() : (() => { | ||
return {}; | ||
@@ -540,480 +417,301 @@ })();var base_573300145710716007 = clonedOptions;if (base_573300145710716007.interval === undefined || base_573300145710716007.interval === null) { | ||
base_573300145710716007.skipsPast = true; | ||
};_get(Object.getPrototypeOf(class_573300145710716007.prototype), "constructor", _this15).call(_this15, clonedOptions);_this15[var_573300145710716007_14] = fn;_this15.onChange = eventField();_this15.onUpdate = eventField();return _this15.onArrive.bind(function () { | ||
var arg_573300145710716007 = _arguments11;return (function () { | ||
return _this15.check(); | ||
};super(clonedOptions);this[var_573300145710716007_14] = fn;this.onChange = eventField();this.onUpdate = eventField();return this.onArrive.bind(() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
return this.check(); | ||
})(); | ||
}); | ||
})(); | ||
}).apply(undefined, args); | ||
})(...args); | ||
}check(forcesUpdate) { | ||
return (forcesUpdate => { | ||
if (forcesUpdate === undefined) { | ||
forcesUpdate = false; | ||
}return (() => { | ||
var newValue;newValue = (() => { | ||
try { | ||
return (() => { | ||
return this[var_573300145710716007_14](); | ||
})(); | ||
} catch (catch_573300145710716007) { | ||
return (() => { | ||
return this.constructor[var_573300145710716007_13]; | ||
})(); | ||
} finally {} | ||
})();newValue === undefined ? (() => { | ||
newValue = this.constructor[var_573300145710716007_13]; | ||
})() : undefined;return forcesUpdate || this[var_573300145710716007_15] === undefined || !Object.is(newValue, this[var_573300145710716007_15]) ? (() => { | ||
this.onUpdate.fire({ value: newValue });this[var_573300145710716007_15] !== undefined ? (() => { | ||
return this.onChange.fire({ oldValue: this[var_573300145710716007_15], newValue: newValue }); | ||
})() : undefined;this[var_573300145710716007_15] = newValue; | ||
})() : undefined; | ||
})(); | ||
})(forcesUpdate); | ||
} | ||
_createClass(class_573300145710716007, [{ | ||
key: "check", | ||
value: function check(forcesUpdate) { | ||
var _this16 = this; | ||
return (function (forcesUpdate) { | ||
if (forcesUpdate === undefined) { | ||
forcesUpdate = false; | ||
}return (function () { | ||
var newValue;newValue = (function () { | ||
try { | ||
return (function () { | ||
return _this16[var_573300145710716007_14](); | ||
})(); | ||
} catch (catch_573300145710716007) { | ||
return (function () { | ||
return _this16.constructor[var_573300145710716007_13]; | ||
})(); | ||
} finally {} | ||
})();newValue === undefined ? (function () { | ||
newValue = _this16.constructor[var_573300145710716007_13]; | ||
})() : undefined;return forcesUpdate || _this16[var_573300145710716007_15] === undefined || !Object.is(newValue, _this16[var_573300145710716007_15]) ? (function () { | ||
_this16.onUpdate.fire({ value: newValue });_this16[var_573300145710716007_15] !== undefined ? (function () { | ||
return _this16.onChange.fire({ oldValue: _this16[var_573300145710716007_15], newValue: newValue }); | ||
})() : undefined;_this16[var_573300145710716007_15] = newValue; | ||
})() : undefined; | ||
})(); | ||
})(forcesUpdate); | ||
} | ||
}]); | ||
return class_573300145710716007; | ||
})(IntervalTimer);class_573300145710716007[var_573300145710716007_13] = new Error();return class_573300145710716007; | ||
})();exports.Point = Point = (function () { | ||
var class_573300145710716007 = (function () { | ||
function class_573300145710716007(x, y) { | ||
var _this17 = this; | ||
_classCallCheck(this, class_573300145710716007); | ||
return (function (x, y) { | ||
return (function () { | ||
_this17.x = x;_this17.y = y; | ||
};class_573300145710716007[var_573300145710716007_13] = new Error();return class_573300145710716007; | ||
})();exports.Point = Point = (() => { | ||
var class_573300145710716007 = class { | ||
constructor(x, y) { | ||
return ((x, y) => { | ||
return (() => { | ||
this.x = x;this.y = y; | ||
})(); | ||
})(x, y); | ||
} | ||
_createClass(class_573300145710716007, [{ | ||
key: "real", | ||
value: function real() { | ||
var _arguments12 = arguments, | ||
_this18 = this; | ||
return (function () { | ||
var arg_573300145710716007 = _arguments12;return (function () { | ||
return _this18.x; | ||
}static from(value, second) { | ||
return ((value, second) => { | ||
return (() => { | ||
return typeof value === "number" ? (() => { | ||
return typeof second === "number" ? (() => { | ||
return new Point(value, second); | ||
})() : (() => { | ||
return new Point(value, 0); | ||
})(); | ||
})() : (() => { | ||
return value instanceof Point ? (() => { | ||
return value.clone(); | ||
})() : (() => { | ||
return typeof value === "string" ? (() => { | ||
return Point.fromString(value); | ||
})() : (() => { | ||
return value instanceof Array ? (() => { | ||
return Point.fromArray(value); | ||
})() : (() => { | ||
return fail(); | ||
})(); | ||
})(); | ||
})(); | ||
})(); | ||
})(); | ||
} | ||
}, { | ||
key: "imaginary", | ||
value: function imaginary() { | ||
var _arguments13 = arguments, | ||
_this19 = this; | ||
return (function () { | ||
var arg_573300145710716007 = _arguments13;return (function () { | ||
return _this19.y; | ||
})(); | ||
})(value, second); | ||
}static fromArray(array) { | ||
return (array => { | ||
return (() => { | ||
return new Point(array[0], array[1]); | ||
})(); | ||
} | ||
}, { | ||
key: "toString", | ||
value: function toString() { | ||
var _arguments14 = arguments, | ||
_this20 = this; | ||
return (function () { | ||
var arg_573300145710716007 = _arguments14;return (function () { | ||
return "(" + _this20.x + "," + _this20.y + ")"; | ||
})(array); | ||
}static fromString(s) { | ||
return (s => { | ||
return (() => { | ||
var adjustedString, normalMatch, complexMatch, real, imaginary, var_573300145710716007_21, var_573300145710716007_22;adjustedString = s.replace(new RegExp("[ ()] ", "g"), "");normalMatch = adjustedString.match(new RegExp("^([^,]*),(.*)$"));return ok_573300145710716007(normalMatch) ? (() => { | ||
return new Point(dotDotCalc_573300145710716007(dotDot_573300145710716007, Number, "parseFloat", [normalMatch[1]]), dotDotCalc_573300145710716007(dotDot_573300145710716007, Number, "parseFloat", [normalMatch[2]])); | ||
})() : (() => { | ||
complexMatch = adjustedString.match(formattedRegex_573300145710716007("^\n (\n [+-]?\n [0-9]*\n \\.?\n [0-9]*\n (?:\n [Ee]\n [+-]?\n [0-9]+\n )?\n (?! [i0-9Ee.] )\n )?\n (?:\n (\n [+-]?\n [0-9]*\n \\.?\n [0-9]*\n (?:\n [Ee]\n [+-]?\n [0-9]+\n )?\n )\n i\n )?\n$"));return ok_573300145710716007(complexMatch) ? (() => { | ||
real = (var_573300145710716007_21 = complexMatch[1]) === undefined || var_573300145710716007_21 === null ? "0" : var_573300145710716007_21;imaginary = (var_573300145710716007_22 = complexMatch[2]) === undefined || var_573300145710716007_22 === null ? "0" : var_573300145710716007_22;real === "" ? (() => { | ||
real = "1"; | ||
})() : undefined;imaginary === "" ? (() => { | ||
imaginary = "1"; | ||
})() : undefined;real === "+" ? (() => { | ||
real = "1"; | ||
})() : undefined;imaginary === "+" ? (() => { | ||
imaginary = "1"; | ||
})() : undefined;real === "-" ? (() => { | ||
real = "-1"; | ||
})() : undefined;imaginary === "-" ? (() => { | ||
imaginary = "-1"; | ||
})() : undefined;return new Point(parseFloat(real), parseFloat(imaginary)); | ||
})() : (() => { | ||
return fail(); | ||
})(); | ||
})(); | ||
})(); | ||
} | ||
}, { | ||
key: "toComplexString", | ||
value: function toComplexString() { | ||
var _arguments15 = arguments, | ||
_this21 = this; | ||
return (function () { | ||
var arg_573300145710716007 = _arguments15;return (function () { | ||
var sign;sign = _this21.y >= 0 ? (function () { | ||
return "+"; | ||
})() : (function () { | ||
return "-"; | ||
})();return "" + _this21.x + "" + sign + "" + Math.abs(_this21.y) + "i"; | ||
})(); | ||
})(s); | ||
}static fromPolar(r, angle) { | ||
return ((r, angle) => { | ||
return (() => { | ||
return new Point(r * Math.cos(angle), r * Math.sin(angle)); | ||
})(); | ||
} | ||
}, { | ||
key: "toArray", | ||
value: function toArray() { | ||
var _arguments16 = arguments, | ||
_this22 = this; | ||
return (function () { | ||
var arg_573300145710716007 = _arguments16;return (function () { | ||
return [_this22.x, _this22.y]; | ||
})(r, angle); | ||
}static fromPolarInDegrees(r, angle) { | ||
return ((r, angle) => { | ||
return (() => { | ||
return (() => { | ||
var matchComparer_573300145710716007 = dotDotCalc_573300145710716007(dotDot_573300145710716007, Math, "principalDegrees", [angle]);return matchComparer_573300145710716007 === 0 ? (() => { | ||
return new Point(r, 0); | ||
})() : matchComparer_573300145710716007 === 90 ? (() => { | ||
return new Point(0, r); | ||
})() : matchComparer_573300145710716007 === -90 ? (() => { | ||
return new Point(0, -r); | ||
})() : matchComparer_573300145710716007 === 180 ? (() => { | ||
return new Point(-r, 0); | ||
})() : (() => { | ||
return Point.fromPolar(r, dotDotCalc_573300145710716007(dotDot_573300145710716007, Math, "degreesToRadians", [angle])); | ||
})(); | ||
})(); | ||
})(); | ||
} | ||
}, { | ||
key: "clone", | ||
value: function clone() { | ||
var _arguments17 = arguments, | ||
_this23 = this; | ||
return (function () { | ||
var arg_573300145710716007 = _arguments17;return (function () { | ||
return new Point(_this23.x, _this23.y); | ||
})(); | ||
})(r, angle); | ||
}real() { | ||
return (() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
return this.x; | ||
})(); | ||
} | ||
}, { | ||
key: "equals", | ||
value: function equals(p) { | ||
var _this24 = this; | ||
return (function (p) { | ||
return (function () { | ||
return cmath.equals(_this24, p); | ||
})(); | ||
})(p); | ||
} | ||
}, { | ||
key: "approxEquals", | ||
value: function approxEquals(p) { | ||
var _this25 = this; | ||
return (function (p) { | ||
return (function () { | ||
return cmath.approxEquals(_this25, p); | ||
})(); | ||
})(p); | ||
} | ||
}, { | ||
key: "opposite", | ||
value: function opposite() { | ||
var _arguments18 = arguments, | ||
_this26 = this; | ||
return (function () { | ||
var arg_573300145710716007 = _arguments18;return (function () { | ||
return cmath.opposite(_this26); | ||
})(); | ||
})(); | ||
}imaginary() { | ||
return (() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
return this.y; | ||
})(); | ||
} | ||
}, { | ||
key: "reciprocal", | ||
value: function reciprocal() { | ||
var _arguments19 = arguments, | ||
_this27 = this; | ||
return (function () { | ||
var arg_573300145710716007 = _arguments19;return (function () { | ||
return cmath.reciprocal(_this27); | ||
})(); | ||
})(); | ||
}toString() { | ||
return (() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
return "(" + this.x + "," + this.y + ")"; | ||
})(); | ||
} | ||
}, { | ||
key: "conjugate", | ||
value: function conjugate() { | ||
var _arguments20 = arguments, | ||
_this28 = this; | ||
return (function () { | ||
var arg_573300145710716007 = _arguments20;return (function () { | ||
return cmath.conjugate(_this28); | ||
})(); | ||
})(); | ||
}toComplexString() { | ||
return (() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
var sign;sign = this.y >= 0 ? (() => { | ||
return "+"; | ||
})() : (() => { | ||
return "-"; | ||
})();return "" + this.x + "" + sign + "" + Math.abs(this.y) + "i"; | ||
})(); | ||
} | ||
}, { | ||
key: "abs", | ||
value: function abs() { | ||
var _arguments21 = arguments, | ||
_this29 = this; | ||
return (function () { | ||
var arg_573300145710716007 = _arguments21;return (function () { | ||
return cmath.abs(_this29); | ||
})(); | ||
})(); | ||
}toArray() { | ||
return (() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
return [this.x, this.y]; | ||
})(); | ||
} | ||
}, { | ||
key: "add", | ||
value: function add(p) { | ||
var _this30 = this; | ||
return (function (p) { | ||
return (function () { | ||
return cmath.add(_this30, p); | ||
})(); | ||
})(p); | ||
} | ||
}, { | ||
key: "subtract", | ||
value: function subtract(p) { | ||
var _this31 = this; | ||
return (function (p) { | ||
return (function () { | ||
return cmath.subtract(_this31, p); | ||
})(); | ||
})(p); | ||
} | ||
}, { | ||
key: "multiply", | ||
value: function multiply(p) { | ||
var _this32 = this; | ||
return (function (p) { | ||
return (function () { | ||
return cmath.multiply(_this32, p); | ||
})(); | ||
})(p); | ||
} | ||
}, { | ||
key: "divide", | ||
value: function divide(p) { | ||
var _this33 = this; | ||
return (function (p) { | ||
return (function () { | ||
return cmath.divide(_this33, p); | ||
})(); | ||
})(p); | ||
} | ||
}, { | ||
key: "distance", | ||
value: function distance(p) { | ||
var _this34 = this; | ||
return (function (p) { | ||
return (function () { | ||
return cmath.distance(_this34, p); | ||
})(); | ||
})(p); | ||
} | ||
}, { | ||
key: "dotProduct", | ||
value: function dotProduct(p) { | ||
var _this35 = this; | ||
return (function (p) { | ||
return (function () { | ||
p = Point.from(p);return _this35.x * p.x + _this35.y * p.y; | ||
})(); | ||
})(p); | ||
} | ||
}, { | ||
key: "crossProduct", | ||
value: function crossProduct(p) { | ||
var _this36 = this; | ||
return (function (p) { | ||
return (function () { | ||
p = Point.from(p);return _this36.x * p.y - _this36.y * p.x; | ||
})(); | ||
})(p); | ||
} | ||
}, { | ||
key: "isOppositeTo", | ||
value: function isOppositeTo(p) { | ||
var _this37 = this; | ||
return (function (p) { | ||
return (function () { | ||
return _this37.opposite().equals(p); | ||
})(); | ||
})(p); | ||
} | ||
}, { | ||
key: "phase", | ||
value: function phase() { | ||
var _arguments22 = arguments, | ||
_this38 = this; | ||
return (function () { | ||
var arg_573300145710716007 = _arguments22;return (function () { | ||
return cmath.phase(_this38); | ||
})(); | ||
})(); | ||
}clone() { | ||
return (() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
return new Point(this.x, this.y); | ||
})(); | ||
} | ||
}, { | ||
key: "phaseTo", | ||
value: function phaseTo(p) { | ||
var _this39 = this; | ||
return (function (p) { | ||
return (function () { | ||
p = Point.from(p);return dotDotCalc_573300145710716007(dotDot_573300145710716007, Math, "principalRadians", [p.phase() - _this39.phase()]); | ||
})(); | ||
})(p); | ||
} | ||
}, { | ||
key: "phaseInDegrees", | ||
value: function phaseInDegrees() { | ||
var _arguments23 = arguments, | ||
_this40 = this; | ||
return (function () { | ||
var arg_573300145710716007 = _arguments23;return (function () { | ||
return cmath.phaseInDegrees(_this40); | ||
})(); | ||
})(); | ||
}equals(p) { | ||
return (p => { | ||
return (() => { | ||
return cmath.equals(this, p); | ||
})(); | ||
} | ||
}, { | ||
key: "phaseInDegreesTo", | ||
value: function phaseInDegreesTo(p) { | ||
var _this41 = this; | ||
return (function (p) { | ||
return (function () { | ||
p = Point.from(p);return dotDotCalc_573300145710716007(dotDot_573300145710716007, Math, "principalDegrees", [p.phaseInDegrees() - _this41.phaseInDegrees()]); | ||
})(); | ||
})(p); | ||
} | ||
}, { | ||
key: "scale", | ||
value: function scale(value, second) { | ||
var _this42 = this; | ||
return (function (value, second) { | ||
return (function () { | ||
var size;size = typeof value === "number" ? (function () { | ||
return typeof second === "number" ? (function () { | ||
return new Point(value, second); | ||
})() : (function () { | ||
return new Point(value, value); | ||
})(); | ||
})() : (function () { | ||
return Point.from(value); | ||
})();return new Point(_this42.x * size.x, _this42.y * size.y); | ||
})(); | ||
})(value, second); | ||
} | ||
}, { | ||
key: "rotate", | ||
value: function rotate(angle) { | ||
var _this43 = this; | ||
return (function (angle) { | ||
return (function () { | ||
return _this43.multiply(Point.fromPolar(1, angle)); | ||
})(); | ||
})(angle); | ||
} | ||
}, { | ||
key: "rotateDegrees", | ||
value: function rotateDegrees(angle) { | ||
var _this44 = this; | ||
return (function (angle) { | ||
return (function () { | ||
return _this44.multiply(Point.fromPolarInDegrees(1, angle)); | ||
})(); | ||
})(angle); | ||
} | ||
}], [{ | ||
key: "from", | ||
value: function from(value, second) { | ||
return (function (value, second) { | ||
return (function () { | ||
return typeof value === "number" ? (function () { | ||
return typeof second === "number" ? (function () { | ||
return new Point(value, second); | ||
})() : (function () { | ||
return new Point(value, 0); | ||
})(); | ||
})() : (function () { | ||
return value instanceof Point ? (function () { | ||
return value.clone(); | ||
})() : (function () { | ||
return typeof value === "string" ? (function () { | ||
return Point.fromString(value); | ||
})() : (function () { | ||
return value instanceof Array ? (function () { | ||
return Point.fromArray(value); | ||
})() : (function () { | ||
return fail(); | ||
})(); | ||
})(); | ||
})(); | ||
})(p); | ||
}approxEquals(p) { | ||
return (p => { | ||
return (() => { | ||
return cmath.approxEquals(this, p); | ||
})(); | ||
})(p); | ||
}opposite() { | ||
return (() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
return cmath.opposite(this); | ||
})(); | ||
})(); | ||
}reciprocal() { | ||
return (() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
return cmath.reciprocal(this); | ||
})(); | ||
})(); | ||
}conjugate() { | ||
return (() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
return cmath.conjugate(this); | ||
})(); | ||
})(); | ||
}abs() { | ||
return (() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
return cmath.abs(this); | ||
})(); | ||
})(); | ||
}add(p) { | ||
return (p => { | ||
return (() => { | ||
return cmath.add(this, p); | ||
})(); | ||
})(p); | ||
}subtract(p) { | ||
return (p => { | ||
return (() => { | ||
return cmath.subtract(this, p); | ||
})(); | ||
})(p); | ||
}multiply(p) { | ||
return (p => { | ||
return (() => { | ||
return cmath.multiply(this, p); | ||
})(); | ||
})(p); | ||
}divide(p) { | ||
return (p => { | ||
return (() => { | ||
return cmath.divide(this, p); | ||
})(); | ||
})(p); | ||
}distance(p) { | ||
return (p => { | ||
return (() => { | ||
return cmath.distance(this, p); | ||
})(); | ||
})(p); | ||
}dotProduct(p) { | ||
return (p => { | ||
return (() => { | ||
p = Point.from(p);return this.x * p.x + this.y * p.y; | ||
})(); | ||
})(p); | ||
}crossProduct(p) { | ||
return (p => { | ||
return (() => { | ||
p = Point.from(p);return this.x * p.y - this.y * p.x; | ||
})(); | ||
})(p); | ||
}isOppositeTo(p) { | ||
return (p => { | ||
return (() => { | ||
return this.opposite().equals(p); | ||
})(); | ||
})(p); | ||
}phase() { | ||
return (() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
return cmath.phase(this); | ||
})(); | ||
})(); | ||
}phaseTo(p) { | ||
return (p => { | ||
return (() => { | ||
p = Point.from(p);return dotDotCalc_573300145710716007(dotDot_573300145710716007, Math, "principalRadians", [p.phase() - this.phase()]); | ||
})(); | ||
})(p); | ||
}phaseInDegrees() { | ||
return (() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
return cmath.phaseInDegrees(this); | ||
})(); | ||
})(); | ||
}phaseInDegreesTo(p) { | ||
return (p => { | ||
return (() => { | ||
p = Point.from(p);return dotDotCalc_573300145710716007(dotDot_573300145710716007, Math, "principalDegrees", [p.phaseInDegrees() - this.phaseInDegrees()]); | ||
})(); | ||
})(p); | ||
}scale(value, second) { | ||
return ((value, second) => { | ||
return (() => { | ||
var size;size = typeof value === "number" ? (() => { | ||
return typeof second === "number" ? (() => { | ||
return new Point(value, second); | ||
})() : (() => { | ||
return new Point(value, value); | ||
})(); | ||
})(); | ||
})(value, second); | ||
} | ||
}, { | ||
key: "fromArray", | ||
value: function fromArray(array) { | ||
return (function (array) { | ||
return (function () { | ||
return new Point(array[0], array[1]); | ||
})(); | ||
})(array); | ||
} | ||
}, { | ||
key: "fromString", | ||
value: function fromString(s) { | ||
return (function (s) { | ||
return (function () { | ||
var adjustedString, normalMatch, complexMatch, real, imaginary, var_573300145710716007_21, var_573300145710716007_22;adjustedString = s.replace(new RegExp("[ ()] ", "g"), "");normalMatch = adjustedString.match(new RegExp("^([^,]*),(.*)$"));return ok_573300145710716007(normalMatch) ? (function () { | ||
return new Point(dotDotCalc_573300145710716007(dotDot_573300145710716007, Number, "parseFloat", [normalMatch[1]]), dotDotCalc_573300145710716007(dotDot_573300145710716007, Number, "parseFloat", [normalMatch[2]])); | ||
})() : (function () { | ||
complexMatch = adjustedString.match(formattedRegex_573300145710716007("^\n (\n [+-]?\n [0-9]*\n \\.?\n [0-9]*\n (?:\n [Ee]\n [+-]?\n [0-9]+\n )?\n (?! [i0-9Ee.] )\n )?\n (?:\n (\n [+-]?\n [0-9]*\n \\.?\n [0-9]*\n (?:\n [Ee]\n [+-]?\n [0-9]+\n )?\n )\n i\n )?\n$"));return ok_573300145710716007(complexMatch) ? (function () { | ||
real = (var_573300145710716007_21 = complexMatch[1]) === undefined || var_573300145710716007_21 === null ? "0" : var_573300145710716007_21;imaginary = (var_573300145710716007_22 = complexMatch[2]) === undefined || var_573300145710716007_22 === null ? "0" : var_573300145710716007_22;real === "" ? (function () { | ||
real = "1"; | ||
})() : undefined;imaginary === "" ? (function () { | ||
imaginary = "1"; | ||
})() : undefined;real === "+" ? (function () { | ||
real = "1"; | ||
})() : undefined;imaginary === "+" ? (function () { | ||
imaginary = "1"; | ||
})() : undefined;real === "-" ? (function () { | ||
real = "-1"; | ||
})() : undefined;imaginary === "-" ? (function () { | ||
imaginary = "-1"; | ||
})() : undefined;return new Point(parseFloat(real), parseFloat(imaginary)); | ||
})() : (function () { | ||
return fail(); | ||
})(); | ||
})(); | ||
})(); | ||
})(s); | ||
} | ||
}, { | ||
key: "fromPolar", | ||
value: function fromPolar(r, angle) { | ||
return (function (r, angle) { | ||
return (function () { | ||
return new Point(r * Math.cos(angle), r * Math.sin(angle)); | ||
})(); | ||
})(r, angle); | ||
} | ||
}, { | ||
key: "fromPolarInDegrees", | ||
value: function fromPolarInDegrees(r, angle) { | ||
return (function (r, angle) { | ||
return (function () { | ||
return (function () { | ||
var matchComparer_573300145710716007 = dotDotCalc_573300145710716007(dotDot_573300145710716007, Math, "principalDegrees", [angle]);return matchComparer_573300145710716007 === 0 ? (function () { | ||
return new Point(r, 0); | ||
})() : matchComparer_573300145710716007 === 90 ? (function () { | ||
return new Point(0, r); | ||
})() : matchComparer_573300145710716007 === -90 ? (function () { | ||
return new Point(0, -r); | ||
})() : matchComparer_573300145710716007 === 180 ? (function () { | ||
return new Point(-r, 0); | ||
})() : (function () { | ||
return Point.fromPolar(r, dotDotCalc_573300145710716007(dotDot_573300145710716007, Math, "degreesToRadians", [angle])); | ||
})(); | ||
})(); | ||
})(); | ||
})(r, angle); | ||
} | ||
}]); | ||
return class_573300145710716007; | ||
})();return class_573300145710716007; | ||
})() : (() => { | ||
return Point.from(value); | ||
})();return new Point(this.x * size.x, this.y * size.y); | ||
})(); | ||
})(value, second); | ||
}rotate(angle) { | ||
return (angle => { | ||
return (() => { | ||
return this.multiply(Point.fromPolar(1, angle)); | ||
})(); | ||
})(angle); | ||
}rotateDegrees(angle) { | ||
return (angle => { | ||
return (() => { | ||
return this.multiply(Point.fromPolarInDegrees(1, angle)); | ||
})(); | ||
})(angle); | ||
} | ||
};return class_573300145710716007; | ||
})();exports.sys = sys; | ||
@@ -1035,37 +733,37 @@ exports.web = web; | ||
exports.dotDot_573300145710716007 = dotDot_573300145710716007 = function (x) { | ||
return (function () { | ||
return x === Number ? (function () { | ||
return (() => { | ||
return x === Number ? (() => { | ||
return feNumberStatic; | ||
})() : (function () { | ||
return x === Object ? (function () { | ||
})() : (() => { | ||
return x === Object ? (() => { | ||
return feObject; | ||
})() : (function () { | ||
return x === Math ? (function () { | ||
})() : (() => { | ||
return x === Math ? (() => { | ||
return feMath; | ||
})() : (function () { | ||
return x === JSON ? (function () { | ||
})() : (() => { | ||
return x === JSON ? (() => { | ||
return feJson; | ||
})() : (function () { | ||
return x === console ? (function () { | ||
})() : (() => { | ||
return x === console ? (() => { | ||
return feConsole; | ||
})() : (function () { | ||
return x === Uint8Array ? (function () { | ||
})() : (() => { | ||
return x === Uint8Array ? (() => { | ||
return feUint8ArrayStatic; | ||
})() : (function () { | ||
return x === Promise ? (function () { | ||
})() : (() => { | ||
return x === Promise ? (() => { | ||
return fePromiseStatic; | ||
})() : (function () { | ||
return typeof x === "number" ? (function () { | ||
})() : (() => { | ||
return typeof x === "number" ? (() => { | ||
return feNumber; | ||
})() : (function () { | ||
return typeof x === "string" ? (function () { | ||
})() : (() => { | ||
return typeof x === "string" ? (() => { | ||
return feString; | ||
})() : (function () { | ||
return x instanceof Array ? (function () { | ||
})() : (() => { | ||
return x instanceof Array ? (() => { | ||
return feArray; | ||
})() : (function () { | ||
return x instanceof Date ? (function () { | ||
})() : (() => { | ||
return x instanceof Date ? (() => { | ||
return feDate; | ||
})() : (function () { | ||
return x instanceof Uint8Array ? (function () { | ||
})() : (() => { | ||
return x instanceof Uint8Array ? (() => { | ||
return feUint8Array; | ||
@@ -1087,4 +785,4 @@ })() : undefined; | ||
exports.loop = loop; | ||
exports["break"] = var_573300145710716007_0; | ||
exports["enum"] = var_573300145710716007_1; | ||
exports.break = var_573300145710716007_0; | ||
exports.enum = var_573300145710716007_1; | ||
exports.fail = fail; | ||
@@ -1091,0 +789,0 @@ exports.compose = compose; |
@@ -1,18 +0,16 @@ | ||
"use strict";Object.defineProperty(exports, "__esModule", { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.randomInt = exports.randomNumber = exports.roundDecimal = exports.principalDegrees = exports.principalRadians = exports.degreesToRadians = exports.radiansToDegrees = exports.approxLessThan = exports.approxGreaterThan = exports.approxEquals = undefined; | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } } | ||
var _main = require("./main"); | ||
var dotDotCalc_573300145710716007 = function dotDotCalc_573300145710716007(dotDot, a, b, c) { | ||
var _dotDot; | ||
return (_dotDot = dotDot(a))[b].apply(_dotDot, [a].concat(_toConsumableArray(c))); | ||
var dotDotCalc_573300145710716007 = function (dotDot, a, b, c) { | ||
return dotDot(a)[b](a, ...c); | ||
};var approxEquals, approxGreaterThan, approxLessThan, radiansToDegrees, degreesToRadians, principalRadians, principalDegrees, roundDecimal, randomNumber, randomInt;exports.approxEquals = approxEquals = function (ns, a, b) { | ||
return (function () { | ||
var threshold, ratioThreshold, var_573300145710716007_2;threshold = 1 / 8388608;ratioThreshold = 1 + threshold;return Math.abs(a) < threshold || Math.abs(b) < threshold ? (function () { | ||
return (() => { | ||
var threshold, ratioThreshold, var_573300145710716007_2;threshold = 1 / 8388608;ratioThreshold = 1 + threshold;return Math.abs(a) < threshold || Math.abs(b) < threshold ? (() => { | ||
return Math.abs(a - b) < threshold; | ||
})() : (function () { | ||
})() : (() => { | ||
return 1 / ratioThreshold < (var_573300145710716007_2 = a / b) && var_573300145710716007_2 < ratioThreshold; | ||
@@ -22,25 +20,25 @@ })(); | ||
};exports.approxGreaterThan = approxGreaterThan = function (ns, a, b) { | ||
return (function () { | ||
return (() => { | ||
return a > b || dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Math, "approxEquals", [a, b]); | ||
})(); | ||
};exports.approxLessThan = approxLessThan = function (ns, a, b) { | ||
return (function () { | ||
return (() => { | ||
return a < b || dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Math, "approxEquals", [a, b]); | ||
})(); | ||
};exports.radiansToDegrees = radiansToDegrees = function (ns, radians) { | ||
return (function () { | ||
return (() => { | ||
return radians / Math.PI * 180; | ||
})(); | ||
};exports.degreesToRadians = degreesToRadians = function (ns, degrees) { | ||
return (function () { | ||
return (() => { | ||
return degrees / 180 * Math.PI; | ||
})(); | ||
};exports.principalRadians = principalRadians = function (ns, radians) { | ||
return (function () { | ||
var t;t = radians % (2 * Math.PI);return t <= -Math.PI ? (function () { | ||
return (() => { | ||
var t;t = radians % (2 * Math.PI);return t <= -Math.PI ? (() => { | ||
return t + 2 * Math.PI; | ||
})() : (function () { | ||
return t > Math.PI ? (function () { | ||
})() : (() => { | ||
return t > Math.PI ? (() => { | ||
return t - 2 * Math.PI; | ||
})() : (function () { | ||
})() : (() => { | ||
return t; | ||
@@ -51,9 +49,9 @@ })(); | ||
};exports.principalDegrees = principalDegrees = function (ns, degrees) { | ||
return (function () { | ||
var t;t = degrees % 360;return t <= -180 ? (function () { | ||
return (() => { | ||
var t;t = degrees % 360;return t <= -180 ? (() => { | ||
return t + 360; | ||
})() : (function () { | ||
return t > 180 ? (function () { | ||
})() : (() => { | ||
return t > 180 ? (() => { | ||
return t - 360; | ||
})() : (function () { | ||
})() : (() => { | ||
return t; | ||
@@ -66,10 +64,10 @@ })(); | ||
digitCount = 0; | ||
}return (function () { | ||
}return (() => { | ||
var factor;factor = Math.pow(10, digitCount);return Math.round(x * factor) / factor; | ||
})(); | ||
};exports.randomNumber = randomNumber = function (ns, m, n) { | ||
return (function () { | ||
return m < n ? (function () { | ||
return (() => { | ||
return m < n ? (() => { | ||
return m + Math.random() * (n - m); | ||
})() : (function () { | ||
})() : (() => { | ||
return (0, _main.fail)(); | ||
@@ -79,10 +77,10 @@ })(); | ||
};exports.randomInt = randomInt = function (ns, m, n) { | ||
return (function () { | ||
var min, max;min = n === undefined ? (function () { | ||
return (() => { | ||
var min, max;min = n === undefined ? (() => { | ||
return 0; | ||
})() : (function () { | ||
})() : (() => { | ||
return m; | ||
})();max = n === undefined ? (function () { | ||
})();max = n === undefined ? (() => { | ||
return m; | ||
})() : (function () { | ||
})() : (() => { | ||
return n; | ||
@@ -89,0 +87,0 @@ })();return Math.floor(dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Math, "randomNumber", [min, max])); |
@@ -1,4 +0,6 @@ | ||
"use strict";Object.defineProperty(exports, "__esModule", { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.parseFloat = exports.isFraction = undefined; | ||
@@ -8,10 +10,10 @@ var _main = require("./main"); | ||
var isFraction, parseFloat;exports.isFraction = isFraction = function (ns, x) { | ||
return (function () { | ||
return (() => { | ||
return typeof x === "number" && isFinite(x) && Math.floor(x) !== x; | ||
})(); | ||
};exports.parseFloat = parseFloat = function (ns, s) { | ||
return (function () { | ||
return Number.parseFloat(s) * (s.endsWith("%") ? (function () { | ||
return (() => { | ||
return Number.parseFloat(s) * (s.endsWith("%") ? (() => { | ||
return 0.01; | ||
})() : (function () { | ||
})() : (() => { | ||
return 1; | ||
@@ -18,0 +20,0 @@ })()); |
@@ -1,91 +0,83 @@ | ||
"use strict";Object.defineProperty(exports, "__esModule", { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.format = exports.pad = exports.approxLessThan = exports.approxGreaterThan = exports.approxEquals = undefined; | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var _main = require("./main"); | ||
var dotDotCalc_573300145710716007 = function dotDotCalc_573300145710716007(dotDot, a, b, c) { | ||
var _dotDot; | ||
return (_dotDot = dotDot(a))[b].apply(_dotDot, [a].concat(_toConsumableArray(c))); | ||
var dotDotCalc_573300145710716007 = function (dotDot, a, b, c) { | ||
return dotDot(a)[b](a, ...c); | ||
};var approxEquals, approxGreaterThan, approxLessThan, pad, format;exports.approxEquals = approxEquals = function (num, x) { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Math, "approxEquals", [num.valueOf(), x]); | ||
})(); | ||
};exports.approxGreaterThan = approxGreaterThan = function (num, x) { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Math, "approxGreaterThan", [num.valueOf(), x]); | ||
})(); | ||
};exports.approxLessThan = approxLessThan = function (num, x) { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Math, "approxLessThan", [num.valueOf(), x]); | ||
})(); | ||
};exports.pad = pad = function (num, integerSize, fractionalSize) { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, num.valueOf(), "format", [{ integerSize: integerSize, fractionalSize: fractionalSize }]); | ||
})(); | ||
};exports.format = format = function (num, options) { | ||
return (function () { | ||
var o, x, s, t, ePos, isNegative, var_573300145710716007_2;o = dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "absorb", [dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "clone", [(var_573300145710716007_2 = options) === undefined ? {} : var_573300145710716007_2]), { integerSize: 1, fractionalSize: 0, forcesSign: false, radix: 10, integerGroupEnabled: false, integerGroupSeparator: ",", integerGroupSize: 3, fractionalGroupEnabled: false, fractionalGroupSeparator: " ", fractionalGroupSize: 3 }]);o.radix !== 10 ? (function () { | ||
return (() => { | ||
var o, x, s, t, ePos, isNegative, var_573300145710716007_2;o = dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "absorb", [dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "clone", [(var_573300145710716007_2 = options) === undefined ? {} : var_573300145710716007_2]), { integerSize: 1, fractionalSize: 0, forcesSign: false, radix: 10, integerGroupEnabled: false, integerGroupSeparator: ",", integerGroupSize: 3, fractionalGroupEnabled: false, fractionalGroupSeparator: " ", fractionalGroupSize: 3 }]);o.radix !== 10 ? (() => { | ||
o.fractionalSize = 0; | ||
})() : undefined;x = num.valueOf();o.integerSize > 80 || o.fractionalSize > 20 || x >= 1e21 || x <= -1e21 || o.integerGroupSize < 1 || o.fractionalGroupSize < 1 ? (function () { | ||
})() : undefined;x = num.valueOf();o.integerSize > 80 || o.fractionalSize > 20 || x >= 1e21 || x <= -1e21 || o.integerGroupSize < 1 || o.fractionalGroupSize < 1 ? (() => { | ||
return (0, _main.fail)("Number or argument out of range"); | ||
})() : undefined;s = o.radix === 10 ? (function () { | ||
t = dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Math, "roundDecimal", [x, o.fractionalSize]).toString();ePos = t.indexOf("e");return ePos === -1 ? (function () { | ||
})() : undefined;s = o.radix === 10 ? (() => { | ||
t = dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Math, "roundDecimal", [x, o.fractionalSize]).toString();ePos = t.indexOf("e");return ePos === -1 ? (() => { | ||
return t; | ||
})() : (function () { | ||
return t[ePos + 1] === "+" ? (function () { | ||
})() : (() => { | ||
return t[ePos + 1] === "+" ? (() => { | ||
return (0, _main.fail)("Number too large"); | ||
})() : (function () { | ||
})() : (() => { | ||
return x.toFixed(o.fractionalSize); | ||
})(); | ||
})(); | ||
})() : (function () { | ||
})() : (() => { | ||
return Math.round(x).toString(o.radix); | ||
})();isNegative = s[0] === "-";s[0] === "+" || s[0] === "-" ? (function () { | ||
})();isNegative = s[0] === "-";s[0] === "+" || s[0] === "-" ? (() => { | ||
s = dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, s, "remove", [0]); | ||
})() : undefined;(function () { | ||
return (function () { | ||
var pos, rawIntegerSize, integerMissing, rawFractionalSize, fractionalMissing;pos = s.indexOf(".");rawIntegerSize = pos === -1 ? (function () { | ||
return (() => { | ||
var pos, rawIntegerSize, integerMissing, rawFractionalSize, fractionalMissing;pos = s.indexOf(".");rawIntegerSize = pos === -1 ? (() => { | ||
return s.length; | ||
})() : (function () { | ||
})() : (() => { | ||
return pos; | ||
})();integerMissing = Math.max(o.integerSize - rawIntegerSize, 0);rawFractionalSize = pos === -1 ? (function () { | ||
})();integerMissing = Math.max(o.integerSize - rawIntegerSize, 0);rawFractionalSize = pos === -1 ? (() => { | ||
return 0; | ||
})() : (function () { | ||
})() : (() => { | ||
return s.length - 1 - pos; | ||
})();fractionalMissing = o.fractionalSize - rawFractionalSize;s = s.substr(0, s.length + fractionalMissing);s[s.length - 1] === "." ? (function () { | ||
})();fractionalMissing = o.fractionalSize - rawFractionalSize;s = s.substr(0, s.length + fractionalMissing);s[s.length - 1] === "." ? (() => { | ||
s = s.substr(0, s.length - 1); | ||
})() : undefined;pos === -1 && o.fractionalSize > 0 ? (function () { | ||
})() : undefined;pos === -1 && o.fractionalSize > 0 ? (() => { | ||
s = s + "."; | ||
})() : undefined;s = "0".repeat(integerMissing) + s + "0".repeat(Math.max(fractionalMissing, 0)); | ||
})(); | ||
})();o.integerGroupEnabled || o.fractionalGroupEnabled ? (function () { | ||
return (function () { | ||
return (function () { | ||
var pos, fractionalStart, integerStart;pos = s.indexOf(".");o.fractionalGroupEnabled ? (function () { | ||
var _repeat; | ||
fractionalStart = (pos === -1 ? (function () { | ||
})();o.integerGroupEnabled || o.fractionalGroupEnabled ? (() => { | ||
return function () { | ||
return (() => { | ||
var pos, fractionalStart, integerStart;pos = s.indexOf(".");o.fractionalGroupEnabled ? (() => { | ||
fractionalStart = (pos === -1 ? (() => { | ||
return s.length; | ||
})() : (function () { | ||
})() : (() => { | ||
return pos; | ||
})()) + 1 + o.fractionalGroupSize;return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, (0, _main.repeat)((_repeat = {}, _defineProperty(_repeat, "", fractionalStart), _defineProperty(_repeat, "to", s.length - 1), _defineProperty(_repeat, "by", o.fractionalGroupSize), _repeat)), "reverse", []).forEach(function (i) { | ||
return (function () { | ||
})()) + 1 + o.fractionalGroupSize;return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, (0, _main.repeat)({ [""]: fractionalStart, to: s.length - 1, by: o.fractionalGroupSize }), "reverse", []).forEach(function (i) { | ||
return (() => { | ||
s = dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, s, "insert", [i, o.fractionalGroupSeparator]); | ||
})(); | ||
}); | ||
})() : undefined;return o.integerGroupEnabled ? (function () { | ||
var _repeat2; | ||
integerStart = (pos === -1 ? (function () { | ||
})() : undefined;return o.integerGroupEnabled ? (() => { | ||
integerStart = (pos === -1 ? (() => { | ||
return s.length; | ||
})() : (function () { | ||
})() : (() => { | ||
return pos; | ||
})()) - o.integerGroupSize;return (0, _main.repeat)((_repeat2 = {}, _defineProperty(_repeat2, "", integerStart), _defineProperty(_repeat2, "to", 1), _defineProperty(_repeat2, "by", -o.integerGroupSize), _repeat2)).forEach(function (i) { | ||
return (function () { | ||
})()) - o.integerGroupSize;return (0, _main.repeat)({ [""]: integerStart, to: 1, by: -o.integerGroupSize }).forEach(function (i) { | ||
return (() => { | ||
s = dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, s, "insert", [i, o.integerGroupSeparator]); | ||
@@ -96,11 +88,11 @@ })(); | ||
})(); | ||
})(); | ||
})() : undefined;o.forcesSign ? (function () { | ||
return isNegative ? (function () { | ||
}(); | ||
})() : undefined;o.forcesSign ? (() => { | ||
return isNegative ? (() => { | ||
s = "-" + s; | ||
})() : (function () { | ||
})() : (() => { | ||
s = "+" + s; | ||
})(); | ||
})() : (function () { | ||
return isNegative ? (function () { | ||
})() : (() => { | ||
return isNegative ? (() => { | ||
s = "-" + s; | ||
@@ -107,0 +99,0 @@ })() : undefined; |
@@ -1,27 +0,23 @@ | ||
"use strict";Object.defineProperty(exports, "__esModule", { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.deepClone = exports.deepAbsorb = exports.absorb = exports.deepAssign = exports.keyValues = exports.clone = exports.isNormalObject = exports.isObject = undefined; | ||
var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; })(); | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } } | ||
var _main = require("./main"); | ||
var dotDotCalc_573300145710716007 = function dotDotCalc_573300145710716007(dotDot, a, b, c) { | ||
var _dotDot; | ||
return (_dotDot = dotDot(a))[b].apply(_dotDot, [a].concat(_toConsumableArray(c))); | ||
var dotDotCalc_573300145710716007 = function (dotDot, a, b, c) { | ||
return dotDot(a)[b](a, ...c); | ||
};var isObject, isNormalObject, clone, keyValues, deepAssign, absorb, deepAbsorb, deepClone;exports.isObject = isObject = function (ns, x) { | ||
return (function () { | ||
return (() => { | ||
return (typeof x === "object" || typeof x === "function") && x !== null; | ||
})(); | ||
};exports.isNormalObject = isNormalObject = function (ns, x) { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "isObject", [x]) && typeof x !== "function" && !Array.isArray(x); | ||
})(); | ||
};exports.clone = clone = function (ns, x) { | ||
return (function () { | ||
return (() => { | ||
var y;y = {};Object.keys(x).forEach(function (key) { | ||
return (function () { | ||
return (() => { | ||
y[key] = x[key]; | ||
@@ -32,5 +28,5 @@ })(); | ||
};exports.keyValues = keyValues = function (ns, x) { | ||
return (function () { | ||
return (() => { | ||
return Object.keys(x).map(function (key) { | ||
return (function () { | ||
return (() => { | ||
return [key, x[key]]; | ||
@@ -40,21 +36,13 @@ })(); | ||
})(); | ||
};exports.deepAssign = deepAssign = function (ns, theTarget) { | ||
for (var _len = arguments.length, sources = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { | ||
sources[_key - 2] = arguments[_key]; | ||
} | ||
return (function () { | ||
};exports.deepAssign = deepAssign = function (ns, theTarget, ...sources) { | ||
return (() => { | ||
sources.forEach(function (theSource) { | ||
return (function () { | ||
return (() => { | ||
var internalDeepAssign;internalDeepAssign = function (target, source) { | ||
return (function () { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "keyValues", [source]).forEach(function (_ref) { | ||
var _ref2 = _slicedToArray(_ref, 2); | ||
var key = _ref2[0]; | ||
var value = _ref2[1]; | ||
return (function () { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "isObject", [value]) && !Array.isArray(value) && dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "isObject", [target[key]]) && !Array.isArray(target[key]) ? (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "keyValues", [source]).forEach(function ([key, value]) { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "isObject", [value]) && !Array.isArray(value) && dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "isObject", [target[key]]) && !Array.isArray(target[key]) ? (() => { | ||
return internalDeepAssign(target[key], value); | ||
})() : (function () { | ||
})() : (() => { | ||
target[key] = dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "deepClone", [value]); | ||
@@ -69,17 +57,9 @@ })(); | ||
})(); | ||
};exports.absorb = absorb = function (ns, subject) { | ||
for (var _len2 = arguments.length, objects = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { | ||
objects[_key2 - 2] = arguments[_key2]; | ||
} | ||
return (function () { | ||
};exports.absorb = absorb = function (ns, subject, ...objects) { | ||
return (() => { | ||
objects.forEach(function (object) { | ||
return (function () { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "keyValues", [object]).forEach(function (_ref3) { | ||
var _ref32 = _slicedToArray(_ref3, 2); | ||
var key = _ref32[0]; | ||
var value = _ref32[1]; | ||
return (function () { | ||
return subject[key] === undefined ? (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "keyValues", [object]).forEach(function ([key, value]) { | ||
return (() => { | ||
return subject[key] === undefined ? (() => { | ||
subject[key] = value; | ||
@@ -92,22 +72,14 @@ })() : undefined; | ||
})(); | ||
};exports.deepAbsorb = deepAbsorb = function (ns, theSubject) { | ||
for (var _len3 = arguments.length, objects = Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) { | ||
objects[_key3 - 2] = arguments[_key3]; | ||
} | ||
return (function () { | ||
};exports.deepAbsorb = deepAbsorb = function (ns, theSubject, ...objects) { | ||
return (() => { | ||
objects.forEach(function (theObject) { | ||
return (function () { | ||
return (() => { | ||
var internalDeepAbsorb;internalDeepAbsorb = function (subject, object) { | ||
return (function () { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "keyValues", [object]).forEach(function (_ref4) { | ||
var _ref42 = _slicedToArray(_ref4, 2); | ||
var key = _ref42[0]; | ||
var value = _ref42[1]; | ||
return (function () { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "isObject", [value]) && !Array.isArray(value) && dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "isObject", [subject[key]]) && !Array.isArray(subject[key]) ? (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "keyValues", [object]).forEach(function ([key, value]) { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "isObject", [value]) && !Array.isArray(value) && dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "isObject", [subject[key]]) && !Array.isArray(subject[key]) ? (() => { | ||
return internalDeepAbsorb(subject[key], value); | ||
})() : (function () { | ||
return subject[key] === undefined ? (function () { | ||
})() : (() => { | ||
return subject[key] === undefined ? (() => { | ||
subject[key] = dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "deepClone", [value]); | ||
@@ -124,23 +96,19 @@ })() : undefined; | ||
};exports.deepClone = deepClone = function (ns, x) { | ||
return (function () { | ||
var theTarget, deepCopyFrom;return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "isObject", [x]) ? (function () { | ||
theTarget = Array.isArray(x) ? (function () { | ||
return (() => { | ||
var theTarget, deepCopyFrom;return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "isObject", [x]) ? (() => { | ||
theTarget = Array.isArray(x) ? (() => { | ||
return []; | ||
})() : (function () { | ||
})() : (() => { | ||
return {}; | ||
})();deepCopyFrom = function (target, source) { | ||
return (function () { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "keyValues", [source]).forEach(function (_ref5) { | ||
var _ref52 = _slicedToArray(_ref5, 2); | ||
var key = _ref52[0]; | ||
var value = _ref52[1]; | ||
return (function () { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "isObject", [value]) ? (function () { | ||
target[key] = Array.isArray(value) ? (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "keyValues", [source]).forEach(function ([key, value]) { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "isObject", [value]) ? (() => { | ||
target[key] = Array.isArray(value) ? (() => { | ||
return []; | ||
})() : (function () { | ||
})() : (() => { | ||
return {}; | ||
})();return deepCopyFrom(target[key], value); | ||
})() : (function () { | ||
})() : (() => { | ||
target[key] = value; | ||
@@ -152,3 +120,3 @@ })(); | ||
};deepCopyFrom(theTarget, x);return theTarget; | ||
})() : (function () { | ||
})() : (() => { | ||
return x; | ||
@@ -155,0 +123,0 @@ })(); |
@@ -1,4 +0,6 @@ | ||
"use strict";Object.defineProperty(exports, "__esModule", { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.delay = undefined; | ||
@@ -8,7 +10,7 @@ var _main = require("./main"); | ||
var delay;exports.delay = delay = function (ns, ms) { | ||
return (function () { | ||
return (() => { | ||
return new Promise(function (resolve, reject) { | ||
return (function () { | ||
return (() => { | ||
return setTimeout(function () { | ||
var arg_573300145710716007 = arguments;return (function () { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
return resolve(); | ||
@@ -15,0 +17,0 @@ })(); |
@@ -1,33 +0,27 @@ | ||
"use strict";Object.defineProperty(exports, "__esModule", { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.bound = exports.toBytes = exports.ensureTrailingNewline = exports.stripTrailingNewline = exports.split = exports.capitalize = exports.matches = exports.remove = exports.insert = exports.format = undefined; | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } } | ||
var _main = require("./main"); | ||
var ok_573300145710716007 = function ok_573300145710716007(a) { | ||
var ok_573300145710716007 = function (a) { | ||
return a !== undefined && a !== null; | ||
};var dotDotCalc_573300145710716007 = function dotDotCalc_573300145710716007(dotDot, a, b, c) { | ||
var _dotDot; | ||
return (_dotDot = dotDot(a))[b].apply(_dotDot, [a].concat(_toConsumableArray(c))); | ||
};var format, insert, remove, matches, capitalize, split, stripTrailingNewline, ensureTrailingNewline, toBytes, bound;exports.format = format = function (str) { | ||
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
return (function () { | ||
};var dotDotCalc_573300145710716007 = function (dotDot, a, b, c) { | ||
return dotDot(a)[b](a, ...c); | ||
};var format, insert, remove, matches, capitalize, split, stripTrailingNewline, ensureTrailingNewline, toBytes, bound;exports.format = format = function (str, ...args) { | ||
return (() => { | ||
var s, m, i;s = str.valueOf();m = [];i = 0;(0, _main.loop)(function () { | ||
return (function () { | ||
var cur, next;return i < s.length ? (function () { | ||
cur = s[i];next = s[i + 1];cur === "{" && next === "{" ? (function () { | ||
return (() => { | ||
var cur, next;return i < s.length ? (() => { | ||
cur = s[i];next = s[i + 1];cur === "{" && next === "{" ? (() => { | ||
m.push("{", "");i = i + 1; | ||
})() : (function () { | ||
return cur === "}" && next === "}" ? (function () { | ||
})() : (() => { | ||
return cur === "}" && next === "}" ? (() => { | ||
m.push("}", "");i = i + 1; | ||
})() : (function () { | ||
return cur === "{" && next >= "0" && next <= "9" && s[i + 2] === "}" ? (function () { | ||
})() : (() => { | ||
return cur === "{" && next >= "0" && next <= "9" && s[i + 2] === "}" ? (() => { | ||
m.push(args[parseInt(next, 10)].toString(), "", "");i = i + 2; | ||
})() : (function () { | ||
})() : (() => { | ||
return m.push(cur); | ||
@@ -37,4 +31,4 @@ })(); | ||
})();i = i + 1; | ||
})() : (function () { | ||
return _main["break"]; | ||
})() : (() => { | ||
return _main.break; | ||
})(); | ||
@@ -45,3 +39,3 @@ })(); | ||
};exports.insert = insert = function (str, index, value) { | ||
return (function () { | ||
return (() => { | ||
var s;s = str.valueOf();return s.substr(0, index) + value + s.substr(index); | ||
@@ -52,13 +46,13 @@ })(); | ||
length = 1; | ||
}return (function () { | ||
}return (() => { | ||
var s;s = str.valueOf();return s.substr(0, start) + s.substr(start + length); | ||
})(); | ||
};exports.matches = matches = function (str, regex) { | ||
return (function () { | ||
return (() => { | ||
var adjustedRegex, result;adjustedRegex = new RegExp(regex.source, "g");result = [];(0, _main.loop)(function () { | ||
return (function () { | ||
var theMatch;theMatch = adjustedRegex.exec(str.valueOf());return ok_573300145710716007(theMatch) ? (function () { | ||
return (() => { | ||
var theMatch;theMatch = adjustedRegex.exec(str.valueOf());return ok_573300145710716007(theMatch) ? (() => { | ||
return result.push(theMatch); | ||
})() : (function () { | ||
return _main["break"]; | ||
})() : (() => { | ||
return _main.break; | ||
})(); | ||
@@ -69,29 +63,25 @@ })(); | ||
};exports.capitalize = capitalize = function (str) { | ||
return (function () { | ||
return (() => { | ||
return str.charAt(0).toUpperCase() + str.substr(1); | ||
})(); | ||
};exports.split = split = function (str) { | ||
for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { | ||
args[_key2 - 1] = arguments[_key2]; | ||
} | ||
return (function () { | ||
var arr;args[0] instanceof Array ? (function () { | ||
};exports.split = split = function (str, ...args) { | ||
return (() => { | ||
var arr;args[0] instanceof Array ? (() => { | ||
args = args[0]; | ||
})() : undefined;arr = str.split(args[0]);return args.length === 2 && typeof args[1] === "number" ? (function () { | ||
return args[1] === 0 ? (function () { | ||
})() : undefined;arr = str.split(args[0]);return args.length === 2 && typeof args[1] === "number" ? (() => { | ||
return args[1] === 0 ? (() => { | ||
return [arr.join(args[0])]; | ||
})() : (function () { | ||
return args[1] <= arr.length - 2 ? (function () { | ||
})() : (() => { | ||
return args[1] <= arr.length - 2 ? (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "portion", [0, args[1] - 1]).concat([dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, arr, "portion", [args[1]]).join(args[0])]); | ||
})() : (function () { | ||
})() : (() => { | ||
return arr; | ||
})(); | ||
})(); | ||
})() : (function () { | ||
return args.length <= 1 ? (function () { | ||
})() : (() => { | ||
return args.length <= 1 ? (() => { | ||
return arr; | ||
})() : (function () { | ||
})() : (() => { | ||
return arr.map(function (s) { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, s, "split", [dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, args, "portion", [1])]); | ||
@@ -104,9 +94,9 @@ })(); | ||
};exports.stripTrailingNewline = stripTrailingNewline = function (str) { | ||
return (function () { | ||
return str[str.length - 2] === "\r" && str[str.length - 1] === "\n" ? (function () { | ||
return (() => { | ||
return str[str.length - 2] === "\r" && str[str.length - 1] === "\n" ? (() => { | ||
return str.substr(0, str.length - 2); | ||
})() : (function () { | ||
return str[str.length - 1] === "\n" ? (function () { | ||
})() : (() => { | ||
return str[str.length - 1] === "\n" ? (() => { | ||
return str.substr(0, str.length - 1); | ||
})() : (function () { | ||
})() : (() => { | ||
return str.valueOf(); | ||
@@ -117,6 +107,6 @@ })(); | ||
};exports.ensureTrailingNewline = ensureTrailingNewline = function (str) { | ||
return (function () { | ||
return str[str.length - 1] !== "\n" ? (function () { | ||
return (() => { | ||
return str[str.length - 1] !== "\n" ? (() => { | ||
return str.valueOf() + "\n"; | ||
})() : (function () { | ||
})() : (() => { | ||
return str.valueOf(); | ||
@@ -126,7 +116,7 @@ })(); | ||
};exports.toBytes = toBytes = function (str) { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Uint8Array, "fromString", [str]); | ||
})(); | ||
};exports.bound = bound = function (str) { | ||
return (function () { | ||
return (() => { | ||
return str.length - 1; | ||
@@ -133,0 +123,0 @@ })(); |
@@ -1,10 +0,12 @@ | ||
"use strict";Object.defineProperty(exports, "__esModule", { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.isNode = exports.feVersion = exports.global = undefined; | ||
var _main = require("./main"); | ||
var feVersion, isNode, theGlobal;exports.feVersion = feVersion = require("../package.json").version;exports.isNode = isNode = typeof process === "object" && typeof process.release === "object" && process.release.name === "node";exports.global = theGlobal = isNode ? (function () { | ||
var feVersion, isNode, theGlobal;exports.feVersion = feVersion = require("../package.json").version;exports.isNode = isNode = typeof process === "object" && typeof process.release === "object" && process.release.name === "node";exports.global = theGlobal = isNode ? (() => { | ||
return global; | ||
})() : (function () { | ||
})() : (() => { | ||
return window; | ||
@@ -11,0 +13,0 @@ })();exports.global = theGlobal; |
@@ -1,33 +0,29 @@ | ||
"use strict";Object.defineProperty(exports, "__esModule", { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.fromHex = exports.fromString = exports.fromBase64 = undefined; | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var _main = require("./main"); | ||
var mod_573300145710716007 = function mod_573300145710716007(a, b) { | ||
var mod_573300145710716007 = function (a, b) { | ||
return (a % b + b) % b; | ||
};var dotDotCalc_573300145710716007 = function dotDotCalc_573300145710716007(dotDot, a, b, c) { | ||
var _dotDot; | ||
return (_dotDot = dotDot(a))[b].apply(_dotDot, [a].concat(_toConsumableArray(c))); | ||
};var dotDotCalc_573300145710716007 = function (dotDot, a, b, c) { | ||
return dotDot(a)[b](a, ...c); | ||
};var $base64, fromBase64, fromString, fromHex;$base64 = require("./base64");exports.fromBase64 = fromBase64 = function (ns, s) { | ||
return (function () { | ||
return (() => { | ||
return $base64.toByteArray(s); | ||
})(); | ||
};exports.fromString = fromString = function (ns, s) { | ||
return (function () { | ||
return (() => { | ||
var bytes, pos;s = encodeURIComponent(s);bytes = [];pos = 0;(0, _main.loop)(function () { | ||
return (function () { | ||
return pos < s.length ? (function () { | ||
return s[pos] === "%" ? (function () { | ||
return (() => { | ||
return pos < s.length ? (() => { | ||
return s[pos] === "%" ? (() => { | ||
bytes.push(parseInt(s.substr(pos + 1, 2), 16));pos = pos + 3; | ||
})() : (function () { | ||
})() : (() => { | ||
bytes.push(s.charCodeAt(pos));pos = pos + 1; | ||
})(); | ||
})() : (function () { | ||
return _main["break"]; | ||
})() : (() => { | ||
return _main.break; | ||
})(); | ||
@@ -38,10 +34,8 @@ })(); | ||
};exports.fromHex = fromHex = function (ns, s) { | ||
return (function () { | ||
var _repeat; | ||
(0, _main.assert)(mod_573300145710716007(s.length, 2) === 0);return new Uint8Array((0, _main.repeat)((_repeat = {}, _defineProperty(_repeat, "", 0), _defineProperty(_repeat, "to", dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, s, "bound", [])), _defineProperty(_repeat, "by", 2), _defineProperty(_repeat, "for", function _for(i) { | ||
return (function () { | ||
return parseInt(s.substr(i, 2), 16); | ||
})(); | ||
}), _repeat))); | ||
return (() => { | ||
(0, _main.assert)(mod_573300145710716007(s.length, 2) === 0);return new Uint8Array((0, _main.repeat)({ [""]: 0, to: dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, s, "bound", []), by: 2, for: function (i) { | ||
return (() => { | ||
return parseInt(s.substr(i, 2), 16); | ||
})(); | ||
} })); | ||
})(); | ||
@@ -48,0 +42,0 @@ };exports.fromBase64 = fromBase64; |
@@ -1,21 +0,19 @@ | ||
"use strict";Object.defineProperty(exports, "__esModule", { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.bound = exports.toHex = exports.toString = exports.toBase64 = undefined; | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } } | ||
var _main = require("./main"); | ||
var dotDotCalc_573300145710716007 = function dotDotCalc_573300145710716007(dotDot, a, b, c) { | ||
var _dotDot; | ||
return (_dotDot = dotDot(a))[b].apply(_dotDot, [a].concat(_toConsumableArray(c))); | ||
var dotDotCalc_573300145710716007 = function (dotDot, a, b, c) { | ||
return dotDot(a)[b](a, ...c); | ||
};var $base64, toBase64, toString, toHex, bound;$base64 = require("./base64");exports.toBase64 = toBase64 = function (bytes) { | ||
return (function () { | ||
return (() => { | ||
return $base64.fromByteArray(bytes); | ||
})(); | ||
};exports.toString = toString = function (bytes) { | ||
return (function () { | ||
return (() => { | ||
return decodeURIComponent(Array.from(bytes).map(function (m) { | ||
return (function () { | ||
return (() => { | ||
return "%" + dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, m, "format", [{ integerSize: 2, radix: 16 }]).toUpperCase(); | ||
@@ -26,5 +24,5 @@ })(); | ||
};exports.toHex = toHex = function (bytes) { | ||
return (function () { | ||
return (() => { | ||
return Array.from(bytes).map(function (m) { | ||
return (function () { | ||
return (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, m, "format", [{ integerSize: 2, radix: 16 }]); | ||
@@ -35,3 +33,3 @@ })(); | ||
};exports.bound = bound = function (bytes) { | ||
return (function () { | ||
return (() => { | ||
return bytes.length - 1; | ||
@@ -38,0 +36,0 @@ })(); |
@@ -1,79 +0,69 @@ | ||
"use strict";Object.defineProperty(exports, "__esModule", { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.Socket = exports.jsonPost = exports.post = exports.binaryGet = exports.jsonGet = exports.get = exports.request = undefined; | ||
var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; })(); | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var _main = require("./main"); | ||
var ok_573300145710716007 = function ok_573300145710716007(a) { | ||
var ok_573300145710716007 = function (a) { | ||
return a !== undefined && a !== null; | ||
};var dotDotCalc_573300145710716007 = function dotDotCalc_573300145710716007(dotDot, a, b, c) { | ||
var _dotDot; | ||
return (_dotDot = dotDot(a))[b].apply(_dotDot, [a].concat(_toConsumableArray(c))); | ||
};var request, get, jsonGet, binaryGet, post, jsonPost;exports.request = request = function (options) { | ||
return (function () { | ||
};var dotDotCalc_573300145710716007 = function (dotDot, a, b, c) { | ||
return dotDot(a)[b](a, ...c); | ||
};var NODE_MAX_REDIRECT_COUNT, request, get, jsonGet, binaryGet, post, jsonPost, Socket;NODE_MAX_REDIRECT_COUNT = 20;exports.request = request = function (options) { | ||
return (() => { | ||
return new Promise(function (resolve, reject) { | ||
return (function () { | ||
var method, uri, headerFields, body, timeout, responseBodyType, ex, var_573300145710716007_2, var_573300145710716007_3, var_573300145710716007_4, var_573300145710716007_5;return (function () { | ||
return (() => { | ||
var method, uri, headerFields, body, timeout, responseBodyType, ex, var_573300145710716007_5, var_573300145710716007_6, var_573300145710716007_7, var_573300145710716007_8;return (() => { | ||
try { | ||
return (function () { | ||
method = options.method;uri = options.uri;headerFields = (var_573300145710716007_2 = options.headerFields) === undefined || var_573300145710716007_2 === null ? null : var_573300145710716007_2;body = (var_573300145710716007_3 = options.body) === undefined || var_573300145710716007_3 === null ? null : var_573300145710716007_3;timeout = (var_573300145710716007_4 = options.timeout) === undefined || var_573300145710716007_4 === null ? null : var_573300145710716007_4;responseBodyType = (var_573300145710716007_5 = options.responseBodyType) === undefined || var_573300145710716007_5 === null ? "text" : var_573300145710716007_5;!ok_573300145710716007(method) ? (function () { | ||
return (() => { | ||
method = options.method;uri = options.uri;headerFields = (var_573300145710716007_5 = options.headerFields) === undefined || var_573300145710716007_5 === null ? null : var_573300145710716007_5;body = (var_573300145710716007_6 = options.body) === undefined || var_573300145710716007_6 === null ? null : var_573300145710716007_6;timeout = (var_573300145710716007_7 = options.timeout) === undefined || var_573300145710716007_7 === null ? null : var_573300145710716007_7;responseBodyType = (var_573300145710716007_8 = options.responseBodyType) === undefined || var_573300145710716007_8 === null ? "text" : var_573300145710716007_8;!ok_573300145710716007(method) ? (() => { | ||
return (0, _main.fail)(); | ||
})() : undefined;!ok_573300145710716007(uri) ? (function () { | ||
})() : undefined;!ok_573300145710716007(uri) ? (() => { | ||
return (0, _main.fail)(); | ||
})() : undefined;ok_573300145710716007(body) && typeof body !== "string" && !(body instanceof Uint8Array) ? (function () { | ||
})() : undefined;ok_573300145710716007(body) && typeof body !== "string" && !(body instanceof Uint8Array) ? (() => { | ||
return (0, _main.fail)(); | ||
})() : undefined;["binary", "text", "json"].indexOf(responseBodyType) < 0 ? (function () { | ||
})() : undefined;["binary", "text", "json"].indexOf(responseBodyType) < 0 ? (() => { | ||
return (0, _main.fail)(); | ||
})() : undefined;return !_main.sys.isNode ? (function () { | ||
return (function () { | ||
return (function () { | ||
var xhr, var_573300145710716007_6;xhr = new XMLHttpRequest();xhr.open(method, uri);ok_573300145710716007(headerFields) ? (function () { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "keyValues", [headerFields]).forEach(function (_ref) { | ||
var _ref2 = _slicedToArray(_ref, 2); | ||
var key = _ref2[0]; | ||
var value = _ref2[1]; | ||
return (function () { | ||
})() : undefined;return !_main.sys.isNode ? (() => { | ||
return function () { | ||
return (() => { | ||
var xhr, var_573300145710716007_9;xhr = new XMLHttpRequest();xhr.open(method, uri);ok_573300145710716007(headerFields) ? (() => { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, Object, "keyValues", [headerFields]).forEach(function ([key, value]) { | ||
return (() => { | ||
return xhr.setRequestHeader(key, value); | ||
})(); | ||
}); | ||
})() : undefined;xhr.responseType = responseBodyType === "binary" ? (function () { | ||
})() : undefined;xhr.responseType = responseBodyType === "binary" ? (() => { | ||
return "arraybuffer"; | ||
})() : (function () { | ||
return responseBodyType === "text" ? (function () { | ||
})() : (() => { | ||
return responseBodyType === "text" ? (() => { | ||
return "text"; | ||
})() : (function () { | ||
return responseBodyType === "json" ? (function () { | ||
})() : (() => { | ||
return responseBodyType === "json" ? (() => { | ||
return "text"; | ||
})() : undefined; | ||
})(); | ||
})();xhr.timeout = (var_573300145710716007_6 = timeout) === undefined || var_573300145710716007_6 === null ? 0 : var_573300145710716007_6;xhr.onload = function () { | ||
var arg_573300145710716007 = arguments;return (function () { | ||
var response;return (function () { | ||
})();xhr.timeout = (var_573300145710716007_9 = timeout) === undefined || var_573300145710716007_9 === null ? 0 : var_573300145710716007_9;xhr.onload = function () { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
var response, var_573300145710716007_10;return (() => { | ||
try { | ||
return (function () { | ||
return (() => { | ||
response = { statusCode: xhr.status, statusReason: xhr.statusText, headerFields: dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, xhr.getAllResponseHeaders(), "stripTrailingNewline", []), "split", ["\r\n", ": ", 1]).map(function (field) { | ||
return (function () { | ||
return (() => { | ||
return [field[0].toLowerCase(), field[1]]; | ||
})(); | ||
}), "toObject", []), body: responseBodyType === "binary" ? (function () { | ||
}), "toObject", []), body: responseBodyType === "binary" ? (() => { | ||
return new Uint8Array(xhr.response); | ||
})() : (function () { | ||
return responseBodyType === "text" ? (function () { | ||
})() : (() => { | ||
return responseBodyType === "text" ? (() => { | ||
return xhr.response; | ||
})() : (function () { | ||
return responseBodyType === "json" ? (function () { | ||
})() : (() => { | ||
return responseBodyType === "json" ? (() => { | ||
return JSON.parse(xhr.response); | ||
})() : undefined; | ||
})(); | ||
})() };return 200 <= response.statusCode && response.statusCode < 300 ? (function () { | ||
})() };return 200 <= (var_573300145710716007_10 = response.statusCode) && var_573300145710716007_10 < 300 ? (() => { | ||
return resolve(response); | ||
})() : (function () { | ||
})() : (() => { | ||
return reject(response); | ||
@@ -83,3 +73,3 @@ })(); | ||
} catch (catch_573300145710716007) { | ||
ex = catch_573300145710716007;return (function () { | ||
ex = catch_573300145710716007;return (() => { | ||
return reject(ex); | ||
@@ -91,11 +81,11 @@ })(); | ||
};xhr.onerror = function (e) { | ||
return (function () { | ||
return (() => { | ||
return reject(e); | ||
})(); | ||
};xhr.ontimeout = function () { | ||
var arg_573300145710716007 = arguments;return (function () { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
return reject(new Error("timeout")); | ||
})(); | ||
};xhr.onabort = function () { | ||
var arg_573300145710716007 = arguments;return (function () { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
return reject(new Error("abort")); | ||
@@ -105,103 +95,113 @@ })(); | ||
})(); | ||
})(); | ||
})() : (function () { | ||
return (function () { | ||
return (function () { | ||
var http, https, urlMod, parsedUri, httpOrHttps, rawRequest;http = module.require("http");https = module.require("https");urlMod = module.require("url");parsedUri = urlMod.parse(uri);httpOrHttps = parsedUri.protocol === "https:" ? (function () { | ||
return https; | ||
})() : (function () { | ||
return http; | ||
})();rawRequest = httpOrHttps.request({ method: method, hostname: parsedUri.hostname, port: parsedUri.port, path: parsedUri.path, headers: headerFields }, function (rawResponse) { | ||
return (function () { | ||
var data;data = new Buffer(0);rawResponse.on("data", function (chunk) { | ||
return (function () { | ||
data = Buffer.concat([data, chunk]); | ||
})(); | ||
});return rawResponse.on("end", function () { | ||
var arg_573300145710716007 = arguments;return (function () { | ||
var response, bodyString, contentType, contentEncodingMatches, encoding;return (function () { | ||
try { | ||
return (function () { | ||
response = { statusCode: rawResponse.statusCode, statusReason: rawResponse.statusMessage, headerFields: rawResponse.headers, body: responseBodyType === "binary" ? (function () { | ||
return new Uint8Array(data); | ||
})() : (function () { | ||
return ["text", "json"].indexOf(responseBodyType) >= 0 ? (function () { | ||
bodyString = data[0] === 0xef && data[1] === 0xbb && data[2] === 0xbf ? (function () { | ||
return data.toString(undefined, 3); | ||
})() : (function () { | ||
return data[0] === 0xff && data[1] === 0xfe ? (function () { | ||
return data.toString("utf16le", 2); | ||
})() : (function () { | ||
return data[0] === 0xfe && data[1] === 0xff ? (function () { | ||
return (0, _main.fail)(); | ||
})() : (function () { | ||
contentType = rawResponse.headers["content-type"].toLowerCase();return ok_573300145710716007(contentType) ? (function () { | ||
contentEncodingMatches = contentType.match(new RegExp(";\\s*charset=([^\\s;]+)\\s*(;|$)"));return ok_573300145710716007(contentEncodingMatches) ? (function () { | ||
encoding = contentEncodingMatches[1];return encoding === "utf-8" ? (function () { | ||
return data.toString(); | ||
})() : (function () { | ||
return ["utf-16", "utf-16le"].indexOf(encoding) >= 0 ? (function () { | ||
return data.toString("utf16le"); | ||
})() : (function () { | ||
return (0, _main.fail)(); | ||
}(); | ||
})() : (() => { | ||
return function () { | ||
return (() => { | ||
var http, https, urlMod, redirectCount, internalRequest;http = module.require("http");https = module.require("https");urlMod = module.require("url");redirectCount = 0;internalRequest = function (internalUri) { | ||
return (() => { | ||
var parsedUri, httpOrHttps, rawRequest;redirectCount > NODE_MAX_REDIRECT_COUNT ? (() => { | ||
return (0, _main.fail)(); | ||
})() : undefined;parsedUri = urlMod.parse(internalUri);httpOrHttps = parsedUri.protocol === "https:" ? (() => { | ||
return https; | ||
})() : (() => { | ||
return http; | ||
})();rawRequest = httpOrHttps.request({ method: method, hostname: parsedUri.hostname, port: parsedUri.port, path: parsedUri.path, headers: headerFields }, function (rawResponse) { | ||
return (() => { | ||
var data;data = Buffer.alloc(0);rawResponse.on("data", function (chunk) { | ||
return (() => { | ||
data = Buffer.concat([data, chunk]); | ||
})(); | ||
});return rawResponse.on("end", function () { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
var response, bodyString, contentType, contentEncodingMatches, encoding, var_573300145710716007_11, var_573300145710716007_12;return (() => { | ||
try { | ||
return (() => { | ||
return method === "GET" && 300 <= (var_573300145710716007_11 = rawResponse.statusCode) && var_573300145710716007_11 < 400 && rawResponse.headers["location"] !== undefined ? (() => { | ||
redirectCount = redirectCount + 1;return internalRequest(rawResponse.headers["location"]); | ||
})() : (() => { | ||
response = { statusCode: rawResponse.statusCode, statusReason: rawResponse.statusMessage, headerFields: rawResponse.headers, body: responseBodyType === "binary" ? (() => { | ||
return new Uint8Array(data); | ||
})() : (() => { | ||
return ["text", "json"].indexOf(responseBodyType) >= 0 ? (() => { | ||
bodyString = data[0] === 0xef && data[1] === 0xbb && data[2] === 0xbf ? (() => { | ||
return data.toString(undefined, 3); | ||
})() : (() => { | ||
return data[0] === 0xff && data[1] === 0xfe ? (() => { | ||
return data.toString("utf16le", 2); | ||
})() : (() => { | ||
return data[0] === 0xfe && data[1] === 0xff ? (() => { | ||
return (0, _main.fail)(); | ||
})() : (() => { | ||
contentType = rawResponse.headers["content-type"].toLowerCase();return ok_573300145710716007(contentType) ? (() => { | ||
contentEncodingMatches = contentType.match(new RegExp(";\\s*charset=([^\\s;]+)\\s*(;|$)"));return ok_573300145710716007(contentEncodingMatches) ? (() => { | ||
encoding = contentEncodingMatches[1];return encoding === "utf-8" ? (() => { | ||
return data.toString(); | ||
})() : (() => { | ||
return ["utf-16", "utf-16le"].indexOf(encoding) >= 0 ? (() => { | ||
return data.toString("utf16le"); | ||
})() : (() => { | ||
return (0, _main.fail)(); | ||
})(); | ||
})(); | ||
})() : (() => { | ||
return data.toString(); | ||
})(); | ||
})() : (() => { | ||
return data.toString(); | ||
})(); | ||
})(); | ||
})() : (function () { | ||
return data.toString(); | ||
})(); | ||
})() : (function () { | ||
return data.toString(); | ||
})();return responseBodyType === "text" ? (() => { | ||
return bodyString; | ||
})() : (() => { | ||
return JSON.parse(bodyString); | ||
})(); | ||
})(); | ||
})(); | ||
})();return responseBodyType === "text" ? (function () { | ||
return bodyString; | ||
})() : (function () { | ||
return JSON.parse(bodyString); | ||
})() : undefined; | ||
})() };return 200 <= (var_573300145710716007_12 = response.statusCode) && var_573300145710716007_12 < 300 ? (() => { | ||
return resolve(response); | ||
})() : (() => { | ||
return reject(response); | ||
})(); | ||
})() : undefined; | ||
})() };return 200 <= response.statusCode && response.statusCode < 300 ? (function () { | ||
return resolve(response); | ||
})() : (function () { | ||
return reject(response); | ||
})(); | ||
})(); | ||
})(); | ||
} catch (catch_573300145710716007) { | ||
ex = catch_573300145710716007;return (() => { | ||
return reject(ex); | ||
})(); | ||
} finally {} | ||
})(); | ||
} catch (catch_573300145710716007) { | ||
ex = catch_573300145710716007;return (function () { | ||
return reject(ex); | ||
})(); | ||
} finally {} | ||
})(); | ||
}); | ||
})(); | ||
});ok_573300145710716007(timeout) ? (() => { | ||
return rawRequest.setTimeout(timeout, function () { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
reject(new Error("timeout"));return rawRequest.abort(); | ||
})(); | ||
}); | ||
})() : undefined;return rawRequest.on("error", function (e) { | ||
return (() => { | ||
return reject(e); | ||
})(); | ||
}); | ||
}).on("abort", function (e) { | ||
return (() => { | ||
return reject(new Error("abort")); | ||
})(); | ||
}).on("aborted", function (e) { | ||
return (() => { | ||
return reject(new Error("abort")); | ||
})(); | ||
}).end(body instanceof Uint8Array ? (() => { | ||
return Buffer.from(body.buffer); | ||
})() : (() => { | ||
return body; | ||
})()); | ||
})(); | ||
});ok_573300145710716007(timeout) ? (function () { | ||
return rawRequest.setTimeout(timeout, function () { | ||
var arg_573300145710716007 = arguments;return (function () { | ||
reject(new Error("timeout"));return rawRequest.abort(); | ||
})(); | ||
}); | ||
})() : undefined;return rawRequest.on("error", function (e) { | ||
return (function () { | ||
return reject(e); | ||
})(); | ||
}).on("abort", function (e) { | ||
return (function () { | ||
return reject(new Error("abort")); | ||
})(); | ||
}).on("aborted", function (e) { | ||
return (function () { | ||
return reject(new Error("abort")); | ||
})(); | ||
}).end(body instanceof Uint8Array ? (function () { | ||
return new Buffer(body); | ||
})() : (function () { | ||
return body; | ||
})()); | ||
};return internalRequest(uri); | ||
})(); | ||
})(); | ||
}(); | ||
})(); | ||
})(); | ||
} catch (catch_573300145710716007) { | ||
ex = catch_573300145710716007;return (function () { | ||
ex = catch_573300145710716007;return (() => { | ||
return reject(ex); | ||
@@ -215,22 +215,122 @@ })(); | ||
};exports.get = get = function (uri, options) { | ||
return (function () { | ||
return (() => { | ||
var actualOptions;actualOptions = { method: "GET", uri: uri };Object.assign(actualOptions, options);return _main.web.request(actualOptions); | ||
})(); | ||
};exports.jsonGet = jsonGet = function (uri, options) { | ||
return (function () { | ||
return (() => { | ||
var actualOptions;actualOptions = { method: "GET", uri: uri, responseBodyType: "json" };Object.assign(actualOptions, options);return _main.web.request(actualOptions); | ||
})(); | ||
};exports.binaryGet = binaryGet = function (uri, options) { | ||
return (function () { | ||
return (() => { | ||
var actualOptions;actualOptions = { method: "GET", uri: uri, responseBodyType: "binary" };Object.assign(actualOptions, options);return _main.web.request(actualOptions); | ||
})(); | ||
};exports.post = post = function (uri, body, options) { | ||
return (function () { | ||
return (() => { | ||
var actualOptions;actualOptions = { method: "POST", uri: uri, body: body };Object.assign(actualOptions, options);return _main.web.request(actualOptions); | ||
})(); | ||
};exports.jsonPost = jsonPost = function (uri, body, options) { | ||
return (function () { | ||
var actualOptions;actualOptions = { method: "POST", uri: uri, headerFields: _defineProperty({}, "Content-Type", "application/json"), body: JSON.stringify(body), responseBodyType: "json" };Object.assign(actualOptions, options);return _main.web.request(actualOptions); | ||
return (() => { | ||
var actualOptions;actualOptions = { method: "POST", uri: uri, headerFields: { ["Content-Type"]: "application/json" }, body: JSON.stringify(body), responseBodyType: "json" };Object.assign(actualOptions, options);return _main.web.request(actualOptions); | ||
})(); | ||
};exports.request = request; | ||
};exports.Socket = Socket = (() => { | ||
var var_573300145710716007_2 = Symbol();var var_573300145710716007_3 = Symbol();var var_573300145710716007_4 = Symbol();var class_573300145710716007 = class { | ||
constructor(uri) { | ||
(uri => { | ||
return (() => { | ||
this.uri = uri;this.onOpen = (0, _main.eventField)();this.onClose = (0, _main.eventField)();this.onMessage = (0, _main.eventField)();this.onError = (0, _main.eventField)();this[var_573300145710716007_2] = null;this[var_573300145710716007_3] = false;this[var_573300145710716007_4] = false; | ||
})(); | ||
})(uri); | ||
}open() { | ||
return (() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
return new Promise((resolve, reject) => { | ||
return (() => { | ||
(0, _main.assert)(!this[var_573300145710716007_4]);this[var_573300145710716007_4] = true;return !_main.sys.isNode ? (() => { | ||
return (() => { | ||
return (() => { | ||
this[var_573300145710716007_2] = new WebSocket(this.uri);this[var_573300145710716007_2].onopen = () => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
this[var_573300145710716007_3] = true;this.onOpen.fire();return resolve(); | ||
})(); | ||
};this[var_573300145710716007_2].onclose = () => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
this.onClose.fire();return !this[var_573300145710716007_3] ? (() => { | ||
return reject(); | ||
})() : undefined; | ||
})(); | ||
};this[var_573300145710716007_2].onmessage = e => { | ||
return (() => { | ||
return this.onMessage.fire(e.data); | ||
})(); | ||
};this[var_573300145710716007_2].onerror = e => { | ||
return (() => { | ||
this.onError.fire(e);return !this[var_573300145710716007_3] ? (() => { | ||
return reject(); | ||
})() : undefined; | ||
})(); | ||
}; | ||
})(); | ||
})(); | ||
})() : (() => { | ||
return (() => { | ||
return (() => { | ||
return reject(); | ||
})(); | ||
})(); | ||
})(); | ||
})(); | ||
}); | ||
})(); | ||
})(); | ||
}send(data) { | ||
return (data => { | ||
return (() => { | ||
return !_main.sys.isNode ? (() => { | ||
return (() => { | ||
return (() => { | ||
return this[var_573300145710716007_2].send(data); | ||
})(); | ||
})(); | ||
})() : (() => { | ||
return (() => { | ||
return (() => { | ||
return (0, _main.fail)(); | ||
})(); | ||
})(); | ||
})(); | ||
})(); | ||
})(data); | ||
}close() { | ||
return (() => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
return new Promise((resolve, reject) => { | ||
return (() => { | ||
(0, _main.assert)(this[var_573300145710716007_3]);return !_main.sys.isNode ? (() => { | ||
return (() => { | ||
return (() => { | ||
this[var_573300145710716007_2].onclose = () => { | ||
var arg_573300145710716007 = arguments;return (() => { | ||
this.onClose.fire();return resolve(); | ||
})(); | ||
};this[var_573300145710716007_2].onerror = e => { | ||
return (() => { | ||
this.onError.fire(e);return reject(); | ||
})(); | ||
};return this[var_573300145710716007_2].close(); | ||
})(); | ||
})(); | ||
})() : (() => { | ||
return (() => { | ||
return (() => { | ||
return reject(); | ||
})(); | ||
})(); | ||
})(); | ||
})(); | ||
}); | ||
})(); | ||
})(); | ||
} | ||
};return class_573300145710716007; | ||
})();exports.request = request; | ||
exports.get = get; | ||
@@ -240,2 +340,3 @@ exports.jsonGet = jsonGet; | ||
exports.post = post; | ||
exports.jsonPost = jsonPost; | ||
exports.jsonPost = jsonPost; | ||
exports.Socket = Socket; |
@@ -1,38 +0,40 @@ | ||
"use strict";Object.defineProperty(exports, "__esModule", { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.global = exports.clearImmediate = exports.setImmediate = exports.dotDot_573300145710716007 = exports.fePromiseStatic = exports.feUint8ArrayStatic = exports.feUint8Array = exports.feConsole = exports.feDate = exports.feJson = exports.feMath = exports.feArray = exports.feObject = exports.feString = exports.feNumberStatic = exports.feNumber = exports.cmath = exports.web = exports.sys = exports.Point = exports.Observer = exports.IntervalTimer = exports.Timer = exports.eventField = exports.spread = exports.assert = exports.compose = exports.fail = exports.enum = exports.break = exports.repeat = exports.loop = undefined; | ||
var _targetMain = require("../target/main"); | ||
var _main = require("../target/main"); | ||
var var_573300145710716007_2;var var_573300145710716007_4;var global, var_573300145710716007_3, var_573300145710716007_5;exports.loop = _targetMain.loop; | ||
exports.repeat = _targetMain.repeat; | ||
exports["break"] = _targetMain["break"]; | ||
exports["enum"] = _targetMain["enum"]; | ||
exports.fail = _targetMain.fail; | ||
exports.compose = _targetMain.compose; | ||
exports.assert = _targetMain.assert; | ||
exports.spread = _targetMain.spread; | ||
exports.eventField = _targetMain.eventField; | ||
exports.setImmediate = var_573300145710716007_2 = (var_573300145710716007_3 = _targetMain.sys.global.setImmediate) === undefined ? _targetMain.setImmediate : var_573300145710716007_3;exports.clearImmediate = var_573300145710716007_4 = (var_573300145710716007_5 = _targetMain.sys.global.clearImmediate) === undefined ? _targetMain.clearImmediate : var_573300145710716007_5;exports.Timer = _targetMain.Timer; | ||
exports.IntervalTimer = _targetMain.IntervalTimer; | ||
exports.Observer = _targetMain.Observer; | ||
exports.Point = _targetMain.Point; | ||
exports.sys = _targetMain.sys; | ||
exports.web = _targetMain.web; | ||
exports.cmath = _targetMain.cmath; | ||
exports.feNumber = _targetMain.feNumber; | ||
exports.feNumberStatic = _targetMain.feNumberStatic; | ||
exports.feString = _targetMain.feString; | ||
exports.feObject = _targetMain.feObject; | ||
exports.feArray = _targetMain.feArray; | ||
exports.feMath = _targetMain.feMath; | ||
exports.feJson = _targetMain.feJson; | ||
exports.feDate = _targetMain.feDate; | ||
exports.feConsole = _targetMain.feConsole; | ||
exports.feUint8Array = _targetMain.feUint8Array; | ||
exports.feUint8ArrayStatic = _targetMain.feUint8ArrayStatic; | ||
exports.fePromiseStatic = _targetMain.fePromiseStatic; | ||
exports.dotDot_573300145710716007 = _targetMain.dotDot_573300145710716007; | ||
exports.global = global = _targetMain.sys.global;exports.setImmediate = var_573300145710716007_2; | ||
var var_573300145710716007_2;var var_573300145710716007_4;var global, var_573300145710716007_3, var_573300145710716007_5;exports.loop = _main.loop; | ||
exports.repeat = _main.repeat; | ||
exports.break = _main.break; | ||
exports.enum = _main.enum; | ||
exports.fail = _main.fail; | ||
exports.compose = _main.compose; | ||
exports.assert = _main.assert; | ||
exports.spread = _main.spread; | ||
exports.eventField = _main.eventField; | ||
exports.setImmediate = var_573300145710716007_2 = (var_573300145710716007_3 = _main.sys.global.setImmediate) === undefined ? _main.setImmediate : var_573300145710716007_3;exports.clearImmediate = var_573300145710716007_4 = (var_573300145710716007_5 = _main.sys.global.clearImmediate) === undefined ? _main.clearImmediate : var_573300145710716007_5;exports.Timer = _main.Timer; | ||
exports.IntervalTimer = _main.IntervalTimer; | ||
exports.Observer = _main.Observer; | ||
exports.Point = _main.Point; | ||
exports.sys = _main.sys; | ||
exports.web = _main.web; | ||
exports.cmath = _main.cmath; | ||
exports.feNumber = _main.feNumber; | ||
exports.feNumberStatic = _main.feNumberStatic; | ||
exports.feString = _main.feString; | ||
exports.feObject = _main.feObject; | ||
exports.feArray = _main.feArray; | ||
exports.feMath = _main.feMath; | ||
exports.feJson = _main.feJson; | ||
exports.feDate = _main.feDate; | ||
exports.feConsole = _main.feConsole; | ||
exports.feUint8Array = _main.feUint8Array; | ||
exports.feUint8ArrayStatic = _main.feUint8ArrayStatic; | ||
exports.fePromiseStatic = _main.fePromiseStatic; | ||
exports.dotDot_573300145710716007 = _main.dotDot_573300145710716007; | ||
exports.global = global = _main.sys.global;exports.setImmediate = var_573300145710716007_2; | ||
exports.clearImmediate = var_573300145710716007_4; | ||
exports.global = global; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
359258
46
4321