Last active
August 29, 2015 14:21
-
-
Save dantman/1227e660b6a65edaa3b8 to your computer and use it in GitHub Desktop.
https://github.com/esperantojs/esperanto/wiki/Cycles in ES5 CommonJS/Node.js
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
"use strict"; | |
var createObject = require('./createObject'); | |
var contrivedExample = createObject( 42 ); |
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
"use strict"; | |
module.exports = createChildren; | |
var createObject = require('./createObject'); | |
function createChildren ( i ) { | |
var children = []; | |
while ( i-- ) { | |
children[i] = createObject( 0 ); | |
} | |
return children; | |
} |
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
"use strict"; | |
module.exports = createObject; | |
var createChildren = require('./createChildren'); | |
function createObject( numChildren ) { | |
return { | |
children: createChildren( numChildren ) | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment