js-yaml
- Version 5.2.1
- Published
- 1.44 MB
- 1 dependency
- MIT license
Install
npm i js-yamlyarn add js-yamlpnpm add js-yamlOverview
YAML 1.2 parser and serializer
Index
Variables
- binaryTag
- boolCoreTag
- boolJsonTag
- boolYaml11Tag
- CHOMPING_CLIP
- CHOMPING_KEEP
- CHOMPING_STRIP
- COLLECTION_STYLE_BLOCK
- COLLECTION_STYLE_FLOW
- CORE_SCHEMA
- EVENT_ALIAS
- EVENT_DOCUMENT
- EVENT_MAPPING
- EVENT_POP
- EVENT_SCALAR
- EVENT_SEQUENCE
- FAILSAFE_SCHEMA
- floatCoreTag
- floatJsonTag
- floatYaml11Tag
- intCoreTag
- intJsonTag
- intYaml11Tag
- JSON_SCHEMA
- legacyMapTag
- mapTag
- MERGE_KEY
- mergeTag
- NOT_RESOLVED
- nullCoreTag
- nullJsonTag
- nullYaml11Tag
- omapTag
- pairsTag
- realMapTag
- SCALAR_STYLE_DOUBLE_QUOTED
- SCALAR_STYLE_FOLDED_BLOCK
- SCALAR_STYLE_LITERAL_BLOCK
- SCALAR_STYLE_PLAIN
- SCALAR_STYLE_SINGLE_QUOTED
- seqTag
- setTag
- strTag
- timestampTag
- VISIT_BREAK
- VISIT_SKIP
- YAML11_SCHEMA
Functions
Classes
Interfaces
Type Aliases
Variables
variable binaryTag
const binaryTag: ScalarTagDefinition<any>;variable boolCoreTag
const boolCoreTag: ScalarTagDefinition<boolean>;variable boolJsonTag
const boolJsonTag: ScalarTagDefinition<boolean>;variable boolYaml11Tag
const boolYaml11Tag: ScalarTagDefinition<boolean>;variable CHOMPING_CLIP
const CHOMPING_CLIP: number;variable CHOMPING_KEEP
const CHOMPING_KEEP: number;variable CHOMPING_STRIP
const CHOMPING_STRIP: number;variable COLLECTION_STYLE_BLOCK
const COLLECTION_STYLE_BLOCK: number;variable COLLECTION_STYLE_FLOW
const COLLECTION_STYLE_FLOW: number;variable CORE_SCHEMA
const CORE_SCHEMA: Schema;variable EVENT_ALIAS
const EVENT_ALIAS: number;variable EVENT_DOCUMENT
const EVENT_DOCUMENT: number;variable EVENT_MAPPING
const EVENT_MAPPING: number;variable EVENT_POP
const EVENT_POP: number;variable EVENT_SCALAR
const EVENT_SCALAR: number;variable EVENT_SEQUENCE
const EVENT_SEQUENCE: number;variable FAILSAFE_SCHEMA
const FAILSAFE_SCHEMA: Schema;variable floatCoreTag
const floatCoreTag: ScalarTagDefinition<number>;variable floatJsonTag
const floatJsonTag: ScalarTagDefinition<number>;variable floatYaml11Tag
const floatYaml11Tag: ScalarTagDefinition<number>;variable intCoreTag
const intCoreTag: ScalarTagDefinition<number>;variable intJsonTag
const intJsonTag: ScalarTagDefinition<number>;variable intYaml11Tag
const intYaml11Tag: ScalarTagDefinition<number>;variable JSON_SCHEMA
const JSON_SCHEMA: Schema;variable legacyMapTag
const legacyMapTag: MappingTagDefinition<StringMapping, StringMapping>;variable mapTag
const mapTag: MappingTagDefinition<StringMapping$1, StringMapping$1>;variable MERGE_KEY
const MERGE_KEY: Symbol;variable mergeTag
const mergeTag: ScalarTagDefinition<typeof MERGE_KEY>;variable NOT_RESOLVED
const NOT_RESOLVED: Symbol;variable nullCoreTag
const nullCoreTag: ScalarTagDefinition<null>;variable nullJsonTag
const nullJsonTag: ScalarTagDefinition<null>;variable nullYaml11Tag
const nullYaml11Tag: ScalarTagDefinition<null>;variable omapTag
const omapTag: SequenceTagDefinition<OmapCarrier, unknown[]>;variable pairsTag
const pairsTag: SequenceTagDefinition<Pair[], Pair[]>;variable realMapTag
const realMapTag: MappingTagDefinition<RealMapping, RealMapping>;variable SCALAR_STYLE_DOUBLE_QUOTED
const SCALAR_STYLE_DOUBLE_QUOTED: number;variable SCALAR_STYLE_FOLDED_BLOCK
const SCALAR_STYLE_FOLDED_BLOCK: number;variable SCALAR_STYLE_LITERAL_BLOCK
const SCALAR_STYLE_LITERAL_BLOCK: number;variable SCALAR_STYLE_PLAIN
const SCALAR_STYLE_PLAIN: number;variable SCALAR_STYLE_SINGLE_QUOTED
const SCALAR_STYLE_SINGLE_QUOTED: number;variable seqTag
const seqTag: SequenceTagDefinition<unknown[], unknown[]>;variable setTag
const setTag: MappingTagDefinition<Set<unknown>, Set<unknown>>;variable strTag
const strTag: ScalarTagDefinition<string>;variable timestampTag
const timestampTag: ScalarTagDefinition<Date>;variable VISIT_BREAK
const VISIT_BREAK: Symbol;variable VISIT_SKIP
const VISIT_SKIP: Symbol;variable YAML11_SCHEMA
const YAML11_SCHEMA: Schema;Functions
function constructFromEvents
constructFromEvents: (events: Event[], options: ConstructorOptions) => unknown[];function defineMappingTag
defineMappingTag: <Carrier, Result = Carrier>( tagName: string, options: MappingTagOptions<Carrier, Result>) => MappingTagDefinition<Carrier, Result>;function defineScalarTag
defineScalarTag: <Result>( tagName: string, options: ScalarTagOptions<Result>) => ScalarTagDefinition<Result>;function defineSequenceTag
defineSequenceTag: <Carrier, Result = Carrier>( tagName: string, options: SequenceTagOptions<Carrier, Result>) => SequenceTagDefinition<Carrier, Result>;function dump
dump: (input: any, options?: DumpOptions) => string;function eventsToAst
eventsToAst: (events: Event[], options: FromEventsOptions) => Document[];function getScalarValue
getScalarValue: (input: string, scalar: ScalarEvent) => string;function jsToAst
jsToAst: (input: unknown, schema: Schema, options?: FromJsOptions) => Document[];function load
load: (input: string, options?: LoadOptions) => unknown;function loadAll
loadAll: { (input: string, options?: LoadOptions): unknown[]; (input: string, iterator: null, options?: LoadOptions): unknown[]; (input: string, iterator: LoadAllIterator, options?: LoadOptions): void;};function parseEvents
parseEvents: (input: string, options: ParserOptions) => Event[];function present
present: (documents: Document[], options: PresenterOptions) => string;function visit
visit: (documents: Document[], visitor: Visitor) => void;Classes
class Schema
class Schema {}constructor
constructor(tags: readonly TagDefinition[]);property defaultMappingTag
readonly defaultMappingTag: MappingTagDefinition<unknown, unknown>;property defaultScalarTag
readonly defaultScalarTag: ScalarTagDefinition<unknown>;property defaultSequenceTag
readonly defaultSequenceTag: SequenceTagDefinition<unknown, unknown>;property exact
readonly exact: TagDefinitionMap;property implicitScalarAnyFirstChar
readonly implicitScalarAnyFirstChar: readonly ScalarTagDefinition<unknown>[];property implicitScalarByFirstChar
readonly implicitScalarByFirstChar: ReadonlyMap< string, readonly ScalarTagDefinition<unknown>[]>;property implicitScalarTags
readonly implicitScalarTags: readonly ScalarTagDefinition<unknown>[];property prefix
readonly prefix: TagDefinitionListMap;property tags
readonly tags: readonly TagDefinition[];method withTags
withTags: (...tags: Array<TagDefinition | readonly TagDefinition[]>) => Schema;class Style
class Style {}property doubleQuoted
doubleQuoted: boolean;property flow
flow: boolean;property folded
folded: boolean;property literal
literal: boolean;property singleQuoted
singleQuoted: boolean;property tagged
tagged: boolean;class YAMLException
class YAMLException extends Error {}constructor
constructor(reason: string, mark?: SnippetMark);property mark
mark?: SnippetMark;property reason
reason: string;method toString
toString: (compact?: boolean) => string;Interfaces
interface AliasEvent
interface AliasEvent {}property anchorEnd
anchorEnd: number;property anchorStart
anchorStart: number;property type
type: typeof EVENT_ALIAS;interface AliasNode
interface AliasNode extends NodeBase {}interface ConstructorOptions
interface ConstructorOptions {}property filename
filename?: string;property json
json?: boolean;property maxAliases
maxAliases?: number;property maxTotalMergeKeys
maxTotalMergeKeys?: number;property schema
schema?: Schema;property source
source: string;interface Document
interface Document {}property contents
contents: Node | null;property directives
directives: DocumentDirective[];property explicitEnd
explicitEnd?: boolean;property explicitStart
explicitStart?: boolean;interface DocumentEvent
interface DocumentEvent {}property directives
directives: DocumentDirective[];property explicitEnd
explicitEnd: boolean;property explicitStart
explicitStart: boolean;property type
type: typeof EVENT_DOCUMENT;interface DumpOptions
interface DumpOptions extends Omit<PresenterOptions, 'schema'> {}property flowLevel
flowLevel?: number;property noRefs
noRefs?: boolean;property schema
schema?: Schema;property skipInvalid
skipInvalid?: boolean;property transform
transform?: (documents: Document[]) => void;interface FromEventsOptions
interface FromEventsOptions {}interface FromJsOptions
interface FromJsOptions {}property noRefs
noRefs?: boolean;property skipInvalid
skipInvalid?: boolean;interface LoadOptions
interface LoadOptions extends ParserOptions, Omit<ConstructorOptions, 'source'> {}interface MappingEvent
interface MappingEvent {}interface MappingNode
interface MappingNode extends NodeBase {}interface MappingTagDefinition
interface MappingTagDefinition<Carrier = unknown, Result = Carrier> {}property addPair
addPair: (carrier: Carrier, key: unknown, value: unknown) => string;property carrierIsResult
carrierIsResult: boolean;property create
create: (tagName: string) => Carrier;property finalize
finalize: (carrier: Carrier) => Result;property get
get: (result: Result, key: unknown) => unknown;property has
has: (carrier: Carrier, key: unknown) => boolean;property identify
identify: IdentifyFn | null;property implicit
implicit: false;property keys
keys: (result: Result) => Iterable<unknown>;property matchByTagPrefix
matchByTagPrefix: boolean;property nodeKind
nodeKind: 'mapping';property represent
represent: MappingRepresent;property representTagName
representTagName: RepresentTagNameFn | null;property tagName
tagName: string;interface NodeBase
interface NodeBase {}property anchor
anchor?: string;property blankBefore
blankBefore?: number;property comment
comment?: string;property commentAfter
commentAfter?: string;property commentBefore
commentBefore?: string;property style
style: Style;property tag
tag: string;interface ParserOptions
interface ParserOptions {}interface PresenterOptions
interface PresenterOptions {}property flowBracketPadding
flowBracketPadding?: boolean;property flowSkipColonSpace
flowSkipColonSpace?: boolean;property flowSkipCommaSpace
flowSkipCommaSpace?: boolean;property forceQuotes
forceQuotes?: boolean;property indent
indent?: number;property lineWidth
lineWidth?: number;property quoteFlowKeys
quoteFlowKeys?: boolean;property quoteStyle
quoteStyle?: 'single' | 'double';property schema
schema: Schema;property seqInlineFirst
seqInlineFirst?: boolean;property seqNoIndent
seqNoIndent?: boolean;property sortKeys
sortKeys?: boolean | ((a: any, b: any) => number);property tagBeforeAnchor
tagBeforeAnchor?: boolean;interface ScalarEvent
interface ScalarEvent {}property anchorEnd
anchorEnd: number;property anchorStart
anchorStart: number;property chomping
chomping: Chomping;property fast
fast: boolean;property indent
indent: number;property style
style: ScalarStyle;property tagEnd
tagEnd: number;property tagStart
tagStart: number;property type
type: typeof EVENT_SCALAR;property valueEnd
valueEnd: number;property valueStart
valueStart: number;interface ScalarNode
interface ScalarNode extends NodeBase {}interface ScalarTagDefinition
interface ScalarTagDefinition<Result = unknown> {}property identify
identify: IdentifyFn | null;property implicit
implicit: boolean;property implicitFirstChars
implicitFirstChars: readonly string[] | null;property matchByTagPrefix
matchByTagPrefix: boolean;property nodeKind
nodeKind: 'scalar';property represent
represent: ScalarRepresent;property representTagName
representTagName: RepresentTagNameFn | null;property resolve
resolve: ( source: string, isExplicit: boolean, tagName: string) => Result | typeof NOT_RESOLVED;property tagName
tagName: string;interface ScalarTagOptions
interface ScalarTagOptions<Result> {}property identify
identify?: ScalarTagDefinition<Result>['identify'];property implicit
implicit?: boolean;property implicitFirstChars
implicitFirstChars?: readonly string[] | null;property matchByTagPrefix
matchByTagPrefix?: boolean;property represent
represent?: ScalarTagDefinition<Result>['represent'];property representTagName
representTagName?: ScalarTagDefinition<Result>['representTagName'];property resolve
resolve: ScalarTagDefinition<Result>['resolve'];interface SequenceEvent
interface SequenceEvent {}interface SequenceNode
interface SequenceNode extends NodeBase {}interface SequenceTagDefinition
interface SequenceTagDefinition<Carrier = unknown, Result = Carrier> {}property addItem
addItem: (carrier: Carrier, item: unknown, index: number) => void | string;property carrierIsResult
carrierIsResult: boolean;property create
create: (tagName: string) => Carrier;property finalize
finalize: (carrier: Carrier) => Result;property identify
identify: IdentifyFn | null;property implicit
implicit: false;property matchByTagPrefix
matchByTagPrefix: boolean;property nodeKind
nodeKind: 'sequence';property represent
represent: SequenceRepresent;property representTagName
representTagName: RepresentTagNameFn | null;property tagName
tagName: string;interface VisitContext
interface VisitContext {}Type Aliases
type DocumentDirective
type DocumentDirective = | { kind: 'yaml'; version: string; } | { kind: 'tag'; handle: string; prefix: string; };type Event
type Event = | DocumentEvent | SequenceEvent | MappingEvent | ScalarEvent | AliasEvent | PopEvent;type MappingTagOptions
type MappingTagOptions<Carrier, Result = Carrier> = { matchByTagPrefix?: boolean; create: MappingTagDefinition<Carrier, Result>['create']; addPair: MappingTagDefinition<Carrier, Result>['addPair']; has: MappingTagDefinition<Carrier, Result>['has']; keys: MappingTagDefinition<Carrier, Result>['keys']; get: MappingTagDefinition<Carrier, Result>['get']; finalize?: MappingTagDefinition<Carrier, Result>['finalize'];} & RepresentOptions<Result, Map<unknown, unknown>, MappingRepresent>;type Node
type Node = ScalarNode | SequenceNode | MappingNode | AliasNode;type SequenceTagOptions
type SequenceTagOptions<Carrier, Result = Carrier> = { matchByTagPrefix?: boolean; create: SequenceTagDefinition<Carrier, Result>['create']; addItem: SequenceTagDefinition<Carrier, Result>['addItem']; finalize?: SequenceTagDefinition<Carrier, Result>['finalize'];} & RepresentOptions<Result, ArrayLike<unknown>, SequenceRepresent>;type TagDefinition
type TagDefinition = | ScalarTagDefinition<any> | SequenceTagDefinition<any, any> | MappingTagDefinition<any, any>;type Visitor
type Visitor = (node: Node, ctx: VisitContext) => VisitControl;Package Files (1)
Dependencies (1)
Dev Dependencies (16)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/js-yaml.
- Markdown[](https://www.jsdocs.io/package/js-yaml)
- HTML<a href="https://www.jsdocs.io/package/js-yaml"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 4735 ms. - Missing or incorrect documentation? Open an issue for this package.
