Skip to content

Instantly share code, notes, and snippets.

@hughfdjackson
Last active December 16, 2015 04:08
Show Gist options
  • Select an option

  • Save hughfdjackson/5374776 to your computer and use it in GitHub Desktop.

Select an option

Save hughfdjackson/5374776 to your computer and use it in GitHub Desktop.
// basically boo.js, but with all the fluffy stripped away :3
var extend = function(to, from){
for ( var p in from ) to[p] = from[p]
return to
}
var Base = {
extend: function(props){
return extend(Object.create(this), props)
},
make: function(){
var obj = Object.create(this)
if ( typeof obj.init === 'function' ) obj.init.apply(obj, arguments)
return obj
}
}
var Coder = Base.extend({
init: function(opts){ this.ossProject = opts.ossProject },
work: function(){ return 'working on ' this.ossProject || ' work things' }
})
var Darren = Coder.make({
ossProject: 'MooTools'
})
var Hugh = Coder.make({
ossProject: 'immutable'
})
var Chiel = Coder.make({
ossProject: 'tinker.io'
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment