aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--space.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/space.js b/space.js
index f5bf041..171df6c 100644
--- a/space.js
+++ b/space.js
@@ -87,9 +87,11 @@ function Space(){ // CLASS
// Iterate over other.data and add to this.data
while (this.data.length < offset[0]+other.data.length) this.data.push([]); // Row padding
for (let row = 0; row < other.data.length; row++){
- while (this.data.length < offset[1]+other.data.length) this.data.push(''); // Character-wise padding
+ let thisrow = this.data[row+offset[0]];
+ while (thisrow.length < offset[1]+other.data[row].length) thisrow.push(''); // Character-wise padding
for (let chr = 0; chr < other.data[row].length; chr++){
- this.data[row+offset[0]][chr+offset[1]] = func(this.data[row+offset[0]][chr+offset[1]], other.data[row][chr]);
+ let thechr = chr+offset[1];
+ thisrow[thechr] = func(thisrow[thechr], other.data[row][chr]);
}
}
}