Closed eggmatters closed 10 years ago
Version 2.4.0 appears to have a bug in the contains method. It returns false (for strings, untested with objects.) regardless of the values provided:
var test = _.contains('pebbles', 'eb'); >>> test: false
this line in contains evaluates to -1:
1769: if (length && typeof length == 'number') { 1770: result = indexOf(collection, target) > -1; 1771: }
Where indexOf() is aliased to:
856: function getIndexOf() { 857: var result = (result = lodash.indexOf) === indexOf ? baseIndexOf : result; 858: return result; 859: }
running the native method :
"pebbles".indexOf("eb")
returns true
I updated Lo-Dash to 2.4.1, and I hope that solves it. If not, you could create an issue on the Lo-Dash project itself.
Thanks! Will do.
Version 2.4.0 appears to have a bug in the contains method. It returns false (for strings, untested with objects.) regardless of the values provided:
this line in contains evaluates to -1:
Where indexOf() is aliased to:
running the native method :
returns true