This is my code:
jira.searchJira('priority = High', null, function(error, issuesArray) {
if (error) {
next(new Error(error));
}
issuesObject = issuesArray[Object.keys(issuesArray)[4]]; //All the issues
var singleIssue = issuesObject[issuesObject[Object.keys(issuesObject)[0]]]; //gets issue at position 0 in object
console.log(singleIssue);
console.log(typeof(singleIssue));
});
I am searching through JIRA using a query string (priority = High
) to search for a list of issues in that filter. The documentation I have been following says that the callback should return an array of issues but, as you can see, I was able to do Object.keys()[]
to return the issues (even though Array.isArray(issueArray)
returned true).
What I am trying to achieve is to loop through my Array/Object of issues (issuesObject
) to retrieve each individual issue. singleIssue
returns the issue at position 0 but I want a way to loop through to find ALL the issues. I have tried for...in issuesObject
but it just counts up listing the index (i.e. from 0 to number of issues).