From dcdbd3bf35f9734590c2b51a095c7981a88bbdbe Mon Sep 17 00:00:00 2001 From: David Mehren Date: Sat, 9 May 2020 17:49:44 +0200 Subject: [PATCH] Replace processData calls with ?? Many times processData was just used to ensure a default value is present. Since TS 3.7 the nullish coalescing operator ?? is supported for that. Signed-off-by: David Mehren --- lib/models/note.ts | 4 ++-- lib/models/revision.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/models/note.ts b/lib/models/note.ts index 129e365dc..3f38c1a5f 100644 --- a/lib/models/note.ts +++ b/lib/models/note.ts @@ -113,7 +113,7 @@ export class Note extends Model { @Column(DataType.TEXT) get title (): string { - return processData(this.getDataValue('title'), '') + return this.getDataValue('title') ?? '' } set title (value: string) { @@ -122,7 +122,7 @@ export class Note extends Model { @Column(DataType.TEXT({ length: 'long' })) get content (): string { - return processData(this.getDataValue('content'), '') + return this.getDataValue('content') ?? '' } set content (value: string) { diff --git a/lib/models/revision.ts b/lib/models/revision.ts index c7e112e60..0861a6383 100644 --- a/lib/models/revision.ts +++ b/lib/models/revision.ts @@ -81,7 +81,7 @@ export class Revision extends Model { @Column(DataType.TEXT({ length: 'long' })) get patch (): string { - return processData(this.getDataValue('patch'), '') + return this.getDataValue('patch') ?? '' } set patch (value: string) { @@ -90,7 +90,7 @@ export class Revision extends Model { @Column(DataType.TEXT({ length: 'long' })) get lastContent (): string { - return processData(this.getDataValue('lastContent'), '') + return this.getDataValue('lastContent') ?? '' } set lastContent (value: string) { @@ -99,7 +99,7 @@ export class Revision extends Model { @Column(DataType.TEXT({ length: 'long' })) get content (): string { - return processData(this.getDataValue('content'), '') + return this.getDataValue('content') ?? '' } set content (value: string) {