{"id":17531203,"url":"https://github.com/kirklin/cfuse","last_synced_at":"2026-02-20T16:02:18.483Z","repository":{"id":249817434,"uuid":"832645115","full_name":"kirklin/cfuse","owner":"kirklin","description":"A utility for constructing className strings conditionally.","archived":false,"fork":false,"pushed_at":"2025-04-21T05:46:28.000Z","size":272,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-04T11:52:48.751Z","etag":null,"topics":["classname","clsx","ts","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/cfuse","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/kirklin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","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,"zenodo":null},"funding":{"github":"kirklin","patreon":"kirklin","custom":["https://www.buymeacoffee.com/linkirk"]}},"created_at":"2024-07-23T12:42:48.000Z","updated_at":"2025-08-25T03:03:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"22d0f3a6-5a3e-48f3-b461-ea85e8414367","html_url":"https://github.com/kirklin/cfuse","commit_stats":null,"previous_names":["kirklin/cfuse"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/kirklin/cfuse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirklin%2Fcfuse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirklin%2Fcfuse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirklin%2Fcfuse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirklin%2Fcfuse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kirklin","download_url":"https://codeload.github.com/kirklin/cfuse/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirklin%2Fcfuse/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29656589,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T09:27:29.698Z","status":"ssl_error","status_checked_at":"2026-02-20T09:26:12.373Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["classname","clsx","ts","typescript"],"created_at":"2024-10-20T17:23:17.021Z","updated_at":"2026-02-20T16:02:18.465Z","avatar_url":"https://github.com/kirklin.png","language":"TypeScript","funding_links":["https://github.com/sponsors/kirklin","https://patreon.com/kirklin","https://www.buymeacoffee.com/linkirk"],"categories":[],"sub_categories":[],"readme":"# cfuse\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![bundle][bundle-src]][bundle-href]\n[![JSDocs][jsdocs-src]][jsdocs-href]\n[![License][license-src]][license-href]\n[![javascript_code style][code-style-image]][code-style-url]\n\n\u003e A utility for constructing `className` strings conditionally.\n\nThis module is available in the following formats:\n\n* **ES Module**: `dist/cfuse.mjs`\n* **CommonJS**: `dist/cfuse.cjs`\n\n## Install\n\n```\n$ npm install --save cfuse\n```\n\n## Usage\n\n```js\nimport cfuse from \"cfuse\";\n\n// Concatenates multiple strings, including only truthy values\nconsole.log(cfuse(\"Introduction\", true \u0026\u0026 \"Chapter 1\", \"Chapter 2\"));\n// result: \"Introduction Chapter 1 Chapter 2\"\n\n// Extracts keys from objects where the values are truthy\nconsole.log(cfuse({ title: \"Learning\", subtitle: false, section: true }));\n// result: \"title section\"\n\n// Flattens and concatenates elements from arrays, ignoring falsy values\nconsole.log(cfuse([\"Introduction\", null, false, \"Chapter 1\"]));\n// result: \"Introduction Chapter 1\"\n\n// Handles nested arrays, flattening and concatenating truthy values\nconsole.log(cfuse([\"Introduction\"], [\"Part A\", null, false, \"Chapter 1\"], [[\"Appendix\", [[\"Section 1\"], \"Section 2\"]]]));\n// result: \"Introduction Part A Chapter 1 Appendix Section 1 Section 2\"\n\n// Combines various input types, including strings, objects, and arrays\nconsole.log(cfuse(\n  \"Start\",\n  [true \u0026\u0026 \"Middle\", { key1: false, key2: true }, [\"Subsection\", [\"Detail\"]]],\n  \"End\"\n// result: \"Start Middle key2 Subsection Detail End\"\n));\n\n// Processes all types of truthy and falsy values, including null, empty strings, NaN, zero, and more\nconsole.log(cfuse({\n  nullValue: null,\n  emptyString: \"\",\n  invalidNumber: Number.NaN,\n  zeroValue: 0,\n  negativeZeroValue: -0,\n  falseValue: false,\n  undefinedValue: undefined,\n  nonEmptyString: \"Valid String\",\n  whitespaceString: \" \",\n  functionValue: Object.prototype.toString,\n  emptyObject: {},\n  nonEmptyObject: { a: 1, b: 2 },\n  emptyList: [],\n  nonEmptyList: [1, 2, 3],\n  positiveNumber: 1,\n}));\n// result: \"Valid String  functionValue emptyObject nonEmptyObject emptyList nonEmptyList positiveNumber\"\n```\n\n## API\n\n### cfuse(...inputs)\n**Returns:** `String`\n\n#### Parameters\n- **`inputs`**: `Mixed`\n    - The `cfuse` function accepts any number of arguments. Each argument can be of type `Object`, `Array`, `Boolean`, `String`, `Number`, `null`, or `undefined`.\n\n#### Description\nThe `cfuse` function concatenates values from the provided arguments into a single string. Falsy values (e.g., `false`, `null`, `undefined`, `0`, `NaN`, `\"\"`, and empty arrays/objects) are ignored. The function processes the arguments in the following manner:\n- **Strings**: Included directly.\n- **Objects**: Includes the keys where the corresponding values are truthy.\n- **Arrays**: Flattens nested arrays and includes all truthy elements.\n- **Other types (Boolean, Number)**: Converts truthy values to strings and ignores falsy values.\n\n#### Examples\n\n```js\n// Examples with different types of inputs\n\nconsole.log(cfuse(true, false, \"\", null, undefined, 0, Number.NaN));\n// =\u003e ''\n\nconsole.log(cfuse(\"Hello\", \"World\", 123, { key: \"value\" }, [true, \"Array\"]));\n// =\u003e 'Hello World 123 key Array'\n```\n\n## License\n\n[MIT](./LICENSE) License \u0026copy; 2023-PRESENT [Kirk Lin](https://github.com/kirklin)\n\nThis project is inspired by and related to [clsx](https://github.com/lukeed/clsx), licensed under the [MIT License](https://github.com/lukeed/clsx/blob/master/license).\n\n\u003c!-- Badges --\u003e\n\n[npm-version-src]: https://img.shields.io/npm/v/cfuse?style=flat\u0026colorA=080f12\u0026colorB=3491fa\n[npm-version-href]: https://npmjs.com/package/cfuse\n[npm-downloads-src]: https://img.shields.io/npm/dm/cfuse?style=flat\u0026colorA=080f12\u0026colorB=3491fa\n[npm-downloads-href]: https://npmjs.com/package/cfuse\n[bundle-src]: https://img.shields.io/bundlephobia/minzip/cfuse?style=flat\u0026colorA=080f12\u0026colorB=3491fa\u0026label=minzip\n[bundle-href]: https://bundlephobia.com/result?p=cfuse\n[license-src]: https://img.shields.io/github/license/kirklin/cfuse.svg?style=flat\u0026colorA=080f12\u0026colorB=3491fa\n[license-href]: https://github.com/kirklin/cfuse/blob/main/LICENSE\n[jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat\u0026colorA=080f12\u0026colorB=3491fa\n[jsdocs-href]: https://www.jsdocs.io/package/cfuse\n[code-style-image]: https://img.shields.io/badge/code__style-%40kirklin%2Feslint--config-3491fa?style=flat\u0026colorA=080f12\u0026colorB=3491fa\n[code-style-url]: https://github.com/kirklin/eslint-config/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirklin%2Fcfuse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkirklin%2Fcfuse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirklin%2Fcfuse/lists"}