Comparing version 1.0.22 to 1.0.23
@@ -74,2 +74,3 @@ import { MutableRefObject, DependencyList } from 'react'; | ||
* (path = '?foo=bar', url = 'a.com/') => '?foo=bar' | ||
* (path = 'bar', url = 'a.com/?foo=') => 'bar' | ||
* (path = 'foo', url = 'a.com') => '/foo' | ||
@@ -82,4 +83,6 @@ * (path = 'foo', url = 'a.com/') => 'foo' | ||
* (path = '/foo') => '/foo' | ||
* (path = '&foo=bar', url = 'a.com?b=k') => '&foo=bar' | ||
* (path = '&foo=bar') => '&foo=bar' | ||
*/ | ||
export declare const addSlash: (input?: string | undefined, url?: string | undefined) => string; | ||
export {}; |
@@ -277,2 +277,3 @@ "use strict"; | ||
* (path = '?foo=bar', url = 'a.com/') => '?foo=bar' | ||
* (path = 'bar', url = 'a.com/?foo=') => 'bar' | ||
* (path = 'foo', url = 'a.com') => '/foo' | ||
@@ -285,2 +286,4 @@ * (path = 'foo', url = 'a.com/') => 'foo' | ||
* (path = '/foo') => '/foo' | ||
* (path = '&foo=bar', url = 'a.com?b=k') => '&foo=bar' | ||
* (path = '&foo=bar') => '&foo=bar' | ||
*/ | ||
@@ -291,3 +294,3 @@ exports.addSlash = function (input, url) { | ||
if (!url) { | ||
if (input.startsWith('?') || input.startsWith('/')) | ||
if (input.startsWith('?') || input.startsWith('&') || input.startsWith('/')) | ||
return input; | ||
@@ -298,5 +301,5 @@ return "/" + input; | ||
return input.substr(1); | ||
if (!url.endsWith('/') && !input.startsWith('/') && !input.startsWith('?')) | ||
if (!url.endsWith('/') && !input.startsWith('/') && !input.startsWith('?') && !input.startsWith('&') && !url.includes('?')) | ||
return "/" + input; | ||
return input; | ||
}; |
@@ -74,2 +74,3 @@ import { MutableRefObject, DependencyList } from 'react'; | ||
* (path = '?foo=bar', url = 'a.com/') => '?foo=bar' | ||
* (path = 'bar', url = 'a.com/?foo=') => 'bar' | ||
* (path = 'foo', url = 'a.com') => '/foo' | ||
@@ -82,4 +83,6 @@ * (path = 'foo', url = 'a.com/') => 'foo' | ||
* (path = '/foo') => '/foo' | ||
* (path = '&foo=bar', url = 'a.com?b=k') => '&foo=bar' | ||
* (path = '&foo=bar') => '&foo=bar' | ||
*/ | ||
export declare const addSlash: (input?: string | undefined, url?: string | undefined) => string; | ||
export {}; |
@@ -269,2 +269,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
* (path = '?foo=bar', url = 'a.com/') => '?foo=bar' | ||
* (path = 'bar', url = 'a.com/?foo=') => 'bar' | ||
* (path = 'foo', url = 'a.com') => '/foo' | ||
@@ -277,2 +278,4 @@ * (path = 'foo', url = 'a.com/') => 'foo' | ||
* (path = '/foo') => '/foo' | ||
* (path = '&foo=bar', url = 'a.com?b=k') => '&foo=bar' | ||
* (path = '&foo=bar') => '&foo=bar' | ||
*/ | ||
@@ -283,3 +286,3 @@ export var addSlash = function (input, url) { | ||
if (!url) { | ||
if (input.startsWith('?') || input.startsWith('/')) | ||
if (input.startsWith('?') || input.startsWith('&') || input.startsWith('/')) | ||
return input; | ||
@@ -290,5 +293,5 @@ return "/" + input; | ||
return input.substr(1); | ||
if (!url.endsWith('/') && !input.startsWith('/') && !input.startsWith('?')) | ||
if (!url.endsWith('/') && !input.startsWith('/') && !input.startsWith('?') && !input.startsWith('&') && !url.includes('?')) | ||
return "/" + input; | ||
return input; | ||
}; |
{ | ||
"name": "use-http", | ||
"version": "1.0.22", | ||
"version": "1.0.23", | ||
"homepage": "https://use-http.com", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js", |
226181
3620