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

detective-typescript

Package Overview
Dependencies
Maintainers
4
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detective-typescript

Get the dependencies of a TypeScript module

  • 13.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created

What is detective-typescript?

The detective-typescript npm package is designed to analyze TypeScript files to extract dependencies, such as import and require statements. It can be used to understand the structure of a TypeScript project, identify unused dependencies, or automate tasks that involve analyzing the dependency graph of a project.

What are detective-typescript's main functionalities?

Extract import statements

This feature allows you to extract all the import statements from a given TypeScript file content. The code sample demonstrates how to use detective-typescript to parse a string containing TypeScript code and return an array of the imported modules.

const detective = require('detective-typescript');
const content = `import { join } from 'path';
import * as fs from 'fs';`;
const dependencies = detective(content);

Extract require statements

In addition to import statements, detective-typescript can also extract require statements from TypeScript files. This is useful for projects that use a mix of ES6 and CommonJS modules. The code sample shows how to extract dependencies from a string of TypeScript code that uses require.

const detective = require('detective-typescript');
const content = `const express = require('express');
const app = express();`;
const dependencies = detective(content);

Other packages similar to detective-typescript

Keywords

FAQs

Package last updated on 14 Apr 2024

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