npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nojaja/pathutil

v1.0.9

Published

Aims to standardize path representations across different operating systems, using Linux-style paths as the common format

Readme

NodePathUtil

NodePathUtil is a utility class designed to standardize path representations across different operating systems. It uses Linux-style paths as the common format to ensure consistency when working with paths from various platforms.

Features

  • Path separator normalization
  • Absolute path detection
  • Conversion from relative to absolute paths
  • Conversion from absolute to relative paths
  • Support for both Windows and Unix-based systems

Installation

npm install @nojaja/pathutil

Usage

import { PathUtil } from '@nojaja/pathutil';

// Normalize path separators
const normalizedPath = PathUtil.normalizeSeparator('C:\\Users\\example\\Documents');
console.log(normalizedPath); // Output: C:/Users/example/Documents

// Check if path is absolute
const isAbsolute = PathUtil.isAbsolute('/home/user/documents');
console.log(isAbsolute); // Output: true

// Convert relative path to absolute path
const absolutePath = PathUtil.absolutePath('../documents', '/home/user');
console.log(absolutePath); // Output: /home/documents

// Convert absolute path to relative path
const relativePath = PathUtil.relativePath('/home/user/documents', '/home');
console.log(relativePath); // Output: user/documents

API

PathUtil.normalizeSeparator(targetPath: string): string

Normalizes path separators to Linux-style (forward slashes).

PathUtil.isAbsolute(targetPath: string): boolean

Determines whether the given path is absolute.

PathUtil.absolutePath(targetPath: string, currentDirectory?: string): string

Converts a relative path to an absolute path. If currentDirectory is not specified, it uses the current working directory.

PathUtil.relativePath(targetPath: string, currentDirectory?: string): string

Converts an absolute path to a relative path. If currentDirectory is not specified, it uses the current working directory.

Test Structure

This project includes both unit tests and integration tests to ensure reliability and correctness.

Unit Tests

Unit tests validate individual methods in isolation using TypeScript source files:

npm test
  • Location: tests/PathUtil/
  • Files: *.spec.js
  • Configuration: jest.config.js
  • Purpose: Test source code logic with mocks and isolated test cases

Integration Tests

Integration tests validate the bundled output that end users consume. These tests ensure that:

  1. All public APIs are correctly exported from the bundle
  2. No regression issues from the build process (e.g., missing exports)
  3. Methods work correctly when accessed through the packaged library
npm run test:integration
  • Location: tests/integration/
  • Files: *.test.js
  • Configuration: jest.integration.config.js
  • Purpose: Test the actual bundled dist/PathUtil.bundle.js file as users will consume it

Run All Tests

To run both unit and integration tests:

npm run test:all

Test Development Workflow

# 1. Make changes to source code
# 2. Run unit tests to validate logic
npm test

# 3. Build the bundle
npm run build

# 4. Run integration tests to validate the bundled output
npm run test:integration

# 5. Or run all tests together
npm run test:all

License

This project is released under the MIT License. See the LICENSE file for details.

Contributing

Contributions of all kinds are welcome, including bug reports, feature requests, and pull requests. For major changes, please open an issue first to discuss what you would like to change.