Uh oh!
There was an error while loading. Please reload this page.
Try 2 bias values when calling originalPositionFor from applySourceMap - #376
Try 2 bias values when calling originalPositionFor from applySourceMap#376MotorHeat wants to merge 2 commits into
Conversation
jasonLaster
commented
Jan 22, 2019
I think this is a nice idea. I'm curious what others will think |
bcoe
commented
Apr 22, 2019
@jasonLaster@MotorHeat rather than trying both if(aBias==exports.LEAST_UPPER_BOUND){returnaHigh<aHaystack.length ? aHigh : -1;}else{returnmid;}Where if Am I missing something, or would it be good to have a mode that's more resilient like this? |
ochameau
commented
Oct 4, 2022
Hi @MotorHeat@bcoe, thanks for the patch. I'm trying to revive the maintenance of this package.... |
The method applySourceMap is calling originalPositionFor without providing the
biasvalue.By default
biasequals to GREATEST_LOWER_BOUND which means: if exact column value was not found - take nearest item from the left. In some cases there is "no nearest value on the left" because most correct value is nearest "from the right". I believe it is worth to try to calloriginalPositionForwith both available bias values rather then just try one and claim that we cannot find mapping while it is exists.Initially the GREATEST_LOWER_BOUND value is used (like it was before). If
originalPositionForcannot find relevant mapping then LEAST_UPPER_BOUND bias value is used to search again.I don't think that
applySourceMapshould made any assumptions on the structure of the source maps and it should be symmetric as much as possible (in proposed implementation preference is given to the "left" element but this is how it always was before).