-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathisExtractableFile.js
35 lines (33 loc) · 1023 Bytes
/
isExtractableFile.js
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
'use strict';
const ReactNativeFile = require('./ReactNativeFile.js');
/**
* Checks if a value is an [extractable file]{@link ExtractableFile}.
* @kind function
* @name isExtractableFile
* @type {ExtractableFileMatcher}
* @param {*} value Value to check.
* @returns {boolean} Is the value an [extractable file]{@link ExtractableFile}.
* @example <caption>Ways to `import`.</caption>
* ```js
* import { isExtractableFile } from 'extract-files';
* ```
*
* ```js
* import isExtractableFile from 'extract-files/public/isExtractableFile.js';
* ```
* @example <caption>Ways to `require`.</caption>
* ```js
* const { isExtractableFile } = require('extract-files');
* ```
*
* ```js
* const isExtractableFile = require('extract-files/public/isExtractableFile.js');
* ```
*/
module.exports = function isExtractableFile(value) {
return (
(typeof File !== 'undefined' && value instanceof File) ||
(typeof Blob !== 'undefined' && value instanceof Blob) ||
value instanceof ReactNativeFile
);
};