You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I love your pipe-ts package, thanks for creating that! There was one use case that I wish it supported - falsy parameters
Example
const data = pipeWith(
apiData,
...,
someOtherData && doSomethingToData(someOtherData)
)
In theory, some helper function like iif(condition, doThis, doThat?) could be used, but it doesn't work well in cases where condition part needs to be used to compose doThis function.
I have made it working locally with full TS inference and I was wondering if you think it could be a useful update to this package. If so, i could put up a pull request
If you'd rather keep the original package simple, I could fork your package and make my own
Thanks!
The text was updated successfully, but these errors were encountered:
Without using function approach & followiing immutability principles, this would look like this
const finalData = [...array1]
if (array2) finalData.push(...array2)
// Or without unnecessarily cloning the first array
let finalData = array1
if (array2) finalData = [...finalData, ...array2]
IMO the first example is a lot more readable, shorter and there's no mutable / immutable (+ const / let) overhead
Or another one
const data = pipeWith(array, featureEnabled && addSomethingToTheList)
I love your pipe-ts package, thanks for creating that! There was one use case that I wish it supported - falsy parameters
Example
In theory, some helper function like
iif(condition, doThis, doThat?)
could be used, but it doesn't work well in cases wherecondition
part needs to be used to composedoThis
function.I have made it working locally with full TS inference and I was wondering if you think it could be a useful update to this package. If so, i could put up a pull request
If you'd rather keep the original package simple, I could fork your package and make my own
Thanks!
The text was updated successfully, but these errors were encountered: