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

packaged-path-parse

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

packaged-path-parse

path.parse() from Node.js as a standalone package

  • 9.11.1-rc1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

path.parse() from Node.js as a standalone package

path.parse() from a current Node.js version (matching this package version), packaged into a stand-alone module, without deps (including Node.js core).

Consider using this package through compatible-path-parse wrapper to avoid unnecessary version updates and to ensure proper deduplication, see #semver for explanation.

usage

// Note: use compatible-path-parse wrapper instead in require
const pathParse = require('packaged-path-parse')
pathParse(path) // platform-dependant, default — posix
pathParse.posix(path) // posix
pathParse.win32(path) // win32

path.parse() from Node.js

Documented in Node.js Documentation.

Clean

No deps on any modules, including Node.js core modules.

ES3-compatible. Single file.

Can be run in browser environment natively.

Ponyfill

This module fits all definitions of being a ponyfill.

Fast

Uses the new code from Node.js that avoids using regexes — there is not a single regex present here.

That was done mainly for performance reasons in Node.js, and path parsing became faster.

Tested

Tested to have the exact same behavior as the corresponding Node.js version path.parse(). Tests are generated from Node.js code automatically, based on strings present in Node.js path tests, and validated on any version.

Also tested for identical behavior on brute-forced strings.

Up-to-date

Based on a recent Node.js verson.

How recent? That's easy to tell — it matches with this package version!

That also makes testing easier.

Also, the Node.js (and this package) version is exported through .version property.

Semver?

Up-to-date section outlined why it was chosen to keep the Node.js package version numbering for this package — to provide clear understanding of the Node.js version used as the source, and to give predictable behavior.

Because of that while packaged-path-parse conforms to semver requirements, it bumps versions more often than it should be done. But there is a fix for that!

The version of packaged-path-parse is mirrored from Node.js version, and not all semver-major changes in Node.js must be semver-major changes in path.parse, as well as not all semver-minor changes in Node.js are semver-minor changes in path.parse.

All semver-major changes in path.parse are semver-major in Node.js, and all semver-minor changes in path.parse are semver-minor in Node.js, so you will never miss those.

It is recommended to use compatible-path-parse instead, which is a wrapper around this module that takes care of not bumping major/minor versions when path.parse was not affected by those — that way you and your users will get important updates faster, and that will better de-duplicate the code in case of several packages using this one.

License

MIT. See LICENSE file.

Keywords

FAQs

Package last updated on 07 Apr 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