GithubHelp home page GithubHelp logo

royjs-ast's Introduction

Roy-Ast buildStatus

A quick static tools for royjs.

Install

npm install @royjs/ast --save

Usage

import {Store} from '@royjs/ast';
const store = new Store(code);

API

Classes

Store

解析Royjs的Store数据

View

解析Royjs的视图数据

Store

解析Royjs的Store数据

Kind: global class

new Store(code)

Store的构造函数

Param Type Description
code String 传入的store的代码

store.parse() ⇒

解析store文件

Kind: instance method of Store Returns: 返回state,actions,urls

store.remove(name) ⇒

根据name移除某个定义的action

Kind: instance method of Store Returns: 修改后的代码

Param Type Description
name String action的名字

store.renameState(oldName, newName) ⇒

重命名某个state

Kind: instance method of Store Returns: 修改后的代码

Param Type Description
oldName String 旧的state的名字
newName String 新的state的名字

store.modifyState(name, value) ⇒

修改状态的值

Kind: instance method of Store Returns: 修改后的代码

Param Type Description
name String 状态的名称
value String 状态的值

store.addState(name, value)

增加状态的值

Kind: instance method of Store

Param Type Description
name String 状态的名称
value String 状态的值

store.modify(name, content) ⇒

根据action的名字,修改action内容

Kind: instance method of Store Returns: 修改后的代码

Param Type Description
name String action的名字
content String action的内容

store.rename(oldName, newName) ⇒

重命名某个action

Kind: instance method of Store Returns: 修改后的代码

Param Type Description
oldName String action的名称
newName String action的新的名称

store.add(name) ⇒

增加一个action, 如果存在同名action则不会添加

Kind: instance method of Store Returns: 修改后的代码

Param Type Description
name String action的名称

store.modifyByStartEnd(node, content) ⇒

根据位置修改内容

Kind: instance method of Store Returns: 返回修改的代码

Param Type Description
node Node 指定的节点,该节点需包含start和end两个属性
content String 替换的content

View

解析Royjs的视图数据

Kind: global class

new View(code)

View的构造函数

Param Type Description
code String 传入的view的代码

view.parse() ⇒

解析视图数据

Kind: instance method of View Returns: 返回 class和elements值

view.attrs(node, name, value)

为一个节点设置属性

Kind: instance method of View

Param Type
node Node | String
name String
value String

view.removeAttr(node, name)

移除一个节点属性

Kind: instance method of View

Param Type Description
node Node | String
name String 要移除的属性名称

view.remove(name)

根据名称移除一个节点

Kind: instance method of View

Param Type
name String

view.removeByStart(start)

根据起始位置移除一个节点

Kind: instance method of View

Param Type
start String | Int

view.cloneByStart(start)

根据起始位置复制一个节点

Kind: instance method of View

Param Type
start String | Int

view.add(node, child)

为一个节点加入子节点

Kind: instance method of View

Param Type Description
node String | node 父节点
child String 子节点的代码

view.rename(}, newName)

重命名一个节点,如果寻找到多个节点,只会重命名第一个

Kind: instance method of View

Param Type Description
} String oldName
newName String

view.find(}) ⇒ Array

根据name寻找节点

Kind: instance method of View

Param Type Description
} String name

view.findByStart(start, isPath)

根据起始位置寻找节点,如果第二个参数为true,则返回节点的路径

Kind: instance method of View

Param Type
start String | Int
isPath Boolean

view.findBy(callback, isPath)

根据callback过滤节点,如果第二个参数为true,则返回节点的路径

Kind: instance method of View

Param Type
callback function
isPath Boolean

royjs-ast's People

Contributors

windygex avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

p79n6a

royjs-ast's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.