You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. "use strict";
  2. /// <reference lib="es2018"/>
  3. /// <reference lib="dom"/>
  4. /// <reference types="node"/>
  5. Object.defineProperty(exports, "__esModule", { value: true });
  6. const typedArrayTypeNames = [
  7. 'Int8Array',
  8. 'Uint8Array',
  9. 'Uint8ClampedArray',
  10. 'Int16Array',
  11. 'Uint16Array',
  12. 'Int32Array',
  13. 'Uint32Array',
  14. 'Float32Array',
  15. 'Float64Array',
  16. 'BigInt64Array',
  17. 'BigUint64Array'
  18. ];
  19. function isTypedArrayName(name) {
  20. return typedArrayTypeNames.includes(name);
  21. }
  22. const objectTypeNames = [
  23. 'Function',
  24. 'Generator',
  25. 'AsyncGenerator',
  26. 'GeneratorFunction',
  27. 'AsyncGeneratorFunction',
  28. 'AsyncFunction',
  29. 'Observable',
  30. 'Array',
  31. 'Buffer',
  32. 'Blob',
  33. 'Object',
  34. 'RegExp',
  35. 'Date',
  36. 'Error',
  37. 'Map',
  38. 'Set',
  39. 'WeakMap',
  40. 'WeakSet',
  41. 'ArrayBuffer',
  42. 'SharedArrayBuffer',
  43. 'DataView',
  44. 'Promise',
  45. 'URL',
  46. 'FormData',
  47. 'URLSearchParams',
  48. 'HTMLElement',
  49. ...typedArrayTypeNames
  50. ];
  51. function isObjectTypeName(name) {
  52. return objectTypeNames.includes(name);
  53. }
  54. const primitiveTypeNames = [
  55. 'null',
  56. 'undefined',
  57. 'string',
  58. 'number',
  59. 'bigint',
  60. 'boolean',
  61. 'symbol'
  62. ];
  63. function isPrimitiveTypeName(name) {
  64. return primitiveTypeNames.includes(name);
  65. }
  66. // eslint-disable-next-line @typescript-eslint/ban-types
  67. function isOfType(type) {
  68. return (value) => typeof value === type;
  69. }
  70. const { toString } = Object.prototype;
  71. const getObjectType = (value) => {
  72. const objectTypeName = toString.call(value).slice(8, -1);
  73. if (/HTML\w+Element/.test(objectTypeName) && is.domElement(value)) {
  74. return 'HTMLElement';
  75. }
  76. if (isObjectTypeName(objectTypeName)) {
  77. return objectTypeName;
  78. }
  79. return undefined;
  80. };
  81. const isObjectOfType = (type) => (value) => getObjectType(value) === type;
  82. function is(value) {
  83. if (value === null) {
  84. return 'null';
  85. }
  86. switch (typeof value) {
  87. case 'undefined':
  88. return 'undefined';
  89. case 'string':
  90. return 'string';
  91. case 'number':
  92. return 'number';
  93. case 'boolean':
  94. return 'boolean';
  95. case 'function':
  96. return 'Function';
  97. case 'bigint':
  98. return 'bigint';
  99. case 'symbol':
  100. return 'symbol';
  101. default:
  102. }
  103. if (is.observable(value)) {
  104. return 'Observable';
  105. }
  106. if (is.array(value)) {
  107. return 'Array';
  108. }
  109. if (is.buffer(value)) {
  110. return 'Buffer';
  111. }
  112. const tagType = getObjectType(value);
  113. if (tagType) {
  114. return tagType;
  115. }
  116. if (value instanceof String || value instanceof Boolean || value instanceof Number) {
  117. throw new TypeError('Please don\'t use object wrappers for primitive types');
  118. }
  119. return 'Object';
  120. }
  121. is.undefined = isOfType('undefined');
  122. is.string = isOfType('string');
  123. const isNumberType = isOfType('number');
  124. is.number = (value) => isNumberType(value) && !is.nan(value);
  125. is.bigint = isOfType('bigint');
  126. // eslint-disable-next-line @typescript-eslint/ban-types
  127. is.function_ = isOfType('function');
  128. is.null_ = (value) => value === null;
  129. is.class_ = (value) => is.function_(value) && value.toString().startsWith('class ');
  130. is.boolean = (value) => value === true || value === false;
  131. is.symbol = isOfType('symbol');
  132. is.numericString = (value) => is.string(value) && !is.emptyStringOrWhitespace(value) && !Number.isNaN(Number(value));
  133. is.array = (value, assertion) => {
  134. if (!Array.isArray(value)) {
  135. return false;
  136. }
  137. if (!is.function_(assertion)) {
  138. return true;
  139. }
  140. return value.every(assertion);
  141. };
  142. is.buffer = (value) => { var _a, _b, _c, _d; return (_d = (_c = (_b = (_a = value) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.isBuffer) === null || _c === void 0 ? void 0 : _c.call(_b, value)) !== null && _d !== void 0 ? _d : false; };
  143. is.blob = (value) => isObjectOfType('Blob')(value);
  144. is.nullOrUndefined = (value) => is.null_(value) || is.undefined(value);
  145. is.object = (value) => !is.null_(value) && (typeof value === 'object' || is.function_(value));
  146. is.iterable = (value) => { var _a; return is.function_((_a = value) === null || _a === void 0 ? void 0 : _a[Symbol.iterator]); };
  147. is.asyncIterable = (value) => { var _a; return is.function_((_a = value) === null || _a === void 0 ? void 0 : _a[Symbol.asyncIterator]); };
  148. is.generator = (value) => { var _a, _b; return is.iterable(value) && is.function_((_a = value) === null || _a === void 0 ? void 0 : _a.next) && is.function_((_b = value) === null || _b === void 0 ? void 0 : _b.throw); };
  149. is.asyncGenerator = (value) => is.asyncIterable(value) && is.function_(value.next) && is.function_(value.throw);
  150. is.nativePromise = (value) => isObjectOfType('Promise')(value);
  151. const hasPromiseAPI = (value) => {
  152. var _a, _b;
  153. return is.function_((_a = value) === null || _a === void 0 ? void 0 : _a.then) &&
  154. is.function_((_b = value) === null || _b === void 0 ? void 0 : _b.catch);
  155. };
  156. is.promise = (value) => is.nativePromise(value) || hasPromiseAPI(value);
  157. is.generatorFunction = isObjectOfType('GeneratorFunction');
  158. is.asyncGeneratorFunction = (value) => getObjectType(value) === 'AsyncGeneratorFunction';
  159. is.asyncFunction = (value) => getObjectType(value) === 'AsyncFunction';
  160. // eslint-disable-next-line no-prototype-builtins, @typescript-eslint/ban-types
  161. is.boundFunction = (value) => is.function_(value) && !value.hasOwnProperty('prototype');
  162. is.regExp = isObjectOfType('RegExp');
  163. is.date = isObjectOfType('Date');
  164. is.error = isObjectOfType('Error');
  165. is.map = (value) => isObjectOfType('Map')(value);
  166. is.set = (value) => isObjectOfType('Set')(value);
  167. is.weakMap = (value) => isObjectOfType('WeakMap')(value);
  168. is.weakSet = (value) => isObjectOfType('WeakSet')(value);
  169. is.int8Array = isObjectOfType('Int8Array');
  170. is.uint8Array = isObjectOfType('Uint8Array');
  171. is.uint8ClampedArray = isObjectOfType('Uint8ClampedArray');
  172. is.int16Array = isObjectOfType('Int16Array');
  173. is.uint16Array = isObjectOfType('Uint16Array');
  174. is.int32Array = isObjectOfType('Int32Array');
  175. is.uint32Array = isObjectOfType('Uint32Array');
  176. is.float32Array = isObjectOfType('Float32Array');
  177. is.float64Array = isObjectOfType('Float64Array');
  178. is.bigInt64Array = isObjectOfType('BigInt64Array');
  179. is.bigUint64Array = isObjectOfType('BigUint64Array');
  180. is.arrayBuffer = isObjectOfType('ArrayBuffer');
  181. is.sharedArrayBuffer = isObjectOfType('SharedArrayBuffer');
  182. is.dataView = isObjectOfType('DataView');
  183. is.enumCase = (value, targetEnum) => Object.values(targetEnum).includes(value);
  184. is.directInstanceOf = (instance, class_) => Object.getPrototypeOf(instance) === class_.prototype;
  185. is.urlInstance = (value) => isObjectOfType('URL')(value);
  186. is.urlString = (value) => {
  187. if (!is.string(value)) {
  188. return false;
  189. }
  190. try {
  191. new URL(value); // eslint-disable-line no-new
  192. return true;
  193. }
  194. catch (_a) {
  195. return false;
  196. }
  197. };
  198. // Example: `is.truthy = (value: unknown): value is (not false | not 0 | not '' | not undefined | not null) => Boolean(value);`
  199. is.truthy = (value) => Boolean(value);
  200. // Example: `is.falsy = (value: unknown): value is (not true | 0 | '' | undefined | null) => Boolean(value);`
  201. is.falsy = (value) => !value;
  202. is.nan = (value) => Number.isNaN(value);
  203. is.primitive = (value) => is.null_(value) || isPrimitiveTypeName(typeof value);
  204. is.integer = (value) => Number.isInteger(value);
  205. is.safeInteger = (value) => Number.isSafeInteger(value);
  206. is.plainObject = (value) => {
  207. // From: https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
  208. if (toString.call(value) !== '[object Object]') {
  209. return false;
  210. }
  211. const prototype = Object.getPrototypeOf(value);
  212. return prototype === null || prototype === Object.getPrototypeOf({});
  213. };
  214. is.typedArray = (value) => isTypedArrayName(getObjectType(value));
  215. const isValidLength = (value) => is.safeInteger(value) && value >= 0;
  216. is.arrayLike = (value) => !is.nullOrUndefined(value) && !is.function_(value) && isValidLength(value.length);
  217. is.inRange = (value, range) => {
  218. if (is.number(range)) {
  219. return value >= Math.min(0, range) && value <= Math.max(range, 0);
  220. }
  221. if (is.array(range) && range.length === 2) {
  222. return value >= Math.min(...range) && value <= Math.max(...range);
  223. }
  224. throw new TypeError(`Invalid range: ${JSON.stringify(range)}`);
  225. };
  226. const NODE_TYPE_ELEMENT = 1;
  227. const DOM_PROPERTIES_TO_CHECK = [
  228. 'innerHTML',
  229. 'ownerDocument',
  230. 'style',
  231. 'attributes',
  232. 'nodeValue'
  233. ];
  234. is.domElement = (value) => {
  235. return is.object(value) &&
  236. value.nodeType === NODE_TYPE_ELEMENT &&
  237. is.string(value.nodeName) &&
  238. !is.plainObject(value) &&
  239. DOM_PROPERTIES_TO_CHECK.every(property => property in value);
  240. };
  241. is.observable = (value) => {
  242. var _a, _b, _c, _d;
  243. if (!value) {
  244. return false;
  245. }
  246. // eslint-disable-next-line no-use-extend-native/no-use-extend-native
  247. if (value === ((_b = (_a = value)[Symbol.observable]) === null || _b === void 0 ? void 0 : _b.call(_a))) {
  248. return true;
  249. }
  250. if (value === ((_d = (_c = value)['@@observable']) === null || _d === void 0 ? void 0 : _d.call(_c))) {
  251. return true;
  252. }
  253. return false;
  254. };
  255. is.nodeStream = (value) => is.object(value) && is.function_(value.pipe) && !is.observable(value);
  256. is.infinite = (value) => value === Infinity || value === -Infinity;
  257. const isAbsoluteMod2 = (remainder) => (value) => is.integer(value) && Math.abs(value % 2) === remainder;
  258. is.evenInteger = isAbsoluteMod2(0);
  259. is.oddInteger = isAbsoluteMod2(1);
  260. is.emptyArray = (value) => is.array(value) && value.length === 0;
  261. is.nonEmptyArray = (value) => is.array(value) && value.length > 0;
  262. is.emptyString = (value) => is.string(value) && value.length === 0;
  263. const isWhiteSpaceString = (value) => is.string(value) && !/\S/.test(value);
  264. is.emptyStringOrWhitespace = (value) => is.emptyString(value) || isWhiteSpaceString(value);
  265. // TODO: Use `not ''` when the `not` operator is available.
  266. is.nonEmptyString = (value) => is.string(value) && value.length > 0;
  267. // TODO: Use `not ''` when the `not` operator is available.
  268. is.nonEmptyStringAndNotWhitespace = (value) => is.string(value) && !is.emptyStringOrWhitespace(value);
  269. is.emptyObject = (value) => is.object(value) && !is.map(value) && !is.set(value) && Object.keys(value).length === 0;
  270. // TODO: Use `not` operator here to remove `Map` and `Set` from type guard:
  271. // - https://github.com/Microsoft/TypeScript/pull/29317
  272. is.nonEmptyObject = (value) => is.object(value) && !is.map(value) && !is.set(value) && Object.keys(value).length > 0;
  273. is.emptySet = (value) => is.set(value) && value.size === 0;
  274. is.nonEmptySet = (value) => is.set(value) && value.size > 0;
  275. is.emptyMap = (value) => is.map(value) && value.size === 0;
  276. is.nonEmptyMap = (value) => is.map(value) && value.size > 0;
  277. // `PropertyKey` is any value that can be used as an object key (string, number, or symbol)
  278. is.propertyKey = (value) => is.any([is.string, is.number, is.symbol], value);
  279. is.formData = (value) => isObjectOfType('FormData')(value);
  280. is.urlSearchParams = (value) => isObjectOfType('URLSearchParams')(value);
  281. const predicateOnArray = (method, predicate, values) => {
  282. if (!is.function_(predicate)) {
  283. throw new TypeError(`Invalid predicate: ${JSON.stringify(predicate)}`);
  284. }
  285. if (values.length === 0) {
  286. throw new TypeError('Invalid number of values');
  287. }
  288. return method.call(values, predicate);
  289. };
  290. is.any = (predicate, ...values) => {
  291. const predicates = is.array(predicate) ? predicate : [predicate];
  292. return predicates.some(singlePredicate => predicateOnArray(Array.prototype.some, singlePredicate, values));
  293. };
  294. is.all = (predicate, ...values) => predicateOnArray(Array.prototype.every, predicate, values);
  295. const assertType = (condition, description, value, options = {}) => {
  296. if (!condition) {
  297. const { multipleValues } = options;
  298. const valuesMessage = multipleValues ?
  299. `received values of types ${[
  300. ...new Set(value.map(singleValue => `\`${is(singleValue)}\``))
  301. ].join(', ')}` :
  302. `received value of type \`${is(value)}\``;
  303. throw new TypeError(`Expected value which is \`${description}\`, ${valuesMessage}.`);
  304. }
  305. };
  306. exports.assert = {
  307. // Unknowns.
  308. undefined: (value) => assertType(is.undefined(value), 'undefined', value),
  309. string: (value) => assertType(is.string(value), 'string', value),
  310. number: (value) => assertType(is.number(value), 'number', value),
  311. bigint: (value) => assertType(is.bigint(value), 'bigint', value),
  312. // eslint-disable-next-line @typescript-eslint/ban-types
  313. function_: (value) => assertType(is.function_(value), 'Function', value),
  314. null_: (value) => assertType(is.null_(value), 'null', value),
  315. class_: (value) => assertType(is.class_(value), "Class" /* class_ */, value),
  316. boolean: (value) => assertType(is.boolean(value), 'boolean', value),
  317. symbol: (value) => assertType(is.symbol(value), 'symbol', value),
  318. numericString: (value) => assertType(is.numericString(value), "string with a number" /* numericString */, value),
  319. array: (value, assertion) => {
  320. const assert = assertType;
  321. assert(is.array(value), 'Array', value);
  322. if (assertion) {
  323. value.forEach(assertion);
  324. }
  325. },
  326. buffer: (value) => assertType(is.buffer(value), 'Buffer', value),
  327. blob: (value) => assertType(is.blob(value), 'Blob', value),
  328. nullOrUndefined: (value) => assertType(is.nullOrUndefined(value), "null or undefined" /* nullOrUndefined */, value),
  329. object: (value) => assertType(is.object(value), 'Object', value),
  330. iterable: (value) => assertType(is.iterable(value), "Iterable" /* iterable */, value),
  331. asyncIterable: (value) => assertType(is.asyncIterable(value), "AsyncIterable" /* asyncIterable */, value),
  332. generator: (value) => assertType(is.generator(value), 'Generator', value),
  333. asyncGenerator: (value) => assertType(is.asyncGenerator(value), 'AsyncGenerator', value),
  334. nativePromise: (value) => assertType(is.nativePromise(value), "native Promise" /* nativePromise */, value),
  335. promise: (value) => assertType(is.promise(value), 'Promise', value),
  336. generatorFunction: (value) => assertType(is.generatorFunction(value), 'GeneratorFunction', value),
  337. asyncGeneratorFunction: (value) => assertType(is.asyncGeneratorFunction(value), 'AsyncGeneratorFunction', value),
  338. // eslint-disable-next-line @typescript-eslint/ban-types
  339. asyncFunction: (value) => assertType(is.asyncFunction(value), 'AsyncFunction', value),
  340. // eslint-disable-next-line @typescript-eslint/ban-types
  341. boundFunction: (value) => assertType(is.boundFunction(value), 'Function', value),
  342. regExp: (value) => assertType(is.regExp(value), 'RegExp', value),
  343. date: (value) => assertType(is.date(value), 'Date', value),
  344. error: (value) => assertType(is.error(value), 'Error', value),
  345. map: (value) => assertType(is.map(value), 'Map', value),
  346. set: (value) => assertType(is.set(value), 'Set', value),
  347. weakMap: (value) => assertType(is.weakMap(value), 'WeakMap', value),
  348. weakSet: (value) => assertType(is.weakSet(value), 'WeakSet', value),
  349. int8Array: (value) => assertType(is.int8Array(value), 'Int8Array', value),
  350. uint8Array: (value) => assertType(is.uint8Array(value), 'Uint8Array', value),
  351. uint8ClampedArray: (value) => assertType(is.uint8ClampedArray(value), 'Uint8ClampedArray', value),
  352. int16Array: (value) => assertType(is.int16Array(value), 'Int16Array', value),
  353. uint16Array: (value) => assertType(is.uint16Array(value), 'Uint16Array', value),
  354. int32Array: (value) => assertType(is.int32Array(value), 'Int32Array', value),
  355. uint32Array: (value) => assertType(is.uint32Array(value), 'Uint32Array', value),
  356. float32Array: (value) => assertType(is.float32Array(value), 'Float32Array', value),
  357. float64Array: (value) => assertType(is.float64Array(value), 'Float64Array', value),
  358. bigInt64Array: (value) => assertType(is.bigInt64Array(value), 'BigInt64Array', value),
  359. bigUint64Array: (value) => assertType(is.bigUint64Array(value), 'BigUint64Array', value),
  360. arrayBuffer: (value) => assertType(is.arrayBuffer(value), 'ArrayBuffer', value),
  361. sharedArrayBuffer: (value) => assertType(is.sharedArrayBuffer(value), 'SharedArrayBuffer', value),
  362. dataView: (value) => assertType(is.dataView(value), 'DataView', value),
  363. enumCase: (value, targetEnum) => assertType(is.enumCase(value, targetEnum), 'EnumCase', value),
  364. urlInstance: (value) => assertType(is.urlInstance(value), 'URL', value),
  365. urlString: (value) => assertType(is.urlString(value), "string with a URL" /* urlString */, value),
  366. truthy: (value) => assertType(is.truthy(value), "truthy" /* truthy */, value),
  367. falsy: (value) => assertType(is.falsy(value), "falsy" /* falsy */, value),
  368. nan: (value) => assertType(is.nan(value), "NaN" /* nan */, value),
  369. primitive: (value) => assertType(is.primitive(value), "primitive" /* primitive */, value),
  370. integer: (value) => assertType(is.integer(value), "integer" /* integer */, value),
  371. safeInteger: (value) => assertType(is.safeInteger(value), "integer" /* safeInteger */, value),
  372. plainObject: (value) => assertType(is.plainObject(value), "plain object" /* plainObject */, value),
  373. typedArray: (value) => assertType(is.typedArray(value), "TypedArray" /* typedArray */, value),
  374. arrayLike: (value) => assertType(is.arrayLike(value), "array-like" /* arrayLike */, value),
  375. domElement: (value) => assertType(is.domElement(value), "HTMLElement" /* domElement */, value),
  376. observable: (value) => assertType(is.observable(value), 'Observable', value),
  377. nodeStream: (value) => assertType(is.nodeStream(value), "Node.js Stream" /* nodeStream */, value),
  378. infinite: (value) => assertType(is.infinite(value), "infinite number" /* infinite */, value),
  379. emptyArray: (value) => assertType(is.emptyArray(value), "empty array" /* emptyArray */, value),
  380. nonEmptyArray: (value) => assertType(is.nonEmptyArray(value), "non-empty array" /* nonEmptyArray */, value),
  381. emptyString: (value) => assertType(is.emptyString(value), "empty string" /* emptyString */, value),
  382. emptyStringOrWhitespace: (value) => assertType(is.emptyStringOrWhitespace(value), "empty string or whitespace" /* emptyStringOrWhitespace */, value),
  383. nonEmptyString: (value) => assertType(is.nonEmptyString(value), "non-empty string" /* nonEmptyString */, value),
  384. nonEmptyStringAndNotWhitespace: (value) => assertType(is.nonEmptyStringAndNotWhitespace(value), "non-empty string and not whitespace" /* nonEmptyStringAndNotWhitespace */, value),
  385. emptyObject: (value) => assertType(is.emptyObject(value), "empty object" /* emptyObject */, value),
  386. nonEmptyObject: (value) => assertType(is.nonEmptyObject(value), "non-empty object" /* nonEmptyObject */, value),
  387. emptySet: (value) => assertType(is.emptySet(value), "empty set" /* emptySet */, value),
  388. nonEmptySet: (value) => assertType(is.nonEmptySet(value), "non-empty set" /* nonEmptySet */, value),
  389. emptyMap: (value) => assertType(is.emptyMap(value), "empty map" /* emptyMap */, value),
  390. nonEmptyMap: (value) => assertType(is.nonEmptyMap(value), "non-empty map" /* nonEmptyMap */, value),
  391. propertyKey: (value) => assertType(is.propertyKey(value), 'PropertyKey', value),
  392. formData: (value) => assertType(is.formData(value), 'FormData', value),
  393. urlSearchParams: (value) => assertType(is.urlSearchParams(value), 'URLSearchParams', value),
  394. // Numbers.
  395. evenInteger: (value) => assertType(is.evenInteger(value), "even integer" /* evenInteger */, value),
  396. oddInteger: (value) => assertType(is.oddInteger(value), "odd integer" /* oddInteger */, value),
  397. // Two arguments.
  398. directInstanceOf: (instance, class_) => assertType(is.directInstanceOf(instance, class_), "T" /* directInstanceOf */, instance),
  399. inRange: (value, range) => assertType(is.inRange(value, range), "in range" /* inRange */, value),
  400. // Variadic functions.
  401. any: (predicate, ...values) => {
  402. return assertType(is.any(predicate, ...values), "predicate returns truthy for any value" /* any */, values, { multipleValues: true });
  403. },
  404. all: (predicate, ...values) => assertType(is.all(predicate, ...values), "predicate returns truthy for all values" /* all */, values, { multipleValues: true })
  405. };
  406. // Some few keywords are reserved, but we'll populate them for Node.js users
  407. // See https://github.com/Microsoft/TypeScript/issues/2536
  408. Object.defineProperties(is, {
  409. class: {
  410. value: is.class_
  411. },
  412. function: {
  413. value: is.function_
  414. },
  415. null: {
  416. value: is.null_
  417. }
  418. });
  419. Object.defineProperties(exports.assert, {
  420. class: {
  421. value: exports.assert.class_
  422. },
  423. function: {
  424. value: exports.assert.function_
  425. },
  426. null: {
  427. value: exports.assert.null_
  428. }
  429. });
  430. exports.default = is;
  431. // For CommonJS default export support
  432. module.exports = is;
  433. module.exports.default = is;
  434. module.exports.assert = exports.assert;