Skip to content

Eval a JS string as if it was a file being required

License

Notifications You must be signed in to change notification settings

mcanthony/eval-as-module

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eval-as-module

travis-ci

Eval a JS string as if it was a file being required

Installation

npm install eval-as-module

then in your app:

var run = require('eval-as-module')

API

run(str, path)

Runs str as if it were a module at path and returns the module object

run('module.exports = require("eval-as-module")', __filename).exports // => run

And like eval it also gives you access to the value of the last statement executed in the script.

run('1;2;3').return // => 3

About

Eval a JS string as if it was a file being required

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 91.0%
  • Makefile 9.0%