current-path-join

0.1.1 • Public • Published

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('my', 'path', 'to', 'you')
// => {absolute}/my/path/to/you

Alright, it's that.

Internal

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

Readme

Keywords

Package Sidebar

Install

npm i current-path-join

Weekly Downloads

1

Version

0.1.1

License

MIT

Unpacked Size

3.11 kB

Total Files

4

Last publish

Collaborators

  • jinghua000