@diotoborg/veniam-soluta
v5.5.94
Published
---
Downloads
2,118
Maintainers
Keywords
Readme
@diotoborg/veniam-soluta
install
npm install @diotoborg/veniam-soluta
use
import safeTrim from '@diotoborg/veniam-soluta'
safeTrim(' a b ')
remove Invisible spaces
let str = ' "a":1 a \r\n\r\t b '
let ret = safeTrim(str)
expect(ret).toEqual('"a":1 a\n\nb')
convert CR CR-LR into LR
a\r\n\r\nb => 'a\n\nb'
a\r\rb => 'a\n\nb'
a\r\r\nb => 'a\n\nb'
remove BOM
JSON.parse('{"a":1}') // ❗️Error because BOM
JSON.parse(safeTrim('{"a":1}')) // ✅