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

  • 4.0.9
  • 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 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 13 Mar 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