Skip to content

Instantly share code, notes, and snippets.

konstantin-hatvan / readdirRecursive.js
Created Feb 16, 2020
Recursive fs.readdir with relative file paths
View readdirRecursive.js
const path = require('path');
const fs = require('fs');
/* Prepend the given path segment */
const prependPathSegment = pathSegment => location => path.join(pathSegment, location);
/* fs.readdir but with relative paths */
const readdirPreserveRelativePath = location => fs.readdirSync(location).map(prependPathSegment(location));
/* Recursive fs.readdir but with relative paths */
# variation of
# Changes order of output tokens so that the commit messages all start at the same line depth
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset %s %C(yellow)%d%Creset %Cgreen(%cr)%Creset %C(bold blue)<%an>%Creset' --abbrev-commit --"