Skip to content

Commit 136d840

Browse files
committed
feat: enhance parseValueToBoolean to support generic default values
1 parent b4f47f2 commit 136d840

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/common/parse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export const parseKeyValuePairs = (input: string): Record<string, string> => {
9191
return pairs;
9292
};
9393

94-
export const parseValueToBoolean = (value: unknown, defaultValue: boolean): boolean => {
94+
export const parseValueToBoolean = <T>(value: unknown, defaultValue: T | boolean): T | boolean => {
9595
const str = String(value).trim().toLowerCase();
9696

9797
if (/^(?:y|yes|true|1|on)$/.test(str)) return true;

0 commit comments

Comments
 (0)