Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getInByJsonPath(obj, jsonPath) {
try {
return jsonPatch.getValueByPointer(obj, jsonPath)
}
catch (e) {
console.error(e) // eslint-disable-line no-console
return {}
}
}
patch.forEach((p) => {
const patchPointedData = jsonpatch.getValueByPointer(preUpdateDidDoc, p.path);
if (patchPointedData && patchPointedData.id && patchPointedData.id === '#recovery') {
throw new Error('Cannot change #recovery with update.');
}
});