main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 6 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
780 bytes
|
Rev | Line | |
---|
[79a0317] | 1 | var Marker = require('../../../tokenizer/marker');
|
---|
| 2 |
|
---|
| 3 | function everyValuesPair(fn, left, right) {
|
---|
| 4 | var leftSize = left.value.length;
|
---|
| 5 | var rightSize = right.value.length;
|
---|
| 6 | var total = Math.max(leftSize, rightSize);
|
---|
| 7 | var lowerBound = Math.min(leftSize, rightSize) - 1;
|
---|
| 8 | var leftValue;
|
---|
| 9 | var rightValue;
|
---|
| 10 | var position;
|
---|
| 11 |
|
---|
| 12 | for (position = 0; position < total; position++) {
|
---|
| 13 | leftValue = left.value[position] && left.value[position][1] || leftValue;
|
---|
| 14 | rightValue = right.value[position] && right.value[position][1] || rightValue;
|
---|
| 15 |
|
---|
| 16 | if (leftValue == Marker.COMMA || rightValue == Marker.COMMA) {
|
---|
| 17 | continue;
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | if (!fn(leftValue, rightValue, position, position <= lowerBound)) {
|
---|
| 21 | return false;
|
---|
| 22 | }
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | return true;
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | module.exports = everyValuesPair;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.