all files / src/ fetcherUtils.js

100% Statements 15/15
100% Branches 4/4
100% Functions 3/3
100% Lines 15/15
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29  26×   26× 14×     12×             26× 26× 59× 59×        
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function isSubscriber(object) {
    return typeof object !== 'function';
}
function toSubscriber(nextOrSubscriber, error, complete) {
    if (isSubscriber(nextOrSubscriber)) {
        return nextOrSubscriber;
    }
    else {
        return {
            next: nextOrSubscriber,
            error: error,
            complete: complete,
        };
    }
}
exports.toSubscriber = toSubscriber;
function validateOperation(operation) {
    var OPERATION_FIELDS = ['query', 'operationName', 'variables', 'context'];
    for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
        var key = _a[_i];
        if (OPERATION_FIELDS.indexOf(key) < 0) {
            throw new Error("illegal argument: " + key);
        }
    }
}
exports.validateOperation = validateOperation;
//# sourceMappingURL=fetcherUtils.js.map