-
-
Notifications
You must be signed in to change notification settings - Fork 456
FEAT: implement support for boolean type #407
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
FEAT: implement support for boolean type #407
Conversation
Thanks for implementing this. I think it should also accept |
Good shout! I've added support for I haven’t extended this to the parseBoolean option yet—wanted to check with you first @sindresorhus . If you think it makes sense, I’ll get it added. Otherwise, I believe the PR is good to go 💪 |
No, it should not. |
Hey folks, Here is the added test: test("types option: boolean type accepts an empty string as true", (t) => {
t.deepEqual(
queryString.parse("a&b", {
parsebooleans: false,
types: {
a: "boolean",
b: "boolean",
},
}),
{
a: true,
b: true,
},
);
}); |
Yeah, that makes sense to me. |
@sindresorhus I'll get this implemented 💪 |
Hey @sindresorhus , when implementing the parsing fix for PR #406 I noticed it would be pretty quick to add support for a
boolean
type. This allows the user to override the behaviour ofparseBoolean
.I've updated the
README
and type definitions to include the newboolean
type.I've also updated the description of the types feature to be clearer. Let me know your thoughts!