Skip to content

Commit cc50436

Browse files
committed
Fix some linter errors
1 parent fecc59d commit cc50436

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

src/interpreter/plugin/TextPlugin.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ export class TextPlugin extends FunctionPlugin implements FunctionPluginTypechec
163163
*
164164
* Concatenates provided arguments to one string.
165165
*
166-
* @param ast
167-
* @param state
166+
* @param {ProcedureAst} ast - The procedure AST node
167+
* @param {InterpreterState} state - The interpreter state
168168
*/
169169
public concatenate(ast: ProcedureAst, state: InterpreterState): InterpreterValue {
170170
return this.runFunction(ast.args, state, this.metadata('CONCATENATE'), (...args) => {
@@ -177,8 +177,8 @@ export class TextPlugin extends FunctionPlugin implements FunctionPluginTypechec
177177
*
178178
* Splits provided string using space separator and returns chunk at zero-based position specified by second argument
179179
*
180-
* @param ast
181-
* @param state
180+
* @param {ProcedureAst} ast - The procedure AST node
181+
* @param {InterpreterState} state - The interpreter state
182182
*/
183183
public split(ast: ProcedureAst, state: InterpreterState): InterpreterValue {
184184
return this.runFunction(ast.args, state, this.metadata('SPLIT'), (stringToSplit: string, indexToUse: number) => {
@@ -388,8 +388,8 @@ export class TextPlugin extends FunctionPlugin implements FunctionPluginTypechec
388388
*
389389
* Converts a text string that represents a number to a number.
390390
*
391-
* @param ast
392-
* @param state
391+
* @param {ProcedureAst} ast - The procedure AST node
392+
* @param {InterpreterState} state - The interpreter state
393393
*/
394394
public value(ast: ProcedureAst, state: InterpreterState): InterpreterValue {
395395
return this.runFunction(ast.args, state, this.metadata('VALUE'), (arg: RawScalarValue): ExtendedNumber | CellError => {
@@ -424,6 +424,12 @@ export class TextPlugin extends FunctionPlugin implements FunctionPluginTypechec
424424
})
425425
}
426426

427+
/**
428+
* Parses a string to a numeric value, handling whitespace trimming and empty string validation.
429+
*
430+
* @param {string} input - The string to parse
431+
* @returns {Maybe<ExtendedNumber>} The parsed number or undefined if parsing fails or input is empty
432+
*/
427433
private parseStringToNumber(input: string): Maybe<ExtendedNumber> {
428434
const trimmedInput = input.trim()
429435

test/unit/interpreter/function-value.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ describe('Function VALUE', () => {
329329
dateFormats: ['YYYY-MM-DD'],
330330
})
331331

332-
expect(customParseDateTime).toHaveBeenCalled()
332+
expect(customParseDateTime).toHaveBeenCalledWith('2026-01-13', 'YYYY-MM-DD', 'hh:mm')
333333
expect(engine.getCellValue(adr('A1'))).toBe(46035)
334334
})
335335

@@ -353,7 +353,7 @@ describe('Function VALUE', () => {
353353
timeFormats: ['hh:mm'],
354354
})
355355

356-
expect(customParseDateTime).toHaveBeenCalled()
356+
expect(customParseDateTime).toHaveBeenCalledWith('14h30m', 'DD/MM/YYYY', 'hh:mm')
357357
expect(engine.getCellValue(adr('A1'))).toBeCloseTo(0.60416667, 6)
358358
})
359359

@@ -381,7 +381,7 @@ describe('Function VALUE', () => {
381381
timeFormats: ['hh:mm'],
382382
})
383383

384-
expect(customParseDateTime).toHaveBeenCalled()
384+
expect(customParseDateTime).toHaveBeenCalledWith('2026-01-13T14:30', 'YYYY-MM-DD', 'hh:mm')
385385
expect(engine.getCellValue(adr('A1'))).toBeCloseTo(46035.60417, 4)
386386
})
387387

@@ -394,7 +394,7 @@ describe('Function VALUE', () => {
394394
parseDateTime: customParseDateTime,
395395
})
396396

397-
expect(customParseDateTime).toHaveBeenCalled()
397+
expect(customParseDateTime).toHaveBeenCalledWith('invalid-format', 'DD/MM/YYYY', 'hh:mm')
398398
expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.VALUE, ErrorMessage.NumberCoercion))
399399
})
400400
})

0 commit comments

Comments
 (0)