Socket
Book a DemoInstallSign in
Socket

require-spy

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

require-spy

Check if a given node module have been required

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

require-spy

Check if a given node module have been required.

Build status js-standard-style

Installation

npm install require-spy

Usage

var spy = require('require-spy')
var http = require('http')

// all modules required after spy.start is called are logged
spy.start()

var fs = require('fs')

console.log(spy.check('http')) // false
console.log(spy.check('fs')) // true

API

spy.start()

Start the spy.

Alternatively you can require the require-spy/start script either inline or via the command line:

node -r require-spy/start app.js

This will auto-start the spy.

spy.check(name)

Returns true if the given name have already been required. Otherwise `false.

License

MIT

Keywords

require

FAQs

Package last updated on 07 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts