Guest User

Untitled

a guest
Feb 18th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. function prop<T, K extends keyof T>(name: K, o: T): T[K] {
  2. return o[name];
  3. }
  4.  
  5. function maybeProp<T, K extends keyof T>(name: K, o: T): Option<T[K]> {
  6. return fromNullable(o[name]);
  7. }
  8.  
  9. const safeProp = R.curry(maybeProp);
  10. const pipeK = R.pipeK;
  11.  
  12. function distribute<T>(os: Option<T[]>): Array<Option<T>> {
  13. return R.sequence(R.of, os);
  14. }
Add Comment
Please, Sign In to add comment