Closed phated closed 8 years ago
Not sure if we want to increase the dependency count, etc.
@phated Seems like overkill + more overhead to maintain. We should look to see if we can replace anything in lib with existing modules though - there has to be a clone buffer, is buffer, is null, etc. that we can rely on instead of rolling our own.
On second look, most of these can be straight up scrapped - we're only using some of them in one place. For example, isNull is only being used once in this whole project: https://github.com/gulpjs/vinyl/blob/a6da597f621d26de18bf2b8844222227cd6c9bc9/index.js#L66 but we have tests and whatnot to confirm that == null
works.
I agree. Sadly there isn't a buffer cloning utility. I was thinking about splitting that out.
@phated We're only using it in one spot: https://github.com/gulpjs/vinyl/blob/a6da597f621d26de18bf2b8844222227cd6c9bc9/index.js#L120 might be worth inlining that too, its two lines of code
@contra there's actually a new/proper way to clone in node 5.something+ - Buffer.from(buff)
. I was thinking about combining both strategies into a utility module.
I've removed the utility methods that made sense to use external modules. The only module I personally split out was clone-buffer
.
We have a few utilities that I think could benefit being on npm. Such as
stripTrailingSlashes
andcloneBuffer
Thoughts? cc @contra