News for hackers. Stuff that matters.
Re:Evergreen: a React UI Framework built by Segment by darekkay on Wednesday October 17, 2018 @02:45AM (#18236709)
arrify(null) returns null, unlike the arrify library . I expect that a function which turns things into an array returns an empty array as fallback. This ist just an example for why one would favor well-tested utilities over re-inventing the wheel (not that I would use arrify as a dependency myself).
Re:Evergreen: a React UI Framework built by Segment by anonytrary on Wednesday October 17, 2018 @03:37AM (#18236960)
> This ist just an example for why one would favor well-tested utilities over re-inventing the wheel

No, it really isn't. The library does not dictate how things should be done, that's the fantastic thing about using your own utilities. In my implementation, we return the value itself if it's falsy. In yours, we return an empty array. Again, trivial "fix" (not that there's anything to "fix", it's a matter of convention, not correctness).