{"id":27817047,"url":"https://github.com/9a8ri3l/sizeof","last_synced_at":"2025-05-01T14:30:22.194Z","repository":{"id":221480282,"uuid":"753692019","full_name":"9a8ri3L/sizeof","owner":"9a8ri3L","description":"A utility function that calculates the size or length of various input types.","archived":false,"fork":false,"pushed_at":"2024-02-08T17:19:48.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-29T06:25:22.893Z","etag":null,"topics":["array-methods","commonjs","es6","length","number","object-length-calculation","size","string"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@g-lib/sizeof","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/9a8ri3L.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-06T16:07:57.000Z","updated_at":"2024-03-04T16:40:00.000Z","dependencies_parsed_at":"2024-02-08T08:25:43.380Z","dependency_job_id":"3313d17d-62cd-4f9e-9ba2-72afdaf8b7af","html_url":"https://github.com/9a8ri3L/sizeof","commit_stats":null,"previous_names":["9a8ri3l/sizeof"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9a8ri3L%2Fsizeof","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9a8ri3L%2Fsizeof/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9a8ri3L%2Fsizeof/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9a8ri3L%2Fsizeof/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/9a8ri3L","download_url":"https://codeload.github.com/9a8ri3L/sizeof/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251889909,"owners_count":21660406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["array-methods","commonjs","es6","length","number","object-length-calculation","size","string"],"created_at":"2025-05-01T14:30:21.595Z","updated_at":"2025-05-01T14:30:22.157Z","avatar_url":"https://github.com/9a8ri3L.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![GitHub Release](https://img.shields.io/github/v/release/9a8ri3L/sizeof)\n![NPM License](https://img.shields.io/npm/l/%40g-lib%2Fsizeof)\n![GitHub forks](https://img.shields.io/github/forks/9a8ri3L/sizeof?style=plastix\u0026color=yellow)\n![GitHub stars](https://img.shields.io/github/stars/9a8ri3L/sizeof?style=flat-square)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/1adbc875e33c46d1a07ee1d2dc8abdf0)](https://app.codacy.com/gh/9a8ri3L/sizeof/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_grade)\n![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/9a8ri3L/sizeof/total)\n\n![GitHub commits since latest release](https://img.shields.io/github/commits-since/9a8ri3L/sizeof/latest)\n![GitHub contributors](https://img.shields.io/github/contributors-anon/9a8ri3L/sizeof)\n![npm bundle size (scoped)](https://img.shields.io/bundlephobia/minzip/%40g-lib/sizeof)\n\n# sizeof\n\n### A utility function that calculates the size or the length of various types.\n\n#### install\n\n```\nnpm i @g-lib/sizeof\n```\n\n```\nyarn add @g-lib/sizeof\n```\n\n```\npnpm add @g-lib/sizeof\n```\n\n### Usage:\n\n```ts\nimport sizeof from \"@g-lib/sizeof\";\n\n// or\n\nconst sizeof = require(\"@g-lib/sizeof\");\n\nconsole.log(sizeof({ foo: \"bar\", bar: \"baz\" })); // 2\nconsole.log(sizeof([1, 2, 3])); // 3\nconsole.log(sizeof(new Map().set(\"foo\", true))); // 1\nconsole.log(sizeof(new Set().add(\"foo\").add(\"bar\"))); // 2\nconsole.log(sizeof(2024)); // 4\nconsole.log(sizeof(100e15)); // 18\nconsole.log(sizeof(Symbol(\"foo\"))); // 3\nconsole.log(\n  sizeof(function foo(a: any, b: any) {\n    return a + b;\n  })\n); // 0\nconsole.log(\n  sizeof(function bar() {\n    return \"bar\";\n  })\n); // 3\nconsole.log(\n  sizeof(\n    new (function Foo(this: any) {\n      this.name = \"Foo\";\n      this.age = 30;\n    } as any)()\n  )\n); // 2\nconsole.log(\n  sizeof(\n    new (class Foo extends Map\u003cany, any\u003e {\n      constructor(public name: string) {\n        super();\n      }\n    })(\"\")\n  )\n); // 0\nconsole.log(\n  sizeof(\n    new (class Bar {\n      constructor(public name: string) {}\n    })(\"\")\n  )\n); // 1\n```\n\n#### Contributing is always welcomed.\n\n### License [MIT](https://choosealicense.com/licenses/mit/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F9a8ri3l%2Fsizeof","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F9a8ri3l%2Fsizeof","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F9a8ri3l%2Fsizeof/lists"}