Skip to content

Instantly share code, notes, and snippets.

@jashkenas
Forked from creationix/nodeFactory2.js
Created February 27, 2010 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jashkenas/316971 to your computer and use it in GitHub Desktop.
Save jashkenas/316971 to your computer and use it in GitHub Desktop.
function nodeFactory() {
function toStringFactory(data) { return function toString() {
// TODO: Implement
}}
function compileFactory(data) { return function compile() {
// TODO: Implement
}}
return {
BaseNode: function (data) {
return {
toString: toStringFactory(data),
compile: compileFactory(data)
}
},
ForNode: function (data) {
return {
toString: function () {
// Override toString
}
compile: compileFactory(data)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment