Socket
Book a DemoInstallSign in
Socket

@nodesecure/dependa

Package Overview
Dependencies
Maintainers
4
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nodesecure/dependa

Identify and categorize Node.js dependencies (builtins, third parties..)

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
4
Created
Source

Dependa

Identify and categorize Node.js dependencies (builtins, alias, third parties..). The module and the code has been inspired by builtins and builtin-modules.

Features

  • Several ways to use the API (get and is) to allow any kind of custom code.
  • First class support of Node.js protocol node:.
  • Wider API not limited or restricted to Node.js core modules.

Getting Started

This package is available in the Node Package Repository and can be easily installed with npm or yarn.

$ npm i @nodesecure/dependa
# or
$ yarn add @nodesecure/dependa

Usage example

import * as dependa from "@nodesecure/dependa";

console.log(dependa.is.builtins("node:fs/promises"));
console.log(dependa.is.builtins("stream"));

const builtins = dependa.get.builtins();
console.log(builtins);

API

is.builtins(moduleName: string): boolean

Return true if the given moduleName is a Node.js core dependency.

is.subpath(moduleName: string): boolean

Return true if the given moduleName is a Subpath import (starting with #).

is.filesystem(moduleName: string): boolean

Return true if the given moduleName is a filesystem dependency (starting with /, ./ or ../).

is.thirdparty(moduleName: string): boolean

Return true if the given moduleName is a third-party dependency (which mean the module is not a subpath, builtins or filesystem).

get.builtins(options): Set< string >

Return an ES6 Set of all Node.js builtins (core dependency).

get.kind(moduleName: string): "subpath" | "filesystem" | "builtins" | "thirdparty"

Return the kind of the given module name.

Contributors ✨

All Contributors

Thanks goes to these wonderful people (emoji key):


Gentilhomme

💻

License

MIT

Keywords

dependency

FAQs

Package last updated on 09 Jul 2022

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