Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove hasOwnProperty call #183

Merged
merged 4 commits into from
Oct 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export interface ParseOptions {
*
* @default decodeURIComponent
*/
decode?: (str: string) => string | undefined;
blakeembrey marked this conversation as resolved.
Show resolved Hide resolved
decode?: (str: string) => string;
}

/**
Expand Down Expand Up @@ -133,7 +133,8 @@ export function parse(
}

const value = dec(str.slice(valStartIdx, valEndIdx));
if (value !== undefined) obj[key] = value;

obj[key] = value;
}

index = endIdx + 1;
Expand Down Expand Up @@ -365,7 +366,7 @@ export function serialize(
/**
* URL-decode string value. Optimized to skip native call when no %.
*/
function decode(str: string): string | undefined {
function decode(str: string): string {
if (str.indexOf("%") === -1) return str;

try {
Expand Down