javascript - underscore's some and every functions - susceptible to not short-circuiting? -
are underscore's some
, every
functions susceptible not short-circuiting?
from reading source, looks can happen if javascript environment not define native some
function define native foreach
method. can happen though? guess it's plausible plenty ever happen in practice?
technical nitty gritty backing thoughts above:
_.some
internally uses _.foreach
if native some
not defined _.foreach
short-circuits when called other underscore functions. respects special breaker
homecoming value. this breaker
object internal underscore , cannot used non-underscore functions. i inquire because people have requested breaker
made available outside underscore others can break behavior foreach
. that's been denied because native foreach
implementations (which underscore delegates if available) not respect convention , they're striving consistent behavior. seems _.some
, _.every
has same inconsistency issue, right?
javascript foreach underscore.js
No comments:
Post a Comment