Skip to content

Instantly share code, notes, and snippets.

@SuperManEver
Created September 14, 2016 12:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SuperManEver/361cb12c99388e82312c0a7c634f789b to your computer and use it in GitHub Desktop.
Save SuperManEver/361cb12c99388e82312c0a7c634f789b to your computer and use it in GitHub Desktop.
var articles = [
{
title: 'Everything Sucks',
url: 'http://do.wn/sucks.html',
author: {
name: 'Debbie Downer',
email: 'debbie@do.wn'
}
},
{
title: 'If You Please',
url: 'http://www.geocities.com/milq',
author: {
name: 'Caspar Milquetoast',
email: 'hello@me.com'
}
}
];
var defineElem = function (obj) {
return [
(function (obj) {
return (R.compose(R.prop('name'), R.prop('author')))(obj)
})(obj)
,
(function (obj) {
return (R.prop('title'))(obj);
})(obj)
];
};
var titleAndName = R.reduce((acc, obj) => {
return acc.concat([ defineElem(obj) ]);
}, []);
titleAndName(articles);
@SuperManEver
Copy link
Author

As you can see I use tennent's correspondence principle in order to delay actual evaluation of how components will be formed. I don't know is it necessary or not, but this is how I did this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment