Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/floatdrop/require-or-die

Require common-js modules and js files that return values
https://github.com/floatdrop/require-or-die

Last synced: about 1 month ago
JSON representation

Require common-js modules and js files that return values

Awesome Lists containing this project

README

        

# require-or-die

[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][depstat-image]][depstat-url]

Requires common.js modules as well as simple js files, that returns values.

## Usage

```js
var rod = require('require-or-die');

rod('./sample.js', function (err, value) {
console.log(value);
})
```

### API

#### require(path, [options], callback)

###### path
Type: `String`

Path to required file (will be resolved by `require.resolve`).

###### options
Type: `Object`

Options, that will be passed to fs.readFile.

###### callback
Type: `Function`

Function, that will be called, when contents is read and processed. Signature pretty common: `function (err, value)`.

#### require.sync(path)

Same as `require`, but in sync way.

## License

MIT (c) 2014 Vsevolod Strukchinsky

[npm-url]: https://npmjs.org/package/require-or-die
[npm-image]: http://img.shields.io/npm/v/require-or-die.svg?style=flat

[travis-url]: http://travis-ci.org/floatdrop/require-or-die
[travis-image]: http://img.shields.io/travis/floatdrop/require-or-die.svg?branch=master&style=flat

[depstat-url]: https://david-dm.org/floatdrop/require-or-die
[depstat-image]: http://img.shields.io/david/floatdrop/require-or-die.svg?style=flat