Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

path-normalize

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

path-normalize

Zero-dependency browser-oriented path.normalize

  • 3.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10K
increased by92.07%
Maintainers
1
Weekly downloads
 
Created
Source

path-normalize

Zero-dependency browser-oriented path.normalize.

npm version CircleCI codecov

path-normalize is different from normalize-path; normalize-path only handles slashes, while this lib is a browser-focused version of the POSIX path.normalize in Node.

path-normalize also differs from Node's path.normalize. path-normalize handles uri-encoded strings.

MOst of this code is heavily based on code in Node.


Installation

npm i path-normalize

Usage

const normalize = require('path-normalize')
const normal = (somePath) => normalize(somePath)

Slightly more real-world example:

import normalize from 'path-normalize'

// imaginary client-side router api
router.route('/foo/*', (pathname) => {
  const normalized = normalize(pathname)
  if (normalized !== pathname) {
    router.redirect(normalized)
  } else {
    renderFoo()
  }
})

See also: react-router-path-normalize.

License

MIT

Keywords

FAQs

Package last updated on 12 Aug 2018

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc