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

@aduth/is-dependency

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

@aduth/is-dependency

Quickly determine if the given package(s) are dependencies in the current directory

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@aduth/is-dependency

A utility to quickly determine if the given package(s) are dependencies within the current working directory.

This implementation optimizes speed over accuracy, synchronously returning true if the package is defined as a dependency in the current directory's package.json, regardless of whether it's actually installed.

Installation

Install using npm:

npm install @aduth/is-dependency

Usage

Pass a name or array of names of dependencies and receive a boolean value in return.

import { isDependency } from '@aduth/is-dependency';

isDependency('@aduth/is-dependency');
// true

API

isDependency

Returns true if the given package name or array of names are all defined as dependency's in the current working directory's relative package.json.

Optionally, pass an object of options to control the behavior.

export type Options = {
	/**
	 * Fields to check in `package.json`.
	 */
	fields: string[];
};

export function isDependency(
	nameOrNames: string | string[],
	options?: Partial<Options> | undefined
): boolean;

License

Copyright 2021 Andrew Duthie

Released under the MIT License.

Keywords

FAQs

Package last updated on 18 Dec 2021

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