You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
rpm-mcarman b9f7ec4306 First Commit пре 3 година
..
.github/workflows First Commit пре 3 година
dist First Commit пре 3 година
src First Commit пре 3 година
test First Commit пре 3 година
.codeclimate.yml First Commit пре 3 година
.editorconfig First Commit пре 3 година
.eslintrc First Commit пре 3 година
LICENSE First Commit пре 3 година
README.md First Commit пре 3 година
index.d.ts First Commit пре 3 година
package.json First Commit пре 3 година
webpack.config.js First Commit пре 3 година

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