made with esnextbin
Last active
March 6, 2017 01:06
-
-
Save TylorS/df206929987390458d139e74f5becd47 to your computer and use it in GitHub Desktop.
esnextbin sketch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>ESNextbin Sketch</title> | |
<!-- put additional styles and scripts here --> | |
</head> | |
<body> | |
<!-- put markup and other contents here --> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function assert(assertion) { | |
return await assertion.verify(Promise.reject, Promise.resolve) | |
} | |
function pass(value) { | |
return new Pass(value); | |
} | |
class Pass { | |
constructor(actual) { | |
this.actual = actual; | |
} | |
verify(failure, success) { | |
return success(this.actual) | |
} | |
} | |
const x = assert(pass(1)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "esnextbin-sketch", | |
"version": "0.0.0", | |
"dependencies": { | |
"babel-runtime": "6.23.0" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck"); | |
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | |
var _createClass2 = require("babel-runtime/helpers/createClass"); | |
var _createClass3 = _interopRequireDefault(_createClass2); | |
var _regenerator = require("babel-runtime/regenerator"); | |
var _regenerator2 = _interopRequireDefault(_regenerator); | |
var _promise = require("babel-runtime/core-js/promise"); | |
var _promise2 = _interopRequireDefault(_promise); | |
var _asyncToGenerator2 = require("babel-runtime/helpers/asyncToGenerator"); | |
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2); | |
var assert = function () { | |
var ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(assertion) { | |
return _regenerator2.default.wrap(function _callee$(_context) { | |
while (1) { | |
switch (_context.prev = _context.next) { | |
case 0: | |
_context.next = 2; | |
return assertion.verify(_promise2.default.reject, _promise2.default.resolve); | |
case 2: | |
return _context.abrupt("return", _context.sent); | |
case 3: | |
case "end": | |
return _context.stop(); | |
} | |
} | |
}, _callee, this); | |
})); | |
return function assert(_x) { | |
return ref.apply(this, arguments); | |
}; | |
}(); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
function pass(value) { | |
return new Pass(value); | |
} | |
var Pass = function () { | |
function Pass(actual) { | |
(0, _classCallCheck3.default)(this, Pass); | |
this.actual = actual; | |
} | |
(0, _createClass3.default)(Pass, [{ | |
key: "verify", | |
value: function verify(failure, success) { | |
return success(this.actual); | |
} | |
}]); | |
return Pass; | |
}(); | |
var x = assert(pass(1)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment