You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
780 B
28 lines
780 B
var Marker = require('../../../tokenizer/marker');
|
|
|
|
function everyValuesPair(fn, left, right) {
|
|
var leftSize = left.value.length;
|
|
var rightSize = right.value.length;
|
|
var total = Math.max(leftSize, rightSize);
|
|
var lowerBound = Math.min(leftSize, rightSize) - 1;
|
|
var leftValue;
|
|
var rightValue;
|
|
var position;
|
|
|
|
for (position = 0; position < total; position++) {
|
|
leftValue = left.value[position] && left.value[position][1] || leftValue;
|
|
rightValue = right.value[position] && right.value[position][1] || rightValue;
|
|
|
|
if (leftValue == Marker.COMMA || rightValue == Marker.COMMA) {
|
|
continue;
|
|
}
|
|
|
|
if (!fn(leftValue, rightValue, position, position <= lowerBound)) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
module.exports = everyValuesPair;
|
|
|