diff options
author | Holden Rohrer <hr@hrhr.dev> | 2020-07-16 12:40:19 -0400 |
---|---|---|
committer | Holden Rohrer <hr@hrhr.dev> | 2020-07-16 12:40:19 -0400 |
commit | db24fbe16e0f73f9278f4ec090be756c9704dee1 (patch) | |
tree | c2a43383a763217efb5fa8bf763212464fc0db42 | |
parent | 2e483bddc3c66aab0af9d4b80f5cacde42d4f041 (diff) |
space.{adhoc,from*} now return this
This eases composition of space functions without having to create
a bunch of closures or global variables
-rw-r--r-- | space.js | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -49,6 +49,7 @@ function Space(){ } } } + return this; } this.towrite = function(){ // Does no splitting or anything like that. Just returns a list of triplets for the write function @@ -70,6 +71,7 @@ function Space(){ this.fromfile = function(filename){ //Reads an external file into internal data this.adhoc(fs.readFileSync(filename,'utf8')); + return this; } this.adhoc = function(text){ @@ -82,6 +84,7 @@ function Space(){ } return row; }); + return this; } this.comb = function(other, func){ // other must have a valid .loc. If this.loc null, treated as offset @@ -112,6 +115,7 @@ function Space(){ this.data[row][chr] = func(this.data[row][chr], otherrow[chr-offset[1]] || ''); } } + return this; } this.search = function(other){ //Returns first instance of `other` subspace (prioritized vertically then horizontally) |