{"id":26611252,"url":"https://github.com/hexarc-software/classnamer","last_synced_at":"2026-04-10T07:05:33.752Z","repository":{"id":57199624,"uuid":"41980070","full_name":"hexarc-software/classnamer","owner":"hexarc-software","description":"An utility for formatting css classnames written in TypeScript","archived":false,"fork":false,"pushed_at":"2017-10-04T17:59:08.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-27T01:02:17.488Z","etag":null,"topics":["css","javascript","nodejs","react","typescript"],"latest_commit_sha":null,"homepage":"","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/hexarc-software.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":"2015-09-05T23:59:21.000Z","updated_at":"2022-12-11T17:32:39.000Z","dependencies_parsed_at":"2022-09-16T15:01:58.089Z","dependency_job_id":null,"html_url":"https://github.com/hexarc-software/classnamer","commit_stats":null,"previous_names":["shadeglare/classnamer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexarc-software%2Fclassnamer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexarc-software%2Fclassnamer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexarc-software%2Fclassnamer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexarc-software%2Fclassnamer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hexarc-software","download_url":"https://codeload.github.com/hexarc-software/classnamer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245199482,"owners_count":20576553,"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":["css","javascript","nodejs","react","typescript"],"created_at":"2025-03-24T02:35:25.147Z","updated_at":"2026-01-12T05:59:46.048Z","avatar_url":"https://github.com/hexarc-software.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Classnamer\n===========\n\n[![Version](http://img.shields.io/npm/v/classnamer.svg)](https://www.npmjs.org/package/classnamer)\n[![License](http://img.shields.io/:license-mit-blue.svg)](http://badges.mit-license.org)\n[![Downloads](http://img.shields.io/npm/dm/classnamer.svg)](https://npmjs.org/package/classnamer)\n[![Downloads](http://img.shields.io/npm/dt/classnamer.svg)](https://npmjs.org/package/classnamer)\n\nThe ES6 utility for formatting css classnames written in TypeScript (inspired by [classnames](https://github.com/JedWatson/classnames)).\nCompatible with TypeScript 1.6+ commonjs module resolution.\n\nInstall with npm:\n\n```sh\nnpm install classnamer\n```\n\nUsing with node.js (TypeScript ES6 syntax):\n\n```js\nimport classnamer from \"classnamer\";\n\n//import classnamer and types\nimport classnamer, {\n    ClassNameObject,\n    ClassNamePrimitive,\n    ClassNameFragment,\n    ClassNameFragmentList } from \"classnamer\";\n```\n\n## Usage\nThe `classnamer` function takes any number of `ClassNameFragment` arguments and produces the string result.\n\nThe `ClassNameFragment` type is a union of `ClassNamePrimitive`, `ClassNameObject` and `ClassNameFragmentList`.\n\nThe `ClassNamePrimitive` type can be `string`, `number` or `boolean`.\n\nThe `ClassNameObject` is a map with boolean values which indicate should keys be included in the output or not.\n\nThe `ClassNameFragmentList` type represents a list of `ClassNameFragment` objects.\n\n```js\nclassnamer(\"super\", \"man\"); // =\u003e \"super man\"\nclassnamer(\"super\", { man : true }); // =\u003e \"super man\"\nclassnamer({ super: true }, { man : true }); // =\u003e \"super man\"\n\n// lots of arguments of various types\nclassnamer(\"super\", { man: true, krypton: false }, \"zor\", { el: true }); // =\u003e \"super man zor el\"\n\n// other falsy values are just ignored\nclassnamer(null, false, \"super\", undefined, 0, 1, { man: null }, \"\"); // =\u003e \"super 1\"\n```\n\n`ClassNameFragmentList` will be recursively flattened as per the rules above:\n\n```js\nlet fragments: ClassNameFragmentList = [\"man\", { kripton: true, phantom: false }];\nclassnamer(\"super\", fragments); // =\u003e \"super man kripton\"\n```\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexarc-software%2Fclassnamer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhexarc-software%2Fclassnamer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexarc-software%2Fclassnamer/lists"}