require-from-string

Require module from string

MIT 9 个版本
安装
npm install require-from-string
yarn add require-from-string
pnpm add require-from-string
bun add require-from-string
README

require-from-string Build Status

Load module from string in Node.

Install

$ npm install --save require-from-string

Usage

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

版本列表
2.0.2 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