Socket
Socket
Sign inDemoInstall

ufo

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ufo - npm Package Compare versions

Comparing version 1.1.2 to 1.2.0

20

dist/index.d.ts

@@ -1,4 +0,5 @@

type QueryValue = string | number | undefined | null | Record<string, any>;
type QueryValue = string | number | undefined | null | boolean | Array<QueryValue> | Record<string, any>;
type QueryObject = Record<string, QueryValue | QueryValue[]>;
declare function parseQuery(parametersString?: string): QueryObject;
type ParsedQuery = Record<string, string | string[]>;
declare function parseQuery<T extends ParsedQuery = ParsedQuery>(parametersString?: string): T;
declare function encodeQueryItem(key: string, value: QueryValue | QueryValue[]): string;

@@ -69,2 +70,9 @@ declare function stringifyQuery(query: QueryObject): string;

/**
* Decode query key (consistent with encodeQueryKey for plus encoding).
* Created different method for decoding key to avoid future changes on value encode/decode.
* @param text - string to decode
* @returns decoded string
*/
declare function decodeQueryKey(text: string): string;
/**
* Decode query value (consistent with encodeQueryValue for plus encoding).

@@ -128,2 +136,5 @@ *

declare function stringifyParsedURL(parsed: ParsedURL): string;
declare function parseFilename(input: string, { strict }: {
strict: any;
}): string | undefined;

@@ -166,2 +177,3 @@ declare class $URL implements URL {

declare function hasProtocol(inputString: string, acceptRelative: boolean): boolean;
declare function isScriptProtocol(protocol?: string): boolean;
declare function hasTrailingSlash(input?: string, queryParameters?: boolean): boolean;

@@ -177,3 +189,3 @@ declare function withoutTrailingSlash(input?: string, queryParameters?: boolean): string;

declare function withQuery(input: string, query: QueryObject): string;
declare function getQuery(input: string): QueryObject;
declare function getQuery<T extends ParsedQuery = ParsedQuery>(input: string): T;
declare function isEmptyURL(url: string): boolean;

@@ -197,2 +209,2 @@ declare function isNonEmptyURL(url: string): boolean;

export { $URL, HasProtocolOptions, ParsedAuth, ParsedHost, ParsedURL, QueryObject, QueryValue, cleanDoubleSlashes, createURL, decode, decodePath, decodeQueryValue, encode, encodeHash, encodeHost, encodeParam, encodePath, encodeQueryItem, encodeQueryKey, encodeQueryValue, getQuery, hasLeadingSlash, hasProtocol, hasTrailingSlash, isEmptyURL, isEqual, isNonEmptyURL, isRelative, isSamePath, joinURL, normalizeURL, parseAuth, parseHost, parsePath, parseQuery, parseURL, resolveURL, stringifyParsedURL, stringifyQuery, withBase, withHttp, withHttps, withLeadingSlash, withProtocol, withQuery, withTrailingSlash, withoutBase, withoutLeadingSlash, withoutProtocol, withoutTrailingSlash };
export { $URL, HasProtocolOptions, ParsedAuth, ParsedHost, ParsedQuery, ParsedURL, QueryObject, 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, withHttp, withHttps, withLeadingSlash, withProtocol, withQuery, withTrailingSlash, withoutBase, withoutLeadingSlash, withoutProtocol, withoutTrailingSlash };

22

package.json
{
"name": "ufo",
"version": "1.1.2",
"version": "1.2.0",
"description": "URL utils for humans",

@@ -29,16 +29,16 @@ "repository": "unjs/ufo",

"release": "pnpm test && changelogen --release && npm publish && git push --follow-tags",
"test": "pnpm lint && vitest run"
"test": "pnpm lint && vitest --run typecheck && vitest run"
},
"devDependencies": {
"@types/node": "^18.16.3",
"@vitest/coverage-c8": "^0.31.0",
"changelogen": "^0.5.3",
"eslint": "^8.39.0",
"eslint-config-unjs": "^0.1.0",
"prettier": "^2.8.8",
"typescript": "^5.0.4",
"@types/node": "^20.4.5",
"@vitest/coverage-v8": "^0.33.0",
"changelogen": "^0.5.4",
"eslint": "^8.46.0",
"eslint-config-unjs": "^0.2.1",
"prettier": "^3.0.0",
"typescript": "^5.1.6",
"unbuild": "^1.2.1",
"vitest": "^0.31.0"
"vitest": "^0.33.0"
},
"packageManager": "pnpm@8.4.0"
"packageManager": "pnpm@8.6.10"
}

@@ -102,2 +102,12 @@ # 👽 ufo

### `parseFilename`
```ts
// Result: filename.ext
parseFilename('http://example.com/path/to/filename.ext')
// Result: undefined
parseFilename('/path/to/.hidden-file', { strict: true })
```
### `$URL`

@@ -104,0 +114,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc