Skip to main content

isBlob

A function that checks whether a given value is of type Blob, and if so, narrows the type of the argument to Blob.


Code

🔗 View source code

Interface

typescript
function isBlob(x: unknown): x is Blob

Usage

typescript
import { isBlob } from '@modern-kit/utils';

isBlob(new Blob()); // true
isBlob(new Blob(['content'], { type: 'text/plain' })); // true

isBlob('blob'); // false
isBlob(123); // false
isBlob({ a: 1 }); // false
isBlob([1, 2, 3]); // false
isBlob(null); // false
isBlob(undefined); // false