Package Exports
- proper-url-join
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (proper-url-join) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
proper-url-join
Like path.join but for a URL.
Installation
$ npm install proper-url-join --save-dev
Motivation
There are a lot of packages that attempt to provide this functionality but they all have issues.
This package exists to properly offer the ability to join urls.
Usage
import urlJoin from 'url-join';
urlJoin('foo', 'bar'); // /foo/bar
urlJoin('/foo/', '/bar/'); // /foo/bar
urlJoin('foo', '', 'bar'); // /foo/bar
urlJoin('foo', undefined, 'bar'); // /foo/bar
urlJoin('foo', null, 'bar'); // /foo/bar
urlJoin('foo', 'bar', { leadingSlash: false }); // foo/bar
urlJoin('foo', 'bar', { trailingSlash: true }); // /foo/bar/
urlJoin('foo', 'bar', { leadingSlash: false, trailingSlash: true }); // foo/bar/Available options:
leadingSlash: Add a leading/(defaults totrue)trailingSlash: Add a trailing/(defaults tofalse)
Tests
$ npm test$ npm test -- --watch during development