Created
March 9, 2011 17:38
-
-
Save robotlolita/862616 to your computer and use it in GitHub Desktop.
This file contains 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
/* | |
- Less noises. No semicolons or braces, unless strictly needed. | |
- Braces shouldn't be on a line of their own, unless they close a | |
function. | |
- No strict comparison operator, unless strictly needed. | |
- Form feed characters to separate pages of the code. | |
- Heading comments with at least four slashes (for outline-mode) | |
- Avoid comments inside the function unless strictly needed. Prefer | |
naming confuse or big chunks of code with a function. | |
- Concise and meaningful names. Use local variables to bind long names, | |
always. | |
- Tabs for indentation, spaces for alignment. | |
*/ | |
function inherit(ctor, base, props) { | |
/*** IFDEF DEBUG | |
assert(base, "Missing `base' parameter") | |
assert(dbg.isfn(ctor), "`ctor' isn't a function") | |
*** ENDIF */ | |
if (!props) props = {} | |
props.constructor = ctor | |
props.__super__ = base | |
ctor.prototype = create(base) | |
return extend(ctor.prototype, props) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment