0.0.3 • Published 1 year ago

nyxpath v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Cover

version downloads size

💡 Why

Have you ever wondered why the path separators for Windows and macOS, Linux, and other Posix operating systems are different? It turns out that for 🕰️ historical reasons, Windows chose to use backslashes \ for separating paths instead of the slash / used by other operating systems. Nowadays, Windows supports both slashes and backslashes for paths, but this can lead to inconsistent code behavior. When running on a Windows operating system, Node.js's built-in path module assumes that Windows-style paths are being used, which makes for inconsistent code behavior between Windows and POSIX.

👉 This is where pathe comes in! It provides identical exports to Node.js's built-in path module, but with normalization on all operations and written in modern ESM/Typescript. Plus, it has no dependency on Node.js! 🤯

🚀 This package is a drop-in replacement for the Node.js path module and ensures that paths are normalized with a slash / for consistent code behavior across all environments, including Node.js. So why not give pathe a try and start enjoying normalized paths? 🔧

🌟 With pathe, you can rest assured that your code will behave consistently and seamlessly, regardless of the operating system you are using. Happy coding! 🚀

🛠️ Usage

Install using nyxi, pnpm, npm or yarn:

# nyxi
nyxi nyxpath

# pnpm 
pnpm i nyxpath

# npm
npm i nyxpath

# yarn
yarn add nyxpath

Import:

// ESM / Typescript
import { resolve } from 'nyxpath'

// CommonJS
const { resolve } = require('nyxpath')

📖 Read more about path utils from Node.js documentation and rest assured behavior is ALWAYS like POSIX regardless of your input paths format and running platform!

🎁 Extra utilties

Pathe exports some extra utilities that do not exist in standard Node.js path module. In order to use them, you can import from nyxpath/utils subpath:

import { filename, normalizeAliases, resolveAlias } from 'nyxpath/utils'

🔒 License

MIT. Made with 💞

Some code used from Node.js project. See LICENSE.