arpinum-oss/js-promising

timeout / timeoutWithOptions: 0 milliseconds special case

Opened this issue · 1 comments

When passing 0 for milliseconds parameter, the timeout occurs immediately and the func fails.
I would have expected one of these two other behaviours:

  • either: don't run the func and raise an exception instead telling that the 0 delay seems... strange
  • or: run the func without any timeout

I think the current behavior is the safest one because minimal timeout delay may be different based on runtime.
For instance it might be 4, 8, 10 ms.
In other words there could be no difference between 0 ms and 4 ms.