Skip to content
Browse files

use Function() in compile so it doesn't actually run if there's a bal…

…anced `}) ... ({` construct, also much faster
  • Loading branch information...
1 parent ffd4d1d commit 5f5e30ed855b112273869e8a6b4700c470e2f138 @substack committed Jun 22, 2012
Showing with 2 additions and 2 deletions.
  1. +1 −1 index.js
  2. +1 −1 package.json
View
2 index.js
@@ -41,7 +41,7 @@ function compile (n, cb) {
js = String(n.toBuffer());
}
try {
- vm.runInNewContext('(function () { ' + js + ' })');
+ Function(js)
}
catch (e) {
if (cb) cb('Invalid number.')
View
2 package.json
@@ -1,6 +1,6 @@
{
"name" : "number-script",
- "version" : "0.0.1",
+ "version" : "0.0.2",
"description" : "Ordinal JavaScript",
"main" : "index.js",
"bin" : {

0 comments on commit 5f5e30e

Please sign in to comment.
Something went wrong with that request. Please try again.