Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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