Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
rpm-mcarman b9f7ec4306 First Commit il y a 3 ans
..
.github/workflows First Commit il y a 3 ans
dist First Commit il y a 3 ans
src First Commit il y a 3 ans
test First Commit il y a 3 ans
.codeclimate.yml First Commit il y a 3 ans
.editorconfig First Commit il y a 3 ans
.eslintrc First Commit il y a 3 ans
LICENSE First Commit il y a 3 ans
README.md First Commit il y a 3 ans
index.d.ts First Commit il y a 3 ans
package.json First Commit il y a 3 ans
webpack.config.js First Commit il y a 3 ans

README.md

attr-accept

JavaScript implementation of the “accept” attribute for HTML5 <input type="file">

npm version semantic-release

See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#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