UNPKG

509 BPlain TextView Raw
1export const matchType = (variable, type) => {
2 return typeof variable === type
3}
4
5export const matchInstance = (variable, instance) => {
6 return variable instanceof instance
7}
8
9/**
10 * @desc only check base type of javascript if exist in array
11 * @param variable: target for checking
12 * @param collection: source for checking
13 * */
14export const containedInArr = (variable, collection) => {
15 if (!collection || !Array.isArray(collection)) return false
16
17 return collection.indexOf(variable) !== -1
18}
\No newline at end of file