File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -100,18 +100,19 @@ compiler.hide('console', 'Math')
100
100
code ({num: 1.8 }) // throws an error, console and Math are undefined
101
101
```
102
102
103
- Context variables are always favored over global ones, when both are present (with the same name).
103
+ Context variables are always favored over global ones when both are present (with the same name).
104
104
105
105
## Example
106
106
107
107
``` js
108
108
const compiler = require (' @risingstack/nx-compile' )
109
109
110
- const context = {name: ' nx-compile' , version: ' 4.0.0' }
111
- const expression = compiler .compileExpression (' name + version)' , sandbox)
110
+ compiler .expose (' console' )
111
+ const context = {name: ' nx-compile' }
112
+ const tempVars = {version: ' 4.2.0' }
113
+ const code = compiler .compileCode (' console.log(name + version)' )
112
114
113
- // outputs 'nx-compile4.0.0' to console
114
- console .log (expression (context))
115
+ code (context, tempVars) // outputs 'nx-compile4.2.0' to console
115
116
```
116
117
117
118
## Contributions
You can’t perform that action at this time.
0 commit comments