You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some cases, it would make sense to use the weak equality == instead of the strong one ===.
Take this example, where two URL parsers give different results :
{
pathvars: {
id: 42
}
}
vs
{
pathvars: {
id: "42"
}
}
I have no idea how complicated it would be to achieve internally. From the API point of view, I would add another function or a flag in the current one's arguments to enable the weak comparison.
The text was updated successfully, but these errors were encountered:
I was able to do it using the undocumented options.comparator, like this:
function isPrimitive(value) {
return value === null || typeof value !== 'object';
}
function loose(a, b) {
return isPrimitive(a) && isPrimitive(b) ? a == b : null;
}
The isPrimitive function is already present internally in the library, so adding this feature should be very simple - the main question is what would you expect the API to look like, how would this work with other comparators, etc.?
In some cases, it would make sense to use the weak equality
==
instead of the strong one===
.Take this example, where two URL parsers give different results :
vs
I have no idea how complicated it would be to achieve internally. From the API point of view, I would add another function or a flag in the current one's arguments to enable the weak comparison.
The text was updated successfully, but these errors were encountered: