Buckets:
3.85 GB
70,867 files
Updated 11 days ago
Ctrl+K
| Name | Size | Uploaded | Xet hash |
|---|---|---|---|
| dist | 2 items | ||
| LICENSE | 1.09 kB xet | 04c93d7f | |
| README.md | 1.28 kB xet | d12ab18c | |
| index.d.ts | 115 Bytes xet | eb2c815d | |
| package.json | 3.4 kB xet | 5db38744 |
attr-accept
JavaScript implementation of the "accept" attribute for HTML5
<input type="file">
See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#attr-accept for more information.
Installation
npm install --save attr-accept
Usage
var accept = require('attr-accept');
accept({
name: 'my file.png',
type: 'image/png'
}, 'image/*') // => true
accept({
name: 'my file.json',
type: 'application/json'
}, 'image/*') // => false
accept({
name: 'my file.srt',
type: ''
}, '.srt') // => true
You can also pass multiple mime types as a comma delimited string or array.
accept({
name: 'my file.json',
type: 'application/json'
}, 'application/json,video/*') // => true
accept({
name: 'my file.json',
type: 'application/json'
}, ['application/json', 'video/*']) // => true
Contributing
Checkout the organization CONTRIBUTING.md.
- Total size
- 3.85 GB
- Files
- 70,867
- Last updated
- Nov 3
- Pre-warmed CDN
- US EU US EU