web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
917 B

  1. # require-from-string [![Build Status](https://travis-ci.org/floatdrop/require-from-string.svg?branch=master)](https://travis-ci.org/floatdrop/require-from-string)
  2. Load module from string in Node.
  3. ## Install
  4. ```
  5. $ npm install --save require-from-string
  6. ```
  7. ## Usage
  8. ```js
  9. var requireFromString = require('require-from-string');
  10. requireFromString('module.exports = 1');
  11. //=> 1
  12. ```
  13. ## API
  14. ### requireFromString(code, [filename], [options])
  15. #### code
  16. *Required*
  17. Type: `string`
  18. Module code.
  19. #### filename
  20. Type: `string`
  21. Default: `''`
  22. Optional filename.
  23. #### options
  24. Type: `object`
  25. ##### appendPaths
  26. Type: `Array`
  27. List of `paths`, that will be appended to module `paths`. Useful, when you want
  28. to be able require modules from these paths.
  29. ##### prependPaths
  30. Type: `Array`
  31. Same as `appendPaths`, but paths will be prepended.
  32. ## License
  33. MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop)