Skip to content

jinghua000/current-path-join

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

current-path-join

Build Status npm module

Introduction

When i need to read some file or do something similar, i have to write like this

const path = require('path')

path.join(__dirname, './path/to/something')

Oh, it's redundantly.

This tiny library make this scene a little simpler.

Usage

In Node Only.

npm i -D 'current-path-join'
yarn add -D 'current-path-join'

Then

const join = require('current-path-join')

join('path','to','something')
// => {absolute}/path/to/something

Alright, it's that.

Internal

// src/index.js

module.exports = function (...paths) {
  return path.join(
    path.dirname(module.parent.filename),
    ...paths
  )
}

About

Join the path with current directory.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published