UNPKG

better-require

Version:

require('better-require')('json yaml') lets you load JSON and YAML files using require syntax. For example: var config = require('./config.json'); Extensions available are: json, yaml.

5 lines (3 loc) 120 B
If no extension, try catch to require as a JS file, otherwise try to detect file type. Load any library with node-ffi?