Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

binary type not working in latest master? #90

Closed
isaacs opened this issue Feb 18, 2019 · 2 comments
Closed

binary type not working in latest master? #90

isaacs opened this issue Feb 18, 2019 · 2 comments

Comments

@isaacs
Copy link
Contributor

isaacs commented Feb 18, 2019

const YAML = require('yaml')
const tags = [ require('yaml/types/binary') ]
const data = Buffer.from('hello, world')
console.log(YAML.stringify(data, {tags}))

Output:

type: Buffer
data:
  - 104
  - 101
  - 108
  - 108
  - 111
  - 44
  - 32
  - 119
  - 111
  - 114
  - 108
  - 100

If I use tags = [require('yaml/types/binary').binary] then it works. Was this an intentional change? omap and set export the type without an extra property assignment.

@eemeli
Copy link
Owner

eemeli commented Feb 20, 2019

Oh, drat. It looks like I've managed to export arrays of tag objects from yaml/types/binary and yaml/types/timestamp, and tag objects from yaml/types/{omap,pairs,set}.

This should get fixed at least so that importing and using the types "just works", but I'm considering taking the opportunity to refactor the type exports to be a bit clearer than they are now.

@eemeli
Copy link
Owner

eemeli commented Mar 5, 2019

I've added a workaround for this specific issue by accepting arrays of tag objects in tags, and will open a separate issue regarding the package's exports more generally.

@eemeli eemeli closed this as completed Mar 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants