UNPKG

mezzanine

Version:

Fantasy land union types with pattern matching

21 lines (17 loc) 848 B
import './type-container'; export var isObject = obj => typeof obj === 'object' && obj !== null; export var isMezzanine = obj => (typeof obj === 'function' || isObject(obj)) && obj.ಠ_ಠ !== undefined; export function toJSON(ctx) {var _repeat = true;var _ctx;while (_repeat) {_repeat = false; if (!isMezzanine(ctx)) return ctx; if (ctx.isMono) {_ctx = ctx.value;ctx = _ctx;_repeat = true;continue;} var _result = {}; for (var _iterator = ctx, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {var _ref;if (_isArray) {if (_i >= _iterator.length) break;_ref = _iterator[_i++];} else {_i = _iterator.next();if (_i.done) break;_ref = _i.value;}var [key, value] = _ref; _result[key] = toJSON(value);} return _result; }} //# sourceMappingURL=fixtures.js.map