gulpjs / vinyl

Virtual file format.
MIT License
1.28k stars 105 forks source link

Split "lib" utilities into npm packages? #112

Closed phated closed 8 years ago

phated commented 8 years ago

We have a few utilities that I think could benefit being on npm. Such as stripTrailingSlashes and cloneBuffer

Thoughts? cc @contra

phated commented 8 years ago

Not sure if we want to increase the dependency count, etc.

yocontra commented 8 years ago

@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.

yocontra commented 8 years ago

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.

phated commented 8 years ago

I agree. Sadly there isn't a buffer cloning utility. I was thinking about splitting that out.

yocontra commented 8 years ago

@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

phated commented 8 years ago

@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.

phated commented 8 years ago

I've removed the utility methods that made sense to use external modules. The only module I personally split out was clone-buffer.