blob: 0e44ab59d22106175825a91392a021815e76c3a4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import {empty} from '#sugar';
export default function performAvailabilityCheck(value, mode) {
switch (mode) {
case 'null':
return value !== undefined && value !== null;
case 'empty':
return value !== undefined && !empty(value);
case 'falsy':
return !!value && (!Array.isArray(value) || !empty(value));
case 'index':
return typeof value === 'number' && value >= 0;
}
return undefined;
}
|