Closed isidrok closed 3 years ago
Check for existence of Buffer so it doesn't throw in environments that don't implement it.
Buffer
Closes https://github.com/mathiasbynens/jsesc/issues/63
I didn't add any test since testing this is pretty awkward but could add something like this if needed:
it('does not throw when Buffer is not defined', function() { assert.doesNotThrow(function() { const _Buffer = global.Buffer; global.Buffer = undefined; delete require.cache[require.resolve('../jsesc.js')]; require('../jsesc.js'); global.Buffer = _Buffer; }); });
Check for existence of
Buffer
so it doesn't throw in environments that don't implement it.Closes https://github.com/mathiasbynens/jsesc/issues/63
I didn't add any test since testing this is pretty awkward but could add something like this if needed: