tap-yaml

Yaml handling for TAP parsers and generators

tap-yaml

Yaml handling for TAP parsers and generators

USAGE

const yaml = require('tap-yaml')

const str = yaml.stringify(someObject)
const obj = yaml.parse(someString)

This is essentially a re-export of the yamlpackage, with a few custom types and default properties to be more suitable for use in tap.

  1. Symbol types are added, so that they don't throw. Shared symbols will (within the same process) retain the same Symbol identity through encoding and decoding. Unshared symbols will not retain their object identity.
  2. A "safe" !functiontype is added. Functions aren't parsed to actual functions using eval(), since that's obviously a Bad Idea, but they do parse to an empty function with a toString()that contains the original string source.
  3. An Errortype is added, which does its best to maintain its properties, and always shows message, stack, and name, even if these are non-enumerable. If an Error has a custom inspect method that returns an object, then that is used as the source of extra properties, so you may filter out what gets dumped to your TAP stream.
  4. Binary types are implicitly allowed in a standard way. In Node.js, this means that a Buffer object is created, and Buffers can be dumped to YAML without any weirdness.
  5. omapand setare configured to refer to Map and Set objects.
  6. Objects with a nullprototype maintain their null-prototyped-ness.
  7. Domainobjects are stringified, but without their giant object graph, since that's often a performance issue.
  8. Dateobjects are given a non-default !datetag rather than the default YAML 1.1 !timestamp, so that they maintain their explicit date object nature through stringifying and re-parsing.
  9. The prettyErrorsoption is always enabled.

Repository

https+https://github.com/tapjs/tap-yaml


上一篇:tickplate
下一篇:remark-lint-linebreak-style

相关推荐

  • 用 webpack 和 Parcel 分别搭建第一个 ReactApp

    学习 React 可以用以下方法直接创建一个 ReactApp ,本文主要介绍如何手动用 Webpack 和 Parcel 来搭这个环境。 (https://img.javascriptcn.c...

    2 年前
  • 深入理解Webpack核心模块Tapable钩子[同步版]

    记录下自己在前端路上爬坑的经历 加深印象,正文开始~ tapable是webpack的核心依赖库 想要读懂webpack源码 就必须首先熟悉tapable ok.下面是webapck中引入的tapa...

    1 年前
  • 核心库 Tapable 的使用与原理解析

    前言Webpack 本质上是一种事件流的机制,它的工作流程就是将各个插件串联起来,而实现这一切的核心就是 Tapable,Webpack 中最核心的负责编译的 Compiler 和负责创建 bundl...

    7 个月前
  • 干货!撸一个webpack插件(内含tapable详解+webpack流程)

    原文链接:https://www.jianshu.com/p/715...(https://www.jianshu.com/p/7159ebe81e7b) 目录 Tabable是什么? ...

    2 年前
  • 如何实现swipe、tap、longTap等自定义事件

    前言 移动端原生支持、、等事件,但是在平常业务中我们经常需要使用、、、等事件去实现想要的效果,对于这种自定义事件他们底层是如何实现的呢?让我们从的模块去分析其原理。

    2 年前
  • 基于canvas和web audio实现低配版MikuTap

    最近发掘了一个特别happy的网页小游戏MikuTap。打开之后沉迷了一下午,导致开发工作没做完差点就要删库跑路了,还好boss瞥了我一眼就没下文了。于是第二天我就继续沉迷,随着一阵抽搐,这个游戏索然...

    2 年前
  • 前端vue2 vue-cli3项目实现国际化实战 vue-i18n +yaml文件格式

    最近公司的新项目需要做国际化,顾名思义,国际化就是可以在页面上切换显示语言,在国内大多数项目中只要支持中文和英文的切换就够了。在这里主要记录一下用vue技术栈,用到的 vuei18n插件的使用。

    2 个月前
  • 分析tapable设计,学习事件流处理

    这是 学习源码设计 第二篇,主要是学习源码实现原理和揣摩设计思路,不会深究每个开源库具体的函数实现。 0 导读 本文学习的版本是2.0.0beta.10(截止至目前20200420),拉取的tap...

    4 个月前
  • zora-tap-reporter

    TAP reporters for zora testing library zoratapreporter Test Anything Protocol(https://testanythin...

    19 天前
  • yawn-yaml

    YAML parser that preserves comments and styling YAWN YAML Build Status(https://travisci.org/mohse...

    4 个月前

官方社区

扫码加入 JavaScript 社区