Created
October 6, 2014 16:27
-
-
Save dmnsgn/c9764801de08da3d848a to your computer and use it in GitHub Desktop.
Douglas Crockford's constructor as explained in his NordicJS 2014 talk.
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
function constructor(spec) { | |
let {member} = spec, | |
{other} = other_constructor(spec), | |
method = function () { | |
// member, other, method, spec... | |
}; | |
return Object.freeze({ | |
method, | |
other | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment