Comparing version 0.0.10 to 0.0.11
{ | ||
"name": "urlconcat", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "Concats paths in an url, places slashes where necessary.", | ||
@@ -5,0 +5,0 @@ "main": "urlconcat.js", |
@@ -0,1 +1,3 @@ | ||
[![Build Status](https://travis-ci.org/andersem/urlconcat.svg?branch=master)](https://travis-ci.org/andersem/urlconcat) | ||
# urlconcat | ||
@@ -12,21 +14,36 @@ Concats paths in an url, places slashes where necessary. | ||
### CommonJS | ||
### Importing | ||
All these methods work: | ||
```javascript | ||
var urlconcat = require('urlconcat'); | ||
urlconcat.concat('http://localhost:8080/', 'search', 'something'); // 'http://localhost:8080/search/something' | ||
var concat = urlconcat.concat; | ||
``` | ||
### ES2015 | ||
```javacript | ||
import urlconcat from 'urlconcat'; | ||
const concat = urlconcat.concat; | ||
``` | ||
```javascript | ||
import urlconcat from 'urlconcat'; | ||
urlconcat.concat('http://localhost:8080/', 'search', 'something'); // 'http://localhost:8080/search/something' | ||
import { concat } from 'urlconcat'; | ||
``` | ||
or | ||
### Using | ||
It will place slashes between url parts, but not before query parameters: | ||
```javascript | ||
import { concat } from 'urlconcat'; | ||
concat('http://localhost:8080/', 'search', 'something'); // 'http://localhost:8080/search/something' | ||
concat('http://localhost:8080/', 'api/search', 'something', '?a=b&b=c'); | ||
// 'http://localhost:8080/api/search/something?a=b&b=c' | ||
``` | ||
It will remove double slashes: | ||
```javascript | ||
concat('http://localhost:8080/', '/search') | ||
// 'http://localhost:8080/search | ||
``` | ||
It will leave trailing slashes: | ||
```javascript | ||
concat('http://localhost:8080/', 'search/') | ||
// 'http://localhost:8080/search | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4508
48