From 8921cc0d825981ab79f9f0d3b9d19d08d5d1677e Mon Sep 17 00:00:00 2001 From: Holden Rohrer Date: Fri, 27 Dec 2019 14:40:21 -0500 Subject: moved space.print --- space.js | 8 +++++--- 1 file 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([]); -- cgit