문제

I have an array of objects that each have a date property. For some of the objects, the "Date" property is blank. I want to remove those from my object so that my view doesn't end up with entries containing NaN for the date.

Here is what I have tried:

_.where(data, { 'Date': d.Date instanceof Date && isFinite(d) })

AND

_.where(data, function(d) {
                        return d.Date instanceof Date && isFinite(d.date);
                    });

Both return 0 results however.

도움이 되었습니까?

해결책

You don't want to use where that "performs a deep comparison to the given property object" , but filter that uses a callback.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top