Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

86
Views
YAML/yamljs string deserialization behaviour

I was testing YAML (yamljs) with random inputs (please don't ask why it's a long story :D). I'm not very well versed in the YAML spec, but as far as I understand YAML should be able to serialize and deserialize primitives (strings, numbers, booleans) without an object or array wrapper. This however doesn't always seem to be the case.

I isolated one failing case:

import YAML from 'yamljs'

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

Where it '0xn5t' is somehow parsed back to 5

Expected: "0xn5t"
Received: 5

Could someone please guide me to the spec where this behaviour is explained? Could this be an issue with the library I'm using?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!