{"id":15862210,"url":"https://github.com/afeiship/config-query","last_synced_at":"2025-04-01T20:35:53.742Z","repository":{"id":96088523,"uuid":"125327048","full_name":"afeiship/config-query","owner":"afeiship","description":"A flexible library for dynamic queries on configuration objects with customizable filters.","archived":false,"fork":false,"pushed_at":"2024-09-18T04:51:43.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-07T13:25:20.024Z","etag":null,"topics":["config","filter","find","local","query","select","sql"],"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/afeiship.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2018-03-15T07:12:55.000Z","updated_at":"2024-09-18T04:51:46.000Z","dependencies_parsed_at":"2024-09-07T03:47:56.087Z","dependency_job_id":"b1721345-ba83-4178-a87e-3c0943511e3f","html_url":"https://github.com/afeiship/config-query","commit_stats":null,"previous_names":["afeiship/config-query"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Fconfig-query","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Fconfig-query/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Fconfig-query/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Fconfig-query/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/afeiship","download_url":"https://codeload.github.com/afeiship/config-query/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246709936,"owners_count":20821298,"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":["config","filter","find","local","query","select","sql"],"created_at":"2024-10-05T22:25:39.457Z","updated_at":"2025-04-01T20:35:53.720Z","avatar_url":"https://github.com/afeiship.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# config-query\n\u003e A flexible library for dynamic queries on configuration objects with customizable filters.\n\n[![version][version-image]][version-url]\n[![license][license-image]][license-url]\n[![size][size-image]][size-url]\n[![download][download-image]][download-url]\n\n## installation\n```shell\nnpm install @jswork/config-query\n```\n\n## usage\n```js\nimport ConfigQuery from '@jswork/config-query';\n\nconst configs = [\n  {\n    school_level: null,\n    language: \"zh-CN\",\n    key: \"yes_or_no\",\n    value: [\n      { label: \"是\", value: \"yes\" },\n      { label: \"否\", value: \"no\" },\n    ],\n  },\n  {\n    school_level: null,\n    language: \"en-US\",\n    key: \"yes_or_no\",\n    value: [\n      { label: \"Yes\", value: \"yes\" },\n      { label: \"No\", value: \"no\" },\n    ],\n  },\n];\n\nconst query = new ConfigQuery(configs);\n\n// select by key\nconst yes_no_items = query.select({ key: \"yes_or_no\" });\nconsole.log(yes_no_items);\n\n\n/* ------------------------------ output ------------------------------\n *  [\n *    {\n *      \"school_level\": null,\n *      \"language\": \"zh-CN\",\n *      \"key\": \"yes_or_no\",\n *      \"value\": [\n *        { \"label\": \"是\", \"value\": \"yes\" },\n *        { \"label\": \"否\", \"value\": \"no\" }\n *      ]\n *    },\n *    {\n *      \"school_level\": null,\n *      \"language\": \"en-US\",\n *      \"key\": \"yes_or_no\",\n *      \"value\": [\n *        { \"label\": \"Yes\", \"value\": \"yes\" },\n *        { \"label\": \"No\", \"value\": \"no\" }\n *      ]\n *    }\n *  ]\n */\n\n\n// get by language\nconst en = query.find({ language: \"en-US\" });\nconsole.log(en);\n\n/* ------------------------------ output ------------------------------\n *   {\n *     \"school_level\": null,\n *     \"language\": \"en-US\",\n *     \"key\": \"yes_or_no\",\n *     \"value\": [\n *       { \"label\": \"Yes\", \"value\": \"yes\" },\n *       { \"label\": \"No\", \"value\": \"no\" }\n *     ]\n *   }\n */\n\n\n// value filter\nconst yes = query.value({ key: \"yes_or_no\", \"language\": \"zh-CN\" });\nconsole.log(yes);\n\n\n/* ------------------------------ output ------------------------------\n *  [ \n *    { \"label\": \"是\", \"value\": \"yes\" },\n *    { \"label\": \"否\", \"value\": \"no\" }\n *  ]\n */\n```\n\n## license\nCode released under [the MIT license](https://github.com/afeiship/config-query/blob/master/LICENSE.txt).\n\n[version-image]: https://img.shields.io/npm/v/@jswork/config-query\n[version-url]: https://npmjs.org/package/@jswork/config-query\n\n[license-image]: https://img.shields.io/npm/l/@jswork/config-query\n[license-url]: https://github.com/afeiship/config-query/blob/master/LICENSE.txt\n\n[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/config-query\n[size-url]: https://github.com/afeiship/config-query/blob/master/dist/index.min.js\n\n[download-image]: https://img.shields.io/npm/dm/@jswork/config-query\n[download-url]: https://www.npmjs.com/package/@jswork/config-query\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafeiship%2Fconfig-query","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fafeiship%2Fconfig-query","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafeiship%2Fconfig-query/lists"}