From a1836662a78e1338553b5d212ad336d3f3efc5fc Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Fri, 20 Jun 2014 12:05:32 -0700 Subject: [PATCH] Clean up comments --- lib/connectors/memory.js | 2 ++ lib/dao.js | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/connectors/memory.js b/lib/connectors/memory.js index 06c65772..97531f13 100644 --- a/lib/connectors/memory.js +++ b/lib/connectors/memory.js @@ -368,6 +368,8 @@ function applyFilter(filter) { return pattern; } var regex = ''; + // Escaping user input to be treated as a literal string within a regular expression + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Writing_a_Regular_Expression_Pattern pattern = pattern.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1"); for (var i = 0, n = pattern.length; i < n; i++) { var char = pattern.charAt(i); diff --git a/lib/dao.js b/lib/dao.js index 5f8d0c77..c788413e 100644 --- a/lib/dao.js +++ b/lib/dao.js @@ -982,25 +982,25 @@ DataAccessObject.updateAll = function (where, data, cb) { if (stillConnecting(this.getDataSource(), this, arguments)) return; if (arguments.length === 1) { - // update(data); + // update(data) is being called data = where; where = null; cb = null; } else if (arguments.length === 2) { if (typeof data === 'function') { - // update(data, cb); + // update(data, cb) is being called cb = data; data = where; where = null; } else { - // update(where, data); + // update(where, data) is being called cb = null; } } assert(typeof where === 'object', 'The where argument should be an object'); assert(typeof data === 'object', 'The data argument should be an object'); - assert(cb === null || typeof cb === 'function', 'The data argument should be an object'); + assert(cb === null || typeof cb === 'function', 'The cb argument should be a function'); try { where = removeUndefined(where);