Comparing version 0.3.0 to 1.0.0
@@ -0,1 +1,8 @@ | ||
v1.0.0 | ||
====== | ||
2016-03-18T19:10:59Z | ||
Add many functions. Rename `repeat` to `loop`. | ||
v0.3.0 | ||
@@ -2,0 +9,0 @@ ====== |
@@ -1,2 +0,2 @@ | ||
# How to publish | ||
# Compile | ||
@@ -10,1 +10,7 @@ Before testing or publishing, it must be compiled to JS using: | ||
Before publishing write the changelog. | ||
# Test | ||
```bash | ||
mocha test-target/main | ||
``` |
{ | ||
"name": "fus-ext", | ||
"version": "0.3.0", | ||
"version": "1.0.0", | ||
"description": "FutureScript Extension", | ||
@@ -5,0 +5,0 @@ "keywords": ["futurescript", "fus"], |
114
README.md
@@ -11,13 +11,19 @@ # FutureScript Extension | ||
Copy `node_modules/fus-ext/examples/manifest.fus` file to your code's directory. | ||
In `node_modules/fus-ext/examples` directory, there're 3 manifest files. Copy one of them to your code's directory. Rename the new file to `manifest.fus` if needed. | ||
You code can be like this: | ||
- `manifest.fus`: For general purposes. | ||
- `manifest-lodash.fus`: Suitable if you want to bind `..` to Lodash (or Underscore after modification) instead of the fus-ext built-in. | ||
- `manifest-no-op.fus`: Suitable if you don't want to bind `..` to anything, or you want to bind later in your own code. | ||
You can remove some exports in the manifest. For example, you can remove `assert` if you want this name to bind to Node.js `assert` module in your own code. | ||
Your code can be like this: | ||
```fus | ||
fus 1.0.1 | ||
fus 1.3.1 | ||
import "./manifest" all | ||
repeat[10, i -> | ||
loop(10, i -> | ||
console.log "This is \(i) time" | ||
] | ||
) | ||
``` | ||
@@ -60,9 +66,11 @@ | ||
repeat, break | ||
============= | ||
loop, repeat, break | ||
=================== | ||
If the iterator returns `break` then it means to jump out of the loop, similar to JS's `break`, but different in essence. Here `break` is an expression, and only capable of cancelling the remaining cycles, not capable of cancelling the remaining part of the function. If `break` then the `repeat` function returns `break`。This example is a loop, from 0 to 9, but it will jump out on 5: | ||
`loop` and `repeat` are similar. The only difference is that `repeat` returns the results as an array while `loop` returns `void`. So, `repeat` make cause performance issue if you run a huge number of cycles. For example, if there're 1,000,000,000 cycles and you use `repeat`, then the results array will be too big. | ||
If the iterator returns `break` then it means to jump out of the loop, similar to JS's `break`, but different in essence. Here `break` is an expression, and only capable of cancelling the remaining cycles, not capable of cancelling the remaining part of the function. If `break` then the `loop` or `repeat` function returns `break`. This example is a loop, from 0 to 9, but it will jump out on 5: | ||
```fus | ||
repeat[10, i -> | ||
loop(10, i -> | ||
if i < 5 | ||
@@ -72,3 +80,3 @@ console.log "This is \(i) time" | ||
break | ||
] | ||
) | ||
``` | ||
@@ -79,3 +87,3 @@ | ||
```fus | ||
repeat -- | ||
loop -- | ||
if abc() | ||
@@ -87,6 +95,6 @@ break | ||
This corresponds to JS's `for` loop, from 1 to 10: | ||
The following corresponds to JS's `for` loop, from 1 to 10: | ||
```fus | ||
repeat{from: 1, to: 10, for: i -> | ||
loop{1 to 10 for i -> | ||
console.log i | ||
@@ -96,6 +104,6 @@ } | ||
This corresponds to JS's `for` loop, from 10 to 1: | ||
The following corresponds to JS's `for` loop, from 10 to 1: | ||
```fus | ||
repeat{from: 10, to: 1, by: -1, for: i -> | ||
loop{10 to 1 by -1 for i -> | ||
console.log i | ||
@@ -105,2 +113,68 @@ } | ||
The following will output `[1, 3, 5, 7, 9]`: | ||
```fus | ||
console.log repeat{1 to 10 by 2} | ||
``` | ||
The following will output `[0, 1, 2, 3, 4]`: | ||
```fus | ||
console.log repeat(5) | ||
``` | ||
The following will output `[2, 3, 4, 5, 6]`: | ||
```fus | ||
console.log repeat(5, i -> i + 2) | ||
``` | ||
enum | ||
==== | ||
This can simulate the `enum` type in many other languages. For example: | ||
```fus | ||
Color: enum{red, green, blue} | ||
console.log(Color.red, Color.green, Color.blue) | ||
``` | ||
This will output `0 1 2`. | ||
compose | ||
======= | ||
Syntax: `compose(function1, [function2, ...])` | ||
Returns the math composition of functions. For example: | ||
```fus | ||
a: compose(Math.min, Math.abs) | ||
console.log a(-2, -3) | ||
``` | ||
This will output `3`. | ||
spread | ||
====== | ||
Syntax: `spread(value, count)` | ||
Returns a length=`count` array. In this array each element is `value`. | ||
For example, `spread(0, 3)` will be `[0, 0, 0]` | ||
fail | ||
==== | ||
Syntax: `fail([errorMessage])` | ||
Shorthand function for `throw Error(errorMessage)`. So you can write `fail()` in many use cases. | ||
assert | ||
====== | ||
This function is equivalent to Node.js `assert` function, but it also works in browser. | ||
web | ||
@@ -157,1 +231,11 @@ ==== | ||
Do HTTP POST for the `uri` and `body`, returning a promise of a response with its body represented as a JSON value. The argument `body` must be also a JSON value, which will be stringified by the library before sending. Options valid in `web.request` are also valid in this method. | ||
feString | ||
======== | ||
Under development. | ||
feArray | ||
======= | ||
Under development. |
@@ -11,10 +11,20 @@ "use strict";Object.defineProperty(exports, "__esModule", { | ||
return a !== undefined && a !== null; | ||
};var portion, toObject;exports.portion = portion = function fun_573300145710716007(arr, args) { | ||
};var portion, toObject;exports.portion = portion = function fun_573300145710716007(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 () { | ||
var startIndex, length, endIndex; | ||
var _args = _slicedToArray(args, 3); | ||
var _ref = args[0] instanceof Array ? (function () { | ||
return args[0]; | ||
})() : (function () { | ||
return args; | ||
})(); | ||
startIndex = _args[0]; | ||
length = _args[1]; | ||
endIndex = _args[2]; | ||
var _ref2 = _slicedToArray(_ref, 3); | ||
startIndex = _ref2[0]; | ||
length = _ref2[1]; | ||
endIndex = _ref2[2]; | ||
return arr.slice(startIndex, ok_573300145710716007(length) ? (function () { | ||
@@ -21,0 +31,0 @@ return startIndex + length; |
@@ -5,2 +5,4 @@ "use strict";Object.defineProperty(exports, "__esModule", { | ||
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 _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; } } | ||
@@ -18,40 +20,84 @@ | ||
var es = _interopRequireWildcard(_string); | ||
var feString = _interopRequireWildcard(_string); | ||
var _array = require("./array"); | ||
var ea = _interopRequireWildcard(_array); | ||
var feArray = _interopRequireWildcard(_array); | ||
var ifvoid_573300145710716007 = function ifvoid_573300145710716007(a, b) { | ||
var ok_573300145710716007 = function ok_573300145710716007(a) { | ||
return a !== undefined && a !== null; | ||
};var ifvoid_573300145710716007 = function ifvoid_573300145710716007(a, b) { | ||
return a === undefined ? b : a; | ||
};var repeat, fail, var_573300145710716007_0, var_573300145710716007_1;exports.repeat = repeat = function fun_573300145710716007() { | ||
var arg_573300145710716007 = arguments;return (function () { | ||
var theBreak, arg, step, startIndex, endIndex;theBreak = var_573300145710716007_0;arg = arg_573300145710716007[0];arg_573300145710716007[0] instanceof Function ? (function () { | ||
};var internalLoop, repeat, loop, fail, compose, assert, spread, eventField, dotDot_573300145710716007, var_573300145710716007_0, var_573300145710716007_1;internalLoop = function fun_573300145710716007(_ref) { | ||
var _ref2 = _slicedToArray(_ref, 2); | ||
var data = _ref2[0]; | ||
var enablesReturns = _ref2[1]; | ||
return (function () { | ||
var theBreak, results, step, startIndex, endIndex;theBreak = var_573300145710716007_0;results = enablesReturns ? (function () { | ||
return []; | ||
})() : (function () { | ||
return undefined; | ||
})();return typeof data === "number" ? (function () { | ||
return (function () { | ||
var i = 0; | ||
while (true) { | ||
if (arg(i) === theBreak) break; | ||
i++; | ||
for (var i = 0; i < data; i++) { | ||
if (enablesReturns) results.push(i); | ||
} | ||
return results; | ||
})(); | ||
})() : (function () { | ||
return arg_573300145710716007[0] instanceof Array ? (function () { | ||
return data instanceof Function ? (function () { | ||
return (function () { | ||
for (var i = 0; i < arg[0]; i++) { | ||
if (arg[1](i) === theBreak) break; | ||
var i = 0; | ||
while (true) { | ||
var r = data(i); | ||
if (r === theBreak) break; | ||
if (enablesReturns) results.push(r); | ||
i++; | ||
} | ||
return results; | ||
})(); | ||
})() : (function () { | ||
return arg_573300145710716007[0] instanceof Object ? (function () { | ||
step = ifvoid_573300145710716007(arg_573300145710716007[0].by, 1);startIndex = ifvoid_573300145710716007(arg_573300145710716007[0].from, arg_573300145710716007[0][""]);endIndex = ifvoid_573300145710716007(arg_573300145710716007[0].to, Infinity);return (function () { | ||
for (var i = startIndex; step >= 0 ? i <= endIndex : i >= endIndex; i += step) { | ||
if (arg["for"](i) === theBreak) break; | ||
return data instanceof Array ? (function () { | ||
return (function () { | ||
for (var i = 0; i < data[0]; i++) { | ||
var r = data[1] === undefined ? i : data[1](i); | ||
if (r === theBreak) break; | ||
if (enablesReturns) results.push(r); | ||
} | ||
return results; | ||
})(); | ||
})() : (function () { | ||
throw new Error("`repeat` syntax error."); | ||
return data instanceof Object ? (function () { | ||
step = ifvoid_573300145710716007(data.by, 1);startIndex = ifvoid_573300145710716007(data.from, data[""]);endIndex = ifvoid_573300145710716007(data.to, Infinity);return (function () { | ||
for (var i = startIndex; step >= 0 ? i <= endIndex : i >= endIndex; i += step) { | ||
var r = data["for"] === undefined ? i : data["for"](i); | ||
if (r === theBreak) break; | ||
if (enablesReturns) results.push(r); | ||
} | ||
return results; | ||
})(); | ||
})() : (function () { | ||
throw new Error("`repeat` syntax error."); | ||
})(); | ||
})(); | ||
})(); | ||
})();return undefined; | ||
})(); | ||
})(); | ||
};exports.repeat = repeat = function fun_573300145710716007(a, b) { | ||
return (function () { | ||
return internalLoop([b === undefined ? (function () { | ||
return a; | ||
})() : (function () { | ||
return [a, b]; | ||
})(), true]); | ||
})(); | ||
};exports.loop = loop = function fun_573300145710716007(a, b) { | ||
return (function () { | ||
return internalLoop([b === undefined ? (function () { | ||
return a; | ||
})() : (function () { | ||
return [a, b]; | ||
})(), false]); | ||
})(); | ||
};exports["break"] = var_573300145710716007_0 = Symbol();exports["enum"] = var_573300145710716007_1 = function fun_573300145710716007() { | ||
@@ -69,9 +115,119 @@ var arg_573300145710716007 = arguments;return (function () { | ||
})(); | ||
};exports.compose = compose = function fun_573300145710716007() { | ||
for (var _len = arguments.length, functions = Array(_len), _key = 0; _key < _len; _key++) { | ||
functions[_key] = arguments[_key]; | ||
} | ||
return (function () { | ||
functions[0] instanceof Array ? (function () { | ||
functions = functions[0]; | ||
})() : undefined;return function fun_573300145710716007() { | ||
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 fun_573300145710716007(m) { | ||
return (function () { | ||
args = [m.apply(var_573300145710716007_2, args)]; | ||
})(); | ||
});return args[0]; | ||
})(); | ||
}; | ||
})(); | ||
};exports.assert = assert = function fun_573300145710716007(condition, message) { | ||
return (function () { | ||
return !condition ? (function () { | ||
return fail(message); | ||
})() : undefined; | ||
})(); | ||
};exports.spread = spread = function fun_573300145710716007(value, count) { | ||
return (function () { | ||
count === undefined ? (function () { | ||
var _value = value; | ||
var _value2 = _slicedToArray(_value, 2); | ||
value = _value2[0]; | ||
count = _value2[1]; | ||
})() : undefined;return repeat([count, function () { | ||
return (function () { | ||
return value; | ||
})(); | ||
}]); | ||
})(); | ||
};exports.eventField = eventField = function () { | ||
return (function () { | ||
var f;f = function fun_573300145710716007(method, arg) { | ||
var _this2 = this; | ||
return (function () { | ||
method instanceof Array ? (function () { | ||
var _method = method; | ||
var _method2 = _slicedToArray(_method, 2); | ||
method = _method2[0]; | ||
arg = _method2[1]; | ||
})() : undefined;method instanceof Function ? (function () { | ||
arg = method;method = "bind"; | ||
})() : undefined;assert(typeof method === "string");f[method](arg);return _this2; | ||
})(); | ||
};f._listeners = [];f.getListeners = function () { | ||
return (function () { | ||
return f._listeners.clone(); | ||
})(); | ||
};f.bind = function fun_573300145710716007(listener) { | ||
return (function () { | ||
f._listeners.indexOf(listener) < 0 ? (function () { | ||
return f._listeners.push(listener); | ||
})() : undefined;return f; | ||
})(); | ||
};f.unbind = function fun_573300145710716007(listener) { | ||
return (function () { | ||
f._listeners.removeAll(listener);return f; | ||
})(); | ||
};f.unbindAll = function () { | ||
return (function () { | ||
f._listeners = [];return f; | ||
})(); | ||
};f.fire = function fun_573300145710716007(arg) { | ||
return (function () { | ||
f._listeners.every(function fun_573300145710716007(listener) { | ||
return (function () { | ||
return (ok_573300145710716007(arg) ? arg.blocksListeners : undefined) ? (function () { | ||
return false; | ||
})() : (function () { | ||
listener(arg);return true; | ||
})(); | ||
})(); | ||
});return f; | ||
})(); | ||
};return f; | ||
})(); | ||
};exports.sys = sys; | ||
exports.web = web; | ||
exports.es = es; | ||
exports.ea = ea; | ||
exports.repeat = repeat; | ||
exports.feString = feString; | ||
exports.feArray = feArray; | ||
exports.dotDot_573300145710716007 = dotDot_573300145710716007 = function fun_573300145710716007(x) { | ||
return (function () { | ||
return typeof x === "string" ? (function () { | ||
return feString; | ||
})() : (function () { | ||
return x instanceof Array ? (function () { | ||
return feArray; | ||
})() : undefined; | ||
})(); | ||
})(); | ||
};exports.repeat = repeat; | ||
exports.loop = loop; | ||
exports["break"] = var_573300145710716007_0; | ||
exports["enum"] = var_573300145710716007_1; | ||
exports.fail = fail; | ||
exports.fail = fail; | ||
exports.compose = compose; | ||
exports.assert = assert; | ||
exports.spread = spread; | ||
exports.eventField = eventField; | ||
exports.dotDot_573300145710716007 = dotDot_573300145710716007; |
"use strict";Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
value: true | ||
}); | ||
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 deepSplit, stripTrailingNewline, ensureTrailingNewline;exports.deepSplit = deepSplit = function fun_573300145710716007(str, args) { | ||
return (function () { | ||
var arr;arr = str.split(args[0]);return args.length === 2 && typeof args[1] === "number" ? (function () { | ||
return args[1] === 0 ? (function () { | ||
return [arr.join(args[0])]; | ||
})() : (function () { | ||
return args[1] <= arr.length - 2 ? (function () { | ||
return _main.ea.portion(arr, [0, args[1] - 1]).concat([_main.ea.portion(arr, [args[1]]).join(args[0])]); | ||
var dotDotCalc_573300145710716007 = function dotDotCalc_573300145710716007(dotDot, a, b, c) { | ||
var _dotDot; | ||
return (_dotDot = dotDot(a))[b].apply(_dotDot, [a].concat(_toConsumableArray(c))); | ||
};var deepSplit, stripTrailingNewline, ensureTrailingNewline;exports.deepSplit = deepSplit = function fun_573300145710716007(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 arr;args[0] instanceof Array ? (function () { | ||
args = args[0]; | ||
})() : undefined;arr = str.split(args[0]);return args.length === 2 && typeof args[1] === "number" ? (function () { | ||
return args[1] === 0 ? (function () { | ||
return [arr.join(args[0])]; | ||
})() : (function () { | ||
return args[1] <= arr.length - 2 ? (function () { | ||
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 arr; | ||
return args.length <= 1 ? (function () { | ||
return arr; | ||
})() : (function () { | ||
return arr.map(function fun_573300145710716007(s) { | ||
return (function () { | ||
return dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, s, "deepSplit", [dotDotCalc_573300145710716007(_main.dotDot_573300145710716007, args, "portion", [1])]); | ||
})(); | ||
}); | ||
})(); | ||
})(); | ||
})(); | ||
})() : (function () { | ||
return args.length <= 1 ? (function () { | ||
return arr; | ||
})() : (function () { | ||
return arr.map(function fun_573300145710716007(s) { | ||
return (function () { | ||
return deepSplit(s, _main.ea.portion(args, [1])); | ||
})(); | ||
}); | ||
})(); | ||
})(); | ||
})(); | ||
};exports.stripTrailingNewline = stripTrailingNewline = function fun_573300145710716007(str) { | ||
return (function () { | ||
return str[str.length - 2] === "\r" && str[str.length - 1] === "\n" ? (function () { | ||
return str.substr(0, str.length - 2); | ||
})() : (function () { | ||
return str[str.length - 1] === "\n" ? (function () { | ||
return str.substr(0, str.length - 1); | ||
})() : (function () { | ||
return str.valueOf(); | ||
})(); | ||
return (function () { | ||
return str[str.length - 2] === "\r" && str[str.length - 1] === "\n" ? (function () { | ||
return str.substr(0, str.length - 2); | ||
})() : (function () { | ||
return str[str.length - 1] === "\n" ? (function () { | ||
return str.substr(0, str.length - 1); | ||
})() : (function () { | ||
return str.valueOf(); | ||
})(); | ||
})(); | ||
})(); | ||
})(); | ||
};exports.ensureTrailingNewline = ensureTrailingNewline = function fun_573300145710716007(str) { | ||
return (function () { | ||
return str[str.length - 1] !== "\n" ? (function () { | ||
return str.valueOf() + "\n"; | ||
})() : (function () { | ||
return str.valueOf(); | ||
return (function () { | ||
return str[str.length - 1] !== "\n" ? (function () { | ||
return str.valueOf() + "\n"; | ||
})() : (function () { | ||
return str.valueOf(); | ||
})(); | ||
})(); | ||
})(); | ||
};exports.deepSplit = deepSplit; | ||
exports.stripTrailingNewline = stripTrailingNewline; | ||
exports.ensureTrailingNewline = ensureTrailingNewline; |
"use strict";Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
value: true | ||
}); | ||
@@ -7,2 +7,4 @@ | ||
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; } | ||
@@ -13,190 +15,194 @@ | ||
var ok_573300145710716007 = function ok_573300145710716007(a) { | ||
return a !== undefined && a !== null; | ||
return a !== undefined && a !== null; | ||
};var ifnull_573300145710716007 = function ifnull_573300145710716007(a, b) { | ||
return a === undefined || a === null ? b : a; | ||
return a === undefined || a === null ? b : a; | ||
};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 fun_573300145710716007(options) { | ||
return (function () { | ||
return new Promise(function fun_573300145710716007(resolve, reject) { | ||
return (function () { | ||
var method, uri, headerFields, body, timeout, responseBodyType, ex;return (function () { | ||
try { | ||
return (function () { | ||
return new Promise(function fun_573300145710716007(resolve, reject) { | ||
return (function () { | ||
method = options.method;uri = options.uri;headerFields = ifnull_573300145710716007(options.headerFields, null);body = ifnull_573300145710716007(options.body, null);timeout = ifnull_573300145710716007(options.timeout, null);responseBodyType = ifnull_573300145710716007(options.responseBodyType, "text");!ok_573300145710716007(method) ? (function () { | ||
return (0, _main.fail)(); | ||
})() : undefined;!ok_573300145710716007(uri) ? (function () { | ||
return (0, _main.fail)(); | ||
})() : undefined;ok_573300145710716007(body) && typeof body !== "string" && !(body instanceof Uint8Array) ? (function () { | ||
return (0, _main.fail)(); | ||
})() : undefined;["binary", "text", "json"].indexOf(responseBodyType) < 0 ? (function () { | ||
return (0, _main.fail)(); | ||
})() : undefined;return !_main.sys.isNode ? (function () { | ||
return (function () { | ||
return (function () { | ||
var xhr;xhr = new XMLHttpRequest();xhr.open(method, uri);ok_573300145710716007(headerFields) ? (function () { | ||
return Object.forEach(headerFields, function fun_573300145710716007(key, value) { | ||
var method, uri, headerFields, body, timeout, responseBodyType, ex;return (function () { | ||
try { | ||
return (function () { | ||
return xhr.setRequestHeader(key, value); | ||
})(); | ||
}); | ||
})() : undefined;xhr.responseType = responseBodyType === "binary" ? (function () { | ||
return "arraybuffer"; | ||
})() : (function () { | ||
return responseBodyType === "text" ? (function () { | ||
return "text"; | ||
})() : (function () { | ||
return responseBodyType === "json" ? (function () { | ||
return "text"; | ||
})() : undefined; | ||
})(); | ||
})();xhr.timeout = ifnull_573300145710716007(timeout, 0);xhr.onload = function fun_573300145710716007() { | ||
var arg_573300145710716007 = arguments;return (function () { | ||
var response;response = { statusCode: xhr.status, statusReason: xhr.statusText, headerFields: _main.ea.toObject(_main.es.deepSplit(_main.es.stripTrailingNewline(xhr.getAllResponseHeaders()), ["\r\n", ": ", 1]).map(function fun_573300145710716007(field) { | ||
return (function () { | ||
return [field[0].toLowerCase(), field[1]]; | ||
})(); | ||
})), body: responseBodyType === "binary" ? (function () { | ||
return new Uint8Array(xhr.response); | ||
})() : (function () { | ||
return responseBodyType === "text" ? (function () { | ||
return xhr.response; | ||
method = options.method;uri = options.uri;headerFields = ifnull_573300145710716007(options.headerFields, null);body = ifnull_573300145710716007(options.body, null);timeout = ifnull_573300145710716007(options.timeout, null);responseBodyType = ifnull_573300145710716007(options.responseBodyType, "text");!ok_573300145710716007(method) ? (function () { | ||
return (0, _main.fail)(); | ||
})() : undefined;!ok_573300145710716007(uri) ? (function () { | ||
return (0, _main.fail)(); | ||
})() : undefined;ok_573300145710716007(body) && typeof body !== "string" && !(body instanceof Uint8Array) ? (function () { | ||
return (0, _main.fail)(); | ||
})() : undefined;["binary", "text", "json"].indexOf(responseBodyType) < 0 ? (function () { | ||
return (0, _main.fail)(); | ||
})() : undefined;return !_main.sys.isNode ? (function () { | ||
return (function () { | ||
return (function () { | ||
var xhr;xhr = new XMLHttpRequest();xhr.open(method, uri);ok_573300145710716007(headerFields) ? (function () { | ||
return Object.forEach(headerFields, function fun_573300145710716007(key, value) { | ||
return (function () { | ||
return xhr.setRequestHeader(key, value); | ||
})(); | ||
}); | ||
})() : undefined;xhr.responseType = responseBodyType === "binary" ? (function () { | ||
return "arraybuffer"; | ||
})() : (function () { | ||
return responseBodyType === "text" ? (function () { | ||
return "text"; | ||
})() : (function () { | ||
return responseBodyType === "json" ? (function () { | ||
return "text"; | ||
})() : undefined; | ||
})(); | ||
})();xhr.timeout = ifnull_573300145710716007(timeout, 0);xhr.onload = function fun_573300145710716007() { | ||
var arg_573300145710716007 = arguments;return (function () { | ||
var response;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", []), "deepSplit", [["\r\n", ": ", 1]]).map(function fun_573300145710716007(field) { | ||
return (function () { | ||
return [field[0].toLowerCase(), field[1]]; | ||
})(); | ||
}), "toObject", []), body: responseBodyType === "binary" ? (function () { | ||
return new Uint8Array(xhr.response); | ||
})() : (function () { | ||
return responseBodyType === "text" ? (function () { | ||
return xhr.response; | ||
})() : (function () { | ||
return responseBodyType === "json" ? (function () { | ||
return JSON.parse(xhr.response); | ||
})() : undefined; | ||
})(); | ||
})() };return 200 <= response.statusCode && response.statusCode < 300 ? (function () { | ||
return resolve(response); | ||
})() : (function () { | ||
return reject(response); | ||
})(); | ||
})(); | ||
};xhr.onerror = function fun_573300145710716007() { | ||
var arg_573300145710716007 = arguments;return (function () { | ||
return reject(new Error()); | ||
})(); | ||
};xhr.ontimeout = function fun_573300145710716007() { | ||
var arg_573300145710716007 = arguments;return (function () { | ||
return reject(new Error("timeout")); | ||
})(); | ||
};return xhr.send(body); | ||
})(); | ||
})(); | ||
})() : (function () { | ||
return responseBodyType === "json" ? (function () { | ||
return JSON.parse(xhr.response); | ||
})() : undefined; | ||
})(); | ||
})() };return 200 <= response.statusCode && response.statusCode < 300 ? (function () { | ||
return resolve(response); | ||
})() : (function () { | ||
return reject(response); | ||
})(); | ||
})(); | ||
};xhr.onerror = function fun_573300145710716007() { | ||
var arg_573300145710716007 = arguments;return (function () { | ||
return reject(new Error()); | ||
})(); | ||
};xhr.ontimeout = function fun_573300145710716007() { | ||
var arg_573300145710716007 = arguments;return (function () { | ||
return reject(new Error("timeout")); | ||
})(); | ||
};return xhr.send(body); | ||
})(); | ||
})(); | ||
})() : (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 fun_573300145710716007(rawResponse) { | ||
return (function () { | ||
var data;data = new Buffer(0);rawResponse.on("data", function fun_573300145710716007(chunk) { | ||
return (function () { | ||
data = Buffer.concat([data, chunk]); | ||
})(); | ||
});return rawResponse.on("end", function fun_573300145710716007() { | ||
var arg_573300145710716007 = arguments;return (function () { | ||
var response;response = { statusCode: rawResponse.statusCode, statusReason: rawResponse.statusMessage, headerFields: rawResponse.headers, body: responseBodyType === "binary" ? (function () { | ||
return new Uint8Array(data); | ||
})() : (function () { | ||
return responseBodyType === "text" ? (function () { | ||
return data.toString(); | ||
})() : (function () { | ||
return responseBodyType === "json" ? (function () { | ||
return JSON.parse(data.toString()); | ||
})() : undefined; | ||
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 fun_573300145710716007(rawResponse) { | ||
return (function () { | ||
var data;data = new Buffer(0);rawResponse.on("data", function fun_573300145710716007(chunk) { | ||
return (function () { | ||
data = Buffer.concat([data, chunk]); | ||
})(); | ||
});return rawResponse.on("end", function fun_573300145710716007() { | ||
var arg_573300145710716007 = arguments;return (function () { | ||
var response;response = { statusCode: rawResponse.statusCode, statusReason: rawResponse.statusMessage, headerFields: rawResponse.headers, body: responseBodyType === "binary" ? (function () { | ||
return new Uint8Array(data); | ||
})() : (function () { | ||
return responseBodyType === "text" ? (function () { | ||
return data.toString(); | ||
})() : (function () { | ||
return responseBodyType === "json" ? (function () { | ||
return JSON.parse(data.toString()); | ||
})() : undefined; | ||
})(); | ||
})() };return 200 <= response.statusCode && response.statusCode < 300 ? (function () { | ||
return resolve(response); | ||
})() : (function () { | ||
return reject(response); | ||
})(); | ||
})(); | ||
}); | ||
})(); | ||
});ok_573300145710716007(timeout) ? (function () { | ||
return rawRequest.setTimeout(timeout, function fun_573300145710716007() { | ||
var arg_573300145710716007 = arguments;return (function () { | ||
rawRequest.abort();return reject(new Error("timeout")); | ||
})(); | ||
}); | ||
})() : undefined;return rawRequest.on("error", function fun_573300145710716007(e) { | ||
return (function () { | ||
return reject(new Error()); | ||
})(); | ||
}).end(body instanceof Uint8Array ? (function () { | ||
return new Buffer(body); | ||
})() : (function () { | ||
return body; | ||
})()); | ||
})(); | ||
})(); | ||
})() };return 200 <= response.statusCode && response.statusCode < 300 ? (function () { | ||
return resolve(response); | ||
})() : (function () { | ||
return reject(response); | ||
})(); | ||
})(); | ||
}); | ||
})(); | ||
});ok_573300145710716007(timeout) ? (function () { | ||
return rawRequest.setTimeout(timeout, function fun_573300145710716007() { | ||
var arg_573300145710716007 = arguments;return (function () { | ||
rawRequest.abort();return reject(new Error("timeout")); | ||
})(); | ||
}); | ||
})() : undefined;return rawRequest.on("error", function fun_573300145710716007(e) { | ||
return (function () { | ||
return reject(new Error()); | ||
})(); | ||
}).end(body instanceof Uint8Array ? (function () { | ||
return new Buffer(body); | ||
})() : (function () { | ||
return body; | ||
})()); | ||
})(); | ||
} catch (catch_573300145710716007) { | ||
ex = catch_573300145710716007;return (function () { | ||
return reject(ex); | ||
})(); | ||
} finally {} | ||
})(); | ||
})(); | ||
})(); | ||
} catch (catch_573300145710716007) { | ||
ex = catch_573300145710716007;return (function () { | ||
return reject(ex); | ||
})(); | ||
} finally {} | ||
})(); | ||
})(); | ||
}); | ||
})(); | ||
}); | ||
})(); | ||
};exports.get = get = function fun_573300145710716007(uri, options) { | ||
return (function () { | ||
var actualOptions;uri instanceof Array ? (function () { | ||
var _uri = uri; | ||
return (function () { | ||
var actualOptions;uri instanceof Array ? (function () { | ||
var _uri = uri; | ||
var _uri2 = _slicedToArray(_uri, 2); | ||
var _uri2 = _slicedToArray(_uri, 2); | ||
uri = _uri2[0]; | ||
options = _uri2[1]; | ||
})() : undefined;actualOptions = { method: "GET", uri: uri };Object.assign(actualOptions, options);return _main.web.request(actualOptions); | ||
})(); | ||
uri = _uri2[0]; | ||
options = _uri2[1]; | ||
})() : undefined;actualOptions = { method: "GET", uri: uri };Object.assign(actualOptions, options);return _main.web.request(actualOptions); | ||
})(); | ||
};exports.jsonGet = jsonGet = function fun_573300145710716007(uri, options) { | ||
return (function () { | ||
var actualOptions;uri instanceof Array ? (function () { | ||
var _uri3 = uri; | ||
return (function () { | ||
var actualOptions;uri instanceof Array ? (function () { | ||
var _uri3 = uri; | ||
var _uri32 = _slicedToArray(_uri3, 2); | ||
var _uri32 = _slicedToArray(_uri3, 2); | ||
uri = _uri32[0]; | ||
options = _uri32[1]; | ||
})() : undefined;actualOptions = { method: "GET", uri: uri, responseBodyType: "json" };Object.assign(actualOptions, options);return _main.web.request(actualOptions); | ||
})(); | ||
uri = _uri32[0]; | ||
options = _uri32[1]; | ||
})() : undefined;actualOptions = { method: "GET", uri: uri, responseBodyType: "json" };Object.assign(actualOptions, options);return _main.web.request(actualOptions); | ||
})(); | ||
};exports.binaryGet = binaryGet = function fun_573300145710716007(uri, options) { | ||
return (function () { | ||
var actualOptions;uri instanceof Array ? (function () { | ||
var _uri4 = uri; | ||
return (function () { | ||
var actualOptions;uri instanceof Array ? (function () { | ||
var _uri4 = uri; | ||
var _uri42 = _slicedToArray(_uri4, 2); | ||
var _uri42 = _slicedToArray(_uri4, 2); | ||
uri = _uri42[0]; | ||
options = _uri42[1]; | ||
})() : undefined;actualOptions = { method: "GET", uri: uri, responseBodyType: "binary" };Object.assign(actualOptions, options);return _main.web.request(actualOptions); | ||
})(); | ||
uri = _uri42[0]; | ||
options = _uri42[1]; | ||
})() : undefined;actualOptions = { method: "GET", uri: uri, responseBodyType: "binary" };Object.assign(actualOptions, options);return _main.web.request(actualOptions); | ||
})(); | ||
};exports.post = post = function fun_573300145710716007(uri, body, options) { | ||
return (function () { | ||
var actualOptions;uri instanceof Array ? (function () { | ||
var _uri5 = uri; | ||
return (function () { | ||
var actualOptions;uri instanceof Array ? (function () { | ||
var _uri5 = uri; | ||
var _uri52 = _slicedToArray(_uri5, 3); | ||
var _uri52 = _slicedToArray(_uri5, 3); | ||
uri = _uri52[0]; | ||
body = _uri52[1]; | ||
options = _uri52[2]; | ||
})() : undefined;actualOptions = { method: "POST", uri: uri, body: body };Object.assign(actualOptions, options);return _main.web.request(actualOptions); | ||
})(); | ||
uri = _uri52[0]; | ||
body = _uri52[1]; | ||
options = _uri52[2]; | ||
})() : undefined;actualOptions = { method: "POST", uri: uri, body: body };Object.assign(actualOptions, options);return _main.web.request(actualOptions); | ||
})(); | ||
};exports.jsonPost = jsonPost = function fun_573300145710716007(uri, body, options) { | ||
return (function () { | ||
var actualOptions;uri instanceof Array ? (function () { | ||
var _uri6 = uri; | ||
return (function () { | ||
var actualOptions;uri instanceof Array ? (function () { | ||
var _uri6 = uri; | ||
var _uri62 = _slicedToArray(_uri6, 3); | ||
var _uri62 = _slicedToArray(_uri6, 3); | ||
uri = _uri62[0]; | ||
body = _uri62[1]; | ||
options = _uri62[2]; | ||
})() : undefined;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); | ||
})(); | ||
uri = _uri62[0]; | ||
body = _uri62[1]; | ||
options = _uri62[2]; | ||
})() : undefined;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); | ||
})(); | ||
};exports.request = request; | ||
@@ -203,0 +209,0 @@ exports.get = get; |
"use strict"; | ||
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
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 _manifest = require("./manifest"); | ||
@@ -10,36 +18,209 @@ | ||
(0, _manifest.repeat)([5, function fun_573300145710716007() { | ||
var arg_573300145710716007 = arguments;return (function () { | ||
return console.log("haha"); | ||
})(); | ||
}]);(0, _manifest.repeat)([5, function fun_573300145710716007(i) { | ||
return (function () { | ||
return console.log(i); | ||
})(); | ||
}]);(0, _manifest.repeat)([10, function fun_573300145710716007(i) { | ||
return (function () { | ||
console.log("still here");return i > 5 ? (function () { | ||
return _manifest["break"]; | ||
})() : undefined; | ||
})(); | ||
}]);(0, _manifest.repeat)({ from: 1, to: 5, "for": function fun_573300145710716007(i) { | ||
var dotDotCalc_573300145710716007 = function dotDotCalc_573300145710716007(dotDot, a, b, c) { | ||
var _dotDot; | ||
return (_dotDot = dotDot(a))[b].apply(_dotDot, [a].concat(_toConsumableArray(c))); | ||
};describe("loop", function () { | ||
return (function () { | ||
return console.log("third " + i + ""); | ||
it("array: number, diamond function", function () { | ||
return (function () { | ||
var r, ret;r = [];ret = (0, _manifest.loop)([5, function fun_573300145710716007() { | ||
var arg_573300145710716007 = arguments;return (function () { | ||
return r.push(1); | ||
})(); | ||
}]);_assert2["default"].deepStrictEqual(r, [1, 1, 1, 1, 1]);return _assert2["default"].strictEqual(ret, undefined); | ||
})(); | ||
});it("array: number, arrow function", function () { | ||
return (function () { | ||
var r;r = [];(0, _manifest.loop)([5, function fun_573300145710716007(i) { | ||
return (function () { | ||
return r.push(i); | ||
})(); | ||
}]);return _assert2["default"].deepStrictEqual(r, [0, 1, 2, 3, 4]); | ||
})(); | ||
});it("object: by 2 with break", function () { | ||
return (function () { | ||
var _loop; | ||
var r;r = [];(0, _manifest.loop)((_loop = {}, _defineProperty(_loop, "", 1), _defineProperty(_loop, "by", 2), _defineProperty(_loop, "for", function fun_573300145710716007(i) { | ||
return (function () { | ||
r.push(i);return i > 9 ? (function () { | ||
return _manifest["break"]; | ||
})() : undefined; | ||
})(); | ||
}), _loop));return _assert2["default"].deepStrictEqual(r, [1, 3, 5, 7, 9, 11]); | ||
})(); | ||
});it("array: number, arrow function with break", function () { | ||
return (function () { | ||
var r;r = [];(0, _manifest.loop)([10, function fun_573300145710716007(i) { | ||
return (function () { | ||
r.push(i);return i > 5 ? (function () { | ||
return _manifest["break"]; | ||
})() : undefined; | ||
})(); | ||
}]);return _assert2["default"].deepStrictEqual(r, [0, 1, 2, 3, 4, 5, 6]); | ||
})(); | ||
});it("object: canonical", function () { | ||
return (function () { | ||
var r;r = [];(0, _manifest.loop)({ from: 1, to: 5, "for": function fun_573300145710716007(i) { | ||
return (function () { | ||
return r.push(i); | ||
})(); | ||
} });return _assert2["default"].deepStrictEqual(r, [1, 2, 3, 4, 5]); | ||
})(); | ||
});it("object: normal", function () { | ||
return (function () { | ||
var _loop2; | ||
var r;r = [];(0, _manifest.loop)((_loop2 = {}, _defineProperty(_loop2, "", 1), _defineProperty(_loop2, "to", 5), _defineProperty(_loop2, "for", function fun_573300145710716007(i) { | ||
return (function () { | ||
return r.push(i); | ||
})(); | ||
}), _loop2));return _assert2["default"].deepStrictEqual(r, [1, 2, 3, 4, 5]); | ||
})(); | ||
});it("object: by -1", function () { | ||
return (function () { | ||
var _loop3; | ||
var r;r = [];(0, _manifest.loop)((_loop3 = {}, _defineProperty(_loop3, "", 5), _defineProperty(_loop3, "to", 1), _defineProperty(_loop3, "by", -1), _defineProperty(_loop3, "for", function fun_573300145710716007(i) { | ||
return (function () { | ||
return r.push(i); | ||
})(); | ||
}), _loop3));return _assert2["default"].deepStrictEqual(r, [5, 4, 3, 2, 1]); | ||
})(); | ||
});return it("function: with break", function () { | ||
return (function () { | ||
var r;r = [];(0, _manifest.loop)(function fun_573300145710716007(i) { | ||
return (function () { | ||
r.push(i);return i > 3 ? (function () { | ||
return _manifest["break"]; | ||
})() : undefined; | ||
})(); | ||
});return _assert2["default"].deepStrictEqual(r, [0, 1, 2, 3, 4]); | ||
})(); | ||
}); | ||
})(); | ||
} });(0, _manifest.repeat)({ from: 5, to: 1, by: -1, "for": function fun_573300145710716007(i) { | ||
});describe("repeat", function () { | ||
return (function () { | ||
return console.log("fourth " + i + ""); | ||
return it("repeat", function () { | ||
return (function () { | ||
var _repeat, _repeat2; | ||
_assert2["default"].deepStrictEqual((0, _manifest.repeat)([5, function fun_573300145710716007(i) { | ||
return (function () { | ||
return i + 2; | ||
})(); | ||
}]), [2, 3, 4, 5, 6]);_assert2["default"].deepStrictEqual((0, _manifest.repeat)(5, function fun_573300145710716007(i) { | ||
return (function () { | ||
return i + 2; | ||
})(); | ||
}), [2, 3, 4, 5, 6]);_assert2["default"].deepStrictEqual((0, _manifest.repeat)([5]), [0, 1, 2, 3, 4]);_assert2["default"].deepStrictEqual((0, _manifest.repeat)(5), [0, 1, 2, 3, 4]);_assert2["default"].deepStrictEqual((0, _manifest.repeat)((_repeat = {}, _defineProperty(_repeat, "", 1), _defineProperty(_repeat, "to", 10), _defineProperty(_repeat, "by", 2), _repeat)), [1, 3, 5, 7, 9]);return _assert2["default"].deepStrictEqual((0, _manifest.repeat)((_repeat2 = {}, _defineProperty(_repeat2, "", 1), _defineProperty(_repeat2, "by", 2), _defineProperty(_repeat2, "for", function fun_573300145710716007(i) { | ||
return (function () { | ||
return i > 9 ? (function () { | ||
return _manifest["break"]; | ||
})() : (function () { | ||
return i; | ||
})(); | ||
})(); | ||
}), _repeat2)), [1, 3, 5, 7, 9]); | ||
})(); | ||
}); | ||
})(); | ||
} });(0, _manifest.repeat)(function fun_573300145710716007(i) { | ||
return (function () { | ||
console.log("fifth " + i + "");return i > 3 ? (function () { | ||
return _manifest["break"]; | ||
})() : undefined; | ||
})(); | ||
});(0, _manifest.repeat)({ from: 1, by: 2, "for": function fun_573300145710716007(i) { | ||
});describe("enum", function () { | ||
return (function () { | ||
console.log("sixth " + i + "");return i > 9 ? (function () { | ||
return _manifest["break"]; | ||
})() : undefined; | ||
return it("enum", function () { | ||
return (function () { | ||
_assert2["default"].deepStrictEqual((0, _manifest["enum"])({ a: true }), { a: 0 });return _assert2["default"].deepStrictEqual((0, _manifest["enum"])({ a: true, b: true }), { a: 0, b: 1 }); | ||
})(); | ||
}); | ||
})(); | ||
} }); | ||
});describe("compose", function () { | ||
return (function () { | ||
it("multiple arguments", function () { | ||
return (function () { | ||
var a;a = (0, _manifest.compose)(Math.min, Math.abs);return _assert2["default"].strictEqual(a(-2, -3), 3); | ||
})(); | ||
});return it("array argument", function () { | ||
return (function () { | ||
var a;a = (0, _manifest.compose)([Math.min, Math.abs]);return _assert2["default"].strictEqual(a(-2, -3), 3); | ||
})(); | ||
}); | ||
})(); | ||
});describe("spread", function () { | ||
return (function () { | ||
return it("spread", function () { | ||
return (function () { | ||
_assert2["default"].deepStrictEqual((0, _manifest.spread)(0, 3), [0, 0, 0]);return _assert2["default"].deepStrictEqual((0, _manifest.spread)([0, 3]), [0, 0, 0]); | ||
})(); | ||
}); | ||
})(); | ||
});describe("eventField", function () { | ||
return (function () { | ||
return it("eventField", function () { | ||
return (function () { | ||
var r, Obj, obj;r = null;Obj = (function () { | ||
var class_573300145710716007 = (function () { | ||
function class_573300145710716007() { | ||
var _this = this; | ||
_classCallCheck(this, class_573300145710716007); | ||
(function () { | ||
return (function () { | ||
_this.onClick = (0, _manifest.eventField)(); | ||
})(); | ||
})(); | ||
} | ||
_createClass(class_573300145710716007, [{ | ||
key: "makeClick", | ||
value: function makeClick() { | ||
var _this2 = this; | ||
return (function () { | ||
return (function () { | ||
return _this2.onClick.fire(); | ||
})(); | ||
})(); | ||
} | ||
}]); | ||
return class_573300145710716007; | ||
})();return class_573300145710716007; | ||
})();obj = new Obj();obj.onClick(function () { | ||
return (function () { | ||
r = true; | ||
})(); | ||
});obj.makeClick();return _assert2["default"].strictEqual(r, true); | ||
})(); | ||
}); | ||
})(); | ||
});describe("string", function () { | ||
return (function () { | ||
it("deepSplit", function () { | ||
return (function () { | ||
_assert2["default"].deepStrictEqual(dotDotCalc_573300145710716007(_manifest.dotDot_573300145710716007, "a:b,c:d", "deepSplit", [",", ":"]), [["a", "b"], ["c", "d"]]);return _assert2["default"].deepStrictEqual(dotDotCalc_573300145710716007(_manifest.dotDot_573300145710716007, "a:b,c:d", "deepSplit", [[",", ":"]]), [["a", "b"], ["c", "d"]]); | ||
})(); | ||
});it("stripTrailingNewline", function () { | ||
return (function () { | ||
_assert2["default"].strictEqual(dotDotCalc_573300145710716007(_manifest.dotDot_573300145710716007, "a\nb\n", "stripTrailingNewline", []), "a\nb");return _assert2["default"].strictEqual(dotDotCalc_573300145710716007(_manifest.dotDot_573300145710716007, "a\nb", "stripTrailingNewline", []), "a\nb"); | ||
})(); | ||
});return it("ensureTrailingNewline", function () { | ||
return (function () { | ||
_assert2["default"].strictEqual(dotDotCalc_573300145710716007(_manifest.dotDot_573300145710716007, "a\nb\n", "ensureTrailingNewline", []), "a\nb\n");return _assert2["default"].strictEqual(dotDotCalc_573300145710716007(_manifest.dotDot_573300145710716007, "a\nb", "ensureTrailingNewline", []), "a\nb\n"); | ||
})(); | ||
}); | ||
})(); | ||
});describe("array", function () { | ||
return (function () { | ||
it("portion", function () { | ||
return (function () { | ||
_assert2["default"].deepStrictEqual(dotDotCalc_573300145710716007(_manifest.dotDot_573300145710716007, [1, 2, 3, 4, 5, 6], "portion", [2, 3]), [3, 4, 5]);_assert2["default"].deepStrictEqual(dotDotCalc_573300145710716007(_manifest.dotDot_573300145710716007, [1, 2, 3, 4, 5, 6], "portion", [[2, 3]]), [3, 4, 5]);_assert2["default"].deepStrictEqual(dotDotCalc_573300145710716007(_manifest.dotDot_573300145710716007, [1, 2, 3, 4, 5, 6], "portion", [2, undefined, 3]), [3, 4]);_assert2["default"].deepStrictEqual(dotDotCalc_573300145710716007(_manifest.dotDot_573300145710716007, [1, 2, 3, 4, 5, 6], "portion", [[2, undefined, 3]]), [3, 4]);_assert2["default"].deepStrictEqual(dotDotCalc_573300145710716007(_manifest.dotDot_573300145710716007, [1, 2, 3, 4, 5, 6], "portion", [2]), [3, 4, 5, 6]);return _assert2["default"].deepStrictEqual(dotDotCalc_573300145710716007(_manifest.dotDot_573300145710716007, [1, 2, 3, 4, 5, 6], "portion", [[2]]), [3, 4, 5, 6]); | ||
})(); | ||
});return it("toObject", function () { | ||
return (function () { | ||
return _assert2["default"].deepStrictEqual(dotDotCalc_573300145710716007(_manifest.dotDot_573300145710716007, [["a", 1], ["b", 2]], "toObject", []), { a: 1, b: 2 }); | ||
})(); | ||
}); | ||
})(); | ||
}); |
@@ -7,10 +7,16 @@ "use strict";Object.defineProperty(exports, "__esModule", { | ||
var global;exports.repeat = _targetMain.repeat; | ||
var global;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.sys = _targetMain.sys; | ||
exports.web = _targetMain.web; | ||
exports.es = _targetMain.es; | ||
exports.ea = _targetMain.ea; | ||
exports.feString = _targetMain.feString; | ||
exports.feArray = _targetMain.feArray; | ||
exports.dotDot_573300145710716007 = _targetMain.dotDot_573300145710716007; | ||
exports.global = global = _targetMain.sys.global;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 not supported yet
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 not supported yet
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
70388
23
754
1
234