forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathis.js
More file actions
28 lines (23 loc) · 738 Bytes
/
is.js
File metadata and controls
28 lines (23 loc) · 738 Bytes
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
export function isPrintableChar (v) {
return (v > 47 && v < 58) || // number keys
v === 32 || v === 13 || // spacebar & return key(s) (if you want to allow carriage returns)
(v > 64 && v < 91) || // letter keys
(v > 95 && v < 112) || // numpad keys
(v > 185 && v < 193) || // ;=,-./` (in order)
(v > 218 && v < 223)
}
export function isObject (v) {
return Object(v) === v
}
export function isDate (v) {
return Object.prototype.toString.call(v) === '[object Date]'
}
export function isRegexp (v) {
return Object.prototype.toString.call(v) === '[object RegExp]'
}
export function isNumber (v) {
return typeof v === 'number' && isFinite(v)
}
export function isString (v) {
return typeof v === 'string'
}