@fav/path.relative

0.9.0 • Public • Published

@fav/path.relative NPM version

Provides same behaviors of path.relative module for all versions of node.js

Install

For installing @fav/path with npm:

$ npm install @fav/path --save

For installing only @fav/path.relative with npm:

$ npm install @fav/path.relative --save

Usage

When installing @fav/path:

const path = require('@fav/path');

path.relative('path/to/aaa/bbb', 'path/to/ccc/ddd')
// => '../../ccc/ddd'

When installing @fav/path.relative:

const relative = require('@fav/path.relative');

relative('path/to/aaa/bbb', 'path/to/ccc/ddd')
// => '../../ccc/ddd'

API

relative(from, to)

Returns a relative path from from to to.

Arguments
  • from [string] : an absolute or relative path string.
  • to [string] : an absolute or relative path string.
Errors
  • [TypeError] : if neither from nor to is a string.

License

Copyright (C) 2016 Takayuki Sato

This program is free software under MIT License. See the file LICENSE in this distribution for more details.

Readme

Keywords

Package Sidebar

Install

npm i @fav/path.relative

Weekly Downloads

0

Version

0.9.0

License

MIT

Last publish

Collaborators

  • sttk