mirror of
https://github.com/toss/es-toolkit.git
synced 2024-11-28 03:34:26 +03:00
251d6bf205
* feat(isBlob): add isBlob function * fix: fixed missing export * docs: isBlob * fix: resolve linting errors * tests(isBlob): ensure File is mocked locally in a test to prevent CI failure * Update docs/ko/reference/predicate/isBlob.md * Update docs/ja/reference/predicate/isBlob.md * Apply suggestions from code review --------- Co-authored-by: Sojin Park <raon0211@gmail.com>
643 B
643 B
isBlob
Checks if the given value is a Blob.
This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to Blob
.
Signature
function isBlob(x: unknown): x is Blob;
Parameters
x
(unknown
): The value to test if it is Blob.
Returns
(x is Blob
): True if the value is a Blob, false otherwise.
Examples
const value1 = new Blob();
const value2 = {};
const value3 = new File(['content'], 'example.txt', { type: 'text/plain' });
console.log(isBlob(value1)); // true
console.log(isBlob(value2)); // false
console.log(isBlob(value3)); // true