Skip to content

Instantly share code, notes, and snippets.

View newW2.js
const request = require('request-promise');
const moment = require('moment');
const getId = url => request(url).then(b => JSON.parse(b).data);
function getSoonItems(deal, type) {
return deals.filter(deal => (
deal.stage_id === app && deal[type.key] === type.refi ||
deal.stage_id === app && deal[type.key] === type.purchase && deal[pbl.key] === pbl.no
)).reduce((obj, deal) => { ...obj, [deal.id]:deal });