forked from beginner-corp/validate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_types.js
More file actions
36 lines (28 loc) · 842 Bytes
/
Copy path_types.js
File metadata and controls
36 lines (28 loc) · 842 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
29
30
31
32
33
34
35
var nodash = require('@smallwins/nodash')
var isObject = nodash.isObject
var isString = nodash.isString
var isNumber = nodash.isNumber
var isArray = Array.isArray
var isBoolean = nodash.isBoolean
var isFunction = nodash.isFunction
// built in types (thus all of JSON!)
module.exports = {
obj: function obj(v) {
return isObject(v)? true : TypeError('not an Object')
},
str: function str(v) {
return isString(v)? true : TypeError('not a String')
},
num: function num(v) {
return isNumber(v)? true : TypeError('not a Number')
},
arr: function arr(v) {
return isArray(v)? true : TypeError('not an Array')
},
bool: function bool(v) {
return isBoolean(v)? true : TypeError('not a Boolean')
},
fun: function bool(v) {
return isFunction(v)? true : TypeError('not a Function')
}
}