Socket
Socket
Sign inDemoInstall

dependit

Package Overview
Dependencies
4
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    dependit

Find the connection inside your project files


Version published
Maintainers
1
Install size
1.04 MB
Created

Readme

Source

dependit

Parse all the imported modules inside the file(Only ES Modules supported)

To install:

npm install dependit -S

Usage

import getDependency from 'dependit'

const filepath = '/path/to/your/file'
const result = getDependency(filepath)

API Documentation

getDependency(filepath)

  • filepath absolute path to your file
Returned object

The return value is an object with all the dependencies information. The object's structure is listed below using TypeScript.

interface Result {
  path: string,
  dependencies: Array<Dependency>
}

interface Dependency {
  source: string,
  imported: Array<ImportedItem>
}

interface ImportedItem {
  value: string,
  local: string,
  type: ImportType
}

enum ImportType {
  default = 'ImportDefault',
  import = 'Import',
  namespace = 'ImportNamespace'
}

Supported file types

Currently only 4 types are supported:

  • .js
  • .jsx
  • .ts
  • .vue

Keywords

FAQs

Last updated on 30 Jan 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc