mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
17 lines
402 B
JavaScript
17 lines
402 B
JavaScript
const Settings = require('settings-sharelatex')
|
|
const { DataTooLargeToParseError } = require('./Errors')
|
|
|
|
module.exports = {
|
|
parse(data, callback) {
|
|
if (data.length > Settings.maxUpdateSize) {
|
|
return callback(new DataTooLargeToParseError(data))
|
|
}
|
|
let parsed
|
|
try {
|
|
parsed = JSON.parse(data)
|
|
} catch (e) {
|
|
return callback(e)
|
|
}
|
|
callback(null, parsed)
|
|
}
|
|
}
|