From ffa06118a0a8c62333156aabef9a5820a29e477f Mon Sep 17 00:00:00 2001 From: devlinjd Date: Thu, 17 Sep 2015 07:27:30 -0400 Subject: [PATCH] Minor extensions to Sheet class. --- src/sheet.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/sheet.js b/src/sheet.js index 628c39f..5f0b84e 100644 --- a/src/sheet.js +++ b/src/sheet.js @@ -15,6 +15,9 @@ Abstract character/resume sheet representation. this.fileName = null; } + /** + Open and parse the specified JSON resume sheet. + */ Sheet.prototype.open = function( file, title ) { var rep = JSON.parse( FS.readFileSync( file, 'utf8' ) ); extend( true, this, rep ); @@ -24,6 +27,16 @@ Abstract character/resume sheet representation. return this; }; + /** + Determine if the sheet includes a specific social profile (eg, GitHub). + */ + Sheet.prototype.hasProfile = function( socialNetwork ) { + socialNetwork = socialNetwork.trim().toLowerCase(); + return this.basics.profiles && this.basics.profiles.filter(function(prof) { + return prof.network.trim().toLowerCase() === socialNetwork; + }).length > 0; + } + module.exports = Sheet; }());