kpdecker / jsdiff

A javascript text differencing implementation.
BSD 3-Clause "New" or "Revised" License
7.69k stars 491 forks source link

Fix the weird function signature of async callbacks #490

Closed ExplodingCabbage closed 4 months ago

ExplodingCabbage commented 4 months ago

Previously, the callback option had to be a function that takes the result as its second argument; the first argument, meanwhile, was never used. (Some tests name the parameter err; however, there is absolutely no circumstance in which an error, or anything besides undefined, will be passed as the value of that argument.)

This PR fixes this (utterly breaking backwards compat in the process) by making the result be passed as the value of the FIRST argument.

Resolves https://github.com/kpdecker/jsdiff/issues/462