{"id":19846611,"url":"https://github.com/fayez-nazzal/scn","last_synced_at":"2025-07-26T21:10:09.670Z","repository":{"id":65346270,"uuid":"589896629","full_name":"fayez-nazzal/scn","owner":"fayez-nazzal","description":"Simple class names utility that is tiny and fast (75 bytes)","archived":false,"fork":false,"pushed_at":"2023-09-27T02:07:54.000Z","size":405,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-01T21:32:24.342Z","etag":null,"topics":["class","classes","classname","classnames"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/scn","language":"TypeScript","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/fayez-nazzal.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-17T07:42:25.000Z","updated_at":"2024-07-19T11:59:50.000Z","dependencies_parsed_at":"2024-11-12T13:12:06.923Z","dependency_job_id":"856866c0-ae80-4f5a-a12b-2ea320985e13","html_url":"https://github.com/fayez-nazzal/scn","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fayez-nazzal/scn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fayez-nazzal%2Fscn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fayez-nazzal%2Fscn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fayez-nazzal%2Fscn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fayez-nazzal%2Fscn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fayez-nazzal","download_url":"https://codeload.github.com/fayez-nazzal/scn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fayez-nazzal%2Fscn/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267236730,"owners_count":24057656,"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-07-26T02:00:08.937Z","response_time":62,"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":["class","classes","classname","classnames"],"created_at":"2024-11-12T13:12:00.468Z","updated_at":"2025-07-26T21:10:09.571Z","avatar_url":"https://github.com/fayez-nazzal.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# scn - Simple class names\n\nSimple class names utility that is the tiniest (75 bytes) and the fastest.\n\n\u003e Now you can write conditional class names more easily and without getting into trouble 😼.\n\n## How to use?\n\n### Code Style 1: Logical operators\n- Use strings for normal class names.\n- Add logical operators for conditional classes.\n\n#### Example\n\n```js\nscn('hello', null, false \u0026\u0026 'world', undefined); // 'hello'\n```\n#### Real world example\n```js\nscn(\n  'text-sm leading-4',\n  isError \u0026\u0026 'text-error bg-error-opacity',\n  !isError \u0026\u0026 'text-success bg-success-opacity'\n); // 'text-sm leading-4 text-success bg-success-opacity'\n```\n\n### Code Style 2: Tuples\n- Use strings for normal class names.\n- Use tuples for conditional styles, if the second value is falsy, the class name will not be included.\n\n#### Examples\n\n```js\nscn('hello', 'world'); // 'hello world'\n```\n\n```js\nscn(['hello', true], ['world', false]); // 'hello'\n```\n\n```js\nscn('one', 'two', ['three', undefined]); // 'one two'\n```\n\n```js\nscn('one', undefined, 'two', false, null, ['three', false]); // 'one two'\n```\n\n#### Real world example\n```js\nscn(\n  'text-sm leading-4',\n  ['text-error bg-error-opacity', isError],\n  ['text-success bg-success-opacity', !isError]\n); // 'text-sm leading-4 text-success bg-success-opacity'\n```\n\n### Example I love to mention\n```ts\nimport scn from \"scn\";\n\ninterface IPropTypes {\n  className?: string;\n}\n\nconst Component = ({ className }: IPropTypes) =\u003e (\n  \u003cdiv className={scn(\"hello\", className)} /\u003e\n);\n\n\u003cComponent className=\"world\" /\u003e // \u003cdiv class=\"hello world\" /\u003e\n\n\u003cComponent /\u003e // \u003cdiv class=\"hello\" /\u003e  -- No \"undefined\" class 🎉\n```\n\n\n## Bundle Size comparison\n![image](https://user-images.githubusercontent.com/49946791/213785262-7a7a8cbb-b801-4eb7-af68-f58ed67fc196.png)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffayez-nazzal%2Fscn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffayez-nazzal%2Fscn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffayez-nazzal%2Fscn/lists"}