dashboardjavacloudcoapiotiot-analyticsiot-platformiot-solutionskafkalwm2mmicroservicesmiddlewaremqttnettyplatformsnmpthingsboardvisualizationwebsocketswidgets
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.
|
|
7 years ago | |
|---|---|---|
| .. | ||
| dist | 7 years ago | |
| src | 7 years ago | |
| test | 7 years ago | |
| .codeclimate.yml | 7 years ago | |
| .editorconfig | 7 years ago | |
| .eslintrc | 7 years ago | |
| .travis.yml | 7 years ago | |
| LICENSE | 7 years ago | |
| README.md | 7 years ago | |
| package.json | 7 years ago | |
| webpack.config.js | 7 years ago | |
README.md
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#Attributes 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