project-name
Get the name of a project, from package.json, git config, basename of the current working directory or, when all else fails, module caller.
Install
Install with npm
$ npm i project-name --save
Usage
The project name is resolved in this order:
- check for package.json, if exists
name
is returned - check for git repository, if exists return repository
name
- use the
path.basename
of the current working directory
var name = require('project-name');
name();
Optionally specify a current working directory:
var name = require('project-name');
name('foo');
Related projects
Running 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 © 2015 Jon Schlinkert
Released under the MIT license.
This file was generated by verb-cli on October 20, 2015.