Skip to content

Instantly share code, notes, and snippets.

@cjihrig
cjihrig / why-assert.md
Created December 31, 2019 20:42
On Using `assert` as Your Assertion Library

This gist is a more detailed followup to this tweet in which I advocate for using Node's assert module as your goto assertion library.

Not Hatin', Just Sayin' Disclaimer: There are plenty of perfectly good JavaScript assertion libraries out there. If you're happy with your current choice in assertion libraries, please continue using them. This gist is just my personal opinion. It does not represent the opinion of my employer, your employer, or anyone else.

Background

@cjihrig
cjihrig / go.js
Created August 18, 2023 15:02
Parse Node Download Data
'use strict';
const assert = require('node:assert');
const fs = require('node:fs/promises');
const DATA_HOME_URL = 'https://storage.googleapis.com/access-logs-summaries-nodejs/index.html';
const DATA_FILE_PATH = 'data.json';
const DATA_CSV_PATH = 'data.csv';
const DATA_CSV_SEVEN_DAY_PATH = 'data-seven-day-avg.csv';
const LINES = ['14', '16', '18', '19', '20'];
async function main() {