Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = function(eleventyConfig) {
eleventyConfig.addPassthroughCopy("js");
eleventyConfig.addPassthroughCopy("CNAME");
eleventyConfig.addLayoutAlias("default", "default.njk");
eleventyConfig.addLayoutAlias("post", "post.njk");
return {
passthroughFileCopy: true
};
Expand Down
2 changes: 1 addition & 1 deletion TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: default.njk
layout: default
title: Your post title
---

Expand Down
2 changes: 1 addition & 1 deletion buffers-and-streams/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: default.njk
layout: default
title: Buffers and Streams
---

Expand Down
47 changes: 46 additions & 1 deletion cheatsheet/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,53 @@
---
layout: default.njk
layout: default
title: Node Cheat Sheet
---

## [Control Flow](#control-flow)

### Callback pattern

```
function foo(val1, val2, callback) {
...
callback();
}
```

### Promise pattern

```
function foo(ok) {
return new Promise(resolve, reject) {
if (ok) {
resolve('success');
} else {
reject('boo');
}
}
}

foo()
.then(res => {
console.log(res);
})
.catch(err => {
throw err;
})
```

### Async/Await

```
async function callFoo() {
try {
const result = await foo(true);
} catch(err) {
throw err;
}
}
```

## [Events](#events)

Class: events.EventEmitter
Expand Down
2 changes: 1 addition & 1 deletion child-processes/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: default.njk
layout: default
title: Child Processes
---

Expand Down
Loading