Closed p-mcgowan closed 3 years ago
suppose, hypothetically, a swagger code generator library turns:
paths: '/hello-wrld': get: tags: - nope summary: nope operationId: nope description: nope responses: '200': description: success '404': description: Not found
into:
const objectReduceByMap = require('object-reduce-by-map'); const { mockItGenerator } = require('generate-it-mockers'); const defaultUndefinedResponse = mockItGenerator({}); // {} const transformSchema = { pathGet: {} }; // cool const res = objectReduceByMap(defaultUndefinedResponse, transformSchema.pathGet); const actualReturnValue = undefined; // explosion const res = objectReduceByMap(actualReturnValue, transformSchema.pathGet); console.log(res);
if the input to the map is undefined, then mapping it to an object should just return undefined
currently, reducer.js#L152 tries to json parse, resulting in an error
suppose, hypothetically, a swagger code generator library turns:
into:
if the input to the map is undefined, then mapping it to an object should just return undefined
currently, reducer.js#L152 tries to json parse, resulting in an error