{"id":24567068,"url":"https://github.com/luca1388/obj-functions","last_synced_at":"2026-05-20T02:44:39.651Z","repository":{"id":54224120,"uuid":"342284105","full_name":"luca1388/obj-functions","owner":"luca1388","description":"Implementation of the array-like function filter() for regular javascript objects. With this tool it's possible to create a new object containing only a subset of the given object key-value pairs without using a for loop.","archived":false,"fork":false,"pushed_at":"2021-03-10T22:17:43.000Z","size":818,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-23T13:16:10.147Z","etag":null,"topics":["filter","javascript","library","object"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/obj-functions","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/luca1388.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}},"created_at":"2021-02-25T15:10:49.000Z","updated_at":"2022-05-10T10:03:49.000Z","dependencies_parsed_at":"2022-08-13T09:31:16.354Z","dependency_job_id":null,"html_url":"https://github.com/luca1388/obj-functions","commit_stats":null,"previous_names":["luca1388/objectfilter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luca1388%2Fobj-functions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luca1388%2Fobj-functions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luca1388%2Fobj-functions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luca1388%2Fobj-functions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luca1388","download_url":"https://codeload.github.com/luca1388/obj-functions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243971157,"owners_count":20376785,"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":["filter","javascript","library","object"],"created_at":"2025-01-23T13:16:21.977Z","updated_at":"2026-05-20T02:44:34.631Z","avatar_url":"https://github.com/luca1388.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# objFilter\n\nImplementation of the array-like function `filter()` for regular javascript objects. With this tool it's possible to create a new object containing only a subset of the given object key-value pairs without using a for loop. It behaves in the same way of the native array [filter function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).\n\n## Getting Started\n### Installing\n```\nnpm install obj-functions\n```\n\n### Usage\nImport `objFilter` function from the package:\n```js\nimport { objFilter } from \"obj-functions\";\n\nconst numbers = {\n  field1: 9,\n  field2: 5,\n  field3: -4\n}\n\nconst negativeNumbers = objFilter(numbers, (field, value) =\u003e value \u003c 0);\n\nconsole.log(negativeNumbers); // will print { field3: -4 }\n\n```\n`objFilter(obj, callback)` accepts 2 parameters:\n- `obj` is the object to filter\n- `callback` is the function used to filter the object and that loops through all object fields. It accepts 2 parameters, the generic object key and the relative value: `callback(key, value)`. Callback should return `true` whenever current (key: value) pair should be kept in the returned object result.\n\n\n### Developing\nInstall all the dependencies:\n```\nnpm install\n```\nBuild it: \n```\nnpm run build\n```\nTo run the tests:\n```\nnpm test\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluca1388%2Fobj-functions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluca1388%2Fobj-functions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluca1388%2Fobj-functions/lists"}