Skip to content

Instantly share code, notes, and snippets.

@vadimpopa
vadimpopa / instructions.txt
Last active February 21, 2019 09:19
How to concat files with CMD then transpile and minify with BabelJs
// Bellow instructions how to run a build with BabelJs. After following them, just run in CLI: `sencha app build` or `npm run build`
// 1. In app.json
"production": {
"output": {
"framework": {
"enable":true //This enables split mode, app code will be splitted in 2 files: app.js and framework.js
}
}
},
@developit
developit / async-examples.js
Last active February 19, 2020 00:43
Async Array utilities in async/await. Now available as an npm package: https://github.com/developit/asyncro
/** Async version of Array.prototype.reduce()
* await reduce(['/foo', '/bar', '/baz'], async (acc, v) => {
* acc[v] = await (await fetch(v)).json();
* return acc;
* }, {});
*/
export async function reduce(arr, fn, val, pure) {
for (let i=0; i<arr.length; i++) {
let v = await fn(val, arr[i], i, arr);
if (pure!==false) val = v;