Skip to content

Commit

Permalink
docs: fix typos (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
Konano authored Jan 19, 2025
1 parent 87f8f36 commit 496140d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,47 +46,47 @@ import { parseURL } from "https://unpkg.com/ufo/dist/index.mjs";

### `decode(text)`

Decode text using `decodeURIComponent`. Returns the original text if it fails.
Decodes text using `decodeURIComponent`. Returns the original text if it fails.

### `decodePath(text)`

Decode path section of URL (consistent with encodePath for slash encoding).
Decodes path section of URL (consistent with encodePath for slash encoding).

### `decodeQueryKey(text)`

Decodes query key (consistent with `encodeQueryKey` for plus encoding).

### `decodeQueryValue(text)`

Decode query value (consistent with `encodeQueryValue` for plus encoding).
Decodes query value (consistent with `encodeQueryValue` for plus encoding).

### `encode(text)`

Encode characters that need to be encoded on the path, search and hash sections of the URL.
Encodes characters that need to be encoded in the path, search and hash sections of the URL.

### `encodeHash(text)`

Encode characters that need to be encoded on the hash section of the URL.
Encodes characters that need to be encoded in the hash section of the URL.

### `encodeHost(name)`

Encodes hostname with punycode encoding.

### `encodeParam(text)`

Encode characters that need to be encoded on the path section of the URL as a param. This function encodes everything `encodePath` does plus the slash (`/`) character.
Encodes characters that need to be encoded in the path section of the URL as a param. This function encodes everything `encodePath` does plus the slash (`/`) character.

### `encodePath(text)`

Encode characters that need to be encoded on the path section of the URL.
Encodes characters that need to be encoded in the path section of the URL.

### `encodeQueryKey(text)`

Encode characters that need to be encoded query values on the query section of the URL and also encodes the `=` character.
Encodes characters that need to be encoded for query values in the query section of the URL and also encodes the `=` character.

### `encodeQueryValue(input)`

Encode characters that need to be encoded query values on the query section of the URL.
Encodes characters that need to be encoded for query values in the query section of the URL.

## Parsing Utils

Expand Down
20 changes: 10 additions & 10 deletions src/encoding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const ENC_SLASH_RE = /%2f/gi;
const ENC_ENC_SLASH_RE = /%252f/gi;

/**
* Encode characters that need to be encoded on the path, search and hash
* Encodes characters that need to be encoded in the path, search and hash
* sections of the URL.
*
* @group encoding_utils
Expand All @@ -33,7 +33,7 @@ export function encode(text: string | number): string {
}

/**
* Encode characters that need to be encoded on the hash section of the URL.
* Encodes characters that need to be encoded in the hash section of the URL.
*
* @group encoding_utils
*
Expand All @@ -48,7 +48,7 @@ export function encodeHash(text: string): string {
}

/**
* Encode characters that need to be encoded query values on the query
* Encodes characters that need to be encoded for query values in the query
* section of the URL.
*
* @group encoding_utils
Expand All @@ -59,7 +59,7 @@ export function encodeHash(text: string): string {
export function encodeQueryValue(input: QueryValue): string {
return (
encode(typeof input === "string" ? input : JSON.stringify(input))
// Encode the space as +, encode the + to differentiate it from the space
// Encodes the space as +, encode the + to differentiate it from the space
.replace(PLUS_RE, "%2B")
.replace(ENC_SPACE_RE, "+")
.replace(HASH_RE, "%23")
Expand All @@ -71,7 +71,7 @@ export function encodeQueryValue(input: QueryValue): string {
}

/**
* Encode characters that need to be encoded query values on the query
* Encodes characters that need to be encoded for query values in the query
* section of the URL and also encodes the `=` character.
*
* @group encoding_utils
Expand All @@ -83,7 +83,7 @@ export function encodeQueryKey(text: string | number): string {
}

/**
* Encode characters that need to be encoded on the path section of the URL.
* Encodes characters that need to be encoded in the path section of the URL.
*
* @group encoding_utils
*
Expand All @@ -100,7 +100,7 @@ export function encodePath(text: string | number): string {
}

/**
* Encode characters that need to be encoded on the path section of the URL as a
* Encodes characters that need to be encoded in the path section of the URL as a
* param. This function encodes everything `encodePath` does plus the
* slash (`/`) character.
*
Expand All @@ -114,7 +114,7 @@ export function encodeParam(text: string | number): string {
}

/**
* Decode text using `decodeURIComponent`. Returns the original text if it
* Decodes text using `decodeURIComponent`. Returns the original text if it
* fails.
*
* @group encoding_utils
Expand All @@ -131,7 +131,7 @@ export function decode(text: string | number = ""): string {
}

/**
* Decode path section of URL (consistent with encodePath for slash encoding).
* Decodes path section of URL (consistent with encodePath for slash encoding).
*
* @group encoding_utils
*
Expand All @@ -155,7 +155,7 @@ export function decodeQueryKey(text: string): string {
}

/**
* Decode query value (consistent with `encodeQueryValue` for plus encoding).
* Decodes query value (consistent with `encodeQueryValue` for plus encoding).
*
* @group encoding_utils
*
Expand Down

0 comments on commit 496140d

Please sign in to comment.