-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
39 lines (38 loc) · 1.08 KB
/
index.js
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
30
31
32
33
34
35
36
37
38
39
function patchTypeFilter(Rx) {
Rx.Observable.prototype.isTruthty = function () {
return this.filter(function (x) {
return !!x === true;
});
};
Rx.Observable.prototype.isFalsey = function () {
return this.filter(function (x) {
return !!x === false;
});
};
Rx.Observable.prototype.isDefined = function () {
return this.filter(function (x) {
return x !== undefined;
});
};
Rx.Observable.prototype.isNull = function () {
return this.filter(function (x) {
return x === null;
});
};
Rx.Observable.prototype.isUndefined = function () {
return this.filter(function (x) {
return x === undefined;
});
};
Rx.Observable.prototype.isString = function () {
return this.filter(function (x) {
return typeof x === 'string' || x instanceof String;
});
};
}
module.exports = function (Rx, options) {
options = options || {};
if (options.all || options.typeFilter) {
patchTypeFilter(Rx);
}
};