iron-lambda for data transformation?

11 views
Skip to first unread message

su...@firsov.net

unread,
Nov 2, 2017, 11:59:15 PM11/2/17
to Polymer
I was looking for the utility which will allow binding of data object in one format into another and was not able to find a decent declarative with minimal code way.

What came to imagination was looking like:
<iron-ajax url="..." last-response="{{srcSections}}" />
<iron-lambda lambdas="errorCheck,name2id" from="[[selectedSection]]"  to="{{selectedId}}" catch="errorMessage" />
<iron-ajax url="...[[selectedSection]]" last-response="{{sectionJson}}" >

<some-select value="{{selectedSection}}" from="[[srcSections]]" field='name' />
<script>
class...
{
    errorCheck
(wikiResult){ if( wikiResult.error) throw wikiResult.error; return wikiResult; }
    name2id
( wikiResult ){ return wikiResult.parse.wikitext['*'] }
}
</script>

Before rushing and implementing would be nice to know whether such solution exists or planned?
Not necessary with same syntax but at least with similar functionality.

Of course the beauty of lambdas are in inline capabilities and chaining. Something like 
<iron-lambda lambdas=" errorCheck, x=>x.parse.wikitext['*' " from="[[selectedSection]]"  to="{{selectedId}}" catch="errorMessage" />
without the need for external functions declaration.
-s
Reply all
Reply to author
Forward
0 new messages