Last active
August 29, 2015 14:05
-
-
Save dankahle/b5c59c7cf7802d8758d7 to your computer and use it in GitHub Desktop.
An example of how to share code between the browser and node. You need to "module.exports" the arrays in node, but not in the browser.
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
var users = [ | |
{id:'dk', name: 'dank', age:50}, | |
{id:'cy', name: 'carl', age:60}, | |
{id:'js', name: 'jim', age:40} | |
]; | |
if(!window && typeof module != 'undefined'){ | |
module.exports.friends = friends; | |
module.exports.users = users; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment