Last change
on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
917 bytes
|
Line | |
---|
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 |
|
---|
3 | Load module from string in Node.
|
---|
4 |
|
---|
5 | ## Install
|
---|
6 |
|
---|
7 | ```
|
---|
8 | $ npm install --save require-from-string
|
---|
9 | ```
|
---|
10 |
|
---|
11 |
|
---|
12 | ## Usage
|
---|
13 |
|
---|
14 | ```js
|
---|
15 | var requireFromString = require('require-from-string');
|
---|
16 |
|
---|
17 | requireFromString('module.exports = 1');
|
---|
18 | //=> 1
|
---|
19 | ```
|
---|
20 |
|
---|
21 |
|
---|
22 | ## API
|
---|
23 |
|
---|
24 | ### requireFromString(code, [filename], [options])
|
---|
25 |
|
---|
26 | #### code
|
---|
27 |
|
---|
28 | *Required*
|
---|
29 | Type: `string`
|
---|
30 |
|
---|
31 | Module code.
|
---|
32 |
|
---|
33 | #### filename
|
---|
34 | Type: `string`
|
---|
35 | Default: `''`
|
---|
36 |
|
---|
37 | Optional filename.
|
---|
38 |
|
---|
39 |
|
---|
40 | #### options
|
---|
41 | Type: `object`
|
---|
42 |
|
---|
43 | ##### appendPaths
|
---|
44 | Type: `Array`
|
---|
45 |
|
---|
46 | List of `paths`, that will be appended to module `paths`. Useful, when you want
|
---|
47 | to be able require modules from these paths.
|
---|
48 |
|
---|
49 | ##### prependPaths
|
---|
50 | Type: `Array`
|
---|
51 |
|
---|
52 | Same as `appendPaths`, but paths will be prepended.
|
---|
53 |
|
---|
54 | ## License
|
---|
55 |
|
---|
56 | MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop)
|
---|
Note:
See
TracBrowser
for help on using the repository browser.