Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGoodall committed Jul 15, 2024
1 parent bd53c91 commit 751813d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/filters/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import datasette from '../services/datasette.js'
const { govukMarkdown } = xGovFilters

const addFilters = async (nunjucksEnv) => {

const datasetSlugNameTable = await datasette.runQuery('select dataset, name from dataset')
const datasetNameMapping = createDatasetMapping(datasetSlugNameTable.rows)
const datasetSlugToReadableName = makeDatasetSlugToReadableNameFilter(datasetNameMapping)
Expand Down
12 changes: 5 additions & 7 deletions src/filters/makeDatasetSlugToReadableNameFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,14 @@ export const makeDatasetSlugToReadableNameFilter = (datasetNameMapping) => {

/**
* Creates a mapping of dataset slugs to their corresponding readable names.
*
*
* @param {Array<[string, string]>} dataSubjects - An array of tuples, where each tuple contains a dataset slug and its corresponding readable name.
* @returns {Map<string, string>} - A Map object where each key is a dataset slug and its value is the corresponding readable name.
*/
export const createDatasetMapping = (dataSubjects) => {
const datasetMapping = new Map();
const datasetMapping = new Map()
dataSubjects.forEach(([slug, name]) => {
datasetMapping.set(slug, name);
});
return datasetMapping;
datasetMapping.set(slug, name)
})
return datasetMapping
}


2 changes: 1 addition & 1 deletion src/services/datasette.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default {
* @param {any[][]} rows - A 2D array of row data, where each inner array represents a row
* @returns {object[]} - An array of objects, where each object represents a row with column names as keys
*/
function formatData (columns, rows){
function formatData (columns, rows) {
// convert the rows into an easier to access format
return rows.map((row) => {
return row.reduce((acc, val, index) => {
Expand Down

0 comments on commit 751813d

Please sign in to comment.