Reference Source Test
import ParamParser from 'esdoc2/out/src/Parser/ParamParser.js'
public class | source

ParamParser

Param Type Parser class.

Test:

Static Method Summary

Static Public Methods
public static

parseParam(typeText: string, paramName: string, paramDesc: string): ParsedParam

parse param text and build formatted result.

public static

parseParamValue(value: string, type: boolean, name: boolean, desc: boolean): {typeText: string, paramName: string, paramDesc: string}

parse param value.

Static Public Methods

public static parseParam(typeText: string, paramName: string, paramDesc: string): ParsedParam source

parse param text and build formatted result.

Params:

NameTypeAttributeDescription
typeText string

param type text.

paramName string
  • optional

param name.

paramDesc string
  • optional

param description.

Return:

ParsedParam

formatted result.

Example:

let value = '{number} param - this is number param';
let {typeText, paramName, paramDesc} = ParamParser.parseParamValue(value);
let result = ParamParser.parseParam(typeText, paramName, paramDesc);

Test:

public static parseParamValue(value: string, type: boolean, name: boolean, desc: boolean): {typeText: string, paramName: string, paramDesc: string} source

parse param value.

Params:

NameTypeAttributeDescription
value string

param value.

type boolean
  • optional
  • default: true

if true, contain param type.

name boolean
  • optional
  • default: true

if true, contain param name.

desc boolean
  • optional
  • default: true

if true, contain param description.

Return:

{typeText: string, paramName: string, paramDesc: string}

parsed value.

Example:

let value = '{number} param - this is number param';
let {typeText, paramName, paramDesc} = ParamParser.parseParamValue(value);

let value = '{number} this is number return value';
let {typeText, paramDesc} = ParamParser.parseParamValue(value, true, false, true);

let value = '{number}';
let {typeText} = ParamParser.parseParamValue(value, true, false, false);

Test: