Beispiel #1
0
T.property = function (type) {
    if (!T.Type.is(type)) {
        throw new TypeError('Incorrect `type` argument supplied to `property` combinator');
    }

    var Property = function (property) { return T.Property(property).map(type); };

    Property.meta = { kind: 'property', type: type };

    Property.is = function (x) {
      return T.Property.is(x) && x.type === type;
    };

    return Property;
};
Beispiel #2
0
T.promise = function (type) {
    if (!T.Type.is(type)) {
        throw new TypeError('Incorrect `type` argument supplied to `promise` combinator');
    }

    var Promise = function (promise) { return T.Promise(promise).then(type); };

    Promise.meta = { kind: 'promise', type: type };

    Promise.is = function (x) {
      return T.Promise.is(x) && x.type === type;
    };

    return Promise;
};
Beispiel #3
0
T.stream = function (type) {
    if (!T.Type.is(type)) {
        throw new TypeError('Incorrect `type` argument supplied to `stream` combinator');
    }

    var Stream = function (stream) { return T.Stream(stream).map(type); };

    Stream.meta = { kind: 'stream', type: type };

    Stream.is = function (x) {
      return T.Stream.is(x) && x.type === type;
    };

    return Stream;
};