underscore’s each checking for {} return of callback

They use each internally for e.g. some. Since some does short-circuit, they can have each break there using the “secret” object, while not exposing this feature for regular users. They don’t expose the break feature because the native function doesn’t do that, either (so their shim is as native-like as possible). If they did, the break feature would only be available if the native function is unavailble, which isn’t particularly helpful.

Leave a Comment