jonschlinkert / kind-of

Get the native JavaScript type of a value, fast. Used by superstruct, micromatch and many others!
https://github.com/jonschlnkert
MIT License
347 stars 38 forks source link

Checking "typeof Buffer" causes browserify to bundle buffer package #9

Closed ksheedlo closed 7 years ago

ksheedlo commented 7 years ago

Rel substack/node-browserify#1228

I found this code, which causes browserify to bundle the buffer package:

if (typeof Buffer !== 'undefined' && isBuffer(val)) {
  return 'buffer';
}

The check for typeof Buffer !== 'undefined' is unnecessary since is-buffer already works fine in environments where Buffer is not defined. Removing it will prevent kind-of from causing this package (which pulls in a lot of code) to bloat the consumer's bundle.

jonschlinkert commented 7 years ago

published and tagged as 3.2.0. thanks again!