Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | 21x 1569x 6968x 6968x 1569x | import { detectArrayBuffer } from './array-buffer'; import { detectArray } from './array'; import { detectBigint } from './bigint'; import { detectBoolean } from './boolean'; import { detectDate } from './date'; import { detectFunction } from './function'; import { detectMap } from './map'; import { detectNull } from './null'; import { detectNumber } from './number'; import { detectObject } from './object'; import { detectRegExp } from './regexp'; import { detectSet } from './set'; import { detectString } from './string'; import { detectSymbol } from './symbol'; import { detectTypedArray } from './typed-array'; import { detectUndefined } from './undefined'; import { ValueType } from '../types'; import { EncodeContext } from '../encode'; import { detectLinkIndex } from './link'; import { detectValueIndex } from './value'; export type DetectMethod = (value: any, context: EncodeContext) => ValueType; export const DETECTORS = [ detectValueIndex, detectLinkIndex, detectUndefined, detectNull, detectBoolean, detectNumber, detectBigint, detectString, detectFunction, detectArray, detectArrayBuffer, detectTypedArray, detectMap, detectSet, detectDate, detectRegExp, detectSymbol, detectObject, ]; export function detectValue(value: any, context: EncodeContext): ValueType { for (const detectMethod of context.detectors) { const type = detectMethod(value, context); if (type !== ValueType.UNKNOWN) { return type; } } /* istanbul ignore next */ return ValueType.UNKNOWN; } |