snyk-resolve
Resolves the location of a node package given a path
Last updated 9 years ago by remy .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install snyk-resolve 
SYNC missed versions from official npm registry.

snyk-resolve

Finds the filename for a given package name and starting directory. This is used to resolve packages in situations like npm@3 and deduped packages.

Supports both async (via promises) and sync methods of looking up.

Usage

var resolve = require('snyk-resolve');

// async (promise based)
resolve('foo', process.cwd()).then(function (dir) {
  // assuming that `foo` lived in the root of your drive
  console.assert(dir === '/node_modules/foo');
});

// sync
var dir = resolve.sync('bar', process.cwd());
// throws Error('package not found bar')

See tests for more examples.

Supports

  • npm@2 directory structure
  • npm@3 directory structure
  • deduped modules
  • scoped modules

Current Tags

  • 1.1.0                                ...           latest (4 years ago)

3 Versions

  • 1.1.0                                ...           4 years ago
  • 1.0.1                                ...           7 years ago
  • 1.0.0                                ...           9 years ago
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dependencies (2)
Dev Dependencies (6)

Copyright 2013 - present © cnpmjs.org | Home |