Skip to content

Instantly share code, notes, and snippets.

View LosAlamosAl's full-sized avatar

Allen McPherson LosAlamosAl

View GitHub Profile
@aaronshaf
aaronshaf / generator.js
Last active May 13, 2022 11:00
Use async generators and async iterators with DynamoDB's scan
const { docClient } = require('../services/dynamodb')
exports.findAllItems = async function* () {
let response = {}
let ExclusiveStartKey
do {
response = await docClient.scan({
TableName: 'mytable',
Limit: 500,
ExclusiveStartKey