{"id":25526152,"url":"https://github.com/exbotanical/coalesce","last_synced_at":"2025-10-16T11:29:55.400Z","repository":{"id":57201975,"uuid":"362698824","full_name":"exbotanical/coalesce","owner":"exbotanical","description":"Highly performant implementation of SQL `COALESCE` for JavaScript. Return the first value that is not null or undefined.","archived":false,"fork":false,"pushed_at":"2021-04-30T04:23:11.000Z","size":132,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-21T11:02:30.195Z","etag":null,"topics":["coalesce","helper-functions","micro-library","sql","validation-library"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/coalesce-x","language":"JavaScript","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/exbotanical.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-04-29T05:20:05.000Z","updated_at":"2021-05-03T06:35:21.000Z","dependencies_parsed_at":"2022-09-17T12:01:03.846Z","dependency_job_id":null,"html_url":"https://github.com/exbotanical/coalesce","commit_stats":null,"previous_names":["matthewzito/coalesce"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/exbotanical/coalesce","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exbotanical%2Fcoalesce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exbotanical%2Fcoalesce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exbotanical%2Fcoalesce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exbotanical%2Fcoalesce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/exbotanical","download_url":"https://codeload.github.com/exbotanical/coalesce/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exbotanical%2Fcoalesce/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279183584,"owners_count":26121431,"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","status":"online","status_checked_at":"2025-10-16T02:00:06.019Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["coalesce","helper-functions","micro-library","sql","validation-library"],"created_at":"2025-02-19T21:16:51.734Z","updated_at":"2025-10-16T11:29:55.320Z","avatar_url":"https://github.com/exbotanical.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# coalesce-x\n\n## Highly performant implementation of SQL `COALESCE` for JavaScript. Return the first value that is not null or undefined\n\n[![Build Status](https://travis-ci.com/MatthewZito/coalesce.svg?branch=master)](https://travis-ci.com/MatthewZito/coalesce)\n[![npm version](https://badge.fury.io/js/coalesce-x.svg)](https://badge.fury.io/js/coalesce-x)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n### Why?\n\nJavaScript evaluates 'falsy' values such as 0 and '' as false, ergo the logical OR `||` operator cannot be reliably employed to tender fallback values. `coalesce` provides a fast interface for resolving fallback values in a single line of code.\n\n## Table of Contents\n\n- [Supported Environments](#builds)\n- [Installation + Usage](#usage)\n  - [Supply Your Own Skip Value](#skip)\n\n## \u003ca name=\"builds\"\u003e\u003c/a\u003e Supported Environments\n\n`coalesce-x` currently supports UMD, CommonJS, and ESM build-targets.\n\n## \u003ca name=\"usage\"\u003e\u003c/a\u003e Installation + Usage\n\n```bash\nnpm install coalesce-x\n\n# OR\n\nyarn add coalesce-x\n```\n\n```js\nconst { coalesce } = require('coalesce-x');\n\n(function t (num) {\n  num = coalesce(num, 9);\n  for (let i = 0; i \u003c num; i++) {\n    console.log({ i });\n  }\n})(null);\n```\n\n```js\nimport { coalesce } from 'coalesce-x';\n\nconst fallback = 9;\n\nconst v = coalesce(maybeVal1, maybeVal2, maybeVal3, fallback);\n```\n\n## \u003ca name=\"skip\"\u003e\u003c/a\u003e Customization\n\nYou can also utilize the `coalescent` function and supply your own list of values to coalesce against.\n\n```js\nimport { coalescent } from 'coalesce-x';\n\nconst coalesceOdds = coalescent(1,3,5,7,9);\n\nconst firstEven = coalesceOdds(1,3,6,3); // 6\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexbotanical%2Fcoalesce","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexbotanical%2Fcoalesce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexbotanical%2Fcoalesce/lists"}