UNPKG

ih-black-lion

Version:

State handler for Arus projects

34 lines (29 loc) 829 B
import { isArrayLike, mapObj } from 'ramda'; export class Notification { constructor(obj) { this.id = obj.sccNtfreqId; this.tag = obj.sccNtfreqItmTag; this.type = obj.sccNtfreqType; this.importance = obj.sccNtfreqImptnce; this.dateTime = obj.sccRowAddDttm; this.subject = obj.sccNtfreqSubject; this.message = obj.sccNtfreqMsgtext; } } export default class Notifications { constructor(obj) { this.notifications = {}; let length = 0; const items = obj.sccGetNotifResp.ntkItem; if (isArrayLike(items)) { this.notifications = mapObj((notification) => { ++length; return new Notification(notification); }, items); } else { ++length; this.notifications['0'] = new Notification(items); } this.notifications.length = length; } }