diff options
| -rw-r--r-- | space.js | 7 | 
1 files changed, 7 insertions, 0 deletions
| @@ -143,6 +143,13 @@ function Space(){      }      return newspace;    } + +  this.copy = function(){ // deeply copies `array` and `loc` to a new space +    let newspace = new Space(); +    newspace.data = this.data.map(row => row.slice()); // Deep copy +    newspace.loc = this.loc.slice(); +    return newspace; +  }  }  module.exports = Space | 
