{"id":40275561,"url":"https://github.com/mirismaili/objectools","last_synced_at":"2026-01-20T03:06:01.673Z","repository":{"id":193521605,"uuid":"688845374","full_name":"mirismaili/objectools","owner":"mirismaili","description":"Useful easy-to-use utilities to for javascript objects","archived":false,"fork":false,"pushed_at":"2024-08-27T08:38:26.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-09T12:43:59.209Z","etag":null,"topics":["every-object","filter-object","find-object","flip-object","foreach-object","map-object","mirror-object","object-utilitis","some-object","sort-object","transpose-object"],"latest_commit_sha":null,"homepage":"","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/mirismaili.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"publiccode":null,"codemeta":null}},"created_at":"2023-09-08T08:18:53.000Z","updated_at":"2024-08-27T08:38:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"a996dc24-dc30-4c4c-a2ba-90fcb44007bc","html_url":"https://github.com/mirismaili/objectools","commit_stats":null,"previous_names":["mirismaili/objectools"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/mirismaili/objectools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirismaili%2Fobjectools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirismaili%2Fobjectools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirismaili%2Fobjectools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirismaili%2Fobjectools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mirismaili","download_url":"https://codeload.github.com/mirismaili/objectools/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirismaili%2Fobjectools/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28594958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T02:08:49.799Z","status":"ssl_error","status_checked_at":"2026-01-20T02:08:44.148Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["every-object","filter-object","find-object","flip-object","foreach-object","map-object","mirror-object","object-utilitis","some-object","sort-object","transpose-object"],"created_at":"2026-01-20T03:06:00.240Z","updated_at":"2026-01-20T03:06:01.664Z","avatar_url":"https://github.com/mirismaili.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ObjecTools\n\n\u003e Useful easy-to-use utilities for JavaScript objects\n\n[![npm (scoped)](https://img.shields.io/npm/v/objectools.svg)](https://npmjs.com/package/objectools)\n[![install size](https://packagephobia.now.sh/badge?p=objectools)](https://packagephobia.now.sh/result?p=objectools)\n[![downloads](https://img.shields.io/npm/dt/objectools.svg)](https://npmjs.com/package/objectools) \u003cbr\u003e\n[![license](https://img.shields.io/github/license/mirismaili/objectools.svg)](https://github.com/mirismaili/objectools/blob/master/LICENSE)\n[![Forks](https://img.shields.io/github/forks/mirismaili/objectools.svg?style=social)](https://github.com/mirismaili/objectools/fork)\n[![Stars](https://img.shields.io/github/stars/mirismaili/objectools.svg?style=social)](https://github.com/mirismaili/objectools)\n\n## Table of contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Examples](#examples)\n  - [`.filter()`](#filter)\n  - [`.map()`, `.mapKeyValue`](#map)\n  - [`.keys`, `.values`, `.entries`, `.length`](#keys-values-entries-length)\n  - [`.find()`, `.findIndex()`, `.findKey()`, `.findValue()`](#find-findindex-findkey-findvalue)\n  - [`.findLast()`, `.findLastIndex()`, `.findLastKey()`, `.findLastValue()`](#findlast-findlastindex-findlastkey-findlastvalue)\n  - [`.indexOf()`, `.lastIndexOf()`, `.indexOfKey()`](#indexof-lastindexof-indexofkey)\n  - [`.sort()`, `.sortByValues()`](#sort-sortbyvalues)\n  - [`.some()`, `.every()`](#some-every)\n  - [`.omit()`](#omit)\n  - [`.flip()`](#flip)\n  - [`.reverse()`](#reverse)\n  - [Chain methods](#chain-methods)\n  - [`.transpose()`](#transpose)\n- [Usage with Jest](#usage-with-jest)\n\n## Features\n\n- **Easy to use**, w/o\n  modifying [object prototype](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Object_prototypes) (`o(obj).filter(...)`)\n- Useful methods that are operable on **keys**, **values** and **indices** (see [Examples](#examples)):\n  - [`filter()`](#filter)\n  - [`map() \u0026 mapKeyValue()`](#map), `forEach()`\n  - [`find()`](#find-findindex-findkey-findvalue), [`findIndex()`](#find-findindex-findkey-findvalue), [`findLast()`](#findlast-findlastindex-findlastkey-findlastvalue), [`findLastIndex()`](\u003c(#findlast-findlastindex-findlastkey-findlastvalue)\u003e)\n  - [`indexOf()`, `lastIndexOf()`, `indexOfKey()`](\u003c(#indexof-lastindexof-indexofkey)\u003e)\n  - [`sort()`](#sort-sortbyvalues),\n  - `reverse()`\n  - [`some()`](#some-every), [`every()`](#some-every)\n  - [`omit() // omit key(s)`](#omit)\n  - [`flip()`](#flip), [`transpose()`](#transpose)\n- and properties:\n  - `.length`\n  - `.keys`, `.values`, `.entries`\n- Provides an easy way to **[chain methods](#chain-methods)**\n- **Typed keys and values**\n- **No dependency**, based on modern JS features\n- Memory and processor efficient\n- Returns [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) instead\n  of [`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) for `.keys` (\n  see: [_Why does `Object.keys()` return an `Array` instead of\n  a `Set`?_](https://esdiscuss.org/topic/why-does-object-keys-return-an-array-instead-of-a-set))\n\n## Installation\n\n```bash\nnpm i objectools\n```\n\nor:\n\n```bash\nyarn add objectools\n```\n\n## Usage\n\n```ts\nimport o from 'objectools'\n\no({a: 1, b: 2, c: 3}).filter(/*...*/)\no({a: 1, b: 2, c: 3}).map(/*...*/)\no({a: 1, c: 3, b: 2}).sort()\no({...}) //...\n\n// Or chain methods:\no({...}).oFilter(/*...*/).oMap(/*...*/).sort() // Don't prefix the last one with `o`.\n// I.e. don't write `.oSort()` if you don't want to countinue the chain.\n```\n\n## Examples\n\n### [`.filter()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)\n\n```ts\no({a: 1, b: 2, c: 3}).filter((value) =\u003e value \u003e 1) // {b: 2, c: 3}\no({a: 1, b: 2, c: 3}).filter((_, key, index) =\u003e key \u003c 'c' \u0026\u0026 index \u003e 0) // {b: 2}\n```\n\n### [`.map()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)\n\n```ts\no({a: 1, b: 2, c: 3}).map((value) =\u003e value * 2) // {a: 2, b: 4, c: 6}\no({a: 1, b: 2, c: 3}).mapKeyValue((value, key) =\u003e [key.toUpperCase(), value - 1]) // {A: 0, B: 1, C: 2}\n```\n\n### `.keys`, `.values`, `.entries`, `.length`\n\n```ts\no({a: 1, b: 2, c: 3}).keys // Set {'a', 'b', 'c'} // Type: `Set\u003c'a' | 'b' | 'c'\u003e`\no({a: 1, b: 2, c: 3}).values // [1, 2, 3] // Type: `number[]`\no({a: 1, b: 2, c: 3}).entries // [['a', 1], ['b', 2], ['c', 3]] // Type: ['a' | 'b' | 'c', number][]\no({a: 1, b: 2, c: 3}).length // 3\n```\n\n### [`.find()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find), [`.findIndex()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex), `.findKey()`, `.findValue()`\n\n```ts\no({a: 1, b: 2, c: 3}).find((value) =\u003e value \u003e 1) // ['b', 2]\no({a: 1, b: 2, c: 3}).findIndex((value) =\u003e value \u003e 1) // 1\no({a: 1, b: 2, c: 3}).findKey((value) =\u003e value \u003e 1) // 'b'\no({a: 1, b: 2, c: 3}).findValue((value) =\u003e value \u003e 1) // 2\n```\n\n### [`.findLast()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findLast), [`.findLastIndex()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findLastIndex), `.findLastKey()`, `.findLastValue()`\n\n```ts\no({a: 1, b: 2, c: 3}).findLast((value) =\u003e value \u003e 1) // ['c', 3]\no({a: 1, b: 2, c: 3}).findLastIndex((value) =\u003e value \u003e 1) // 2\no({a: 1, b: 2, c: 3}).findLastKey((value) =\u003e value \u003e 1) // 'c'\no({a: 1, b: 2, c: 3}).findLastValue((value) =\u003e value \u003e 1) // 3\n```\n\n### [`.indexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf), [`.lastIndexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf), `.indexOfKey()`\n\n```ts\no({a: 3, b: 3}).indexOf(3) // 0\no({a: 3, b: 3}).lastIndexOf(3) // 1\no({a: 3, b: 3}).indexOfKey('b') // 1\n```\n\n### [`.sort()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toSorted), `.sortByValues()`\n\n```ts\no({b: 1, a: 3, c: 2}).sort() // {a: 3, b: 1, c: 2}\no({b: 1, a: 3, c: 2}).sortByValues() // {b: 1, c: 2, a: 3}\n```\n\n### [`.some()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some), [`.every()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every)\n\n```ts\no({a: 1, b: 2, c: 3}).some((value) =\u003e value \u003e 1) // true\no({a: 1, b: 2, c: 3}).every((value) =\u003e value \u003e 1) // false\n```\n\n### `.omit()`\n\n```ts\no({a: 1, b: 2, c: 3}).omit('b') // {a: 1, c: 3}\no({a: 1, b: 2, c: 3}).omit('c', 'a') // {b: 2}\n```\n\n### `.flip()`\n\n```ts\no({a: 'x', b: 'y'}).flip() // {x: 'a', y: 'b'}\n```\n\n### [`.reverse()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse)\n\n```ts\no({a: 'x', b: 'y'}).reverse() // {b: 'y', a: 'x'}\n```\n\n### Chain methods\n\n```ts\no({b: 1, a: 2, c: 3})\n  .oFilter((value) =\u003e value \u003c 3)\n  .oMap((value) =\u003e value * 2)\n  .sort()\n// --\u003e {a: 4, b: 2}\n```\n\n### `.transpose()`\n\n```ts\no({\n  x: {a: 1, b: 2},\n  y: {a: 3, b: 4},\n  z: {a: 5, b: 6},\n}).transpose()\n// --\u003e\n// {\n//   a: {x: 1, y: 3, z: 5},\n//   b: {x: 2, y: 4, z: 6},\n// }\n```\n\n## Usage with [Jest](https://jestjs.io/)\n\nYou may need to add this to your [_\"jest.config.js\"_](https://jestjs.io/docs/configuration) file:\n\n```js\nexport default {\n  transformIgnorePatterns: [\n    // These packages are created based on modern javascript and use ESM module system (import/export). But Jest use\n    // old common-js module-system. So we need to transform these files using babel, too (like source files). Note that\n    // \"node_modules\" folder is ignored by default, and we've EXCLUDED these packages from this general rule (see `?!`\n    // in the below regex).\n    '/node_modules/(?!(objectools)/)',\n}\n```\n\n\u003csup\u003e_See: https://stackoverflow.com/a/49676319/5318303/#jest-gives-an-error-syntaxerror-unexpected-token-export_ \u003c/sup\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirismaili%2Fobjectools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmirismaili%2Fobjectools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirismaili%2Fobjectools/lists"}