require-data
A function that tries to get the data out of a file that is either…
- … a JSON file
- … a JS file exporting a value that is not a function
- … a JS file exporting a function
- … a JS file exporting an async function
Install
npm install require-data
Usage
const requireData =
const requireData = const customRequire =
Files
require-data
will return data for all of those four files.
moduleexports = some: "data"
module some: "data"
moduleexports = async some: "data"
Parameters
filePath
{String}
Path to file.requireFn
{?Function}
Custom require function.
Returns
{Promise<*>}
Data of file.