{"id":15914684,"url":"https://github.com/addonewr/astro-classname","last_synced_at":"2025-04-03T03:44:25.998Z","repository":{"id":57185335,"uuid":"164229587","full_name":"AddOneWR/astro-classname","owner":"AddOneWR","description":"A small and powerful package which can help you change or add classnames quickly and easily","archived":false,"fork":false,"pushed_at":"2019-04-22T12:19:15.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-03T03:44:23.482Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AddOneWR.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":"2019-01-05T15:59:09.000Z","updated_at":"2019-04-22T12:19:17.000Z","dependencies_parsed_at":"2022-09-14T10:02:58.714Z","dependency_job_id":null,"html_url":"https://github.com/AddOneWR/astro-classname","commit_stats":null,"previous_names":["addonedn/astro-classname"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AddOneWR%2Fastro-classname","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AddOneWR%2Fastro-classname/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AddOneWR%2Fastro-classname/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AddOneWR%2Fastro-classname/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AddOneWR","download_url":"https://codeload.github.com/AddOneWR/astro-classname/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246933357,"owners_count":20857052,"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":[],"created_at":"2024-10-06T17:05:18.641Z","updated_at":"2025-04-03T03:44:25.978Z","avatar_url":"https://github.com/AddOneWR.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## astro-classname\n\n[![](https://img.shields.io/bundlephobia/min/react.svg)](https://github.com/AddOneDn/astro-classname)\n[![](https://img.shields.io/npm/dt/localeval.svg)](https://www.npmjs.com/package/astro-classname)\nA small and powerful package which can help you change or add classnames quickly and easily\n\n### install\n\nnpm: \n\n```\nnpm install astro-classname\n```\n\nyarn: \n\n```\nyarn add astro-classname\n```\n\n### Usage\n\nYou can set anything to the classname，but the value that was associated with a given key is falsy， it will not be effective。Object has the highest priority\n\n**Before you use，you should require or import the package**\n\nYou can also add classname to dom directly\n\n```javascript\nclassname('tom', 'bob'); // tom bob\nclassname('tom', { bob: true }); // tom bob\nclassname('tom', { bob: false }); // tom\nclassname({ 'tom-bob': true }); // tom-bob\nclassname({ tom: false }, { bob: true }); // bob\nclassname({ tom: false, 'bob': true }); // bob\n\nclassname('tom', { bob: false }, 'lili', undefined, 0, 1, null, { hey: 0 }, '') // tom lili 0 1\n```\n\nUsage with react!\n\n```javascript\nimport cn from 'astro-classname';\n\nclassname('button', {\n  'btn-pressed': this.state.isPressed,\n  'btn-over': !this.state.isPressed \u0026\u0026 this.state.isHovered\n})\n```\n\nUsage with jquery!\n```javascript\nclassname($('btn'), 'tom', 'bob');\nclassname(document.getElementById('btn'), { tom: true });\n```\n\nYou can use all the methods in anywhere\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faddonewr%2Fastro-classname","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faddonewr%2Fastro-classname","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faddonewr%2Fastro-classname/lists"}