A simple 'extend' helper, adapted from the Backbone.js library.