In the context of a babel plugin, I reading a Buffer from a file to check some content.
I'm looking specifically for the following string ɵɵfoobar
escaped as \u0275\u0275foobar
.
When I printing my buffer with myBuffer.toString()
I can see
...
[...\u0275\u0275foobar()]
...
But when I check the content, I never get a positive. I've tried following :
myBuffer.includes('ɵɵfoobar')
myBuffer.includes('\u0275\u0275foobar')
myBuffer.toString().includes('ɵɵfoobar')
Also note that myBuffer.includes('foobar()')
returns true
.
Any idea what I'm doing wrong ?
myBuffer.includes('\\u0275\\u0275foobar')
Anyway, please reduce this to a minimal reproducible example –.subarray
,.toString('hex')
, andBuffer.from('…', 'hex')
can help with that.