first commit

This commit is contained in:
rionzhao
2025-11-06 18:53:16 +08:00
commit 7adfd412b1
1397 changed files with 173058 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
/**
* Determine if {@linkcode arg} is a Plain Old JavaScript Object.
*
* @see https://masteringjs.io/tutorials/fundamentals/pojo
*
* @param arg to test
* @returns true if {@linkcode arg} is a POJO
*/
export function isPOJO(arg: unknown): arg is Record<string, unknown> {
if (!arg || typeof arg !== 'object') {
return false;
}
const proto = Object.getPrototypeOf(arg);
if (!proto) {
return true; // `Object.create(null)`
}
return proto === Object.prototype;
}