{"id":18799560,"url":"https://github.com/l2silver/erschema-selectors","last_synced_at":"2025-06-25T19:36:39.209Z","repository":{"id":57226911,"uuid":"84759360","full_name":"l2silver/erschema-selectors","owner":"l2silver","description":null,"archived":false,"fork":false,"pushed_at":"2017-11-15T05:21:50.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-21T19:53:42.032Z","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/l2silver.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}},"created_at":"2017-03-12T21:39:34.000Z","updated_at":"2017-03-12T21:40:44.000Z","dependencies_parsed_at":"2022-08-29T06:21:23.725Z","dependency_job_id":null,"html_url":"https://github.com/l2silver/erschema-selectors","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/l2silver/erschema-selectors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/l2silver%2Ferschema-selectors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/l2silver%2Ferschema-selectors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/l2silver%2Ferschema-selectors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/l2silver%2Ferschema-selectors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/l2silver","download_url":"https://codeload.github.com/l2silver/erschema-selectors/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/l2silver%2Ferschema-selectors/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261423919,"owners_count":23156078,"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-11-07T22:15:46.038Z","updated_at":"2025-06-25T19:36:39.178Z","avatar_url":"https://github.com/l2silver.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# erschema-selectors\n\nA class of selectors for use with the erschema-redux-immutable library\n\n## Usage\n```\nimport Selector from 'erschema-selectors'\nimport erschema from 'erschema-redux-immutable'\nimport { createStore, combineReducers } from 'redux';\nimport { Record } from 'immutable'\nimport schema from './schema'\nimport reducers from './reducer'\n\nconst store = createStore(combineReducer({\n  ...reducers,\n  erschema({\n    schema,\n  })\n}))\n\nclass UserModel extends Record({\n  name: '',\n  id: '',\n}){}\n\nconst defaultUserModel = new UserModel()\n\nconst userSelectors(\n  ((state)=\u003estate.erschema) | 'erschema',\n  'users',\n  defaultUserModel\n)\n\nconst mapStateToProps = (state, props)=\u003e{\n  return {\n    user: userSelectors.find((props)=\u003eprops.id)(state, props)\n  }\n}\n```\n\n## Properties\n\n```\ntype $idSelector = (state: Object, props: Object)=\u003eany\nconst defaultIdSelector = (s, p)=\u003ep.id\n\ntype $idsSelector = (state: Object, props: Object)=\u003eany[]\n\n```\n### findEntityData\n```\nuserSelectors.findEntityData()\n===\u003e\nreturns all of the models for users entity type in an immutable Map\n```\n\n\n### find\n```\nuserSelectors.find(idSelector?: $idSelector = defaultIdSelector)\n===\u003e\nreturns the user model if it exists, or the default user model\n```\n\n### get\n```\nuserSelectors.find(idSelectors: $idsSelector)\n===\u003e\nreturns the ids iterator type mapped with the user models if they exists, or the default user model\n```\n\n### get\n```\nuserSelectors.find(idSelectors: $idsSelector)\n===\u003e\nreturns the ids iterator type mapped with the user models if they exists, or the default user model\n```\n\n### findManyRelationshipData\n```\nuserSelectors.findManyRelationshipData(relationshipName)\n===\u003e\nreturns the entire immutable Map of relationship values\n\nie. userSelectors.findManyRelationshipData('friends')\n===\u003e\nImmutable.Map({\n  [id]: Immutable.OrderedSet([...ids])\n})\n```\n\n### findMonoRelationshipData\n```\nuserSelectors.findMonoRelationshipData(relationshipName)\n===\u003e\nreturns the entire immutable Map of relationship values\n\nie. userSelectors.findManyRelationshipData('friends')\n===\u003e\nImmutable.Map({\n  [id]: id\n})\n```\n\n### getRawRelatedIds\n```\nuserSelectors.getRawRelatedIds(relationshipName, idSelector?: $$idSelector = defaultIdSelector)\n===\u003e\nreturns the relationship for a specific id as an Immutable OrderedSet if it exists, or a empty OrderedSet if no relationship for that id exists\n```\n### getRelatedIds\n```\nSame as getRawRelatedIds except returns an Immutable List instead of an OrderedSet, which is easier to work with\n```\n\n### findRelatedId\n```\nuserSelectors.findRelatedId(relationshipName, idSelector?: $$idSelector = defaultIdSelector)\n===\u003e\nreturns the related id for a specific ids relationship  if it exists, or a 0 if it does not exist\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fl2silver%2Ferschema-selectors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fl2silver%2Ferschema-selectors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fl2silver%2Ferschema-selectors/lists"}