1 | # ee-types
|
2 |
|
3 | Reliabale type detection
|
4 |
|
5 | ## installation
|
6 |
|
7 | npm install ee-types
|
8 |
|
9 | ## usage
|
10 |
|
11 |
|
12 | var type = require( "ee-types" );
|
13 |
|
14 |
|
15 | type.string( "nope" ); // true
|
16 | type.strign( new String( "yeah" ) ); // true
|
17 | type.s( "michael" ); // true
|
18 |
|
19 |
|
20 | type( 2 ) // number
|
21 |
|
22 |
|
23 | ## API
|
24 |
|
25 | type() // returns the loawercase type
|
26 |
|
27 | type.string()
|
28 | type.number()
|
29 | type.boolean()
|
30 | type.function()
|
31 | type.object() // array, dates, erors, regexps & sometimes strings, numbers and bools are objects
|
32 | type.date()
|
33 | type.error()
|
34 | type.regexp()
|
35 | type.array()
|
36 | type.undefined()
|
37 |
|
38 | shortcut methods
|
39 |
|
40 | type.s()
|
41 | type.n()
|
42 | type.b()
|
43 | type.f()
|
44 | type.o()
|
45 | type.d()
|
46 | type.e()
|
47 | type.r()
|
48 | type.a()
|
49 | type.u()
|
50 |
|
51 | check array and their contents. for every type above there is an array method like the one below.
|
52 |
|
53 | type.stringArray( [ "hi", new String( "name" ), "is", "michael" ] ) // true
|
54 | type.sa( [ "hi", new String( "name" ), "is", "michael" ] ) // true |
\ | No newline at end of file |