-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmaps.js
61 lines (53 loc) · 1 KB
/
maps.js
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
'use strict'
var u = require('../util')
exports.lt = function (a, b) {
return a < b
}
exports.gt = function (a, b) {
return a > b
}
exports.lte = function (a, b) {
return a <= b
}
exports.gte = function (a, b) {
return a >= b
}
exports.eq = function (a, b) {
return a === b
}
exports.ne = function (a, b) {
return a !== b
}
exports.not = function (a) {
return !a
}
exports.truthy = function (a) {
return !!a
}
exports.prefix = function (a, str) {
if(u.isArray(str))
return ( u.isArray(a) && a.length > str.length
&& str.every(function (v, i) {
return a[i] === v
})
)
return 'string' == typeof a && a.substring(0, str.length) == str
}
exports.is = function (a, type) {
return typeof a === type
}
exports.in = function (a, b) {
return ~b.indexOf(a)
}
exports.type = function (a) {
return typeof a
}
exports.int = function (a) {
return u.isInteger(a)
}
exports.mod = function (a, b) {
return a % b
}
exports.get = function (a, path) {
return u.get(a, path)
}