Skip to content

Commit

Permalink
change output of getLabels to object
Browse files Browse the repository at this point in the history
  • Loading branch information
FireLemons committed Feb 5, 2022
1 parent 24b861d commit d2a6740
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ async function getColumnCardIssues (columnId) {
// Get a list of labels for an issue
// @param {number} issueNumber The number of the issue to fetch labels for
// @return {Promise} A promise representing fetching of the labels for an issue
// @fulfilled {Array} An array of label strings with all characters lower case
// @fulfilled {Object} An object where the label strings are the keys with all characters lower case
// @throws {TypeError} for a parameter of the incorrect type
// @throws {RangeError} when issueNumber is less than 1
// @throws {Error} if an error occurs while trying to fetch the project data
Expand All @@ -161,7 +161,13 @@ async function getIssueLabels (issueNumber) {
issue_number: issueNumber
})

return labelObjectList.data.map((labelObject) => labelObject.name.toLowerCase())
const labelsAsObject = {}

for (const label of labelObjectList) {
labelsAsObject[label.name.toLowerCase()] = true
}

return labelsAsObject
}

// Get the project with name passed into projectName from the current repo
Expand Down

0 comments on commit d2a6740

Please sign in to comment.