Skip to content

Instantly share code, notes, and snippets.

@raix
Last active December 20, 2015 00:09
Show Gist options
  • Save raix/6040192 to your computer and use it in GitHub Desktop.
Save raix/6040192 to your computer and use it in GitHub Desktop.
Syntax tree Meteor.isClient = false
// code = 'server';
{
"type": "Program",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "Identifier",
"name": "code"
},
"right": {
"type": "Literal",
"value": "server",
"raw": "'server'"
}
}
}
]
}
// if (Meteor.isClient) {
// code = 'client';
// } else {
// code = 'server';
// }
{
"type": "Program",
"body": [
{
"type": "IfStatement",
"test": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "Meteor"
},
"property": {
"type": "Identifier",
"name": "isClient"
}
},
"consequent": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "Identifier",
"name": "code"
},
"right": {
"type": "Literal",
"value": "client",
"raw": "'client'"
}
}
}
]
},
"alternate": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "Identifier",
"name": "code"
},
"right": {
"type": "Literal",
"value": "server",
"raw": "'server'"
}
}
}
]
}
}
]
}
@mquandalle
Copy link

Can you explain what is this for?

@raix
Copy link
Author

raix commented Sep 7, 2013

Stripping code, sorry about the late response, Got no notifications

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment