JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 106
  • Score
    100M100P100Q81806F
  • License

Resolve paths to globally installed npm modules using glob patterns.

Package Exports

  • resolve-up

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (resolve-up) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

resolve-up NPM version

Resolve paths to globally installed npm modules using glob patterns.

Install with npm

npm i resolve-up --save

Usage

var resolveup = require('resolve-up');
console.log(resolveup('generator-*'));

Results in an array of module directories like:

[ '/usr/local/lib/node_modules/generator-foo',
  '/usr/local/lib/node_modules/generator-bar',
  '/usr/local/lib/node_modules/generator-baz' ]

This only returns directories so you can loop over them and create your own logic to get what you need.

Filter function

You can also pass a filter function as the last argument. Note that the function will be used to eliminate paths before the remaining paths are tested against the glob patterns.

var generators = resolveup('generator-*', function(segment, fp, stat) {
  // `segment` - the current directory or file name being looped over
  // `fp` - the full, absolute file path
  // `fs.stat` object
});

Run tests

Install dev dependencies:

npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright (c) 2015 Jon Schlinkert
Released under the MIT license


This file was generated by verb-cli on April 03, 2015.