🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

relative-package

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

relative-package

Find package.json (or another) relative to a given file

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

relative-package Build Status NPM version

Find the package.json (or another) relative to a given path

Getting Started

Install the module with: npm install relative-package

Usage

Find package.json:

var relativePackage = require('relative-package');

console.log('package.json relative to where relativePackage() is called:\n  %s',
  relativePackage())

console.log('package.json relative a given path:\n  %s',
  relativePackage('./test/relative-package.test.js'))

console.log('package.json relative to a given absolute path:\n  %s',
  relativePackage(__dirname + '/readme.md'))

console.log('package.json relative to a given package:\n  %s',
  relativePackage('mocha'))

console.log('package.json relative to a given package:\n  %s',
  relativePackage('mocha'))

Find any other file:

var relativePackage = require('relative-package');

console.log('.gitignore relative to where relativePackage() is called:\n  %s',
  relativePackage(null, '.gitignore'))

console.log('Readme.md of a given package:\n  %s',
  relativePackage('mocha', 'Readme.md'))

(see demo.js)

Keywords

package.json

FAQs

Package last updated on 12 Sep 2014

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