forked from software-mansion/react-native-gesture-handler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.js
More file actions
18 lines (15 loc) · 614 Bytes
/
utils.js
File metadata and controls
18 lines (15 loc) · 614 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
export const isnan = v => Number.isNaN(v);
export const isValidNumber = v => typeof v === 'number' && !Number.isNaN(v);
export const TEST_MIN_IF_NOT_NAN = (value, limit) =>
!isnan(limit) &&
((limit < 0 && value <= limit) || (limit >= 0 && value >= limit));
export const VEC_LEN_SQ = ({ x = 0, y = 0 } = {}) => x * x + y * y;
export const TEST_MAX_IF_NOT_NAN = (value, max) =>
!isnan(max) && ((max < 0 && value < max) || (max >= 0 && value > max));
export function fireAfterInterval(method, interval) {
if (!interval) {
method();
return null;
}
return setTimeout(() => method(), interval);
}