0.9.0 • Published 10 years ago

@fav/path.relative v0.9.0

Weekly downloads
12
License
MIT
Repository
github
Last release
10 years ago

@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.

0.9.0

10 years ago

0.8.0

10 years ago