mezzanine
Version:
Fantasy land union types with pattern matching
21 lines (10 loc) • 1.02 kB
JavaScript
;Object.defineProperty(exports, "__esModule", { value: true });exports.isMezzanine = exports.isObject = undefined;exports.
toJSON = toJSON;require('./type-container');var isObject = exports.isObject = obj => typeof obj === 'object' && obj !== null;var isMezzanine = exports.isMezzanine = obj => (typeof obj === 'function' || isObject(obj)) && obj.ಠ_ಠ !== undefined;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