1. Sean Wilkinson
  2. quanah

Commits

Sean Wilkinson  committed 3514f8b

New `hood` function isolates the "evil" line in Quanah

  • Participants
  • Parent commits f1da325
  • Branches master

Comments (0)

Files changed (2)

File package.json

View file
  • Ignore whitespace
 {
     "name": "quanah",
-    "version": "0.0.10",
+    "version": "0.0.11",
     "description": "Event-driven framework for distributed computing",
     "main": "src/quanah.js",
     "directories": {

File src/quanah.js

View file
  • Ignore whitespace
 //
 //                                                      ~~ (c) SRW, 30 Oct 2012
 
-(function (global) {
+(function (global, hood) {
     'use strict';
 
  // Pragmas
                      // matter, calling the regular expression twice may be
                      // slower than calling it once and processing its output
                      // conditionally, and that way might be clearer, too ...
-                        /*jslint evil: true */
-                        f = ((new Function('return ' + atob(code)))());
+                        f = hood(atob(code));
                         copy(deserialize(atob(props)), f);
                         return;
                     });
 
     return (typeof this.global === 'object') ? this.global : this;
 
-}, null, this)));
+}, null, this), function ($f) {
+    'use strict';
+
+ // This is a sandbox for resuscitating function code safely. I will explain
+ // more later ...
+
+    /*jslint evil: true, indent: 4, maxlen: 80 */
+
+    return (new Function('return ' + $f))();
+
+}));
 
 //- vim:set syntax=javascript: