Front end of the Slack clone application.

pluck.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637
  1. "use strict";
  2. var pluck_1 = require('../operators/pluck');
  3. /**
  4. * Maps each source value (an object) to its specified nested property.
  5. *
  6. * <span class="informal">Like {@link map}, but meant only for picking one of
  7. * the nested properties of every emitted object.</span>
  8. *
  9. * <img src="./img/pluck.png" width="100%">
  10. *
  11. * Given a list of strings describing a path to an object property, retrieves
  12. * the value of a specified nested property from all values in the source
  13. * Observable. If a property can't be resolved, it will return `undefined` for
  14. * that value.
  15. *
  16. * @example <caption>Map every click to the tagName of the clicked target element</caption>
  17. * var clicks = Rx.Observable.fromEvent(document, 'click');
  18. * var tagNames = clicks.pluck('target', 'tagName');
  19. * tagNames.subscribe(x => console.log(x));
  20. *
  21. * @see {@link map}
  22. *
  23. * @param {...string} properties The nested properties to pluck from each source
  24. * value (an object).
  25. * @return {Observable} A new Observable of property values from the source values.
  26. * @method pluck
  27. * @owner Observable
  28. */
  29. function pluck() {
  30. var properties = [];
  31. for (var _i = 0; _i < arguments.length; _i++) {
  32. properties[_i - 0] = arguments[_i];
  33. }
  34. return pluck_1.pluck.apply(void 0, properties)(this);
  35. }
  36. exports.pluck = pluck;
  37. //# sourceMappingURL=pluck.js.map