dotfiles/.vscode/extensions/saviorisdead.RustyCode-0.18.0/node_modules/is-my-json-valid/require.js
Cyryl Płotnicki 2f946d6200 Add .vscode
2016-09-11 10:29:13 +02:00

12 lines
444 B
JavaScript

var fs = require('fs')
var path = require('path')
var compile = require('./')
delete require.cache[require.resolve(__filename)]
module.exports = function(file, opts) {
file = path.join(path.dirname(module.parent.filename), file)
if (!fs.existsSync(file) && fs.existsSync(file+'.schema')) file += '.schema'
if (!fs.existsSync(file) && fs.existsSync(file+'.json')) file += '.json'
return compile(fs.readFileSync(file, 'utf-8'), opts)
}