-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
issue: #89
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,8 +141,13 @@ export const getParser = (parser: Parser["parse"]) => | |
a.tag === PARAM && | ||
b.tag === PARAM | ||
) { | ||
//sort params | ||
return paramsOrder.indexOf(a.name) - paramsOrder.indexOf(b.name); | ||
const aIndex = paramsOrder.indexOf(a.name); | ||
const bIndex = paramsOrder.indexOf(b.name); | ||
if (aIndex > -1 && bIndex > -1) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
hosseinmd
Author
Owner
|
||
//sort params | ||
return aIndex - bIndex; | ||
} | ||
return 0; | ||
} | ||
return getTagOrderWeight(a.tag) - getTagOrderWeight(b.tag); | ||
}); | ||
|
@hosseinmd Because of this
if
, the compare function does not define a total order. This means that the output of thesort
function is not defined.Put simply, you just got lucky to get the correct result in your test case.
This solution does not work.