Front end of the Slack clone application.

pluck.d.ts 1.1KB

1234567891011121314151617181920212223242526272829
  1. import { Observable } from '../Observable';
  2. /**
  3. * Maps each source value (an object) to its specified nested property.
  4. *
  5. * <span class="informal">Like {@link map}, but meant only for picking one of
  6. * the nested properties of every emitted object.</span>
  7. *
  8. * <img src="./img/pluck.png" width="100%">
  9. *
  10. * Given a list of strings describing a path to an object property, retrieves
  11. * the value of a specified nested property from all values in the source
  12. * Observable. If a property can't be resolved, it will return `undefined` for
  13. * that value.
  14. *
  15. * @example <caption>Map every click to the tagName of the clicked target element</caption>
  16. * var clicks = Rx.Observable.fromEvent(document, 'click');
  17. * var tagNames = clicks.pluck('target', 'tagName');
  18. * tagNames.subscribe(x => console.log(x));
  19. *
  20. * @see {@link map}
  21. *
  22. * @param {...string} properties The nested properties to pluck from each source
  23. * value (an object).
  24. * @return {Observable} A new Observable of property values from the source values.
  25. * @method pluck
  26. * @owner Observable
  27. */
  28. export declare function pluck<T, R>(this: Observable<T>, ...properties: string[]): Observable<R>;