Prefinem/nativemodels

View on GitHub
src/lib/parseRecord.js

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
const parseValue = require('./parseValue');

const parseRecord = (schema, record, options) =>
  Object.keys(record).reduce(
    (result, key) => ({
      ...result,
      ...(schema[key] ? { [key]: parseValue(schema[key], key, record[key], options) } : {}),
    }),
    {},
  );

module.exports = parseRecord;