Last active
December 16, 2015 04:08
-
-
Save hughfdjackson/5374776 to your computer and use it in GitHub Desktop.
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
| // 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 | |
| } | |
| } |
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
| 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