UNPKG

477 BJavaScriptView Raw
1"use strict";
2
3var isEither = function isEither(first) {
4 for (var _len = arguments.length, comparisons = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
5 comparisons[_key - 1] = arguments[_key];
6 }
7
8 if (!comparisons.length) {
9 throw Error('isEither takes at least a second argument');
10 }
11
12 if (Array.isArray(comparisons[0])) {
13 return comparisons[0].includes(first);
14 }
15
16 return comparisons.includes(first);
17};
18
19module.exports = isEither;
\No newline at end of file