Comments (3)
After internal discussion we came to the conclusion that this would be an inconsistent solution - it misleads people into thinking that it is fn
that does the filtering when it is spread
that does it, it introduces new complex concepts to solve a very small problem.
This problem is easier to solve with native methods, although it may be a slightly more verbose solution
sample({
clock: trigger,
fn: (upd) => ({
foo: 0,
...(upd.both ? {bar: 0} : null),
...(upd.baz ? {baz: 0} : null),
}),
target: spread({
foo,
bar,
baz,
})
})
from patronum.
But the underlying issue remains opened:
- A trigger from a single data source is required
- For multiple units at once
- With support for data transformation
- With the ability to skip updates of any of them by arbitrary criteria
We'll continue to think about this idea, maybe go back to the option suggested above, maybe solve it some other way
from patronum.
Actually, it looks like someting that prepend
operator (proposed quite a while ago) should handle
sample({
clock: trigger,
target: spread({
first: $first,
second: prepend({
filter: $allowed,
fn: mapData
target: $second
}),
}),
});
It does check all boxes:
- Supports the ability to skip updates by arbitrary criteria
- Supports data transformation
- Can be applied to multiple units (one can combine it with another spread to make it multiple units at once)
from patronum.
Related Issues (20)
- Return `Store` and `StoreWritable<T>` whenever it is meaningful HOT 4
- debounce typing does not support void HOT 2
- Clock-less `delay` HOT 3
- Operator proposal: ```toggler``` HOT 3
- Allow array of targets in `delay` HOT 1
- Spread doesn't allow to pass a narrower type to a wider one HOT 1
- Remove `forward` using HOT 1
- Add `createToggle ` operator HOT 6
- `@@debug` protocol + integration for `debug` operator HOT 3
- reset argument for `once` operator
- pass argument ms from started into tick (interval)
- Add shorthands for common cases HOT 1
- Add API for custom time functions implementation HOT 6
- Add API for converting StoreWritable and EventCallable to readonly HOT 3
- Type-incompatible `TriggerProtocol` with Farfetched HOT 1
- multiple targets for spread
- Operator proposal: `defer` HOT 7
- Error in types for reset function
- Readonly create store if args is not unitable HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from patronum.