diff --git a/lib/client/storage.js b/lib/client/storage.js index 0c649ce0..1e906d15 100644 --- a/lib/client/storage.js +++ b/lib/client/storage.js @@ -40,15 +40,14 @@ var Util, DOM; }; this.removeMatch = function(string, callback) { - var name, is, - reg = new RegExp('^' + string + '.*$'); + var reg = RegExp('^' + string + '.*$'); - for (name in localStorage) { - is = name.match(reg); + Object.keys(localStorage).forEach(function(name) { + var is = reg.test(name); if (is) localStorage.removeItem(name); - } + }); Util.exec(callback);