try-resolve
Try and resolve a filename
Last updated 5 years ago by sebmck .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install try-resolve 
SYNC missed versions from official npm registry.

try-resolve

Installation

$ npm install try-resolve

Usage

var resolve = require("try-resolve");

resolve(filename, [require])

  • filename is a filename to be resolved.
  • require is an optional instance of the require function from any file.

Returns null if the file can't be required, otherwise it returns an absolute filename string.

Example

if (require("try-resolve")("/home/sebastian/file")) {
  // this file can be required
} else {
  // it can't
}

resolve.relative(filename)

Resolve a filename relative to the cwd.

Current Tags

  • 1.0.1                                ...           latest (5 years ago)

2 Versions

  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago

Copyright 2014 - 2016 © taobao.org |