Socket
Socket
Sign inDemoInstall

cwp

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cwp

Get a path string relative to the current working directory.


Version published
Maintainers
1
Install size
7.23 kB
Created

Changelog

Source

1.0.1 - 2018-02-23

Fixes

  • update URLs & author field

Chores

  • add contributing guidelines
  • update license
  • update deps, remove faucet, move test file down
  • update badges
  • add tests, update contribs
  • update readme

Readme

Source

cwp

npm travis standard downloads

Get a path string relative to the current working directory.

i.e., Current Working Path.

About

It just pass arguments to path.join with process.cwd() prepended.

A very minimal (perhaps totally unnecessary) shortcut.

Install

npm install cwp

Usage

var cwp = require('cwp')
var file = cwp('path/to', 'file')

Unix filesystem notation, strings for each entity, or a mix of both are all supported. The API is the same as path.join -- the only difference is that the current working directory is always automatically prepended.

Example

Given the process is running in /Users/ng/dev/github/cwp/, here are some example outputs.

cwp('package.json')
// -> '/Users/ng/dev/github/cwp/package.json'

cwp('test', 'index.js')
// -> '/Users/ng/dev/github/cwp/test/index.js'

cwp('lib/secret/dir', 'file')
// -> '/Users/ng/dev/github/cwp/lib/secret/dir/file'

cwp('../../../.ssh/id_rsa')
// -> '/Users/ng/.ssh/id_rsa'

Tests

npm install
npm test

Contributing

Contributions welcome! Please read the contributing guidelines before getting started.

License

ISC

Keywords

FAQs

Last updated on 23 Feb 2018

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc