Skip to content

Instantly share code, notes, and snippets.

@garbles
Last active March 13, 2017 03:33
Show Gist options
  • Save garbles/7101bb237b2496b34c7015cec7ce56f9 to your computer and use it in GitHub Desktop.
Save garbles/7101bb237b2496b34c7015cec7ce56f9 to your computer and use it in GitHub Desktop.
export default function append<T>(arr: T[], val: T): T[] {
return [...arr, val];
}
import {sampleOne, types} from 'babel-plugin-transform-flow-to-gen/api';
import append from './append.js';
const strArgsGen = append.asGenerator(types.string());
const strArgs = sampleOne(strArgsGen);
console.log(strArgs);
// [ [ '1dv', '', 'b' ], '4w0' ]
const numArgsGen = append.asGenerator(types.number());
const numArgs = sampleOne(numArgsGen);
console.log(numArgs);
// [ [ 0, -1 ], 2 ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment