aboutsummaryrefslogtreecommitdiff
path: root/space.js
diff options
context:
space:
mode:
authorHolden Rohrer <holden.rohrer@gmail.com>2019-12-27 14:40:21 -0500
committerHolden Rohrer <holden.rohrer@gmail.com>2019-12-27 14:40:21 -0500
commit8921cc0d825981ab79f9f0d3b9d19d08d5d1677e (patch)
tree915967843dd16d5fa5db559be40c2cbb6912ba77 /space.js
parent8810c883ff3b0b5709b9d7fb78e70ecec7211e94 (diff)
moved space.print
Diffstat (limited to 'space.js')
-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([]);