From c54137a4935849518f215dc46cd2f213bca05e64 Mon Sep 17 00:00:00 2001 From: devlinjd Date: Thu, 10 Sep 2015 09:13:12 -0400 Subject: [PATCH] Cleanup. --- src/sheet.js | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/sheet.js b/src/sheet.js index 37435f6..e173837 100644 --- a/src/sheet.js +++ b/src/sheet.js @@ -1,21 +1,26 @@ +/** +Abstract character/resume sheet representation. +@license Copyright (c) 2015 by James M. Devlin. All rights reserved. +*/ + (function() { -var FS = require('fs'); + var FS = require('fs'); -function Sheet() { + function Sheet() { + this.id = null; + this.title = "New"; + this.rep = { }; + this.fileName = null; + } - this.id = null; - this.title = ""; - this.sheets = []; - this.rep = { }; + Sheet.prototype.open = function( file, title ) { + this.rep = JSON.parse( FS.readFileSync( file, 'utf8' ) ); + this.fileName = file; + this.title = title || this.rep.basics.name; + return this; + }; -} - -Sheet.prototype.open = function( file ) { - this.rep = JSON.parse( FS.readFileSync( file, 'utf8' ) ); - return this; -}; - -module.exports = Sheet; + module.exports = Sheet; }());