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

find-requires

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

find-requires

Find all require() calls. Fast and solid implementation backed with direct scanner and esprima AST parser

  • 0.2.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
937K
increased by2.65%
Maintainers
1
Weekly downloads
 
Created

What is find-requires?

The find-requires npm package is a tool for analyzing JavaScript code to find and list all the require statements. It is useful for understanding dependencies in a codebase, refactoring, or simply auditing the use of modules.

What are find-requires's main functionalities?

Find all require statements in a file

This feature allows you to find all the require statements in a given JavaScript file. The code reads the content of a file and uses the find-requires package to extract all the require statements.

const findRequires = require('find-requires');
const fs = require('fs');

const fileContent = fs.readFileSync('path/to/your/file.js', 'utf8');
const requires = findRequires(fileContent);
console.log(requires);

Find require statements with options

This feature allows you to find require statements with additional options. For example, setting the 'raw' option to true will return the raw AST nodes instead of just the module names.

const findRequires = require('find-requires');
const fs = require('fs');

const fileContent = fs.readFileSync('path/to/your/file.js', 'utf8');
const options = { raw: true };
const requires = findRequires(fileContent, options);
console.log(requires);

Other packages similar to find-requires

Keywords

FAQs

Package last updated on 28 Dec 2018

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

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