We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 75de82b commit 7dc7e97Copy full SHA for 7dc7e97
1 file changed
src/NtpTimeSync.ts
@@ -119,8 +119,7 @@ export class NtpTimeSync {
119
return [key, options[key]];
120
}
121
122
- const isObject = typeof options[key] === "object" && options[key] !== null;
123
- if (isObject) {
+ if (NtpTimeSync.isPlainObject(options[key])) {
124
return [key, this.recursiveResolveOptions(options[key], defaults[key])];
125
126
@@ -130,6 +129,11 @@ export class NtpTimeSync {
130
129
return Object.fromEntries(mergedConfig);
131
132
+ // @see https://quickref.me/check-if-a-value-is-a-plain-object.html
133
+ private static isPlainObject(v: any): boolean {
134
+ return !!v && typeof v === "object" && (v.__proto__ === null || v.__proto__ === Object.prototype);
135
+ }
136
+
137
/**
138
* Returns a singleton
139
*/
0 commit comments