@n1k1t/mock-server
Version:
Powerful util to setup mocks over HTTP APIs
21 lines • 636 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractWithJsonPathSafe = void 0;
const jsonpath_plus_1 = require("jsonpath-plus");
;
const extractWithJsonPathSafe = (params) => {
try {
return {
status: 'OK',
results: (0, jsonpath_plus_1.JSONPath)(Object.assign(params, { resultType: 'all' })),
};
}
catch (error) {
return {
status: 'ERROR',
error: error instanceof Error ? error : new Error('Unknown'),
};
}
};
exports.extractWithJsonPathSafe = extractWithJsonPathSafe;
//# sourceMappingURL=json.js.map