2.2.5 • Published 2 years ago
attr-accept v2.2.5
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-acceptUsage
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') // => trueYou 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/*']) // => trueContributing
Checkout the organization CONTRIBUTING.md.
3.0.0-beta.1
2 years ago
3.0.0
2 years ago
2.2.5
2 years ago
2.2.3
2 years ago
2.2.4
2 years ago
2.2.2
6 years ago
2.2.1
6 years ago
2.2.0
6 years ago
2.1.0
6 years ago
2.0.0
7 years ago
1.1.3
8 years ago
1.1.2
8 years ago
1.1.1
8 years ago
1.1.0
10 years ago
1.0.3
11 years ago
1.0.2
11 years ago
1.0.1
11 years ago
1.0.0
11 years ago