MCPcopy Create free account
hub / github.com/tensorflow/tfjs / isObjectEmpty

Function isObjectEmpty

tfjs-layers/src/utils/generic_utils.ts:378–388  ·  view source on GitHub ↗
(obj: {})

Source from the content-addressed store, hash-verified

376 * @throws ValueError: If object is `null` or `undefined`.
377 */
378export function isObjectEmpty(obj: {}): boolean {
379 if (obj == null) {
380 throw new ValueError(`Invalid value in obj: ${JSON.stringify(obj)}`);
381 }
382 for (const key in obj) {
383 if (obj.hasOwnProperty(key)) {
384 return false;
385 }
386 }
387 return true;
388}
389
390/**
391 * Helper function used to build type union/enum run-time checkers.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…