Guest User

Untitled

a guest
Feb 7th, 2021
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. export function propEq(path: string, value: any, obj: Object): boolean; // Overload with obj
  2. /**
  3.  * @param path dot delimited path to check
  4.  * @param value value to test
  5.  * @returns a function that the object to test
  6.  * @example const checkValue = propEq('path.to.property'(charge: number) => Promise<any>, 'value');
  7.  * checkValue({}) // call the check
  8.  */
  9. export function propEq(path: string, value: any): (obj: Object) => boolean; // Overload for no obj
  10. export function propEq(path: string, value: any, obj?: Object): boolean | ((obj: Object) => boolean) { // Actual implementation signature
  11.   return obj
  12.     ? R.equals(pick(path, obj), value)
  13.     : (target: Object) => R.equals(pick(path, target), value);
  14. }
Advertisement
Add Comment
Please, Sign In to add comment