All Projects → janryWang → qverse

janryWang / qverse

Licence: other
Traverse any data with DPML commands.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to qverse

Object Visualizer
Vue JSON inspector with Chrome-like theme.
Stars: ✭ 159 (+536%)
Mutual labels:  tree, object
Deepdash
eachDeep, filterDeep, findDeep, someDeep, omitDeep, pickDeep, keysDeep etc.. Tree traversal library written in Underscore/Lodash fashion
Stars: ✭ 175 (+600%)
Mutual labels:  tree, object
performant-array-to-tree
Converts an array of items with ids and parent ids to a nested tree in a performant O(n) way. Runs in browsers and Node.js.
Stars: ✭ 193 (+672%)
Mutual labels:  tree, traverse
extjs-reactjs-examples
Code examples for ExtJS to React transition
Stars: ✭ 48 (+92%)
Mutual labels:  tree
TreeRep
Learning Tree structures and Tree metrics
Stars: ✭ 18 (-28%)
Mutual labels:  tree
stefano-tree
Framework agnostic Nested Set (MPTT) implementation for PHP
Stars: ✭ 24 (-4%)
Mutual labels:  tree
markdown-explorer
Easily explore, view and edit markdown documentation of a file tree
Stars: ✭ 58 (+132%)
Mutual labels:  tree
AdvancedHTMLParser
Fast Indexed python HTML parser which builds a DOM node tree, providing common getElementsBy* functions for scraping, testing, modification, and formatting. Also XPath.
Stars: ✭ 90 (+260%)
Mutual labels:  tree
Object.fromEntries
Official ES spec-compliant polyfill for Object.fromEntries
Stars: ✭ 33 (+32%)
Mutual labels:  object
matching-engine
Superfast Matching Engine written in golang
Stars: ✭ 35 (+40%)
Mutual labels:  tree
is-extendable
Answers the question: "can this value have keys?". Returns true if a value is any of the object types: array, regexp, plain object, function or date. Useful for determining if a value is an object that can be extended.
Stars: ✭ 19 (-24%)
Mutual labels:  object
wisdomtree
Study helper for zhihuishu.com
Stars: ✭ 33 (+32%)
Mutual labels:  tree
python-pyfields
Define fields in python classes. Easily.
Stars: ✭ 39 (+56%)
Mutual labels:  object
treap
🍃 🌳 🍂 Efficient implementation of the implicit treap data structure
Stars: ✭ 64 (+156%)
Mutual labels:  tree
radixdb
Static Radix Tree (Patricia trie) implementation in C
Stars: ✭ 34 (+36%)
Mutual labels:  tree
trees
No description or website provided.
Stars: ✭ 54 (+116%)
Mutual labels:  tree
react-binary-tree
Binary Tree Traversal Visualisation
Stars: ✭ 25 (+0%)
Mutual labels:  tree
php-sorted-collections
Sorted Collections for PHP
Stars: ✭ 22 (-12%)
Mutual labels:  tree
treetime
TreeTime is a data organisation, management and analysis tool. A tree is a hierarchical structure that arranges information in units and sub-units. TreeTime uses linked trees (one data item can be part of different distinct trees) to store and organise any general purpose data.
Stars: ✭ 26 (+4%)
Mutual labels:  tree
fsify
Convert an array of objects into a persistent or temporary directory structure.
Stars: ✭ 24 (-4%)
Mutual labels:  tree

qverse

Traverse any data with DPML commands.

You can use qverse for react-propers.

Support pipeline operator.

Usage

import React from "react"
import ReactDOM from "react-dom"
import Propers from "react-propers"
import qverse,{produce} from "qverse"

ReactDOM.render(
   <Propers selector="$id" traverse={qverse(($)=>{
       $("*(aaa,bbb)").produce((props)=>{
           props.className = "yellow"
       })
       
       $("ddd").pipe(
         display(false)
       )
       
       $(["aaa","bbb"])
       |> produce(props=>{
           props.className += " blue-font"
       })
   })}>
      {React=>(
       <>
         <div $id="aaa">111</div>
         <div $id="bbb">222</div>
         <div $id="ccc">333</div>
         <div $id="ddd">444</div>
       </>
      )}
   </Propers>
)

//out put

<div class="yellow blue-font">111</div><div class="yellow blue-font">222</div><div>333</div>

Install

npm install --save qverse

API

qverse(ctrl : Controller ) : Traverse

create traverse with callback function

extend(proto : Object)

extend some methods for CommandFactory

produce(fn : Function)

pipline operator for produce data

display(show : Function | Boolean)

pipeline operator for show data

rescue()

pipeline operator for rescue data

select(DPML : String | Array<String> | Function , Options : MatchOptions)

pipeline operator for reselect data

filter(fn : Function)

pipeline operator for filter data

include(fn : Function)

pipeline operator for include data

exclude(fn : Function)

pipeline operator for exclude data

Interface

Controller

interface Controller {
  ($ : CommandFactory) : Traverse
}

CommandFactory

interface Replacer {
    $0:function(item : String) : String
    $1:function(item : String) : String
    $2:function(item : String) : String
    ....
}

interface CommandFactory {
   (DPML : String | Array<String> | Function , Options : MatchOptions) : Command
   replace(path : String,replacer : Replacer ) : String
   path() : Array<String>
   key() : String
   params() : any
   payload() : any
   state(path : String | Array) : any // State getter for CurrentParams
}

Command

interface Command {
    filter(params : CurrentParams) : Boolean
    exclude(params : CurrentParams) : Boolean
    include(params : CurrentParams) : Boolean
    produce(callback : function(payload : any): Boolean? ) : any //Here is the usage of https://github.com/mweststrate/immer
    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.
    select(DPML : String | Array<String> | Function , Options : MatchOptions) : Command
    display(show : Function | Boolean) : Command
    call(fn : Function) : Command
}

MatchOptions


interface MachOptions {
    include?:function(params : CurrentParams) : Boolean;
    exclude?:function(params : CurrentParams) : Boolean
}

Traverse

interface Traverse{
   (payload : any,params : CurrentParams) : any
}

CurrentParams

interface CurrentParams {
    key:String,
    path:Array<String>
}

LICENSE

The MIT License (MIT)

Copyright (c) 2018 JanryWang

Permission 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:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].