Skip to content

Primitive serialization issue #143

@bali182

Description

@bali182

I was testing the library with random data. As far as I understand, similarly to JSON, YAML is capable of serializing and deserializing primitives (string, number, boolean). This doesn't always seem to be the case. Please see example below:

import YAML from 'yamljs'

describe('YAML', () => {
  it('should be equal to the input', () => {
    const str = '0xn5t'
    expect(YAML.parse(YAML.stringify(str))).toBe(str)
  })
})

Which results in :

Expected: "0xn5t"
Received: 5

Is this something that's expected or is this a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions