Skip to content

[Replacement]: relative #874

Description

@gameroman

Package to replace

relative

Suggested replacement(s)

Cross-platform / Unixified paths

import path from 'node:path/posix'

path.relative('/a/b', '/a/c/file.js')  // '../c/file.js' 

Relative path from a file

import path from 'node:path'

const fileA = 'src/components/Button.js'
const fileB = 'src/utils/helpers.js'

path.relative(path.dirname(fileA), fileB)  // '../utils/helpers.js'

Relative to current working directory

import path from 'node:path'

path.relative(process.cwd(), to)

Manifest type

micro-utility (tiny utility replaceable with native code or removal)

Rationale

A simple util handling 3 different concerns in the same package

Availability

No response

Code example (optional)

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedUsed to signal if a suggested replacement has been accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions