dy / spect

Observable selectors in DOM
https://dy.github.io/spect
MIT License
77 stars 8 forks source link

operators #227

Closed dy closed 4 years ago

dy commented 4 years ago

a(target, prop) is a meaningful way to create observable. But operators allow the nicest way to define chains:

h`<table>${ map(items => items.map(item => h`<td>${item.x}</td>`))(a(element, 'data')) }</table>`

// direct non-observable operators
h`<table>${ map(items => items.map(item => h`<td>${item.x}</td>`))(element.data) }</table>`

// pipe proposal https://github.com/js-choi/proposal-smart-pipelines/blob/master/readme.md
h`<table>${ a(element, 'data') |> map(items => items.map(item => h`<td>${item.x}</td>`)) }</table>`

https://github.com/js-choi/proposal-smart-pipelines/blob/master/readme.md

dy commented 4 years ago

Ops is a matter of strui