1.0.3 • Published 2 years ago

rough-object-size v1.0.3

Weekly downloads
2,633
License
Apache-2.0
Repository
github
Last release
2 years ago

return max object size

Usage

use OBJECT_SIZE_MAX_LOOPS to change the default 1000 iteration loop

  const { roughObjectSize } = require('rough-object-size');


  const circular = {
      ok: 1,
    };
    const object = {
      circular,
      val: 1,
    };

    circular.object = circular;

    roughObjectSize(object) === 16


  const object = {
    bool: true,
    alon: 1,
    shimon: 'shimon',
    arr: [1],
    another: {
      wow: [1, 2, 3],
    },
  };

  roughObjectSize(object) ===(4 + 8 + 6 * 2 + 8 + 3 * 8);