From 8f679b3d0703aaad8a573cc4f39c5d40bc84978d Mon Sep 17 00:00:00 2001 From: Jeremy Date: Wed, 25 Jan 2012 12:04:01 -0800 Subject: [PATCH] Contains is the most useful function in the _.string library; this commit saves it from the _.str ghetto (while still preserving the existing _.contains functionality). --- lib/underscore.string.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/underscore.string.js b/lib/underscore.string.js index 221cf48f..17bc1cbb 100644 --- a/lib/underscore.string.js +++ b/lib/underscore.string.js @@ -478,3 +478,12 @@ } }(this || window)); + +_._contains = _.contains; +_.contains = function(a,b) { + if (typeof a == "string" && typeof b == "string") { + return _.str.contains(a,b) + } else { + return _._contains(a,b); + } +}; \ No newline at end of file