Registry / testing / absolute

absolute

JSON →
library1.0.0jsnpmunverified

The `absolute` package is a minimalist utility designed to test whether a given string represents an absolute file path. Published over a decade ago (version 0.0.1, last updated February 2015), it served a simple purpose in the early Node.js ecosystem. The package performs basic string checks to determine if a path starts with a root directory separator (e.g., `/` on Unix-like systems). It is not actively maintained and is considered abandoned. For modern Node.js applications, the built-in `path.isAbsolute()` method, which is part of the core `path` module, is the recommended and superior alternative. `path.isAbsolute()` provides robust, platform-aware checks for absolute paths, handling nuances like Windows drive letters and UNC paths, which this `absolute` package does not. Developers should migrate away from this package to avoid potential issues related to lack of maintenance and limited functionality.

npm install absolute
INSTALL
IMPORT
SIG · ABSOLUTE
A
absolute
testingjavascriptv1.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

absolute
const absolute = require('absolute');
This package is CommonJS-only and was published before widespread ES Module adoption. It exports a single function as its module.exports.

Demonstrates how to import and use the 'absolute' function to check various path strings.

const absolute = require('absolute'); console.log(absolute('/home/dave')); // => true console.log(absolute('/something')); // => true console.log(absolute('./myfile')); // => false console.log(absolute('temp')); // => false
Debug
Known issues
breakingThis package is abandoned and has not been updated in over a decade. It is superseded by the built-in `path.isAbsolute()` method in Node.js, which offers more robust and platform-aware functionality.
fix
Migrate to `require('path').isAbsolute()` or `import { isAbsolute } from 'path';` for modern applications.
affects: >=0.0.1
gotchaThe `absolute` package performs simple string-based checks and does not inherently understand operating system-specific path semantics (e.g., Windows drive letters, UNC paths). This can lead to incorrect results on non-POSIX systems.
fix
Use Node.js's native `path.isAbsolute()` which is designed to handle platform differences correctly.
affects: >=0.0.1
gotchaThe package is strictly CommonJS (CJS) and does not provide native ES Module (ESM) exports. Attempting to use `import absolute from 'absolute';` in an ESM context without proper transpilation may lead to errors.
fix
If you must use this package (which is discouraged), ensure your environment supports CommonJS `require()` or use a build step that can transpile CJS to ESM. The recommended fix is to switch to `path.isAbsolute()`.
affects: >=0.0.1
Errors
Common errors & fixes
TypeError: absolute is not a function
Attempting to use named import syntax (e.g., `import { absolute } from 'absolute';`) for a CommonJS package that exports a single function as its `module.exports`.
fix
Use the CommonJS default import pattern: `const absolute = require('absolute');`
ReferenceError: require is not defined (in ES Module scope)
Attempting to use `require()` within an ES Module (ESM) file, where `require` is not globally available.
fix
If running in an ESM environment, you cannot directly use `require()`. You should either refactor your file to use ESM imports for other packages or, preferably, switch to Node.js's built-in `path.isAbsolute()` which supports both CJS and ESM.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
74 hits · last 30 days
node
62
OpenAI (training)
1
Resources