Browse Source

style: Improve code formatting and consistency

Code formatting improvements across multiple files:

1. databaseUtil.ts:
   - Convert single quotes to double quotes for string literals
   - Maintain consistency with project style guidelines

2. CapacitorPlatformService.ts:
   - Convert single quotes to double quotes for string literals
   - Align with TypeScript formatting standards

3. NewEditProjectView.vue:
   - Improve code formatting for error handling lambda
   - Better readability with proper line breaks and indentation

These changes improve code consistency and readability without
affecting functionality. All changes follow project style guidelines.
pull/142/head
Matthew Raymer 1 month ago
parent
commit
c13008d476
  1. 8
      src/db/databaseUtil.ts
  2. 4
      src/services/platforms/CapacitorPlatformService.ts
  3. 4
      src/views/NewEditProjectView.vue

8
src/db/databaseUtil.ts

@ -262,11 +262,11 @@ export function generateInsertStatement(
if (value === null || value === undefined) { if (value === null || value === undefined) {
return null; return null;
} }
if (typeof value === 'object' && value !== null) { if (typeof value === "object" && value !== null) {
// Convert objects and arrays to JSON strings // Convert objects and arrays to JSON strings
return JSON.stringify(value); return JSON.stringify(value);
} }
if (typeof value === 'boolean') { if (typeof value === "boolean") {
// Convert boolean to integer (0 or 1) // Convert boolean to integer (0 or 1)
return value ? 1 : 0; return value ? 1 : 0;
} }
@ -323,10 +323,10 @@ export function generateUpdateStatement(
// Convert values to SQLite-compatible types // Convert values to SQLite-compatible types
let convertedValue = value ?? null; let convertedValue = value ?? null;
if (convertedValue !== null) { if (convertedValue !== null) {
if (typeof convertedValue === 'object') { if (typeof convertedValue === "object") {
// Convert objects and arrays to JSON strings // Convert objects and arrays to JSON strings
convertedValue = JSON.stringify(convertedValue); convertedValue = JSON.stringify(convertedValue);
} else if (typeof convertedValue === 'boolean') { } else if (typeof convertedValue === "boolean") {
// Convert boolean to integer (0 or 1) // Convert boolean to integer (0 or 1)
convertedValue = convertedValue ? 1 : 0; convertedValue = convertedValue ? 1 : 0;
} }

4
src/services/platforms/CapacitorPlatformService.ts

@ -184,11 +184,11 @@ export class CapacitorPlatformService implements PlatformService {
if (param === null || param === undefined) { if (param === null || param === undefined) {
return null; return null;
} }
if (typeof param === 'object' && param !== null) { if (typeof param === "object" && param !== null) {
// Convert objects and arrays to JSON strings // Convert objects and arrays to JSON strings
return JSON.stringify(param); return JSON.stringify(param);
} }
if (typeof param === 'boolean') { if (typeof param === "boolean") {
// Convert boolean to integer (0 or 1) // Convert boolean to integer (0 or 1)
return param ? 1 : 0; return param ? 1 : 0;
} }

4
src/views/NewEditProjectView.vue

@ -674,7 +674,9 @@ export default class NewEditProjectView extends Vue {
const privateExtendedKey = extPubPri?.privateExtendedKey; const privateExtendedKey = extPubPri?.privateExtendedKey;
const privateBytes: Uint8Array = const privateBytes: Uint8Array =
accountFromExtendedKey(privateExtendedKey).privateKey || accountFromExtendedKey(privateExtendedKey).privateKey ||
(() => { throw new Error("Failed to derive private key"); })(); (() => {
throw new Error("Failed to derive private key");
})();
// No real content is necessary, we just want something signed, // No real content is necessary, we just want something signed,
// so we might as well use nostr libs for nostr functions. // so we might as well use nostr libs for nostr functions.
// Besides: someday we may create real content that we can relay. // Besides: someday we may create real content that we can relay.

Loading…
Cancel
Save