Permalink
Browse files

make the code more friendly with scope

  • Loading branch information...
XadillaX committed Dec 29, 2015
1 parent d7fa632 commit df37bd062e94c45b1e300bea74e9fddf2b161ea2
Showing with 6 additions and 5 deletions.
  1. +1 −0 .gitignore
  2. +5 −5 lib/query.js
@@ -30,3 +30,4 @@ node_modules
coverage
*.out

*-es6.js
@@ -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,
@@ -246,7 +246,7 @@ Query.prototype._makeConditionField = function(condition, field, type) {
value = [ value ];
}

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

continue;
}
@@ -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;

0 comments on commit df37bd0

Please sign in to comment.