source: trip-planner-front/node_modules/yaml/util.d.ts@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.0 KB
Line 
1import { Document } from './index'
2import { CST } from './parse-cst'
3import { AST, Pair, Scalar, Schema } from './types'
4
5export function findPair(items: any[], key: Scalar | any): Pair | undefined
6
7export function parseMap(doc: Document, cst: CST.Map): AST.BlockMap
8export function parseMap(doc: Document, cst: CST.FlowMap): AST.FlowMap
9export function parseSeq(doc: Document, cst: CST.Seq): AST.BlockSeq
10export function parseSeq(doc: Document, cst: CST.FlowSeq): AST.FlowSeq
11
12export function stringifyNumber(item: Scalar): string
13export function stringifyString(
14 item: Scalar,
15 ctx: Schema.StringifyContext,
16 onComment?: () => void,
17 onChompKeep?: () => void
18): string
19
20export function toJSON(
21 value: any,
22 arg?: any,
23 ctx?: Schema.CreateNodeContext
24): any
25
26export enum Type {
27 ALIAS = 'ALIAS',
28 BLANK_LINE = 'BLANK_LINE',
29 BLOCK_FOLDED = 'BLOCK_FOLDED',
30 BLOCK_LITERAL = 'BLOCK_LITERAL',
31 COMMENT = 'COMMENT',
32 DIRECTIVE = 'DIRECTIVE',
33 DOCUMENT = 'DOCUMENT',
34 FLOW_MAP = 'FLOW_MAP',
35 FLOW_SEQ = 'FLOW_SEQ',
36 MAP = 'MAP',
37 MAP_KEY = 'MAP_KEY',
38 MAP_VALUE = 'MAP_VALUE',
39 PLAIN = 'PLAIN',
40 QUOTE_DOUBLE = 'QUOTE_DOUBLE',
41 QUOTE_SINGLE = 'QUOTE_SINGLE',
42 SEQ = 'SEQ',
43 SEQ_ITEM = 'SEQ_ITEM'
44}
45
46interface LinePos {
47 line: number
48 col: number
49}
50
51export class YAMLError extends Error {
52 name:
53 | 'YAMLReferenceError'
54 | 'YAMLSemanticError'
55 | 'YAMLSyntaxError'
56 | 'YAMLWarning'
57 message: string
58 source?: CST.Node
59
60 nodeType?: Type
61 range?: CST.Range
62 linePos?: { start: LinePos; end: LinePos }
63
64 /**
65 * Drops `source` and adds `nodeType`, `range` and `linePos`, as well as
66 * adding details to `message`. Run automatically for document errors if
67 * the `prettyErrors` option is set.
68 */
69 makePretty(): void
70}
71
72export class YAMLReferenceError extends YAMLError {
73 name: 'YAMLReferenceError'
74}
75
76export class YAMLSemanticError extends YAMLError {
77 name: 'YAMLSemanticError'
78}
79
80export class YAMLSyntaxError extends YAMLError {
81 name: 'YAMLSyntaxError'
82}
83
84export class YAMLWarning extends YAMLError {
85 name: 'YAMLWarning'
86}
Note: See TracBrowser for help on using the repository browser.