Skip to content

Instantly share code, notes, and snippets.

@santospatrick
Last active May 28, 2018 22:37
Show Gist options
  • Save santospatrick/6f5d249055d5c357d5705eca02a5a7e7 to your computer and use it in GitHub Desktop.
Save santospatrick/6f5d249055d5c357d5705eca02a5a7e7 to your computer and use it in GitHub Desktop.
/**
* Pure javascript responsability:
* http to get cultures then add it to
* 'cultures' variable and then reuse
* the transformers we wrote
*/
// Vue.js
<ul>
<li v-for="item in getNames(cultures)">{{ item }}</li>
<strong>{{ totalQuantity(cultures) }}</strong>
<pre>{{ energies(cultures) | json 2 }}</pre>
</ul>
// Angular.js
<ul>
<li ng-repeat="item in getNames(cultures)">{{ item }}</li>
<strong>{{totalQuantity(cultures)}}</strong>
<pre>{{ energies(cultures) | json: 2 }}</pre>
</ul>
// React.js
<ul>
{getNames(cultures).map(item => <li>{{ item }}</li>)}
<strong>{{totalQuantity(cultures)}}</strong>
<pre>{JSON.stringify(energies(cultures), null, 2)}</pre>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment