import * as fs from "fs" ; import * as path from "path" ; import { Issue , IssueComment } from "./github" ; export function loadQuery ( name ) { return fs . readFileSync ( path . join ( __dirname , ".." , "queries" , `${ name }.graphql` ) , "utf8" ) ; } export const getIssuesWithComments = ( issues ) : Issue [ ] => { return issues . filter ( ( issue ) => issue . comments . totalCount - ( issue . comments . nodes as IssueComment [ ] ) . length ) ; } ; export const iterateObject = ( obj , callback ) : any => { for ( const property in obj ) { if ( obj . hasOwnProperty ( property ) ) { if ( typeof obj [ property ] == "object" ) { iterateObject ( obj [ property ] , callback ) ; } else { callback ( obj , property ) ; } } } } ;