id
int64
0
3.78k
code
stringlengths
13
37.9k
declarations
stringlengths
16
64.6k
2,000
constructor(label: Identifier, body: Statement) { this.type = Syntax.LabeledStatement; this.label = label; this.body = body; }
class Identifier { readonly type: string; readonly name: string; constructor(name) { this.type = Syntax.Identifier; this.name = name; } }
2,001
constructor(meta: Identifier, property: Identifier) { this.type = Syntax.MetaProperty; this.meta = meta; this.property = property; }
class Identifier { readonly type: string; readonly name: string; constructor(name) { this.type = Syntax.Identifier; this.name = name; } }
2,002
constructor(callee: Expression, args: ArgumentListElement[]) { this.type = Syntax.NewExpression; this.callee = callee; this.arguments = args; }
type Expression = ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AsyncArrowFunctionExpression | AsyncFunctionExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | ClassExpression | ComputedMemberExpression | ConditionalExpression | Identifier | FunctionExpressi...
2,003
constructor(argument: Expression) { this.type = Syntax.SpreadElement; this.argument = argument; }
type Expression = ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AsyncArrowFunctionExpression | AsyncFunctionExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | ClassExpression | ComputedMemberExpression | ConditionalExpression | Identifier | FunctionExpressi...
2,004
constructor(object: Expression, property: Expression, optional: boolean) { this.type = Syntax.MemberExpression; this.computed = false; this.object = object; this.property = property; this.optional = optional; }
type Expression = ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AsyncArrowFunctionExpression | AsyncFunctionExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | ClassExpression | ComputedMemberExpression | ConditionalExpression | Identifier | FunctionExpressi...
2,005
constructor(test: Expression, consequent: Statement[]) { this.type = Syntax.SwitchCase; this.test = test; this.consequent = consequent; }
type Expression = ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AsyncArrowFunctionExpression | AsyncFunctionExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | ClassExpression | ComputedMemberExpression | ConditionalExpression | Identifier | FunctionExpressi...
2,006
constructor(discriminant: Expression, cases: SwitchCase[]) { this.type = Syntax.SwitchStatement; this.discriminant = discriminant; this.cases = cases; }
type Expression = ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AsyncArrowFunctionExpression | AsyncFunctionExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | ClassExpression | ComputedMemberExpression | ConditionalExpression | Identifier | FunctionExpressi...
2,007
constructor(tag: Expression, quasi: TemplateLiteral) { this.type = Syntax.TaggedTemplateExpression; this.tag = tag; this.quasi = quasi; }
type Expression = ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AsyncArrowFunctionExpression | AsyncFunctionExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | ClassExpression | ComputedMemberExpression | ConditionalExpression | Identifier | FunctionExpressi...
2,008
constructor(tag: Expression, quasi: TemplateLiteral) { this.type = Syntax.TaggedTemplateExpression; this.tag = tag; this.quasi = quasi; }
class TemplateLiteral { readonly type: string; readonly quasis: TemplateElement[]; readonly expressions: Expression[]; constructor(quasis: TemplateElement[], expressions: Expression[]) { this.type = Syntax.TemplateLiteral; this.quasis = quasis; this.expressions = expressions; ...
2,009
constructor(value: TemplateElementValue, tail: boolean) { this.type = Syntax.TemplateElement; this.value = value; this.tail = tail; }
interface TemplateElementValue { cooked: string | null; raw: string; }
2,010
constructor(argument: Expression) { this.type = Syntax.ThrowStatement; this.argument = argument; }
type Expression = ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AsyncArrowFunctionExpression | AsyncFunctionExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | ClassExpression | ComputedMemberExpression | ConditionalExpression | Identifier | FunctionExpressi...
2,011
constructor(block: BlockStatement, handler: CatchClause | null, finalizer: BlockStatement | null) { this.type = Syntax.TryStatement; this.block = block; this.handler = handler; this.finalizer = finalizer; }
class BlockStatement { readonly type: string; readonly body: Statement[]; constructor(body) { this.type = Syntax.BlockStatement; this.body = body; } }
2,012
constructor(test: Expression, body: Statement) { this.type = Syntax.WhileStatement; this.test = test; this.body = body; }
type Statement = AsyncFunctionDeclaration | BreakStatement | ContinueStatement | DebuggerStatement | DoWhileStatement | EmptyStatement | ExpressionStatement | Directive | ForStatement | ForInStatement | ForOfStatement | FunctionDeclaration | IfStatement | ReturnStatement | SwitchStatement | ThrowStatement | ...
2,013
constructor(test: Expression, body: Statement) { this.type = Syntax.WhileStatement; this.test = test; this.body = body; }
type Expression = ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AsyncArrowFunctionExpression | AsyncFunctionExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | ClassExpression | ComputedMemberExpression | ConditionalExpression | Identifier | FunctionExpressi...
2,014
constructor(object: Expression, body: Statement) { this.type = Syntax.WithStatement; this.object = object; this.body = body; }
type Statement = AsyncFunctionDeclaration | BreakStatement | ContinueStatement | DebuggerStatement | DoWhileStatement | EmptyStatement | ExpressionStatement | Directive | ForStatement | ForInStatement | ForOfStatement | FunctionDeclaration | IfStatement | ReturnStatement | SwitchStatement | ThrowStatement | ...
2,015
constructor(object: Expression, body: Statement) { this.type = Syntax.WithStatement; this.object = object; this.body = body; }
type Expression = ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AsyncArrowFunctionExpression | AsyncFunctionExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | ClassExpression | ComputedMemberExpression | ConditionalExpression | Identifier | FunctionExpressi...
2,016
parseComplexJSXElement(el: MetaJSXElement): MetaJSXElement { const stack: MetaJSXElement[] = []; while (!this.scanner.eof()) { el.children = el.children.concat(this.parseJSXChildren()); const node = this.createJSXChildNode(); const element = this.parseJSXBoundaryElem...
interface MetaJSXElement { node: Marker; opening: JSXNode.JSXOpeningElement | JSXNode.JSXOpeningFragment; closing: JSXNode.JSXClosingElement | JSXNode.JSXClosingFragment | null; children: JSXNode.JSXChild[]; }
2,017
constructor(name: JSXElementName) { this.type = JSXSyntax.JSXClosingElement; this.name = name; }
type JSXElementName = JSXIdentifier | JSXNamespacedName | JSXMemberExpression;
2,018
constructor(name: JSXAttributeName, value: JSXAttributeValue | null) { this.type = JSXSyntax.JSXAttribute; this.name = name; this.value = value; }
type JSXAttributeName = JSXIdentifier | JSXNamespacedName;
2,019
constructor(namespace: JSXIdentifier, name: JSXIdentifier) { this.type = JSXSyntax.JSXNamespacedName; this.namespace = namespace; this.name = name; }
class JSXIdentifier { readonly type: string; readonly name: string; constructor(name: string) { this.type = JSXSyntax.JSXIdentifier; this.name = name; } }
2,020
constructor(name: JSXElementName, selfClosing: boolean, attributes: JSXElementAttribute[]) { this.type = JSXSyntax.JSXOpeningElement; this.name = name; this.selfClosing = selfClosing; this.attributes = attributes; }
type JSXElementName = JSXIdentifier | JSXNamespacedName | JSXMemberExpression;
2,021
convertToken(token: RawToken): TokenEntry { const t: TokenEntry = { type: TokenName[token.type], value: this.getTokenRaw(token) }; if (this.config.range) { t.range = [token.start, token.end]; } if (this.config.loc) { t.loc = { ...
interface RawToken { type: Token; value: string | number; pattern?: string; flags?: string; regex?: RegExp | null; octal?: boolean; cooked?: string | null; notEscapeSequenceHead?: NotEscapeSequenceHead | null; head?: boolean; tail?: boolean; lineNumber: number; lineStart:...
2,022
finalize(marker: Marker, node) { if (this.config.range) { node.range = [marker.index, this.lastMarker.index]; } if (this.config.loc) { node.loc = { start: { line: marker.line, column: marker.column, ...
interface Marker { index: number; line: number; column: number; }
2,023
throwTemplateLiteralEarlyErrors(token: RawToken): never { switch (token.notEscapeSequenceHead) { case 'u': return this.throwUnexpectedToken(token, Messages.InvalidUnicodeEscapeSequence); case 'x': return this.throwUnexpectedToken(token, Messages.InvalidHex...
interface RawToken { type: Token; value: string | number; pattern?: string; flags?: string; regex?: RegExp | null; octal?: boolean; cooked?: string | null; notEscapeSequenceHead?: NotEscapeSequenceHead | null; head?: boolean; tail?: boolean; lineNumber: number; lineStart:...
2,024
parseTemplateHead(options: ParseTemplateLiteralOptions): Node.TemplateElement { assert(this.lookahead.head as boolean, 'Template literal must start with a template head'); const node = this.createNode(); const token = this.nextToken(); if (!options.isTagged && token.notEscapeSequenceHea...
interface ParseTemplateLiteralOptions { isTagged: boolean; }
2,025
parseTemplateElement(options: ParseTemplateLiteralOptions): Node.TemplateElement { if (this.lookahead.type !== Token.Template) { this.throwUnexpectedToken(); } const node = this.createNode(); const token = this.nextToken(); if (!options.isTagged && token.notEscapeSeq...
interface ParseTemplateLiteralOptions { isTagged: boolean; }
2,026
parseTemplateLiteral(options: ParseTemplateLiteralOptions): Node.TemplateLiteral { const node = this.createNode(); const expressions: Node.Expression[] = []; const quasis: Node.TemplateElement[] = []; let quasi = this.parseTemplateHead(options); quasis.push(quasi); whil...
interface ParseTemplateLiteralOptions { isTagged: boolean; }
2,027
parseVariableDeclaration(options: DeclarationOptions): Node.VariableDeclarator { const node = this.createNode(); const params = []; const id = this.parsePattern(params, 'var'); if (this.context.strict && id.type === Syntax.Identifier) { if (this.scanner.isRestrictedWord((id...
interface DeclarationOptions { inFor: boolean; }
2,028
recordError(error: Error): void { this.errors.push(error); }
class Error { public name: string; public message: string; public index: number; public lineNumber: number; public column: number; public description: string; constructor(message: string); }
2,029
public restoreState(state: ScannerState): void { this.index = state.index; this.lineNumber = state.lineNumber; this.lineStart = state.lineStart; this.curlyStack = state.curlyStack; }
interface ScannerState { index: number; lineNumber: number; lineStart: number; curlyStack: string[]; }
2,030
onparserinit(parser: Parser) { // @ts-expect-error Accessing private tokenizer here expect(parser.tokenizer).toBeInstanceOf(CustomTokenizer); }
class Parser implements Callbacks { /** The start index of the last event. */ public startIndex = 0; /** The end index of the last event. */ public endIndex = 0; /** * Store the start index of the current open tag, * so we can update the start index for attributes. */ private open...
2,031
onparserinit(parser: Parser): void
class Parser implements Callbacks { /** The start index of the last event. */ public startIndex = 0; /** The end index of the last event. */ public endIndex = 0; /** * Store the start index of the current open tag, * so we can update the start index for attributes. */ private open...
2,032
function ui (opts: UIOptions): UI { return cliui(opts, { stringWidth: (str: string) => { return [...str].length }, stripAnsi, wrap }) }
interface UIOptions { width: number; wrap?: boolean; rows?: string[]; }
2,033
function ui (opts: UIOptions) { return cliui(opts, { stringWidth, stripAnsi, wrap }) }
interface UIOptions { width: number; wrap?: boolean; rows?: string[]; }
2,034
constructor (opts: UIOptions) { this.width = opts.width this.wrap = opts.wrap ?? true this.rows = [] }
interface UIOptions { width: number; wrap?: boolean; rows?: string[]; }
2,035
span (...args: ColumnArray) { const cols = this.div(...args) cols.span = true }
interface ColumnArray extends Array<Column> { span: boolean; }
2,036
rowToString (row: ColumnArray, lines: Line[]) { this.rasterize(row).forEach((rrow, r) => { let str = '' rrow.forEach((col: string, c: number) => { const { width } = row[c] // the width with padding. const wrapWidth = this.negatePadding(row[c]) // the width without padding. let t...
interface ColumnArray extends Array<Column> { span: boolean; }
2,037
private rasterize (row: ColumnArray) { const rrows: string[][] = [] const widths = this.columnWidths(row) let wrapped // word wrap all columns, and create // a data-structure that is easy to rasterize. row.forEach((col, c) => { // leave room for left and right padding. col.width = w...
interface ColumnArray extends Array<Column> { span: boolean; }
2,038
private negatePadding (col: Column) { let wrapWidth = col.width || 0 if (col.padding) { wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0) } if (col.border) { wrapWidth -= 4 } return wrapWidth }
interface Column { text: string; width?: number; align?: 'right'|'left'|'center', padding: number[], border?: boolean; }
2,039
private columnWidths (row: ColumnArray) { if (!this.wrap) { return row.map(col => { return col.width || mixin.stringWidth(col.text) }) } let unset = row.length let remainingWidth = this.width // column widths can be set in config. const widths = row.map(col => { if (c...
interface ColumnArray extends Array<Column> { span: boolean; }
2,040
function addBorder (col: Column, ts: string, style: string) { if (col.border) { if (/[.']-+[.']/.test(ts)) { return '' } if (ts.trim().length !== 0) { return style } return ' ' } return '' }
interface Column { text: string; width?: number; align?: 'right'|'left'|'center', padding: number[], border?: boolean; }
2,041
function _minWidth (col: Column) { const padding = col.padding || [] const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0) if (col.border) { return minWidth + 4 } return minWidth }
interface Column { text: string; width?: number; align?: 'right'|'left'|'center', padding: number[], border?: boolean; }
2,042
(pathname: Pathname) => boolean
type Pathname = string
2,043
ignores(pathname: Pathname): boolean
type Pathname = string
2,044
test(pathname: Pathname): TestResult
type Pathname = string
2,045
function ignore(options?: Options): Ignore
interface Options { ignorecase?: boolean // For compatibility ignoreCase?: boolean allowRelativePaths?: boolean }
2,046
(node: XastElement, info: PluginInfo) => string
type XastElement = { type: 'element'; name: string; attributes: Record<string, string>; children: Array<XastChild>; };
2,047
(node: XastElement, info: PluginInfo) => string
type PluginInfo = { path?: string; multipassCount: number; };
2,048
(node: Node, parentNode: XastParent) => void | symbol
type XastParent = XastRoot | XastElement;
2,049
(node: Node, parentNode: XastParent) => void
type XastParent = XastRoot | XastElement;
2,050
(node: XastRoot, parentNode: null) => void
type XastRoot = { type: 'root'; children: Array<XastChild>; };
2,051
( root: XastRoot, params: Params, info: PluginInfo ) => null | Visitor
type XastRoot = { type: 'root'; children: Array<XastChild>; };
2,052
( root: XastRoot, params: Params, info: PluginInfo ) => null | Visitor
type PluginInfo = { path?: string; multipassCount: number; };
2,053
(config: BaseConfig): number[] => { return config.columns.map(({truncate}) => { return truncate; }); }
type BaseConfig = { readonly border: BorderConfig, readonly columns: ColumnConfig[], readonly drawVerticalLine: DrawVerticalLine, readonly drawHorizontalLine?: DrawHorizontalLine, readonly spanningCellManager?: SpanningCellManager, };
2,054
(spanningCellConfig: SpanningCellConfig): RangeCoordinate => { const {row, col, colSpan = 1, rowSpan = 1} = spanningCellConfig; return {bottomRight: {col: col + colSpan - 1, row: row + rowSpan - 1}, topLeft: {col, row}}; }
type SpanningCellConfig = CellUserConfig & { readonly row: number, readonly col: number, readonly rowSpan?: number, readonly colSpan?: number, };
2,055
(cell1: CellCoordinates, cell2: CellCoordinates): boolean => { return cell1.row === cell2.row && cell1.col === cell2.col; }
type CellCoordinates = { row: number, col: number, };
2,056
(cell: CellCoordinates, {topLeft, bottomRight}: RangeCoordinate): boolean => { return ( topLeft.row <= cell.row && cell.row <= bottomRight.row && topLeft.col <= cell.col && cell.col <= bottomRight.col ); }
type RangeCoordinate = { topLeft: CellCoordinates, bottomRight: CellCoordinates, };
2,057
(cell: CellCoordinates, {topLeft, bottomRight}: RangeCoordinate): boolean => { return ( topLeft.row <= cell.row && cell.row <= bottomRight.row && topLeft.col <= cell.col && cell.col <= bottomRight.col ); }
type CellCoordinates = { row: number, col: number, };
2,058
(config: StreamUserConfig): StreamConfig => { validateConfig('streamConfig.json', config); if (config.columnDefault.width === undefined) { throw new Error('Must provide config.columnDefault.width when creating a stream.'); } return { drawVerticalLine: () => { return true; }, ...config, ...
type StreamUserConfig = BaseUserConfig & { /** * The number of columns */ readonly columnCount: number, /** * Default values for all columns. Column specific settings overwrite the default values. */ readonly columnDefault: ColumnUserConfig & { /** * The default width for each column ...
2,059
(rangeConfig: RangeConfig, rangeWidth: number, context: SpanningCellContext): string[] => { const {topLeft, paddingRight, paddingLeft, truncate, wrapWord, alignment} = rangeConfig; const originalContent = context.rows[topLeft.row][topLeft.col]; const contentWidth = rangeWidth - paddingLeft - paddingRight; ret...
type SpanningCellContext = SpanningCellParameters & { rowHeights: number[], };
2,060
(rangeConfig: RangeConfig, rangeWidth: number, context: SpanningCellContext): string[] => { const {topLeft, paddingRight, paddingLeft, truncate, wrapWord, alignment} = rangeConfig; const originalContent = context.rows[topLeft.row][topLeft.col]; const contentWidth = rangeWidth - paddingLeft - paddingRight; ret...
type RangeConfig = RangeCoordinate & Required<CellUserConfig>;
2,061
(range: RangeConfig, content: string[], context: SpanningCellContext) => { const {rows, drawHorizontalLine, rowHeights} = context; const {topLeft, bottomRight, verticalAlignment} = range; // They are empty before calculateRowHeights function run if (rowHeights.length === 0) { return []; } const totalC...
type SpanningCellContext = SpanningCellParameters & { rowHeights: number[], };
2,062
(range: RangeConfig, content: string[], context: SpanningCellContext) => { const {rows, drawHorizontalLine, rowHeights} = context; const {topLeft, bottomRight, verticalAlignment} = range; // They are empty before calculateRowHeights function run if (rowHeights.length === 0) { return []; } const totalC...
type RangeConfig = RangeCoordinate & Required<CellUserConfig>;
2,063
(row: Row, columnWidths: number[], config: StreamConfig) => { const rows = prepareData([row], config); const body = rows.map((literalRow) => { return drawRow(literalRow, config); }).join(''); let output; output = ''; output += drawBorderTop(columnWidths, config); output += body; output += drawBo...
type Row = Cell[];
2,064
(row: Row, columnWidths: number[], config: StreamConfig) => { const rows = prepareData([row], config); const body = rows.map((literalRow) => { return drawRow(literalRow, config); }).join(''); let output; output = ''; output += drawBorderTop(columnWidths, config); output += body; output += drawBo...
type StreamConfig = Required<Omit<StreamUserConfig, 'border' | 'columnDefault' | 'columns'>> & { readonly border: BorderConfig, readonly columns: ColumnConfig[], };
2,065
(row: Row, columnWidths: number[], config: StreamConfig) => { const rows = prepareData([row], config); const body = rows.map((literalRow) => { return drawRow(literalRow, config); }).join(''); let output = ''; const bottom = drawBorderBottom(columnWidths, config); if (bottom !== '\n') { output = '...
type Row = Cell[];
2,066
(row: Row, columnWidths: number[], config: StreamConfig) => { const rows = prepareData([row], config); const body = rows.map((literalRow) => { return drawRow(literalRow, config); }).join(''); let output = ''; const bottom = drawBorderBottom(columnWidths, config); if (bottom !== '\n') { output = '...
type StreamConfig = Required<Omit<StreamUserConfig, 'border' | 'columnDefault' | 'columns'>> & { readonly border: BorderConfig, readonly columns: ColumnConfig[], };
2,067
(userConfig: StreamUserConfig): WritableStream => { const config = makeStreamConfig(userConfig); const columnWidths = Object.values(config.columns).map((column) => { return column.width + column.paddingLeft + column.paddingRight; }); let empty = true; return { write: (row: string[]) => { if (...
type StreamUserConfig = BaseUserConfig & { /** * The number of columns */ readonly columnCount: number, /** * Default values for all columns. Column specific settings overwrite the default values. */ readonly columnDefault: ColumnUserConfig & { /** * The default width for each column ...
2,068
(cell: Cell): number => { return Math.max( ...cell.split('\n').map(stringWidth), ); }
type Cell = string;
2,069
(row: Row, config: DrawRowConfig): string => { const {border, drawVerticalLine, rowIndex, spanningCellManager} = config; return drawContent({ contents: row, drawSeparator: drawVerticalLine, elementType: 'cell', rowIndex, separatorGetter: (index, columnCount) => { if (index === 0) { ...
type Row = Cell[];
2,070
(row: Row, config: DrawRowConfig): string => { const {border, drawVerticalLine, rowIndex, spanningCellManager} = config; return drawContent({ contents: row, drawSeparator: drawVerticalLine, elementType: 'cell', rowIndex, separatorGetter: (index, columnCount) => { if (index === 0) { ...
type DrawRowConfig = { border: BodyBorderConfig, drawVerticalLine: DrawVerticalLine, spanningCellManager?: SpanningCellManager, rowIndex?: number, };
2,071
(config: TableConfig): number[] => { return config.columns.map((col) => { return col.paddingLeft + col.width + col.paddingRight; }); }
type TableConfig = Required<Omit<TableUserConfig, 'border' | 'columnDefault' | 'columns' | 'header' | 'spanningCells'>> & { readonly border: BorderConfig, readonly columns: ColumnConfig[], readonly spanningCellManager: SpanningCellManager, };
2,072
(parameters: DrawContentParameters): string => { const {contents, separatorGetter, drawSeparator, spanningCellManager, rowIndex, elementType} = parameters; const contentSize = contents.length; const result: string[] = []; if (drawSeparator(0, contentSize)) { result.push(separatorGetter(0, contentSize)); ...
type DrawContentParameters = { contents: string[], drawSeparator: (index: number, size: number) => boolean, separatorGetter: (index: number, size: number) => string, spanningCellManager?: SpanningCellManager, rowIndex?: number, elementType?: 'border' | 'cell' | 'row', };
2,073
(rangeConfig: RangeConfig, dependencies: SpanningCellParameters): number => { const {columnsConfig, drawVerticalLine} = dependencies; const {topLeft, bottomRight} = rangeConfig; const totalWidth = sumArray( columnsConfig.slice(topLeft.col, bottomRight.col + 1).map(({width}) => { return width; }), ...
type SpanningCellParameters = { spanningCellConfigs: SpanningCellConfig[], rows: Row[], columnsConfig: ColumnConfig[], drawVerticalLine: DrawVerticalLine, drawHorizontalLine: DrawHorizontalLine, };
2,074
(rangeConfig: RangeConfig, dependencies: SpanningCellParameters): number => { const {columnsConfig, drawVerticalLine} = dependencies; const {topLeft, bottomRight} = rangeConfig; const totalWidth = sumArray( columnsConfig.slice(topLeft.col, bottomRight.col + 1).map(({width}) => { return width; }), ...
type RangeConfig = RangeCoordinate & Required<CellUserConfig>;
2,075
(cell: CellCoordinates, options?: {mapped: true, }) => ResolvedRangeConfig | undefined
type CellCoordinates = { row: number, col: number, };
2,076
(cell1: CellCoordinates, cell2: CellCoordinates) => boolean
type CellCoordinates = { row: number, col: number, };
2,077
(cell: CellCoordinates, rangeConfigs: RangeConfig[]): RangeConfig | undefined => { return rangeConfigs.find((rangeCoordinate) => { return isCellInRange(cell, rangeCoordinate); }); }
type CellCoordinates = { row: number, col: number, };
2,078
(rangeConfig: RangeConfig, context: SpanningCellContext): ResolvedRangeConfig | undefined => { const width = calculateSpanningCellWidth(rangeConfig, context); const wrappedContent = wrapRangeContent(rangeConfig, width, context); const alignedContent = alignVerticalRangeContent(rangeConfig, wrappedContent, conte...
type SpanningCellContext = SpanningCellParameters & { rowHeights: number[], };
2,079
(rangeConfig: RangeConfig, context: SpanningCellContext): ResolvedRangeConfig | undefined => { const width = calculateSpanningCellWidth(rangeConfig, context); const wrappedContent = wrapRangeContent(rangeConfig, width, context); const alignedContent = alignVerticalRangeContent(rangeConfig, wrappedContent, conte...
type RangeConfig = RangeCoordinate & Required<CellUserConfig>;
2,080
(cell1: CellCoordinates, cell2: CellCoordinates, ranges: RangeConfig[]): boolean => { const range1 = findRangeConfig(cell1, ranges); const range2 = findRangeConfig(cell2, ranges); if (range1 && range2) { return areCellEqual(range1.topLeft, range2.topLeft); } return false; }
type CellCoordinates = { row: number, col: number, };
2,081
(range: RangeConfig): string => { const {row, col} = range.topLeft; return `${row}/${col}`; }
type RangeConfig = RangeCoordinate & Required<CellUserConfig>;
2,082
(parameters: SpanningCellParameters): SpanningCellManager => { const {spanningCellConfigs, columnsConfig} = parameters; const ranges = spanningCellConfigs.map((config) => { return makeRangeConfig(config, columnsConfig); }); const rangeCache: Record<string, ResolvedRangeConfig | undefined> = {}; let rowH...
type SpanningCellParameters = { spanningCellConfigs: SpanningCellConfig[], rows: Row[], columnsConfig: ColumnConfig[], drawVerticalLine: DrawVerticalLine, drawHorizontalLine: DrawHorizontalLine, };
2,083
(spanningCellConfig: SpanningCellConfig, columnsConfig: ColumnConfig[]): RangeConfig => { const {topLeft, bottomRight} = calculateRangeCoordinate(spanningCellConfig); const cellConfig: Required<CellUserConfig> = { ...columnsConfig[topLeft.col], ...spanningCellConfig, paddingRight: spanningCellCon...
type SpanningCellConfig = CellUserConfig & { readonly row: number, readonly col: number, readonly rowSpan?: number, readonly colSpan?: number, };
2,084
constructor(options?: PromptOptions)
type PromptOptions = | BasePromptOptions | ArrayPromptOptions | BooleanPromptOptions | StringPromptOptions | NumberPromptOptions | SnippetPromptOptions | SortPromptOptions
2,085
(this: Enquirer) => PromptOptions
class Enquirer<T = object> extends EventEmitter { constructor(options?: object, answers?: T); /** * Register a custom prompt type. * * @param type * @param fn `Prompt` class, or a function that returns a `Prompt` class. */ register(type: string, fn: typeof BasePrompt | (() => typeof BasePrompt)): ...
2,086
constructor(opts: TracerOptions = {}) { super(); if (typeof opts !== "object") { throw new Error("Invalid options passed (must be an object)"); } if (opts.parent != null && typeof opts.parent !== "object") { throw new Error("Invalid option (parent) passed (must be an object)"); } i...
interface TracerOptions { parent?: Tracer | null; fields?: Fields | null; objectMode?: boolean | null; noStream?: boolean; }
2,087
private _pushString(ev: Event) { var separator = ""; if (!this.firstPush) { this.push("["); this.firstPush = true; } else { separator = ",\n"; } this.push(separator + JSON.stringify(ev), "utf8"); }
interface Event { ts: number; pid: number; tid: number; /** event phase */ ph?: string; [otherData: string]: any; }
2,088
public child(fields: Fields) { return new Tracer({ parent: this, fields: fields }); }
interface Fields { cat?: any; args?: any; [filedName: string]: any; }
2,089
public begin(fields: Fields) { return this.mkEventFunc("b")(fields); }
interface Fields { cat?: any; args?: any; [filedName: string]: any; }
2,090
public end(fields: Fields) { return this.mkEventFunc("e")(fields); }
interface Fields { cat?: any; args?: any; [filedName: string]: any; }
2,091
public completeEvent(fields: Fields) { return this.mkEventFunc("X")(fields); }
interface Fields { cat?: any; args?: any; [filedName: string]: any; }
2,092
public instantEvent(fields: Fields) { return this.mkEventFunc("I")(fields); }
interface Fields { cat?: any; args?: any; [filedName: string]: any; }
2,093
(fields: Fields) => { var ev = evCommon(); // Assign the event phase. ev.ph = ph; if (fields) { if (typeof fields === "string") { ev.name = fields; } else { for (const k of Object.keys(fields)) { if (k === "cat") { ev.cat = fields.ca...
interface Fields { cat?: any; args?: any; [filedName: string]: any; }
2,094
function match<P extends object = object>( str: Path, options?: ParseOptions & TokensToRegexpOptions & RegexpToFunctionOptions ) { const keys: Key[] = []; const re = pathToRegexp(str, keys, options); return regexpToFunction<P>(re, keys, options); }
type Path = string | RegExp | Array<string | RegExp>;
2,095
function regexpToFunction<P extends object = object>( re: RegExp, keys: Key[], options: RegexpToFunctionOptions = {} ): MatchFunction<P> { const { decode = (x: string) => x } = options; return function (pathname: string) { const m = re.exec(pathname); if (!m) return false; const { 0: path, index...
interface RegexpToFunctionOptions { /** * Function for decoding strings for params. */ decode?: (value: string, token: Key) => string; }
2,096
function pathToRegexp( path: Path, keys?: Key[], options?: TokensToRegexpOptions & ParseOptions ) { if (path instanceof RegExp) return regexpToRegexp(path, keys); if (Array.isArray(path)) return arrayToRegexp(path, keys, options); return stringToRegexp(path, keys, options); }
type Path = string | RegExp | Array<string | RegExp>;
2,097
function getAjvSyncInstances(extraOpts?: Options): AjvCore[] { return getAjvInstances( _Ajv, { strict: false, allErrors: true, code: {lines: true, optimize: false}, }, extraOpts ) }
type Options = CurrentOptions & DeprecatedOptions
2,098
function testTree(treeSchema: SchemaObject, strictTreeSchema: SchemaObject): void { const validTree = { data: 1, children: [ { data: 2, children: [{data: 3}], }, ], } const invalidTree = { data: 1, children: [ { data: 2, ...
interface SchemaObject extends _SchemaObject { id?: string $id?: string $schema?: string $async?: false [x: string]: any // TODO }
2,099
function testInlined(validate: AnyValidateFunction, expectedInlined) { const inlined: any = !validate.source?.scopeValues.validate inlined.should.equal(expectedInlined) }
type AnyValidateFunction<T = any> = ValidateFunction<T> | AsyncValidateFunction<T>