{"id":19134025,"url":"https://github.com/umbrellio/prefix-classnames","last_synced_at":"2025-09-01T12:41:20.716Z","repository":{"id":143825034,"uuid":"286764807","full_name":"umbrellio/prefix-classnames","owner":"umbrellio","description":null,"archived":false,"fork":false,"pushed_at":"2020-08-20T15:09:34.000Z","size":95,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-12T01:33:30.679Z","etag":null,"topics":[],"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/umbrellio.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":"2020-08-11T14:23:06.000Z","updated_at":"2024-09-25T14:35:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"918b5344-fbac-4294-a5bf-8da1eb0bf121","html_url":"https://github.com/umbrellio/prefix-classnames","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/umbrellio/prefix-classnames","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umbrellio%2Fprefix-classnames","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umbrellio%2Fprefix-classnames/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umbrellio%2Fprefix-classnames/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umbrellio%2Fprefix-classnames/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/umbrellio","download_url":"https://codeload.github.com/umbrellio/prefix-classnames/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umbrellio%2Fprefix-classnames/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270148603,"owners_count":24535701,"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-08-12T02:00:09.011Z","response_time":80,"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":[],"created_at":"2024-11-09T06:24:58.019Z","updated_at":"2025-08-13T21:37:26.946Z","avatar_url":"https://github.com/umbrellio.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @umbrellio/prefix-classnames\n\n[![Coverage Status](https://coveralls.io/repos/github/umbrellio/prefix-classnames/badge.svg?branch=master)](https://coveralls.io/github/umbrellio/prefix-classnames?branch=master)\n[![Build Status](https://travis-ci.com/umbrellio/prefix-classnames.svg?branch=master)](https://travis-ci.com/umbrellio/prefix-classnames)\n\nThis library allows adding prefixes to classes attributes of html elements.\n\n## Install\n\n```sh\n$ yarn add @umbrellio/prefix-classnames\n```\n\n## Usage\n\nImported from the library function takes one argument which will be the prefix for classes. Returns function which takes any number of arguments which can be a string, an object or an array and returns the string with the prefix.\n\n```js\nclassnames(prefix: String): (...args: String | Object | Array): String =\u003e result\n```\n\n```js\nimport classnames from \"@umbrellio/prefix-classnames\"\n\nclassnames(prefix: String): (...args: String | Object | Array): String =\u003e result\n\nconst cn = classnames(\"prefix__\")\n\n// string arguments\ncn(\"foo\", \"bar\") // =\u003e \"prefix__foo prefix__bar\"\ncn(\"foo\", { bar: true }) // =\u003e \"prefix__foo prefix__bar\"\n\n// object arguments\ncn({ \"foo-bar\": true }) // =\u003e \"prefix__foo-bar\"\ncn({ \"foo-bar\": false }) // =\u003e \"\"\ncn({ foo: true }, { bar: true }) // =\u003e \"prefix__foo prefix__bar\"\ncn({ foo: true, bar: true }) // =\u003e \"prefix__foo prefix__bar\"\n\n// array argument\ncn([\"cat\", { foo: true, bar: false }, \"duck\"]) // =\u003e \"prefix__cat prefix__foo prefix__duck\"\n\n// lots of arguments of various types\ncn(\"foo\", { bar: true, duck: false }, \"baz\", { quux: true }); // =\u003e \"prefix__foo prefix__bar prefix__baz prefix__quux\"\n\n// other and falsy types of arguments are just ignored\ncn(null, false, \"bar\", undefined, 0, 123, { baz: null }, \"\"); // =\u003e \"prefix__bar\"\n```\n\nUsage with React component\n\n```js\nimport classnames from \"@umbrellio/prefix-classnames\"\n\nconst cn = classnames(\"super-prefix__\");\n\nclass Button extends React.Component {\n  // ...\n  render () {\n    const btnClass = cn({\n      btn: true,\n      \"btn-pressed\": this.state.isPressed,\n      \"btn-over\": !this.state.isPressed \u0026\u0026 this.state.isHovered\n    });\n    return \u003cbutton className={btnClass}\u003e{this.props.label}\u003c/button\u003e;\n  }\n}\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/umbrellio/prefix-classnames.\n\n## License\n\nReleased under MIT License.\n\n## Authors\n\nCreated by [Dmitry Tysky](https://github.com/tysky).\n\n\u003ca href=\"https://github.com/umbrellio/\"\u003e\n\u003cimg style=\"float: left;\" src=\"https://umbrellio.github.io/Umbrellio/supported_by_umbrellio.svg\" alt=\"Supported by Umbrellio\" width=\"439\" height=\"72\"\u003e\n\u003c/a\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumbrellio%2Fprefix-classnames","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fumbrellio%2Fprefix-classnames","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumbrellio%2Fprefix-classnames/lists"}