Skip to content

Instantly share code, notes, and snippets.

@mrkelly
Created October 10, 2014 18:12
Show Gist options
  • Save mrkelly/5fa79603edf94c24011a to your computer and use it in GitHub Desktop.
Save mrkelly/5fa79603edf94c24011a to your computer and use it in GitHub Desktop.
node lodash extend
'use strict';
var BasePageObject = function(arg1) {
this.arg1 = arg1;
};
BasePageObject.prototype.helloWorld = function() {
console.log('Hello, World!');
};
module.exports = BasePageObject;
'use strict';
var _ = require('lodash'),
BasePageObject = require('./base.page.object');
var MyPageObject = function(arg1, arg2) {
// If needed, this is similar to super()
BasePageObject.call(this, arg1);
this.arg2 = arg2;
};
MyPageObject.prototype = _.extend(BasePageObject.prototype, {
printArgs: function() {
console.log(this.arg1, this.arg2);
}
});
module.exports = MyPageObject;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment