{"id":18905057,"url":"https://github.com/kenberkeley/reject-empty","last_synced_at":"2026-03-04T18:30:20.006Z","repository":{"id":57352645,"uuid":"88006649","full_name":"kenberkeley/reject-empty","owner":"kenberkeley","description":"Omit empty values of an array | object","archived":false,"fork":false,"pushed_at":"2017-04-12T03:56:13.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-15T03:12:20.900Z","etag":null,"topics":["clear","delete","empty","filter","omit","pick","reject","remove","value"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kenberkeley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-12T03:39:33.000Z","updated_at":"2017-04-12T03:43:08.000Z","dependencies_parsed_at":"2022-09-16T08:22:21.825Z","dependency_job_id":null,"html_url":"https://github.com/kenberkeley/reject-empty","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenberkeley%2Freject-empty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenberkeley%2Freject-empty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenberkeley%2Freject-empty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenberkeley%2Freject-empty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kenberkeley","download_url":"https://codeload.github.com/kenberkeley/reject-empty/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239889026,"owners_count":19713702,"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":["clear","delete","empty","filter","omit","pick","reject","remove","value"],"created_at":"2024-11-08T09:10:30.044Z","updated_at":"2026-03-04T18:30:19.954Z","avatar_url":"https://github.com/kenberkeley.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rejectEmpty(sth `\u003cArray|Object\u003e`, omitZero `\u003cBoolean\u003e`)\r\n\r\n[![npm version][npm-v-img]][npm-url]\r\n[![npm download][npm-dl-img]][npm-url]\r\n[![build][build-img]][build-url]\r\n\r\n\u003e Omit empty values of an array | object\r\n\r\n### Installation\r\n\r\n`npm i reject-empty -S`  \r\n\r\n### Usage\r\n\u003e Let's take a look at the test examples\r\n\r\n```\r\ntest('omit empty values except zero of an array', t =\u003e {\r\n  t.deepEqual(\r\n    rejectEmpty(\r\n      [0, '0', undefined, null, NaN, false, '', true, 1, 'hello', { a: 1 }, [2]]\r\n    ),\r\n    [0, '0', true, 1, 'hello', { a: 1 }, [2]]\r\n  )\r\n})\r\n\r\ntest('omit empty values of an array', t =\u003e {\r\n  t.deepEqual(\r\n    rejectEmpty(\r\n      [0, '0', undefined, null, NaN, false, '', true, 1, 'hello', { a: 1 }, [2]],\r\n      true // omit zero\r\n    ),\r\n    [true, 1, 'hello', { a: 1 }, [2]]\r\n  )\r\n})\r\n\r\ntest('omit empty values except zero of an object', t =\u003e {\r\n  t.deepEqual(\r\n    rejectEmpty(\r\n      { a: 0, b: undefined, c: null, d: NaN, e: false, f: '', g: true, h: 'hello', i: { a: 1 }, j: [2] }\r\n    ),\r\n    { a: 0, g: true, h: 'hello', i: { a: 1 }, j: [2] }\r\n  )\r\n})\r\n\r\ntest('omit empty values of an object', t =\u003e {\r\n  t.deepEqual(\r\n    rejectEmpty(\r\n      { a: '0', b: undefined, c: null, d: NaN, e: false, f: '', g: true, h: 'hello', i: { a: 1 }, j: [2] },\r\n      true // omit zero\r\n    ),\r\n    { g: true, h: 'hello', i: { a: 1 }, j: [2] }\r\n  )\r\n})\r\n```\r\n\r\n### Test \u0026 Coverage\r\n\r\n`npm test` \u0026 `npm run cov`\r\n\r\n[npm-url]: https://www.npmjs.com/package/reject-empty\r\n[npm-v-img]: http://img.shields.io/npm/v/reject-empty.svg\r\n[npm-dl-img]: http://img.shields.io/npm/dm/reject-empty.svg\r\n[build-img]: https://travis-ci.org/kenberkeley/reject-empty.svg?branch=master\r\n[build-url]: https://travis-ci.org/kenberkeley/reject-empty\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenberkeley%2Freject-empty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkenberkeley%2Freject-empty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenberkeley%2Freject-empty/lists"}