2
2
3
3
// these helpers produces better vm code in JS engines due to their
4
4
// explicitness and function inlining
5
- export function isUndef ( v : any ) : boolean {
5
+ export function isUndef ( v : any ) : boolean % checks {
6
6
return v === undefined || v === null
7
7
}
8
8
9
- export function isDef ( v : any ) /* : %checks */ {
9
+ export function isDef ( v : any ) : boolean % checks {
10
10
return v !== undefined && v !== null
11
11
}
12
12
13
- export function isTrue ( v : any ) : boolean {
13
+ export function isTrue ( v : any ) : boolean % checks {
14
14
return v === true
15
15
}
16
16
17
17
/**
18
18
* Check if value is primitive
19
19
*/
20
- export function isPrimitive ( value : any ) : boolean {
20
+ export function isPrimitive ( value : any ) : boolean % checks {
21
21
return typeof value === 'string' || typeof value === 'number'
22
22
}
23
23
@@ -26,28 +26,28 @@ export function isPrimitive (value: any): boolean {
26
26
* Objects from primitive values when we know the value
27
27
* is a JSON-compliant type.
28
28
*/
29
- export function isObject ( obj : mixed ) : boolean {
29
+ export function isObject ( obj : mixed ) : boolean % checks {
30
30
return obj !== null && typeof obj === 'object'
31
31
}
32
32
33
- const toString = Object . prototype . toString
33
+ const _toString = Object . prototype . toString
34
34
35
35
/**
36
36
* Strict object type check. Only returns true
37
37
* for plain JavaScript objects.
38
38
*/
39
39
export function isPlainObject ( obj : any ) : boolean {
40
- return toString . call ( obj ) === '[object Object]'
40
+ return _toString . call ( obj ) === '[object Object]'
41
41
}
42
42
43
43
export function isRegExp ( v : any ) : boolean {
44
- return toString . call ( v ) === '[object RegExp]'
44
+ return _toString . call ( v ) === '[object RegExp]'
45
45
}
46
46
47
47
/**
48
48
* Convert a value to a string that is actually rendered.
49
49
*/
50
- export function _toString ( val : any ) : string {
50
+ export function toString ( val : any ) : string {
51
51
return val == null
52
52
? ''
53
53
: typeof val === 'object'
0 commit comments