1.0.0 • Published 1 year ago

@diotobtea/maxime-beatae v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

yaml-ast-parser

Build Status

This is a fork of JS-YAML which supports parsing of YAML into AST.

In additional to parsing YAML to AST, it has following features:

  • restoration after the errors and reporting errors as a part of AST nodes.
  • built-in support for !include tag used in RAML

Usage

The type information below is relevant when using TypeScript, if using from JavaScript only the field/method information is relevant.

load method can be used to load the tree and returns a YAMLNode.

YAMLNode

YAMLNode class is an ancestor for all node kinds. It's kind field determine node kind, one of Kind enum:

  • SCALAR, MAPPING, MAP, SEQ, ANCHOR_REF or INCLUDE_REF.

After node kind is determined, it can be cast to one of the YAMLNode descendants types:

  • YAMLScalar, YAMLMapping, YamlMap, YAMLSequence or YAMLAnchorReference.
classimportant members
YAMLNodestartPosition and endPosition provide node range.
YAMLScalarstring value field
YAMLMappingYAMLScalar key and YAMLNode value fields
YAMLSequenceYAMLNode[] items field
YamlMapYAMLMapping[] mappings field
YAMLAnchorReferencestring referencesAnchor and YAMLNode value

YAMLScalar

Scalars are one of the three main node types defined by YAML and are effectively leaf nodes.

There are many factors that can influence the type of datum represent in scalar node (context, schema, tag, etc.).

To help inspection of a YAMLScalar to determine its datatype when a document uses the Core Schema, you can pass the YAMLScalar to the determineScalarType function. It will return an enum value indicating null, bool, int, float, or string.

Once you know the type, there are also some helper functions to help read the value by passing them the string, value: parseYamlBoolean, parseYamlFloat, and parseYamlInteger.

rsshashES6classnamestraversepostcssnamesagentsubprocesshasOwnPropertysomeesfolderfpdescriptorbrowserlistcoreRxJScoercibleendpointfinduputileventses2015ES2016schemeReflect.getPrototypeOfObject.keysassertses-shim API$.extendtouchpropertyenderrequirecolumnstestingtoArrayiterateUint8ArraytapserviceelasticachecharacterrecursivedebugxtermignoregetOwnPropertyDescriptorrfc4122styleguideidentifiersredirectquerystringSymbol.toStringTagapppruneswfreworkjsdiffclicloudfronttimeprettyrobustfast-copyURLfile cachefullObject.iswarningeventDispatchertaketransportmatchAllspringsearchcallbackposestructuredCloneReactiveXecmascriptFunction.prototype.name.envBigUint64Arrayfind-upserializationaccessorAsyncIteratorarrayscontainsdescriptionstreaminternal slotPromiseloadingObservablesvalidationmanipulationpropertiesECMAScript 2015vpcrestfularrayObject.getPrototypeOfutilitiesprefix0ponyfilltoSortedrapidObject.entriesajvconsolespecargvtypescriptfastifyECMAScript 2021chromerdsfindLastIndexmkdirspoint-freegroupreadstabletypedarraysArrayBuffer.prototype.slicejavascriptWeakSetperformantreduxwhatwgArray.prototype.containspicomatchES2022channelspawnenvironmentsownvalidflagespreeweaksetArray.prototype.flatfromlocaltoStringTagcloudwatchprogressmodulesiamArray.prototype.findLastIndextostringtaggetopteslintrandomsymbolsoffsetstringESnexthelperpromiseWebSocketspackage.jsongetobjprivateUint16ArrayerrorArrayassertmockingArray.prototype.flatMapCSSruleskarmainstallerimmutablehasOwnenvironmentTypeScriptmobileprocessObservablecallboundstreamseslintpluginpureInt16ArrayasciicommanderdescriptorsECMAScript 2018sidepositiveUint8ClampedArrayFloat64ArrayxhrgetPrototypeOfaccessibilityURLSearchParamsfast-clonelanguagetacitString.prototype.matchAllminimalstyleelbmkdir_.extendlinteast-asian-widthnodejsgraphqllistenersdomfindscheme-validationWeakMapECMAScript 2020byteOffsettelephonelookresolvestyled-componentsxmlcomputed-typesES2023functionisec2ES2021String.prototype.trimMapqueueMicrotasktc39package manageravaReactiveExtensionsfilei18nroutetaperangeerrorcolourutil.inspectglobalsthreeArray.prototype.flattenamazonrm -rfECMAScript 3form-validationformatjoiloadbalancingfindLastpackagesasynccopyclientRegExp#flagsprotobuf-0BigInt64ArrayextenddebuggercheckES2018JSONautoprefixeres-shimsWebSocketjshintcryptoexpressmulti-packagecloudformationclass-validatorapolloback-endArray.prototype.filtersameValueZerosimpledbio-tsconvertinferencenameYAMLwebdependency managerprototypeECMAScript 7compilersafeparserbinaryIteratorchinesetrimzxjshelperses-abstractinternalschemavisualdeepcopycensorcoloruser-streamsbyteLengthpushdeepObject.definePropertyreadablestreamES5framerargumenthandlerjasminegetterparsefetchsyntaxfigletbrowserslistmochapipecommand-linereactObject.valuessinatratesternpmcloudtrailstringifyUint32Arraynegativespinnersdayjsjsdom[[Prototype]]testshellincludescommandtextfile systema11ygdprregexjsxemroptioncolorssyntaxerrorcachepreprocessorspeedflagsshimsqslastfunctionalsharedarraybufferintrinsicdotenvECMAScript 6fnmatchiconvwriteflatMapjapanesees6look-upspinnerclassesglacierlinkinplugintransforminstalldataViewgitignorecss-in-jsutilsObject.assignconcatHyBiterminalunicodees8storagegatewaycoverageremovechromiumserializeECMAScript 2023higher-orderartreact-hook-formfunctionsjsonqueueroutingbddsetterslicetddcompareemitwalkingmergesetImmediatetrimRightcharactersforkroute53ECMAScript 2019beanstalknpmignoreshrinkwraptslibtoReversedcallbindfpsyupdeepcloneregular expressionsexecfileeslintconfigredux-toolkittranspilerhookformbusyidleobjectserializerObject.fromEntriesautoscalingmrucall-boundmapjson cachemakeroutermocktrimStartansiomitformsdraglruzodworkflowFloat32Arrayeslint-pluginserveres5StyleSheetwaithooksfastES2017deleteflattenkey valuelengthchildchaiwafmovedirgetintrinsicreact posehttplibphonenumberajaxs3shamfast-deep-clonesetPrototypeOfcreatestyleses2016dataviewsource mapconfigurablewhichbinariesimmertoobjecthas-owntrimEndqsMicrosoftfeedatomkoreanES2019simple cachejestclassnameJSON-SchemareadablepinozeroweakmapebsdatamanagertypedtypeuuidpopmotionSetkey parpropregular expressionbinreducetoolsfullwidthquoteequalruntimenumberacorndiffRegExp.prototype.flagscurriedbindkinesisreducerexecuteenvArrayBuffer#sliceassertion
1.0.0

1 year ago