From 8ef9c6e80ced21401aa13ea9476d3d4dd106dee7 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Sun, 22 Oct 2023 17:00:00 +0200 Subject: [PATCH 1/2] chore: substrings of length one --- scripts/apidoc/typedoc.ts | 2 +- src/modules/helpers/luhn-check.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/apidoc/typedoc.ts b/scripts/apidoc/typedoc.ts index 28a3db8545a..2b2eb51f4c9 100644 --- a/scripts/apidoc/typedoc.ts +++ b/scripts/apidoc/typedoc.ts @@ -154,7 +154,7 @@ export function extractModuleName(module: DeclarationReflection): string { export function extractModuleFieldName(module: DeclarationReflection): string { const moduleName = extractModuleName(module); - return moduleName.substring(0, 1).toLowerCase() + moduleName.substring(1); + return moduleName.charAt(0).toLowerCase() + moduleName.substring(1); } export const MISSING_DESCRIPTION = 'Missing'; diff --git a/src/modules/helpers/luhn-check.ts b/src/modules/helpers/luhn-check.ts index ba68b41d470..90cffecff28 100644 --- a/src/modules/helpers/luhn-check.ts +++ b/src/modules/helpers/luhn-check.ts @@ -28,7 +28,7 @@ function luhnChecksum(str: string): number { let sum = 0; let alternate = false; for (let i = str.length - 1; i >= 0; i--) { - let n = Number.parseInt(str.substring(i, i + 1)); + let n = Number.parseInt(str.charAt(i)); if (alternate) { n *= 2; if (n > 9) { From b5c38a21a4a8aa42bdf07eb6e000bd6b84e0e4e7 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Sun, 22 Oct 2023 17:16:53 +0200 Subject: [PATCH 2/2] chore: use index access --- scripts/apidoc/typedoc.ts | 2 +- src/modules/helpers/luhn-check.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/apidoc/typedoc.ts b/scripts/apidoc/typedoc.ts index 2b2eb51f4c9..4a39bd3344a 100644 --- a/scripts/apidoc/typedoc.ts +++ b/scripts/apidoc/typedoc.ts @@ -154,7 +154,7 @@ export function extractModuleName(module: DeclarationReflection): string { export function extractModuleFieldName(module: DeclarationReflection): string { const moduleName = extractModuleName(module); - return moduleName.charAt(0).toLowerCase() + moduleName.substring(1); + return moduleName[0].toLowerCase() + moduleName.substring(1); } export const MISSING_DESCRIPTION = 'Missing'; diff --git a/src/modules/helpers/luhn-check.ts b/src/modules/helpers/luhn-check.ts index 90cffecff28..42fbe1a5485 100644 --- a/src/modules/helpers/luhn-check.ts +++ b/src/modules/helpers/luhn-check.ts @@ -28,7 +28,7 @@ function luhnChecksum(str: string): number { let sum = 0; let alternate = false; for (let i = str.length - 1; i >= 0; i--) { - let n = Number.parseInt(str.charAt(i)); + let n = Number.parseInt(str[i]); if (alternate) { n *= 2; if (n > 9) {