xash93d/src/ManifestParser.js
2022-10-28 02:48:42 -06:00

18 lines
360 B
JavaScript
Executable File

const Ajv = require('ajv'),
constants = require('./util/constants')
const validate = new ajv().compile(constants.manifestSchema)
class ManifestParser {
constructor(manifestString) {
let data = JSON.parse(manifestString),
valid = validate(data)
if(!valid)
throw new Error('Uh oh, stinky!')
return data
}
}
module.exports = ManifestParser