All files / src/containers/Notification create.js

0% Statements 0/42
0% Branches 0/23
0% Functions 0/6
0% Lines 0/8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18                                   
import moment from 'domain/moment';
import Notification from './model';
 
const reviver = ([key, val]) => {
  if (! val) return [key, val];
  switch (key) {
    case 'timestamp':
    case 'notedDateTimeUtc':
      return ['moment', moment.utc(val)];
    default:
      return [key, val];
  }
};
 
const create = (data) => new Notification(data).mapEntries(reviver);
 
export default create;