Skip to content

sdgluck/path-__dirname

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

path-__dirname

Get a path in the __dirname

Note: this will not work for modules that are executed indirectly, for example testing engines like Jest.

Unlike the resolve-* these modules allow resolution of non-module paths.

Install

npm install --save path-__dirname
yarn add path-__dirname

Import

// ES2015
import dirname from 'path-__dirname'
// CommonJS
var dirname = require('path-__dirname')

Usage

dirname([path]) : String

Get a path in the dirname.

  • path {String} (optional) path to get in the dirname

Returns a string.

Example

import dirname from 'path-__dirname'

dirname() === __dirname //=> true
dirname('pineapple') //=> C:/User/Spongebob Squarepants/projects/bikini-bottom/pineapple

See also

Contributing

All pull requests and issues welcome!

If you're not sure how, check out the great video tutorials on egghead.io!

License

MIT © Sam Gluck

About

Get a path in the __dirname

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published