Using _.some | _.any properly for lo-dash or underscore Using _.some | _.any properly for lo-dash or underscore jquery jquery

Using _.some | _.any properly for lo-dash or underscore


You've misunderstood what the last argument to _.some is. The documentation shows that it is the context, or scope, under which the iterator function runs, but it seems like you're trying to use it as a value for equality testing.

You'll need to explicitly execute the equality test yourself.

_.some(a.days, function(day) {    return day.date.format('DD-MM') === "01-01";});


You appear to be misunderstanding how to use _.some(). Consult the documentation and you'll see that your function needs to return true or false, and the last argument will be used as this in tat function.

You need to do this instead:

_.some(a.days,function(day){ return day.date.format("DD-MM") == "01-01";});