Skip to content

Instantly share code, notes, and snippets.

View iansu's full-sized avatar

Ian Sutherland iansu

View GitHub Profile
@iansu
iansu / resources.md
Last active October 14, 2021 17:24
The Past, Present, and Future of JavaScript
@iansu
iansu / dataloader.js
Last active December 8, 2021 19:50
Minimal Dataloader implementation
/*
* This is a minimal implementation of Dataloader. This implementation leaves out the caching functionality
* and skips most of the error handling so it's not suitable to use in production. This is meant to help
* you understand how Dataloader works. Once you understand this code check out the full Dataloader code:
* https://github.com/graphql/dataloader
*/
class Dataloader {
constructor(batchFunction) {
this.batchFunction = batchFunction;