class globalFunc { PDataCheck(arg1, arg2) { var iarg1 = arg1 if (moment(iarg1).isValid()) {iarg1 = arg1.toString()} var iarg2 = arg2 if (moment(iarg2).isValid()) {iarg2 = arg2.toString()} if (!Array.isArray(iarg2)) { var resultdc = iarg1.contains(iarg2) } else if (!Array.isArray(iarg1)) { var resultdc = iarg2.contains(iarg1) } else { let count = iarg2.length let tempresult = false for (let i = 0; i < count; i++) { tempresult = tempresult || iarg1.contains(iarg2[i]) } var resultdc = tempresult } return resultdc } GetTableHeaders(DataT, TableT) { let TempData = ["Name"] switch(DataT) { case 'Investment': switch(TableT) { case 'overview': TempData = ["Name", "Currency", "Style", "Stage", "Themes"] break; case 'trading': TempData = ["Name", "Currency", "Trading date", "Trading price"] break; } break; case 'Source': TempData = ["Title", "Author", "Published date", "Language", "Themes", "Date read"] break; case 'Place': switch(TableT) { case 'Restaurant': TempData = ["Name", "Style", "Cuisine", "Phone", "Email", "Website"] break; case 'Brunch': TempData = ["Name", "Style", "Cuisine", "Phone", "Email", "Website"] break; case 'Hotel': TempData = ["Name", "Type", "Influence", "Phone", "Email", "Website"] break; case 'Bar': TempData = ["Name", "Type", "Influence", "Phone", "Email", "Website"] break; case 'Sport': TempData = ["Name", "Phone", "Email", "Website"] break; case 'Café': TempData = ["Name", "Style", "Phone", "Email", "Website"] break; } break; case 'Product': TempData = ["Name", "Category", "Link", "Value", "Themes"] break; } return TempData } GetTableMap(DataT, TableT, p) { let TempData = [p.file.link] switch(DataT) { case 'Investment': switch(TableT) { case 'overview': TempData = [p.file.link, p.Investment.Ccy, p.Investment.Style, p.Investment.Stage, p.Tag] break; case 'trading': TempData = [p.file.link, p.Investment.Ccy, p.Trading.PDate, p.Trading.PPrice] break; } break; case 'Source': TempData = [p.file.link, p.Source.Author, p.Source.Published, p.Source.Language, p.Tag, p.Source.Read] break; case 'Place': switch(TableT) { case 'Restaurant': TempData = [p.file.link, p.Place.SubType, p.Place.Style, p.Phone, p.Email, p.Website] break; case 'Brunch': TempData = [p.file.link, p.Place.SubType, p.Place.Style, p.Phone, p.Email, p.Website] break; case 'Hotel': TempData = [p.file.link, p.Place.SubType, p.Place.Style, p.Phone, p.Email, p.Website] break; case 'Bar': TempData = [p.file.link, p.Place.SubType, p.Place.Style, p.Phone, p.Email, p.Website] break; case 'Sport': TempData = [p.file.link, p.Phone, p.Email, p.Website] break; case 'Café': TempData = [p.file.link, p.Place.SubType, p.Phone, p.Email, p.Website] break; } break; case 'Product': TempData = [p.file.link, p.Product.Type, p.Product.Link, p.Product.Value, p.Tag] break; } return TempData } BuildList(arg1, construct) { let ilength = arg1.length let TempS = "" for (let i = 0; i < ilength; i++) { if (Boolean(arg1[i])) { if (TempS == "") { TempS = arg1[i] } else { TempS = TempS + construct + arg1[i] } } } return TempS } Get1stArg(arg3) { if (!Array.isArray(arg3)) { return arg3 } else { return arg3[0] } } IsInSearch(pobj, DocType, darray, iarray) { let ilength = iarray.length; let result = true for (let i = 0; i < iarray.length; i++) { if (iarray[i] == undefined || darray[i] == undefined) {result = result && true} else { switch(darray[i]) { case 'readingd': if (iarray[i] == true || iarray[i] == false) {result = result && (Boolean(this.GetpProp(pobj, DocType, darray[i])) == iarray[i])} else { if (Boolean(iarray[i])) { let pProp = this.GetpProp(pobj, DocType, darray[i]) if (!Boolean(pProp)) { result = result && false } else { result = result && this.PDataCheck(pProp, iarray[i]) } } else {result = result && true} } break; default: if (Boolean(iarray[i])) { let pProp = this.GetpProp(pobj, DocType, darray[i]) if (!Boolean(pProp)) { result = result && false } else { result = result && this.PDataCheck(pProp, iarray[i]) } } else {result = result && true} break; } } } return result } GetpProp(pobj, DocType, dPoint) { let result = null switch(dPoint) { case 'dateadded': result = this.GetPoint(pobj, "main", "date") break; case 'theme': result = this.GetPoint(pobj, "main", "tag") break; case 'invtype': case 'sourcetype': case 'placetype': case 'prodtype': result = this.GetPoint(pobj, DocType, "type") break; case 'style': result = this.GetPoint(pobj, DocType, "style") break; case 'stage': result = this.GetPoint(pobj, DocType, "stage") break; case 'ccy': result = this.GetPoint(pobj, DocType, "ccy") break; case 'tradingd': result = this.GetPoint(pobj, DocType, "tradingd") break; case 'tradingp': result = this.GetPoint(pobj, DocType, "tradingp") break; case 'language': result = this.GetPoint(pobj, DocType, "lang") break; case 'author': result = this.GetPoint(pobj, DocType, "author") break; case 'publicationd': result = this.GetPoint(pobj, DocType, "published") break; case 'readingd': result = this.GetPoint(pobj, DocType, "read") break; case 'country': result = this.GetPoint(pobj, DocType, "country") break; case 'area': result = this.GetPoint(pobj, DocType, "location") break; case 'ambiance': result = this.GetPoint(pobj, DocType, "subtype") break; case 'status': result = this.GetPoint(pobj, DocType, "status") break; case 'prodvalue': result = this.GetPoint(pobj, DocType, "value") break; } return result } GetPoint(pobj, fstline, dPoint) { let result = null switch(fstline) { case 'main': switch(dPoint) { case 'alias': result = pobj.Alias break; case 'tag': result = pobj.Tag break; case 'date': result = pobj.Date break; case 'type': result = pobj.DocType break; case 'hierarchy': result = pobj.Hierarchy break; case 'location': result = pobj.location break; case 'meatatable': result = pobj.CollapseMetaTable break; case 'timestamp': result = pobj.TimeStamp break; } break; case 'Investment': switch(dPoint) { case 'style': result = pobj.Investment.Style break; case 'stage': result = pobj.Investment.Stage break; case 'ccy': result = pobj.Investment.Ccy break; case 'type': result = pobj.Investment.Type break; case 'tradingd': result = pobj.Trading.Date break; case 'tradingp': result = pobj.Trading.Price break; } break; case 'Place': switch(dPoint) { case 'style': result = pobj.Place.Style break; case 'subtype': result = pobj.Place.SubType break; case 'location': result = pobj.Place.Location break; case 'type': result = pobj.Place.Type break; case 'country': result = pobj.Place.Country break; case 'status': result = pobj.Place.Status break; case 'phone': result = pobj.Phone break; case 'email': result = pobj.Email break; case 'website': result = pobj.Website break; } break; case 'Source': switch(dPoint) { case 'author': result = pobj.Source.Author break; case 'lang': result = pobj.Source.Language break; case 'published': result = pobj.Source.Published break; case 'type': result = pobj.Source.Type break; case 'link': result = pobj.Source.Link break; case 'read': result = pobj.Source.Read break; } break; case 'Product': switch(dPoint) { case 'value': result = pobj.Product.Value break; case 'type': result = pobj.Product.Type break; case 'link': result = pobj.Product.Link break; } break; case 'Server': switch(dPoint) { case 'cpu': result = pobj.Performance.CPU break; case 'ram': result = pobj.Performance.RAM break; case 'bw': result = pobj.Performance.Bandwidth break; case 'speed': result = pobj.Performance.Speed break; case 'os': result = pobj.Characteristics.OS break; case 'dom': result = pobj.Characteristics.Domiciliation break; case 'ipv4': result = pobj.Characteristics.IPv4 break; case 'hostname': result = pobj.Characteristics.Hostname break; case 'host': result = pobj.Characteristics.Host break; case 'subdomain': result = pobj.Characteristics.SubDomain break; case 'capa': result = pobj.Disk.Capa break; case 'type': result = pobj.Disk.Type break; case 'usedspace': result = pobj.Disk.UsedSpace break; case 'timestamp': result = pobj.Disk.TimeStamp break; } break; case 'Task': switch(dPoint) { case 'priority': result = pobj.Task.Priority break; case 'status': result = pobj.Task.Status break; case 'startdate': result = pobj.Task.StartDate break; case 'duedate': result = pobj.Task.DueDate break; case 'nextreviewdate': result = pobj.Task.NextReviewDate break; } break; case 'Travel': switch(dPoint) { case 'country': result = pobj.Travel.Country break; case 'duration': result = pobj.Travel.Duration break; case 'budget': result = pobj.Travel.Budget break; case 'type': result = pobj.Travel.Type break; case 'lbestseason': result = pobj.Travel.BestSeason break; case 'departuredate': result = pobj.Travel.DepartureDate break; } break; } return result } }