Comparing version 1.4.0 to 1.5.0
@@ -12,3 +12,3 @@ type QueryValue = string | number | undefined | null | boolean | Array<QueryValue> | Record<string, any>; | ||
* | ||
* @group qeury | ||
* @group Query_utils | ||
*/ | ||
@@ -21,3 +21,3 @@ declare function parseQuery<T extends ParsedQuery = ParsedQuery>(parametersString?: string): T; | ||
* | ||
* @group qeury | ||
* @group Query_utils | ||
*/ | ||
@@ -28,3 +28,3 @@ declare function encodeQueryItem(key: string, value: QueryValue | QueryValue[]): string; | ||
* | ||
* @group qeury | ||
* @group Query_utils | ||
*/ | ||
@@ -37,3 +37,3 @@ declare function stringifyQuery(query: QueryObject): string; | ||
* | ||
* @group encoding | ||
* @group encoding_utils | ||
* | ||
@@ -47,3 +47,3 @@ * @param text - string to encode | ||
* | ||
* @group encoding | ||
* @group encoding_utils | ||
* | ||
@@ -58,3 +58,3 @@ * @param text - string to encode | ||
* | ||
* @group encoding | ||
* @group encoding_utils | ||
* | ||
@@ -69,3 +69,3 @@ * @param input - string to encode | ||
* | ||
* @group encoding | ||
* @group encoding_utils | ||
* | ||
@@ -78,3 +78,3 @@ * @param text - string to encode | ||
* | ||
* @group encoding | ||
* @group encoding_utils | ||
* | ||
@@ -90,3 +90,3 @@ * @param text - string to encode | ||
* | ||
* @group encoding | ||
* @group encoding_utils | ||
* | ||
@@ -101,3 +101,3 @@ * @param text - string to encode | ||
* | ||
* @group encoding | ||
* @group encoding_utils | ||
* | ||
@@ -111,3 +111,3 @@ * @param text - string to decode | ||
* | ||
* @group encoding | ||
* @group encoding_utils | ||
* | ||
@@ -121,3 +121,3 @@ * @param text - string to decode | ||
* | ||
* @group encoding | ||
* @group encoding_utils | ||
* | ||
@@ -131,3 +131,3 @@ * @param text - string to decode | ||
* | ||
* @group encoding | ||
* @group encoding_utils | ||
* | ||
@@ -141,3 +141,3 @@ * @param text - string to decode | ||
* | ||
* @group encoding | ||
* @group encoding_utils | ||
*/ | ||
@@ -181,3 +181,3 @@ declare function encodeHost(name?: string): string; | ||
* | ||
* @group parsing | ||
* @group parsing_utils | ||
* | ||
@@ -192,3 +192,3 @@ * @param [input] - The URL to parse. | ||
* | ||
* @group parsing | ||
* @group parsing_utils | ||
* | ||
@@ -203,3 +203,3 @@ * @param [input] - The URL to parse. | ||
* | ||
* @group parsing | ||
* @group parsing_utils | ||
* | ||
@@ -213,3 +213,3 @@ * @param [input] - The URL to parse. | ||
* | ||
* @group parsing | ||
* @group parsing_utils | ||
* | ||
@@ -224,3 +224,3 @@ * @param [input] - The URL to parse. | ||
* | ||
* @group parsing | ||
* @group parsing_utils | ||
* | ||
@@ -245,3 +245,3 @@ * @example | ||
* | ||
* @group parsing | ||
* @group parsing_utils | ||
* | ||
@@ -334,3 +334,3 @@ * @example | ||
* | ||
* If second argument is is true, it will only remove the trailing slash if it's not part of the query or fragment with cost of more expensive operations. | ||
* If second argument is true, it will only remove the trailing slash if it's not part of the query or fragment with cost of more expensive operations. | ||
* | ||
@@ -462,2 +462,14 @@ * @example | ||
/** | ||
* Joins multiple URL segments into a single URL and also handles relative paths with `./` and `../`. | ||
* | ||
* @example | ||
* | ||
* ```js | ||
* joinRelativeURL("/a", "../b", "./c"); // "/b/c" | ||
* ``` | ||
* | ||
* @group utils | ||
*/ | ||
declare function joinRelativeURL(..._input: string[]): string; | ||
/** | ||
* Adds or replaces url protocol to `http://`. | ||
@@ -605,3 +617,15 @@ * | ||
declare function withoutFragment(input: string): string; | ||
/** | ||
* Removes the host from the URL preserving everything else. | ||
* | ||
* @example | ||
* ```js | ||
* withoutHost("http://example.com/foo?q=123#bar") | ||
* // Returns "/foo?q=123#bar" | ||
* ``` | ||
* | ||
* @group utils | ||
*/ | ||
declare function withoutHost(input: string): string; | ||
export { $URL, type HasProtocolOptions, type ParsedAuth, type ParsedHost, type ParsedQuery, type ParsedURL, type QueryObject, type QueryValue, cleanDoubleSlashes, createURL, decode, decodePath, decodeQueryKey, decodeQueryValue, encode, encodeHash, encodeHost, encodeParam, encodePath, encodeQueryItem, encodeQueryKey, encodeQueryValue, getQuery, hasLeadingSlash, hasProtocol, hasTrailingSlash, isEmptyURL, isEqual, isNonEmptyURL, isRelative, isSamePath, isScriptProtocol, joinURL, normalizeURL, parseAuth, parseFilename, parseHost, parsePath, parseQuery, parseURL, resolveURL, stringifyParsedURL, stringifyQuery, withBase, withFragment, withHttp, withHttps, withLeadingSlash, withProtocol, withQuery, withTrailingSlash, withoutBase, withoutFragment, withoutLeadingSlash, withoutProtocol, withoutTrailingSlash }; | ||
export { $URL, type HasProtocolOptions, type ParsedAuth, type ParsedHost, type ParsedQuery, type ParsedURL, type QueryObject, type QueryValue, cleanDoubleSlashes, createURL, decode, decodePath, decodeQueryKey, decodeQueryValue, encode, encodeHash, encodeHost, encodeParam, encodePath, encodeQueryItem, encodeQueryKey, encodeQueryValue, getQuery, hasLeadingSlash, hasProtocol, hasTrailingSlash, isEmptyURL, isEqual, isNonEmptyURL, isRelative, isSamePath, isScriptProtocol, joinRelativeURL, joinURL, normalizeURL, parseAuth, parseFilename, parseHost, parsePath, parseQuery, parseURL, resolveURL, stringifyParsedURL, stringifyQuery, withBase, withFragment, withHttp, withHttps, withLeadingSlash, withProtocol, withQuery, withTrailingSlash, withoutBase, withoutFragment, withoutHost, withoutLeadingSlash, withoutProtocol, withoutTrailingSlash }; |
{ | ||
"name": "ufo", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "URL utils for humans", | ||
@@ -33,16 +33,16 @@ "repository": "unjs/ufo", | ||
"devDependencies": { | ||
"@types/node": "^20.11.16", | ||
"@vitest/coverage-v8": "^1.2.2", | ||
"automd": "^0.1.1", | ||
"@types/node": "^20.11.25", | ||
"@vitest/coverage-v8": "^1.3.1", | ||
"automd": "^0.3.6", | ||
"changelogen": "^0.5.5", | ||
"eslint": "^8.56.0", | ||
"eslint": "^8.57.0", | ||
"eslint-config-unjs": "^0.2.1", | ||
"jiti": "^1.21.0", | ||
"prettier": "^3.2.5", | ||
"typescript": "^5.3.3", | ||
"typescript": "^5.4.2", | ||
"unbuild": "^2.0.0", | ||
"untyped": "^1.4.2", | ||
"vitest": "^1.2.2" | ||
"vitest": "^1.3.1" | ||
}, | ||
"packageManager": "pnpm@8.15.1" | ||
"packageManager": "pnpm@8.15.4" | ||
} |
@@ -43,8 +43,6 @@ # ufo | ||
# Utils | ||
<!-- AUTOMD_START generator="jsdocs" defaultGroup="utils" --> | ||
<!-- AUTOMD_START generator="jsdocs" headingLevel="2" --> | ||
## Encoding Utils | ||
## Encoding | ||
### `decode(text)` | ||
@@ -94,3 +92,3 @@ | ||
## Parsing | ||
## Parsing Utils | ||
@@ -125,3 +123,3 @@ ### `parseAuth(input)` | ||
### `parseURL(input, defaultProto)` | ||
### `parseURL(input, defaultProto?)` | ||
@@ -156,3 +154,3 @@ Takes a URL string and returns an object with the URL's `protocol`, `auth`, `host`, `pathname`, `search`, and `hash`. | ||
## Qeury | ||
## Query Utils | ||
@@ -205,4 +203,7 @@ ### `encodeQueryItem(key, value)` | ||
### `hasTrailingSlash(input, respectQueryAndFragment)` | ||
### `hasProtocol(inputString, opts)` | ||
### `hasTrailingSlash(input, respectQueryAndFragment?)` | ||
Checks if the input has a trailing slash. | ||
@@ -258,6 +259,16 @@ | ||
### `isScriptProtocol(protocol)` | ||
### `isScriptProtocol(protocol?)` | ||
Checks if the input protocol is any of the dangerous `blob:`, `data:`, `javascript`: or `vbscript:` protocols. | ||
### `joinRelativeURL()` | ||
Joins multiple URL segments into a single URL and also handles relative paths with `./` and `../`. | ||
**Example:** | ||
```js | ||
joinRelativeURL("/a", "../b", "./c"); // "/b/c" | ||
``` | ||
### `joinURL(base)` | ||
@@ -359,2 +370,13 @@ | ||
### `withoutHost(input)` | ||
Removes the host from the URL preserving everything else. | ||
**Example:** | ||
```js | ||
withoutHost("http://example.com/foo?q=123#bar") | ||
// Returns "/foo?q=123#bar" | ||
``` | ||
### `withoutLeadingSlash(input)` | ||
@@ -364,7 +386,17 @@ | ||
### `withoutTrailingSlash(input, respectQueryAndFragment)` | ||
### `withoutProtocol(input)` | ||
Removes the protocol from the input. | ||
**Example:** | ||
```js | ||
withoutProtocol("http://example.com"); // "example.com" | ||
``` | ||
### `withoutTrailingSlash(input, respectQueryAndFragment?)` | ||
Removes trailing slash from the URL or pathname. | ||
If second argument is is true, it will only remove the trailing slash if it's not part of the query or fragment with cost of more expensive operations. | ||
If second argument is true, it will only remove the trailing slash if it's not part of the query or fragment with cost of more expensive operations. | ||
@@ -399,3 +431,3 @@ **Example:** | ||
### `withTrailingSlash(input, respectQueryAndFragment)` | ||
### `withTrailingSlash(input, respectQueryAndFragment?)` | ||
@@ -414,16 +446,3 @@ Ensures url ends with a trailing slash. | ||
### `hasProtocol(inputString, opts)` | ||
### `withoutProtocol(input)` | ||
Removes the protocol from the input. | ||
**Example:** | ||
```js | ||
withoutProtocol("http://example.com"); // "example.com" | ||
``` | ||
<!-- AUTOMD_END --> | ||
@@ -430,0 +449,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
102394
1883
456