path-to

0.1.4 • Public • Published

path-to

Build Status Coverage Status

Description

A simple abstraction to identify the path and request your files and folders in a Node.js project.

Installation

npm install path-to --save

Usage

Without path-to module:

 
var dep1 = require( '../../../../file' );
var dep2 = require( '../../../../../../folder' );
var dep3 = require( '../../../folder' );
var dep4 = require( '../../../another-folder' );
 

With path-to module:

 
var path = require( 'path-to' );
 
var dep1 = require( path( 4, 'file' ));
var dep2 = require( path( 6, 'folder' ));
var dep3 = require( path( 3, 'folder' ));
var dep4 = require( path( 3, 'another-folder' ));
 

If you want to use just the ../../../ abstraction, you could use the path-to in that manner:

 
var path = require( 'path-to' )( 4 );
 
var dep1 = require( path + 'file' );
var dep2 = require( path + 'folder' );
var dep4 = require( path + 'another-folder' );
 

Real Example

You could look at this folder to see a working example.

In app.js file, we loaded the path-to module and used it in two different forms.

Tests

npm test

Contributing

  • Take care to maintain the existing coding style.
  • Add unit tests for any new or changed functionality.
  • Lint and test your code.

Release History

  • 0.1.0 Initial release

Package Sidebar

Install

npm i path-to

Weekly Downloads

0

Version

0.1.4

License

MIT

Last publish

Collaborators

  • ericdouglas