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
booleantype. This allows the user to override the behaviour ofparseBoolean.I've updated the
READMEand type definitions to include the newbooleantype.I've also updated the description of the types feature to be clearer. Let me know your thoughts!