Socket
Book a DemoInstallSign in
Socket

path-here

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

path-here

A simple module to get the path with __dirname

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

path-here

Status: npm version npm downloads Build Status Code Coverage

This micro-lib will take your code from this:

var path = require('path');
var srcDirectory = path.resolve('src');

to this:

var here = require('path-here');
var srcDirectory = here('src');

Note: This is actually not all that useful. Originally when I made this I thought it was doing something it wasn't. However, something more useful that it allows you to do (and the reason I haven't deprecated it) is this:

var here = require('path-here');
var there = here.dir('~/Developer/starwars-names');
var starWarsNamesSrc = there('src');

Examples

var here = require('path-here');
var srcDir = here('src');
var somePath = here('some/path');
var somePathWithMultipleParams = here('some', 'path'); // <-- same result as previous
var withTrailingSlash = here('src/'); // <-- result has a trailing slash
var withPrefixSlash = here('/src'); // <-- same as here('src');

// specify a different root other than process.cwd()
var there = here.dir('/usr');
var bin = there('bin');

Other info

LICENSE -> MIT

Keywords

path

FAQs

Package last updated on 19 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts