|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
693 bytes
|
| Rev | Line | |
|---|
| [a762898] | 1 | /**
|
|---|
| 2 | * Checks if the given value is a File.
|
|---|
| 3 | *
|
|---|
| 4 | * This function tests whether the provided value is an instance of `File`.
|
|---|
| 5 | * It returns `true` if the value is an instance of `File`, and `false` otherwise.
|
|---|
| 6 | *
|
|---|
| 7 | * @param {unknown} x - The value to test if it is a File.
|
|---|
| 8 | * @returns {x is File} True if the value is a File, false otherwise.
|
|---|
| 9 | *
|
|---|
| 10 | * @example
|
|---|
| 11 | * const value1 = new File(["content"], "example.txt");
|
|---|
| 12 | * const value2 = {};
|
|---|
| 13 | * const value3 = new Blob(["content"], { type: "text/plain" });
|
|---|
| 14 | *
|
|---|
| 15 | * console.log(isFile(value1)); // true
|
|---|
| 16 | * console.log(isFile(value2)); // false
|
|---|
| 17 | * console.log(isFile(value3)); // false
|
|---|
| 18 | */
|
|---|
| 19 | declare function isFile(x: unknown): x is File;
|
|---|
| 20 |
|
|---|
| 21 | export { isFile };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.