1.0.3 • Published 8 years ago
reqjs v1.0.3
reqjs
Install
yarn add reqjsUsage
const req = require('reqjs')
const life = req(`module.exports = () => 42`)
life() === 42 // trueGotchas
This is not really a CommonJS spec implementation, the code you req only supports module.exports and exports, you cannot use require inside the code!
The primary use case is that I want to evaluate a piece of user-supplied code, and allowing user to specify what I need using module.exports syntax. (Note that this may be dangerous!)
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin my-new-feature - Submit a pull request :D
Author
reqjs © egoist, Released under the MIT License. Authored and maintained by egoist with help from contributors (list).
egoistian.com · GitHub @egoist · Twitter @rem_rin_rin