Skip to content

Instantly share code, notes, and snippets.

@TheSavior
Last active October 13, 2015 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheSavior/8ec9702df52ff302715d to your computer and use it in GitHub Desktop.
Save TheSavior/8ec9702df52ff302715d to your computer and use it in GitHub Desktop.
Expose helpers on functions
'use strict';
var privateState = require('privatestate');
function nameHelper(first, last) {
return first + ' ' + last;
}
function Person(first, last) {
this.first = first;
this.last = last;
}
Person.prototype = {
welcome: function() {
return 'My name is ' + nameHelper(this.first, this.last);
}
}
privateState.registerTestingFunctions(Person, ['nameHelper']);
module.exports = Person;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment