Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
options = Object.assign({}, options, parserOptions)
if (!options.filePath) {
throw new Error('no file path provided!')
}
const keyHash = crypto.createHash('sha256')
keyHash.update(content)
hashObject(options, keyHash)
const key = keyHash.digest('hex')
let ast = cache.get(key)
if (ast != null) return ast
const realParser = moduleRequire(options.parser)
ast = realParser.parse(content, options)
cache.set(key, ast)
return ast
}