Created
October 10, 2014 18:12
-
-
Save mrkelly/5fa79603edf94c24011a to your computer and use it in GitHub Desktop.
node lodash extend
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var BasePageObject = function(arg1) { | |
this.arg1 = arg1; | |
}; | |
BasePageObject.prototype.helloWorld = function() { | |
console.log('Hello, World!'); | |
}; | |
module.exports = BasePageObject; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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