Skip to content

Commit fa3a33b

Browse files
Fix JSDoc formatting etc
1 parent e19b89f commit fa3a33b

27 files changed

+314
-157
lines changed

app/filters.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ module.exports = function (env) {
99
* Instantiate object used to store the methods registered as a
1010
* 'filter' (of the same name) within nunjucks. You can override
1111
* gov.uk core filters by creating filter methods of the same name.
12-
* @type {Object}
12+
*
13+
* @type {object}
1314
*/
1415
const filters = {}
1516

app/filters/form-attributes.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ const _ = require('lodash')
77
* Add name, value, id, idPrefix and checked attributes to NHSUK form components
88
* Generate the attributes based on the application ID and the section they're in
99
*
10-
* @param {Object} originalObject - The original component configuration
11-
* @param {Object} data - The data object to extract values from
10+
* @param {object} originalObject - The original component configuration
11+
* @param {object} data - The data object to extract values from
1212
* @param {string} path - Path to the data property (e.g. "data.nationality")
13-
* @returns {Object} The decorated component configuration
14-
*
13+
* @returns {object} The decorated component configuration
1514
* @example
1615
* {{ nhsukCheckboxes({
1716
* fieldset: {

app/filters/formatting.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
/**
44
* Format a yes/no/not answered response with optional additional details
5+
*
56
* @param {string|boolean} value - The response value to format
6-
* @param {Object} [options] - Formatting options
7+
* @param {object} [options] - Formatting options
78
* @param {string} [options.yesValue] - Additional details to show after "Yes -" for positive responses
8-
* @param {string} [options.noText="No"] - Text to show for negative responses
9-
* @param {string} [options.notAnsweredText="Not answered"] - Text to show when no response given
10-
* @param {string} [options.yesPrefix="Yes"] - Text to show for positive responses (before any yesValue)
9+
* @param {string} [options.noText] - Text to show for negative responses
10+
* @param {string} [options.notAnsweredText] - Text to show when no response given
11+
* @param {string} [options.yesPrefix] - Text to show for positive responses (before any yesValue)
1112
* @returns {string} Formatted response text
1213
* @example
1314
* formatAnswer("yes", { yesValue: "Details here" }) // Returns "Yes - Details here"

app/filters/forms.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
/**
44
* Add error messages to form components based on flash messages
5-
* @param {Object} component - The form component configuration object
6-
* @param {Object} context - The template context containing flash messages
7-
* @returns {Object} Updated component configuration with error details if applicable
5+
*
6+
* @param {object} component - The form component configuration object
7+
* @returns {object} Updated component configuration with error details if applicable
88
*/
99
const populateErrors = function (component) {
1010
// Get flash messages from template context

app/filters/nunjucks.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ const log = (a, description = null) => {
1414

1515
/**
1616
* Safely join array elements with proper undefined/null handling
17+
*
1718
* @param {any} input - Array-like input to join
18-
* @param {string} [delimiter=''] - String to use as delimiter between elements
19-
* @param {string} [attribute] - Optional object property to extract before joining
20-
* @param {Object} [options] - Additional options for join behavior
21-
* @param {boolean} [options.filterEmpty=true] - Whether to filter out empty/null/undefined values
22-
* @param {boolean} [options.toString=true] - Whether to convert values to strings before joining
19+
* @param {string} [delimiter] - String to use as delimiter between elements
20+
* @param {string | null} [attribute] - Optional object property to extract before joining
21+
* @param {object} [options] - Additional options for join behavior
22+
* @param {boolean} [options.filterEmpty] - Whether to filter out empty/null/undefined values
23+
* @param {boolean} [options.toString] - Whether to convert values to strings before joining
2324
* @returns {string} Joined string or empty string if invalid input
24-
*
2525
* @example
2626
* join(['a', 'b', 'c'], ', ') // 'a, b, c'
2727
* join([{name: 'John'}, {name: 'Jane'}], ', ', 'name') // 'John, Jane'
@@ -86,10 +86,11 @@ const join = (input, delimiter = '', attribute = null, options = {}) => {
8686

8787
/**
8888
* Get user name by user ID with format options
89+
*
8990
* @param {string} userId - ID of the user
90-
* @param {Object} options - Display options
91-
* @param {boolean} [options.identifyCurrentUser=false] - Whether to add "(you)" for current user
92-
* @param {string} [options.format='full'] - Name format: 'full', 'short', or 'initial'
91+
* @param {object} [options] - Display options
92+
* @param {boolean} [options.identifyCurrentUser] - Whether to add "(you)" for current user
93+
* @param {string} [options.format] - Name format: 'full', 'short', or 'initial'
9394
* @returns {string} User's name in requested format
9495
*/
9596
const getUsername = function (userId, options = {}) {
@@ -127,7 +128,7 @@ const getUsername = function (userId, options = {}) {
127128

128129
/**
129130
*
130-
* @returns {Object} The context data
131+
* @returns {object} The context data
131132
*/
132133
const getContext = function () {
133134
return this.ctx

app/filters/tags.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ const { getStatusTagColour, getStatusText } = require('../lib/utils/status')
66

77
/**
88
* Convert a status string into an NHS tag
9+
*
910
* @param {string} status - Status to convert
10-
* @param {Object} [options] - Optional configuration
11+
* @param {object} [options] - Optional configuration
1112
* @returns {string} HTML for tag component
1213
*/
1314
const toTag = (status, options = {}) => {

app/lib/generators/address-generator.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ const HOUSE_NAMES = [
6969

7070
/**
7171
* Extract postcode area (first 1-2 letters) from a full postcode
72+
*
7273
* @param {string} postcode - Full UK postcode
7374
* @returns {string} Postcode area (e.g., 'OX' from 'OX3 7LE')
7475
*/
@@ -78,6 +79,7 @@ const getPostcodeArea = (postcode) => {
7879

7980
/**
8081
* Get the postcode district (number after area) from a full postcode
82+
*
8183
* @param {string} postcode - Full UK postcode
8284
* @returns {string} Postcode district number
8385
*/
@@ -87,6 +89,7 @@ const getPostcodeDistrict = (postcode) => {
8789

8890
/**
8991
* Generate a random postcode in the same area as the reference postcode
92+
*
9093
* @param {string} referencePostcode - Postcode to base the new one on
9194
* @returns {string} New postcode in same area
9295
*/
@@ -113,6 +116,7 @@ const generateNearbyPostcode = (referencePostcode) => {
113116

114117
/**
115118
* Generate a random street name
119+
*
116120
* @returns {string} Generated street name
117121
*/
118122
const generateStreetName = () => {
@@ -123,7 +127,8 @@ const generateStreetName = () => {
123127

124128
/**
125129
* Generate line 1 of an address
126-
* @returns {Object} Address line 1 details
130+
*
131+
* @returns {object} Address line 1 details
127132
*/
128133
const generateAddressLine1 = () => {
129134
// 20% chance of using a house name instead of number
@@ -151,7 +156,8 @@ const generateAddressLine1 = () => {
151156

152157
/**
153158
* Generate list of nearby towns/areas based on BSU location
154-
* @param {Object} bsu - Breast screening unit object
159+
*
160+
* @param {object} bsu - Breast screening unit object
155161
* @returns {Array} List of nearby towns/areas
156162
*/
157163
const generateNearbyAreas = (bsu) => {
@@ -192,8 +198,9 @@ const generateNearbyAreas = (bsu) => {
192198

193199
/**
194200
* Generate an address appropriate for the BSU area
195-
* @param {Object} bsu - Breast screening unit object
196-
* @returns {Object} Generated address object
201+
*
202+
* @param {object} bsu - Breast screening unit object
203+
* @returns {object} Generated address object
197204
*/
198205
const generateBSUAppropriateAddress = (bsu) => {
199206
const nearbyAreas = generateNearbyAreas(bsu)

app/lib/generators/mammogram-generator.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,16 @@ const generateImageUrl = (side, view, accessionNumber) => {
4848

4949
/**
5050
* Generate images for a single view
51-
* @param {Object} params - Parameters for image generation
51+
*
52+
* @param {object} params - Parameters for image generation
5253
* @param {string} params.side - Breast side ('right' or 'left')
5354
* @param {string} params.view - View type ('mediolateral oblique' or 'craniocaudal')
5455
* @param {string} params.accessionBase - Base accession number
5556
* @param {number} params.startIndex - Starting index for image numbering
5657
* @param {string} params.startTime - Start timestamp
5758
* @param {boolean} params.isSeedData - Whether generating seed data
5859
* @param {boolean} [params.needsRepeat] - Force this view to be repeated
59-
* @returns {Object} View data with images
60+
* @returns {object} View data with images
6061
*/
6162
const generateViewImages = ({
6263
side,
@@ -109,14 +110,15 @@ const generateViewImages = ({
109110

110111
/**
111112
* Generate a complete set of mammogram images
112-
* @param {Object} options - Generation options
113+
*
114+
* @param {object} [options] - Generation options
113115
* @param {Date|string} [options.startTime] - Starting timestamp (defaults to now)
114-
* @param {boolean} [options.isSeedData=false] - Whether generating seed data
115-
* @param {Object} [options.config] - Optional configuration for specific scenarios
116+
* @param {boolean} [options.isSeedData] - Whether generating seed data
117+
* @param {object} [options.config] - Optional configuration for specific scenarios
116118
* @param {string[]} [options.config.repeatViews] - Array of views to repeat (e.g. ['RMLO', 'LCC'])
117119
* @param {string[]} [options.config.missingViews] - Array of views to omit (e.g. ['RMLO'])
118-
* @param {Object} [options.probabilities] - Override default probabilities
119-
* @returns {Object} Complete mammogram data
120+
* @param {object} [options.probabilities] - Override default probabilities
121+
* @returns {object} Complete mammogram data
120122
*/
121123
const generateMammogramImages = ({
122124
startTime = new Date(),

app/lib/generators/participant-generator.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ const dayjs = require('dayjs')
1010

1111
/**
1212
* Generate a precise date of birth within the specified age range
13-
* @param {Object} options - Generation options
14-
* @param {string} options.riskLevel - Risk level to use for age range
15-
* @param {Date} [options.referenceDate] - Date to calculate age from (defaults to today)
13+
*
14+
* @param {string} riskLevel - Risk level to use for age range
15+
* @param {Date} [referenceDate] - Date to calculate age from (defaults to today)
1616
* @returns {string} ISO date string for date of birth
1717
*/
1818
const generateDateOfBirth = (riskLevel, referenceDate = new Date()) => {

app/lib/generators/reading-generator.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const { eligibleForReading } = require('../utils/status')
66

77
/**
88
* Generate sample image reading data to simulate first and second reads
9+
*
910
* @param {Array} events - Array of screening events
1011
* @param {Array} users - Array of system users
1112
* @returns {Array} Updated events with reading data

0 commit comments

Comments
 (0)