# require-from-string

> Require module from string

Latest version **2.0.2** (published 2018-04-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install require-from-string
pnpm add require-from-string
yarn add require-from-string
bun add require-from-string
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2018-04-09 |
| First published | 2015-07-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/require-from-string) |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 0 |
| Unpacked size | 3.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 298 |
| Author | Vsevolod Strukchinsky |
| Maintainers | floatdrop |

## Links

- npm: https://www.npmjs.com/package/require-from-string
- Repository: https://github.com/floatdrop/require-from-string
- Homepage: https://github.com/floatdrop/require-from-string#readme
- Issues: https://github.com/floatdrop/require-from-string/issues
- npm.io page: https://npm.io/package/require-from-string

## Recent versions

- 2.0.2 (latest) — 2018-04-09
- 2.0.1 — 2017-09-17
- 2.0.0 — 2017-09-16
- 1.2.1 — 2016-10-01
- 1.2.0 — 2016-05-03
- 1.1.0 — 2015-11-07
- 1.0.2 — 2015-11-06
- 1.0.1 — 2015-11-03
- 1.0.0 — 2015-07-18

## README

# require-from-string [![Build Status](https://travis-ci.org/floatdrop/require-from-string.svg?branch=master)](https://travis-ci.org/floatdrop/require-from-string)

Load module from string in Node.

## Install

```
$ npm install --save require-from-string
```


## Usage

```js
var requireFromString = require('require-from-string');

requireFromString('module.exports = 1');
//=> 1
```


## API

### requireFromString(code, [filename], [options])

#### code

*Required*  
Type: `string`

Module code.

#### filename
Type: `string`  
Default: `''`

Optional filename.


#### options
Type: `object`

##### appendPaths
Type: `Array`

List of `paths`, that will be appended to module `paths`. Useful, when you want
to be able require modules from these paths.

##### prependPaths
Type: `Array`

Same as `appendPaths`, but paths will be prepended.

## License

MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop)

---
_Source: https://npm.io/package/require-from-string · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
