1.0.0 • Published 4 months ago

@yuntu/utils v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
4 months ago

安装

yarn add @yuntu/utils
// or
npm install @yuntu/utils

API

通用

getStrLen(String)

获取文本的字符长度,中午占两个字符。一般用于计算文本的宽度。

randomCode(Number=8)

生成随机字符串,可传入字符长度。

safeParseJSON(String)

JSON 数据格式化。

图相关

图分析

fullPath({ nodes, edges, start, end, step, pathNum })

全路径分析

shortestPath({ edges, start, end, pathNum })

最短路径分析

getGraphByPaths({ nodes: gNodes, edges: gEdges }, paths)

根据路径获取图数据

点图形

边路径

业务处理

formatGraphData()

云图接口返回图数据格式化

formatSchema()

云图接口返回图 schema 格式化

formatProps({ value, properties })

属性值格式化,value 为具体的属性值,properties 为属性对应的 schema