-
-
Notifications
You must be signed in to change notification settings - Fork 453
Closed
Labels
Description
(related to #201)
Consider 2 examples:
const search1 = '?phoneNumber=%2B380951234567&subtopicId=2&topicId=1';
const result1 = queryString.parse(search, {
parseBooleans: true,
parseNumbers: true,
});
const search2 = '?phoneNumber=a%2B380951234567&subtopicId=2&topicId=1';
const result2 = queryString.parse(search, {
parseBooleans: true,
parseNumbers: true,
});
console.log('result1', result1);
// {
// phoneNumber: 380951234567,
// subtopicId: 2,
// topicId: 1,
// };
console.log('result2', result2);
// {
// phoneNumber: 'a+380951234567',
// subtopicId: 2,
// topicId: 1,
// };In the 1st example, "+" sign (%2B escaped) is ignored thus reducing to the number parsing, which is not what it supposed to be.
The main goal is to keep parsing numbers for parameters which values starts on the number and parse as plain string otherwise.
Does it look feasible to make a PR on this or should I not use parseNumbers option in that case?
Reactions are currently unavailable