Last active
March 13, 2017 03:33
-
-
Save garbles/7101bb237b2496b34c7015cec7ce56f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function append<T>(arr: T[], val: T): T[] { | |
return [...arr, val]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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