New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

folquire

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

folquire - npm Package Compare versions

Comparing version 0.0.3 to 0.1.0

.github/workflows/node.js.yml

10

index.js

@@ -15,3 +15,9 @@ 'use strict'

*/
module.exports = (folder, { async = false } = {}) => {
module.exports = (folder, { async = false, ignore = [] } = {}) => {
if (!Array.isArray(ignore)) {
throw new TypeError('Ignore must be an array')
}
const filterIgnoredModules = module => !ignore.includes(module)
if (async) {

@@ -22,2 +28,3 @@ return fs

.then(files => files.filter(filterModules))
.then(modules => modules.filter(filterIgnoredModules))
.then(modules => modules.map(mapModules(folder)))

@@ -32,4 +39,5 @@ .then(Object.fromEntries)

.filter(filterModules)
.filter(filterIgnoredModules)
.map(mapModules(folder))
)
}

5

package.json
{
"name": "folquire",
"version": "0.0.3",
"version": "0.1.0",
"description": "Requires all the modules from a folder",
"main": "index.js",
"scripts": {
"test": "jest"
"test": "jest --coverage",
"test:watch": "npm test -- --watch"
},

@@ -9,0 +10,0 @@ "repository": {

@@ -58,1 +58,13 @@ ![Folquire banner](./assets/folquire.png)

```
### Ignore modules
```js
'use strict'
const folquire = require('folquire')
const modules = folquire(__dirname + '/math', {
ignore: ['add.js']
})
```

@@ -27,2 +27,16 @@ const folquire = require('..')

})
describe('Parameter \'ignore\'', () => {
test('Should throw an error when \'ignore\' is not an array', () => {
expect(() => {
folquire(__dirname + '/folder', { ignore: 123 })
}).toThrowError(new TypeError('Ignore must be an array'))
})
test('Should not import the modules specified in \'ignore\' parameter', () => {
const result = folquire(__dirname + '/folder', { ignore: ['add.js'] })
expect(result).not.toHaveProperty('add', require('./folder/add'))
})
})
})
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