Socket
Socket
Sign inDemoInstall

canonical-path

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

canonical-path

paths that always use forward slashes


Version published
Maintainers
1
Weekly downloads
299,784
decreased by-28.65%

Weekly downloads

Readme

Source

Canonical Path Utility

When writing node.js code that must support Windows and *nix OSes, it is sometimes frustrating that path segments are separated differently depending upon the environment.

Ironically, we can pass in paths with either separator and the library will normalize it to the current OS's format. But it then returns paths using the current OS's separator.

This utility simple wraps the built-in path library such that it only ever returns path segments separated by forward slashes (/).

Installation

npm install --save canonical-path

Usage

var path = require('canonical-path');

var p = path.normalize('a/b/../c');
// p === 'a/c';

Testing

npm test

Keywords

FAQs

Last updated on 24 Oct 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