aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--space.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/space.js b/space.js
index 0dffbca..2b535fd 100644
--- a/space.js
+++ b/space.js
@@ -62,6 +62,11 @@ function Space(){
this.tofile = function(filename){
fs.writeFileSync(filename, this.print());
};
+
+ this.print = function(){
+ return this.data.map(row => replace(replace(replace(row,'&','\\&'),'\\','\\\\'),'','&').join('')).join('\n');
+ }
+
this.fromfile = function(filename){ //Reads an external file into internal data
this.adhoc(fs.readFileSync(filename,'utf8'));
}
@@ -77,9 +82,6 @@ function Space(){
return row;
});
}
- this.print = function(){
- return this.data.map(row => replace(replace(replace(row,'&','\\&'),'\\','\\\\'),'','&').join('')).join('\n');
- }
this.comb = function(other, func, offset){
// Convert negative offsets of either sort into zero offsets with significant previous whitespace (translation)
for (let i = 0; i < -offset[0]; i++) this.data.unshift([]);