a zip code crypto-currency system good for red ONLY

skip.js 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. "use strict";
  2. var __extends = (this && this.__extends) || function (d, b) {
  3. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  4. function __() { this.constructor = d; }
  5. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6. };
  7. var Subscriber_1 = require('../Subscriber');
  8. /**
  9. * Returns an Observable that skips the first `count` items emitted by the source Observable.
  10. *
  11. * <img src="./img/skip.png" width="100%">
  12. *
  13. * @param {Number} count - The number of times, items emitted by source Observable should be skipped.
  14. * @return {Observable} An Observable that skips values emitted by the source Observable.
  15. *
  16. * @method skip
  17. * @owner Observable
  18. */
  19. function skip(count) {
  20. return function (source) { return source.lift(new SkipOperator(count)); };
  21. }
  22. exports.skip = skip;
  23. var SkipOperator = (function () {
  24. function SkipOperator(total) {
  25. this.total = total;
  26. }
  27. SkipOperator.prototype.call = function (subscriber, source) {
  28. return source.subscribe(new SkipSubscriber(subscriber, this.total));
  29. };
  30. return SkipOperator;
  31. }());
  32. /**
  33. * We need this JSDoc comment for affecting ESDoc.
  34. * @ignore
  35. * @extends {Ignored}
  36. */
  37. var SkipSubscriber = (function (_super) {
  38. __extends(SkipSubscriber, _super);
  39. function SkipSubscriber(destination, total) {
  40. _super.call(this, destination);
  41. this.total = total;
  42. this.count = 0;
  43. }
  44. SkipSubscriber.prototype._next = function (x) {
  45. if (++this.count > this.total) {
  46. this.destination.next(x);
  47. }
  48. };
  49. return SkipSubscriber;
  50. }(Subscriber_1.Subscriber));
  51. //# sourceMappingURL=skip.js.map