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

require-plus

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

require-plus - npm Package Compare versions

Comparing version 2.1.1 to 2.1.2

36

lib/index.js

@@ -7,2 +7,3 @@ 'use strict';

const Path = require('path');
const Utils = require('basic-utils');

@@ -16,2 +17,3 @@ const internals = {

const parentDir = Path.dirname(module.parent.filename);

@@ -27,3 +29,3 @@ delete require.cache[__filename];

this.moduleSet = {};
if (Array.isArray(this._settings.directory)) {
if (Utils.isArray(this._settings.directory)) {
const length = this._settings.directory.length;

@@ -45,6 +47,7 @@ for (let i = 0; i < length; ++i) {

let mod;
Fs.readdirSync(directory).forEach((path) => {
const files = internals.readDir(directory);
files.forEach((path) => {
const joined = Path.resolve(directory, path);
if (Fs.statSync(joined).isDirectory()) {
if (Utils.isDir(joined)) {
const blacklist = new RegExp(this._settings.blacklist.join('|'), 'i').test(path);

@@ -94,31 +97,28 @@ if (!blacklist) {

internals.resolve = function (path) {
internals.readDir = (path) => {
if (!Path.isAbsolute(path)) {
path = Path.resolve(parentDir, path);
try {
return Fs.readdirSync(path);
}
if (!internals.isDir(path)) {
throw new Error('Directory ' + path + ' does not exist');
catch (e) {
throw e;
}
return path;
};
internals.isDir = function (path) {
internals.resolve = (path) => {
try {
path = Fs.lstatSync(path);
return path.isDirectory() ? true : false;
if (!Path.isAbsolute(path)) {
path = Path.resolve(parentDir, path);
}
catch (e){
return false;
}
return path;
};
module.exports = (options) => {
const plus = new RequirePlus(options);
return plus.moduleSet;
return new RequirePlus(options).moduleSet;
};
{
"name": "require-plus",
"version": "2.1.1",
"version": "2.1.2",
"description": "better require for directories",

@@ -28,10 +28,11 @@ "main": "lib/index.js",

"devDependencies": {
"code": "^3.0.1",
"coveralls": "^2.11.11",
"lab": "^10.9.0"
"code": "^4.0.0",
"coveralls": "^2.11.14",
"lab": "^11.1.0"
},
"dependencies": {
"deepmerge": "^0.2.10",
"hoek": "^4.0.1"
"basic-utils": "^1.7.0",
"deepmerge": "^1.2.0",
"hoek": "^4.1.0"
}
}
# require-plus
[![Build Status](https://travis-ci.org/simon-p-r/require-plus.svg?branch=master)](https://travis-ci.org/simon-p-r/require-plus)
[![Current Version](https://img.shields.io/npm/v/require-plus.svg)](https://www.npmjs.org/package/require-plus)
[![Coverage Status](https://coveralls.io/repos/github/simon-p-r/require-plus/badge.svg?branch=master)](https://coveralls.io/github/simon-p-r/require-plus?branch=master)
[![build status](https://travis-ci.org/simon-p-r/require-plus.svg?branch=master)](https://travis-ci.org/simon-p-r/require-plus)
[![Current Version](https://img.shields.io/npm/v/require-plus.svg?maxAge=1000)](https://www.npmjs.org/package/require-plus)
[![dependency Status](https://img.shields.io/david/simon-p-r/require-plus.svg?maxAge=1000)](https://david-dm.org/simon-p-r/require-plus)
[![devDependency Status](https://img.shields.io/david/dev/simon-p-r/require-plus.svg?maxAge=1000)](https://david-dm.org/simon-p-r/require-plus?type=dev)
[![Coveralls](https://img.shields.io/coveralls/simon-p-r/require-plus.svg?maxAge=1000)](https://coveralls.io/github/simon-p-r/require-plus)
Node module for requiring a directory tree, it will throw if not a valid directory and it will also throw if the object is not exported properly or cannot be required by require.

@@ -18,3 +19,3 @@

var options = {
const options = {
blacklist: ['node_modules', '.git', '.idea'],

@@ -24,5 +25,6 @@ extensions: ['.js','.json'],

};
var plus = require('require-plus')(options);
const plus = require('require-plus')(options);
console.log(plus);
//plus is an object
//plus is an object containing modules exported from above directories

@@ -29,0 +31,0 @@ ##Todo

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