Options
All
  • Public
  • Public/Protected
  • All
Menu

Module utils

Index

Variables

Const logger

logger: { debug: any } = ...

Type declaration

  • debug: function
    • debug(...args: any[]): void
    • Parameters

      • Rest ...args: any[]

      Returns void

Functions

Const Camel2kebab

  • Camel2kebab(name: string): string
  • 驼峰格式 -转-> 中划线格式

    Parameters

    • name: string

      原名称

    Returns string

    转换后的名称

Const firstUpperCase

  • firstUpperCase(value: string): string
  • 首字母大写

    Parameters

    • value: string

      字符串

    Returns string

Const getLastOfPath

  • getLastOfPath(path: string): string
  • Parameters

    • path: string

    Returns string

Const kebab2Camel

  • kebab2Camel(name: string): string
  • 中划线格式 -转-> 驼峰格式

    Parameters

    • name: string

      原名称

    Returns string

    转换后的名称

Const sliceTagContent

  • sliceTagContent(source: string, tag: string, attrs?: string): string
  • 切出标签内的内容

    Parameters

    • source: string

      原始内容

    • tag: string

      标签

    • attrs: string = ''

      属性匹配

    Returns string

Const throttle

  • throttle(func: Function, wait: number, options: any): Function
  • 用 lodash 的 throttle 好像有点问题,先临时做个处理

    Parameters

    • func: Function
    • wait: number
    • options: any

    Returns Function

traverse

  • traverse<T>(func: (current: INodeInfo<T>) => any, init: INodeInfo<T>, options?: { depthFirst?: boolean; mode?: "onlyChildren" | "onlyArray" | "anyObject" }): any
  • 遍历树

    example

    traverse((current) => console.log(current.node.name), { init: rootNode });

    example

    traverse((current) => console.log(current.jsonPath), { init: ast }, { mode: 'anyObject' });

    Type parameters

    Parameters

    • func: (current: INodeInfo<T>) => any
    • init: INodeInfo<T>

      初始点信息

    • Optional options: { depthFirst?: boolean; mode?: "onlyChildren" | "onlyArray" | "anyObject" }
      • Optional depthFirst?: boolean

        默认广度优先搜索,是否深度优先搜索

      • Optional mode?: "onlyChildren" | "onlyArray" | "anyObject"

        'onlyChildren' 表示只向下遍历 children 的元素(默认);'onlyArray' 表示只向下遍历 Array 的元素;'anyObject' 表示只要属性为 Object 类型都会遍历

    Returns any

unique

  • unique(key: string, set: Set<string> | Map<string, any> | string[] | {}, start?: number): string
  • Parameters

    • key: string
    • set: Set<string> | Map<string, any> | string[] | {}
    • start: number = 1

    Returns string

Generated using TypeDoc