jeremyfa / yaml.js

Standalone JavaScript YAML 1.2 Parser & Encoder. Works under node.js and all major browsers. Also brings command line YAML/JSON conversion tools.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Primitive serialization issue

bali182 opened this issue · comments

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?