Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

attr-accept

Package Overview
Dependencies
Maintainers
3
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

attr-accept - npm Package Compare versions

Comparing version 2.2.2 to 2.2.3

2

package.json
{
"name": "attr-accept",
"description": "JavaScript implementation of the \"accept\" attribute for HTML5 <input type=\"file\">",
"version": "2.2.2",
"version": "2.2.3",
"main": "dist/index.js",

@@ -6,0 +6,0 @@ "module": "dist/es/index.js",

# attr-accept
JavaScript implementation of the "accept" attribute for HTML5 `<input type="file">`
> JavaScript implementation of the "accept" attribute for HTML5 `<input type="file">`
![](https://github.com/react-dropzone/attr-accept/workflows/Test/badge.svg)
[![npm version](https://badge.fury.io/js/attr-accept.svg)](https://badge.fury.io/js/attr-accept)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![npm](https://img.shields.io/npm/v/attr-accept.svg?style=flat-square)](https://www.npmjs.com/package/attr-accept)
![Tests](https://img.shields.io/github/actions/workflow/status/react-dropzone/attr-accept/test.yml?branch=master&style=flat-square&label=tests)
See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept for more information.
See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#attr-accept for more information.
Installation
=====
## Installation
```sh

@@ -16,4 +14,3 @@ npm install --save attr-accept

Usage
=====
## Usage
```javascript

@@ -49,1 +46,5 @@ var accept = require('attr-accept');

```
## Contributing
Checkout the organization [CONTRIBUTING.md](https://github.com/react-dropzone/.github/blob/main/CONTRIBUTING.md).

@@ -8,3 +8,3 @@ /**

* @param file {File} https://developer.mozilla.org/en-US/docs/Web/API/File
* @param acceptedFiles {string}
* @param acceptedFiles {string|string[]}
* @returns {boolean}

@@ -18,2 +18,5 @@ */

: acceptedFiles.split(',')
if (acceptedFilesArray.length === 0) {
return true
}
const fileName = file.name || ''

@@ -20,0 +23,0 @@ const mimeType = (file.type || '').toLowerCase()

@@ -310,2 +310,23 @@ /* eslint no-unused-expressions: 0 */

})
it('should allow any file if the accepted files is an empty array or string', () => {
expect(
accept(
{
name: 'testfile.jpg',
type: 'img/jpeg'
},
''
)
).toBe(true)
expect(
accept(
{
name: 'testfile.pdf',
type: 'random/type'
},
[]
)
).toBe(true)
})
})

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc