{"id":21890749,"url":"https://github.com/chantastic/pseudo-class","last_synced_at":"2026-04-02T03:04:15.515Z","repository":{"id":58242373,"uuid":"38586891","full_name":"chantastic/pseudo-class","owner":"chantastic","description":null,"archived":false,"fork":false,"pushed_at":"2015-07-26T13:58:59.000Z","size":168,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-02-06T11:18:34.509Z","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/chantastic.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-07-05T22:41:37.000Z","updated_at":"2019-06-25T14:27:11.000Z","dependencies_parsed_at":"2022-08-30T20:10:32.510Z","dependency_job_id":null,"html_url":"https://github.com/chantastic/pseudo-class","commit_stats":null,"previous_names":["chantastic/pseudo"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/chantastic/pseudo-class","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chantastic%2Fpseudo-class","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chantastic%2Fpseudo-class/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chantastic%2Fpseudo-class/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chantastic%2Fpseudo-class/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chantastic","download_url":"https://codeload.github.com/chantastic/pseudo-class/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chantastic%2Fpseudo-class/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31294828,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T01:43:37.129Z","status":"online","status_checked_at":"2026-04-02T02:00:08.535Z","response_time":89,"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-28T12:16:39.799Z","updated_at":"2026-04-02T03:04:15.490Z","avatar_url":"https://github.com/chantastic.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Circle CI](https://circleci.com/gh/chantastic/pseudo-class.svg?style=svg)](https://circleci.com/gh/chantastic/pseudo-class)\n\n## Psuedo\n\n*WIP*\n\nA small set of functions for pseudo-class-like logic logic in JavaScript. I'm\nusing it with React and inline-styles in mind. I don't see why you couldn't use\nit elsewhere.\n\n## Why?\n\nThese are pretty simple expressions. I see this being more useful as a resource\nthan a library. Cheat-sheets are boring. This is living.\n\n## Usage in React\n\nIn React render function, it can be used like so:\n\n```javascript\n{this.props.item.map((item, i, arr) =\u003e {\n  return (\n    \u003cli style={Object.assign{\n     {},\n     lastChild(i,arr): { backgroundColor: \"#eee\" }\n    }}\u003e\n      {item}\n    \u003c/li\u003e\n  );\n})};\n```\n\n*If you're not familiar with `Object.assign`, it's just a way of merging objects\nfrom right to left. `_.extend` could serve the same purpose.*\n\n## Capabilities\n\nThis is a map of pseudo-classes to available functions.\n\n##### item\n\n```javascript\n:first-child         firstChild(i)\n:last-child          lastChild(i, arr)\n\n:only-child          onlyChild(i, arr)\n\n:nth-child(even)     evenChildren(i)\n:nth-child(odd)      oddChildren(i)\n\n:nth-child(n)        nthChild(n, i)\n:nth-last-child(n)   nthLastChild(n, i, arr)\n\n:nth-child(-n+3)     firstChildren(n, i)\n```\n\n##### collection\n\n```javascript\n:empty               empty(arr)\n```\n\n### Why not use the same names?\n\n`:nth-child` is a pretty overloaded selector. I really don't want to get into\nparsing.\n\n### Is this exhaustive?\n\nNope. I've added those most common me. Happy to add more if useful.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchantastic%2Fpseudo-class","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchantastic%2Fpseudo-class","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchantastic%2Fpseudo-class/lists"}