• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

visgl / loaders.gl / 24139120841

08 Apr 2026 01:53PM UTC coverage: 65.319% (+30.2%) from 35.137%
24139120841

push

github

web-flow
chore: Replace puppeteer with playwright (#3350)

14216 of 18890 branches covered (75.26%)

Branch coverage included in aggregate %.

3 of 3 new or added lines in 1 file covered. (100.0%)

3248 existing lines in 369 files now uncovered.

73509 of 115413 relevant lines covered (63.69%)

5763.45 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.68
/modules/loader-utils/src/lib/javascript-utils/is-type.ts
1
// loaders.gl
1✔
2
// SPDX-License-Identifier: MIT
2✔
3
// Copyright (c) vis.gl contributors
1,378✔
4

1,378✔
5
/* eslint-disable @typescript-eslint/unbound-method */
1,378✔
6

1,378✔
7
import type {Readable} from 'stream';
1,378✔
8

1,378✔
9
/** Minimal shape for Node.js Buffer-like values */
1,378✔
10
type NodeBufferLike = {buffer: ArrayBufferLike; isBuffer: true};
1,378✔
11

1,378✔
12
/** Minimal shape for Node.js writable streams */
1,378✔
13
type NodeWritableStream = {
1,378✔
14
  end: (...args: unknown[]) => unknown;
1,378✔
15
  write: (...args: unknown[]) => unknown;
1,378✔
16
  writable: boolean;
1,378✔
17
};
1,378✔
18

1,378✔
19
/** Minimal shape for WritableStream-like DOM implementations */
1,378✔
20
type WritableDOMStreamLike = WritableStream | {abort: () => unknown; getWriter: () => unknown};
1,378✔
21

1,378✔
22
/** A DOM or Node readable stream */
1,378✔
23
export type ReadableStreamType = ReadableStream | Readable;
1,378✔
24

1,378✔
25
/** Checks whether a value is a boolean */
1,378✔
26
const isBoolean = (value: unknown): value is boolean => typeof value === 'boolean';
1✔
27

333,706✔
28
/** Checks whether a value is a function */
248,230✔
29
const isFunction = (value: unknown): value is (...args: unknown[]) => unknown =>
248,230✔
30
  typeof value === 'function';
84,745✔
31

84,745✔
32
/** Checks whether a value is a non-null object */
2✔
33
export const isObject = (value: unknown): value is object =>
2✔
34
  value !== null && typeof value === 'object';
1✔
35

1✔
UNCOV
36
/** Checks whether a value is a plain object (created by the Object constructor) */
×
37
export const isPureObject = (value: unknown): value is Record<string, unknown> =>
1✔
38
  isObject(value) && value.constructor === {}.constructor;
1✔
39

1,256✔
40
/** Checks whether a value is an ArrayBuffer */
662✔
41
export const isArrayBuffer = (value: unknown): value is ArrayBuffer =>
1✔
42
  typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;
1✔
43

2✔
44
/** Checks whether a value is an ArrayBuffer */
9✔
45
export const isSharedArrayBuffer = (value: unknown): value is SharedArrayBuffer =>
9✔
46
  typeof SharedArrayBuffer !== 'undefined' && value instanceof SharedArrayBuffer;
1✔
47

9✔
48
/** Checks whether a value is ArrayBuffer-like */
9✔
49
export const isArrayBufferLike = (value: unknown): value is ArrayBufferLike =>
206✔
50
  isObject(value) &&
1,361✔
51
  typeof (value as ArrayBufferLike).byteLength === 'number' &&
1,361✔
52
  typeof (value as ArrayBufferLike).slice === 'function';
84,108✔
53

84,108✔
54
/** Checks whether a value behaves like a promise */
969✔
55
export const isPromise = (value: unknown): value is Promise<unknown> =>
81,251✔
56
  isObject(value) && 'then' in value && isFunction((value as {then: unknown}).then);
1✔
57

1✔
58
/** Checks whether a value implements the iterable protocol */
1✔
59
export const isIterable = (value: unknown): value is Iterable<unknown> =>
1✔
60
  Boolean(value) && isFunction((value as Iterable<unknown>)[Symbol.iterator]);
1✔
61

1✔
UNCOV
62
/** Checks whether a value implements the async iterable protocol */
×
63
export const isAsyncIterable = (value: unknown): value is AsyncIterable<unknown> =>
1✔
64
  Boolean(value) && isFunction((value as AsyncIterable<unknown>)[Symbol.asyncIterator]);
1✔
65

3✔
66
/** Checks whether a value is an iterator (has a next function) */
2✔
67
export const isIterator = (value: unknown): value is Iterator<unknown> =>
1✔
68
  Boolean(value) && isFunction((value as Iterator<unknown>).next);
134✔
69

134✔
UNCOV
70
/** Checks whether a value is a fetch Response or a duck-typed equivalent */
×
71
export const isResponse = (value: unknown): value is Response =>
9!
72
  (typeof Response !== 'undefined' && value instanceof Response) ||
84,129✔
73
  (isObject(value) &&
2✔
74
    isFunction((value as {arrayBuffer?: unknown}).arrayBuffer) &&
2✔
75
    isFunction((value as {text?: unknown}).text) &&
2✔
76
    isFunction((value as {json?: unknown}).json));
1✔
77

1✔
78
/** Checks whether a value is a File */
9✔
79
export const isFile = (value: unknown): value is File =>
9!
80
  typeof File !== 'undefined' && value instanceof File;
1!
81

1✔
82
/** Checks whether a value is a Blob */
133✔
83
export const isBlob = (value: unknown): value is Blob =>
133✔
84
  typeof Blob !== 'undefined' && value instanceof Blob;
1✔
85

2✔
86
/** Checks for Node.js Buffers without triggering bundlers to include the Buffer polyfill */
1✔
87
export const isBuffer = (value: unknown): value is NodeBufferLike =>
1✔
88
  Boolean(
×
89
    value &&
×
90
      typeof value === 'object' &&
×
91
      (value as Partial<NodeBufferLike>).isBuffer &&
×
92
      'buffer' in (value as NodeBufferLike)
×
93
  );
1✔
94

1✔
95
/** Checks whether a value looks like a DOM WritableStream */
1✔
96
export const isWritableDOMStream = (value: unknown): value is WritableDOMStreamLike =>
1✔
97
  isObject(value) &&
3✔
98
  isFunction((value as WritableDOMStreamLike).abort) &&
3✔
99
  isFunction((value as WritableDOMStreamLike).getWriter);
1✔
100

1✔
101
/** Checks whether a value looks like a DOM ReadableStream */
1✔
102
export const isReadableDOMStream = (value: unknown): value is ReadableStream =>
1✔
103
  (typeof ReadableStream !== 'undefined' && value instanceof ReadableStream) ||
137✔
104
  (isObject(value) &&
13✔
105
    isFunction((value as ReadableStream).tee) &&
13!
106
    isFunction((value as ReadableStream).cancel) &&
13!
107
    isFunction((value as ReadableStream).getReader));
1✔
108
// Not implemented in Firefox: && isFunction(x.pipeTo)
1✔
109

1✔
110
/** Checks whether a value looks like a Node.js writable stream */
1✔
111
export const isWritableNodeStream = (value: unknown): value is NodeWritableStream =>
1✔
112
  isObject(value) &&
2✔
113
  isFunction((value as NodeWritableStream).end) &&
2✔
114
  isFunction((value as NodeWritableStream).write) &&
2✔
115
  isBoolean((value as NodeWritableStream).writable);
1✔
116

1✔
117
/** Checks whether a value looks like a Node.js readable stream */
1✔
118
export const isReadableNodeStream = (value: unknown): value is Readable =>
1✔
119
  isObject(value) &&
15✔
120
  isFunction((value as Readable).read) &&
15✔
121
  isFunction((value as Readable).pipe) &&
15✔
122
  isBoolean((value as Readable).readable);
1✔
123

1✔
124
/** Checks whether a value is any readable stream (DOM or Node.js) */
1✔
125
export const isReadableStream = (value: unknown): value is ReadableStreamType =>
1✔
126
  isReadableDOMStream(value) || isReadableNodeStream(value);
1✔
127

1✔
128
/** Checks whether a value is any writable stream (DOM or Node.js) */
1✔
129
export const isWritableStream = (value: unknown): value is WritableStream | NodeWritableStream =>
1✔
130
  isWritableDOMStream(value) || isWritableNodeStream(value);
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc