Skip to content

Commit

Permalink
Fix handling of URL as a field value type
Browse files Browse the repository at this point in the history
  • Loading branch information
dhritzkiv committed Mar 26, 2020
1 parent 665d998 commit d053b44
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/util/OrmUtils.ts
@@ -1,4 +1,5 @@
import { ObjectLiteral } from "../common/ObjectLiteral";
import { URL } from "url";

export class OrmUtils {

Expand Down Expand Up @@ -82,7 +83,8 @@ export class OrmUtils {
&& !(value instanceof Set)
&& !(value instanceof Date)
&& !(value instanceof Buffer)
&& !(value instanceof RegExp)) {
&& !(value instanceof RegExp)
&& !(value instanceof URL)) {
if (!target[key])
Object.assign(target, { [key]: Object.create(Object.getPrototypeOf(value)) });
this.mergeDeep(target[key], value);
Expand Down Expand Up @@ -192,7 +194,8 @@ export class OrmUtils {
(x instanceof Date && y instanceof Date) ||
(x instanceof RegExp && y instanceof RegExp) ||
(x instanceof String && y instanceof String) ||
(x instanceof Number && y instanceof Number))
(x instanceof Number && y instanceof Number) ||
(x instanceof URL && y instanceof URL))
return x.toString() === y.toString();

// At last checking prototypes as good as we can
Expand Down

0 comments on commit d053b44

Please sign in to comment.