Illia Kozyr c722a49f64 React Project DONE | 2 éve | |
---|---|---|
.. | ||
.github | 2 éve | |
dist | 2 éve | |
src | 2 éve | |
test | 2 éve | |
.codeclimate.yml | 2 éve | |
.editorconfig | 2 éve | |
.eslintrc | 2 éve | |
LICENSE | 2 éve | |
README.md | 2 éve | |
index.d.ts | 2 éve | |
package.json | 2 éve | |
webpack.config.js | 2 éve |
JavaScript implementation of the "accept" attribute for HTML5 <input type="file">
See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept for more information.
npm install --save attr-accept
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