Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
make the code more friendly with scope
  • Loading branch information
XadillaX committed Dec 29, 2015
1 parent d7fa632 commit df37bd0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -30,3 +30,4 @@ node_modules
coverage
*.out

*-es6.js
10 changes: 5 additions & 5 deletions lib/query.js
Expand Up @@ -150,7 +150,7 @@ Query.prototype._makeConditionField = function(condition, field, type) {
("\"" + escaper.escape(value) + "\"") :
value;
};
var cdtMapper = function(value) {
var cdtMapper = function(symbol, value) {
value = field.type.restore(value);

var cdt = util.format("`%s` %s %s", field.column, symbol,
Expand Down Expand Up @@ -246,7 +246,7 @@ Query.prototype._makeConditionField = function(condition, field, type) {
value = [ value ];
}

value.map(cdtMapper);
value.map(cdtMapper.bind(null, symbol));

continue;
}
Expand Down Expand Up @@ -982,11 +982,11 @@ Query.prototype.find = function(callback, withJson, findOne) {
// fill in cache result
var offset = 0;
var unfetchedCount = 0;
var dataFinder = function(n) {
return self._cacheFitWithPrimary(rows[i], n);
var dataFinder = function(row, n) {
return self._cacheFitWithPrimary(row, n);
};
for(var i = 0; i < rows.length; i++) {
var d = λ.find(data, dataFinder);
var d = λ.find(data, dataFinder.bind(null, rows[i]));

if(d !== undefined) {
data[offset].$fromCache = true;
Expand Down

0 comments on commit df37bd0

Please sign in to comment.