TypeScript supports Pick to allow you to get a "subset" object type of a given type, but there is no built-in Pick for deeper nested fields.

If you have a function that takes a large object as argument, but you don't use all of its fields, you can use Pick, Pick2, Pick3, etc to narrow down the input type to be only just what you need. This will make it easier to test your function, because when mocking the input object, you don't need to pass all fields of the "large" object.

View .bashrc
# Name it whatever you want. I like `y` because in my keyboard layout it's close to `;`
function y() {
if [ $previous -eq 0 ]; then
osascript -e "display notification \"Done\" with title \"Terminal Task\"" && say "it is done";
osascript -e "display notification \"Failed\" with title \"Terminal Task\"" && say "it went to the trees";

Not for everyone. Each programmer has their own appreciation of what is good coding music.

For when I need to think deep, debug something, or design

(From most influential to least)

View adnetworks.txt,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

Keybase proof

I hereby claim:

  • I am staltz on github.
  • I am andrestaltz ( on keybase.
  • I have a public key whose fingerprint is C83A 1721 7B3E 3DE2 23F2 F4C6 A1F0 0911 A32F D4DD

To claim this, I am signing this object:

View streamio.js
function *main() {
const confirmRequest = {
type: 'confirm',
value: 'Are you sure?',
const confirmResponse = yield confirmRequest;
if (confirmResponse === true) {
const consoleRequest = {
type: 'console',
View main.js
import xs from 'xstream';
import Cycle from '@cycle/xstream-run';
import {h, makeDOMDriver} from '@cycle/dom';
function main(sources) {
let vdom$ = xs.periodic(16).startWith(0).map(i =>
h('a-scene', [
h('a-sphere', {
attrs: {
View helper.js
// Generic helper function that takes a main() (the top-level component)
// and wraps it with Stanga logic
function wrapWithStanga(main, initialState) {
return function (sources) {
const modProxy$ = new Subject();
const modelSource = Model(initialState)(modProxy$);
sources.model = modelSource;
const sinks = main(sources);

Run this in one shell

./node_modules/.bin/mocha --debug-brk --compilers js:babel-register test/node

Then this in another shell


Then open the browser

View check-operators.js
var operators = [