{"id":15654925,"url":"https://github.com/janrywang/qverse","last_synced_at":"2025-05-01T09:56:55.802Z","repository":{"id":68974193,"uuid":"131028413","full_name":"janryWang/qverse","owner":"janryWang","description":"Traverse any data with DPML commands.","archived":false,"fork":false,"pushed_at":"2018-08-06T08:00:12.000Z","size":88,"stargazers_count":25,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-01T09:56:46.253Z","etag":null,"topics":["javascript","object","traverse","tree"],"latest_commit_sha":null,"homepage":"","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/janryWang.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":"2018-04-25T15:38:33.000Z","updated_at":"2019-12-13T05:06:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"2122f178-dac6-47fd-a215-26460daeba2c","html_url":"https://github.com/janryWang/qverse","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janryWang%2Fqverse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janryWang%2Fqverse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janryWang%2Fqverse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janryWang%2Fqverse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/janryWang","download_url":"https://codeload.github.com/janryWang/qverse/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251856992,"owners_count":21655119,"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":["javascript","object","traverse","tree"],"created_at":"2024-10-03T12:54:55.546Z","updated_at":"2025-05-01T09:56:55.782Z","avatar_url":"https://github.com/janryWang.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# qverse\n\n\u003e Traverse any data with [DPML](https://github.com/janryWang/dot-match) commands.\n\u003e\n\u003e You can use qverse for [react-propers](https://github.com/janryWang/react-propers).\n\u003e\n\u003e Support pipeline operator.\n\n\n\n### Usage\n\n```\nimport React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport Propers from \"react-propers\"\nimport qverse,{produce} from \"qverse\"\n\nReactDOM.render(\n   \u003cPropers selector=\"$id\" traverse={qverse(($)=\u003e{\n       $(\"*(aaa,bbb)\").produce((props)=\u003e{\n           props.className = \"yellow\"\n       })\n       \n       $(\"ddd\").pipe(\n         display(false)\n       )\n       \n       $([\"aaa\",\"bbb\"])\n       |\u003e produce(props=\u003e{\n           props.className += \" blue-font\"\n       })\n   })}\u003e\n      {React=\u003e(\n       \u003c\u003e\n         \u003cdiv $id=\"aaa\"\u003e111\u003c/div\u003e\n         \u003cdiv $id=\"bbb\"\u003e222\u003c/div\u003e\n         \u003cdiv $id=\"ccc\"\u003e333\u003c/div\u003e\n         \u003cdiv $id=\"ddd\"\u003e444\u003c/div\u003e\n       \u003c/\u003e\n      )}\n   \u003c/Propers\u003e\n)\n\n//out put\n\n\u003cdiv class=\"yellow blue-font\"\u003e111\u003c/div\u003e\u003cdiv class=\"yellow blue-font\"\u003e222\u003c/div\u003e\u003cdiv\u003e333\u003c/div\u003e\n```\n\n\n\n### Install\n\n```\nnpm install --save qverse\n```\n\n\n\n### API\n\n\n\n**`qverse(ctrl : Controller ) : Traverse`**\n\n\u003e create traverse with callback function\n\n\n\n**`extend(proto : Object)`**\n\n\u003e extend some methods for CommandFactory \n\n\n**`produce(fn : Function)`**\n\n\u003e pipline operator for produce data\n\n**`display(show : Function | Boolean)`**\n\n\u003e pipeline operator for show data\n\n**`rescue()`**\n\n\u003e pipeline operator for rescue data\n\n**`select(DPML : String | Array\u003cString\u003e | Function , Options : MatchOptions)`**\n\n\u003e pipeline operator for reselect data\n\n**`filter(fn : Function)`**\n\n\u003e pipeline operator for filter data\n\n**`include(fn : Function)`**\n\n\u003e pipeline operator for include data\n\n**`exclude(fn : Function)`**\n\n\u003e pipeline operator for exclude data\n\n### Interface\n\n\n\n**Controller**\n\n```\ninterface Controller {\n  ($ : CommandFactory) : Traverse\n}\n```\n\n\n\n**CommandFactory**\n\n```\ninterface Replacer {\n    $0:function(item : String) : String\n    $1:function(item : String) : String\n    $2:function(item : String) : String\n    ....\n}\n\ninterface CommandFactory {\n   (DPML : String | Array\u003cString\u003e | Function , Options : MatchOptions) : Command\n   replace(path : String,replacer : Replacer ) : String\n   path() : Array\u003cString\u003e\n   key() : String\n   params() : any\n   payload() : any\n   state(path : String | Array) : any // State getter for CurrentParams\n}\n```\n\n\n\n**Command**\n\n```\ninterface Command {\n    filter(params : CurrentParams) : Boolean\n    exclude(params : CurrentParams) : Boolean\n    include(params : CurrentParams) : Boolean\n    produce(callback : function(payload : any): Boolean? ) : any //Here is the usage of https://github.com/mweststrate/immer\n    rescue() : Void //Because our command is an orderly execution logic, if the previous command overrides the result of the following command, then we can use the rescue method.\n    select(DPML : String | Array\u003cString\u003e | Function , Options : MatchOptions) : Command\n    display(show : Function | Boolean) : Command\n    call(fn : Function) : Command\n}\n```\n\n\n\n**MatchOptions**\n\n```\n\ninterface MachOptions {\n    include?:function(params : CurrentParams) : Boolean;\n    exclude?:function(params : CurrentParams) : Boolean\n}\n```\n\n\n\n**Traverse**\n\n```\ninterface Traverse{\n   (payload : any,params : CurrentParams) : any\n}\n```\n\n\n\n**CurrentParams**\n\n```\ninterface CurrentParams {\n    key:String,\n    path:Array\u003cString\u003e\n}\n```\n\n\n\n### LICENSE\n\nThe MIT License (MIT)\n\nCopyright (c) 2018 JanryWang\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanrywang%2Fqverse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjanrywang%2Fqverse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanrywang%2Fqverse/lists"}