Skip to content

Commit 80c1847

Browse files
committed
Fixed default replacer not used
1 parent f193b25 commit 80c1847

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/surreal.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ export class Surreal {
7676
http: HttpEngine,
7777
https: HttpEngine,
7878
};
79-
protected replacer?: ReplacerOptions;
79+
protected replacer: ReplacerOptions;
8080

81-
constructor({ engines, replacer }: SurrealOptions = {}) {
81+
constructor({ engines, replacer: customReplacer }: SurrealOptions = {}) {
8282
this.emitter = new Emitter();
8383
this.emitter.subscribe(ConnectionStatus.Disconnected, () => this.clean());
8484
this.emitter.subscribe(ConnectionStatus.Error, () => this.close());
@@ -90,7 +90,10 @@ export class Surreal {
9090
};
9191
}
9292

93-
this.replacer = replacer;
93+
this.replacer = customReplacer ?? {
94+
encode: replacer.encode,
95+
decode: replacer.decode,
96+
};
9497
}
9598

9699
/**

0 commit comments

Comments
 (0)