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

require-in-the-middle

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

require-in-the-middle - npm Package Compare versions

Comparing version 2.0.3 to 2.1.0

12

index.js

@@ -13,4 +13,10 @@ 'use strict'

var patched = {}
if (typeof Module._resolveFilename !== 'function') {
console.error('Error: Expected Module._resolveFilename to be a function (was: %s) - aborting!', typeof Module._resolveFilename)
console.error('Please report this error as an issue related to Node.js %s at %s', process.version, require('./package.json').bugs.url)
return
}
hook.cache = {}
Module._load = function (request, parent, isMain) {

@@ -43,4 +49,4 @@ var exports = orig.apply(Module, arguments)

if (patched[filename]) return exports // abort if module have already been processed
patched[filename] = true
if (hook.cache[filename]) return exports // abort if module have already been processed
hook.cache[filename] = exports

@@ -47,0 +53,0 @@ return onrequire(exports, name, basedir)

{
"name": "require-in-the-middle",
"version": "2.0.3",
"version": "2.1.0",
"description": "Module to hook into the Node.js require function",

@@ -43,5 +43,5 @@ "main": "index.js",

"coordinates": [
55.6665906,
12.580154
55.6665607,
12.5801843
]
}

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

test('all modules', function (t) {
t.plan(6)
t.plan(8)

@@ -29,5 +29,10 @@ var n = 1

var http = require('http')
var net = require('net')
t.equal(http.foo, 1)
t.equal(net.foo, 2)
t.equal(require('http').foo, 1)
t.equal(require('net').foo, 2)
t.equal(require('http').foo, 1)
t.deepEqual(hook.cache['http'], http)
t.deepEqual(hook.cache['net'], net)
t.equal(n, 3)

@@ -34,0 +39,0 @@ })

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