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

  • 5.0.2
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

path-normalize

Zero-dependency browser-oriented path.normalize.

npm version CircleCI codecov Patreon ko-fi

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 library is directly from Node's source.

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

Keywords

FAQs

Package last updated on 07 Sep 2020

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