a zip code crypto-currency system good for red ONLY

distinct.js 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. "use strict";
  2. var distinct_1 = require('../operators/distinct');
  3. /**
  4. * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from previous items.
  5. *
  6. * If a keySelector function is provided, then it will project each value from the source observable into a new value that it will
  7. * check for equality with previously projected values. If a keySelector function is not provided, it will use each value from the
  8. * source observable directly with an equality check against previous values.
  9. *
  10. * In JavaScript runtimes that support `Set`, this operator will use a `Set` to improve performance of the distinct value checking.
  11. *
  12. * In other runtimes, this operator will use a minimal implementation of `Set` that relies on an `Array` and `indexOf` under the
  13. * hood, so performance will degrade as more values are checked for distinction. Even in newer browsers, a long-running `distinct`
  14. * use might result in memory leaks. To help alleviate this in some scenarios, an optional `flushes` parameter is also provided so
  15. * that the internal `Set` can be "flushed", basically clearing it of values.
  16. *
  17. * @example <caption>A simple example with numbers</caption>
  18. * Observable.of(1, 1, 2, 2, 2, 1, 2, 3, 4, 3, 2, 1)
  19. * .distinct()
  20. * .subscribe(x => console.log(x)); // 1, 2, 3, 4
  21. *
  22. * @example <caption>An example using a keySelector function</caption>
  23. * interface Person {
  24. * age: number,
  25. * name: string
  26. * }
  27. *
  28. * Observable.of<Person>(
  29. * { age: 4, name: 'Foo'},
  30. * { age: 7, name: 'Bar'},
  31. * { age: 5, name: 'Foo'})
  32. * .distinct((p: Person) => p.name)
  33. * .subscribe(x => console.log(x));
  34. *
  35. * // displays:
  36. * // { age: 4, name: 'Foo' }
  37. * // { age: 7, name: 'Bar' }
  38. *
  39. * @see {@link distinctUntilChanged}
  40. * @see {@link distinctUntilKeyChanged}
  41. *
  42. * @param {function} [keySelector] Optional function to select which value you want to check as distinct.
  43. * @param {Observable} [flushes] Optional Observable for flushing the internal HashSet of the operator.
  44. * @return {Observable} An Observable that emits items from the source Observable with distinct values.
  45. * @method distinct
  46. * @owner Observable
  47. */
  48. function distinct(keySelector, flushes) {
  49. return distinct_1.distinct(keySelector, flushes)(this);
  50. }
  51. exports.distinct = distinct;
  52. //# sourceMappingURL=distinct.js.map