UNPKG
tcomb
Version:
latest (3.2.29)
3.2.29
3.2.28
3.2.27
3.2.26
3.2.25
3.2.24
3.2.23
3.2.22
3.2.21
3.2.20
3.2.19
3.2.18
3.2.17
3.2.16
3.2.15
3.2.14
3.2.13
3.2.12
3.2.11
3.2.10
3.2.9
3.2.8
3.2.7
3.2.6
3.2.5
3.2.4
3.2.3
3.2.2
3.2.1
3.2.0
3.1.0
3.0.0
2.7.0
2.6.0
2.5.2
2.5.1
2.5.0
2.4.1
2.4.0
2.3.0
2.2.1
2.2.0
2.1.0
2.0.1
2.0.0
2.0.0-beta
1.1.0
1.0.3
1.0.2
1.0.1
1.0.0
0.4.0
0.3.6
0.3.5
0.3.4
0.3.3
0.3.2
0.3.1
0.3.0
0.2.1
0.2.0
0.1.0
0.0.12
0.0.11
0.0.10
0.0.9
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1
Type checking and DDD for JavaScript
github.com/gcanti/tcomb
gcanti/tcomb
tcomb
/
lib
/
is.js
10 lines
(8 loc)
•
237 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
var
isType =
require
(
'./isType'
);
// returns true if x is an instance of type
module
.
exports
=
function
is
(
x,
type
) {
if
(
isType
(
type
)) {
return
type
.
is
(x); }
return
x
instanceof
type
;
// type should be a class constructor
};