1 line
3.6 KiB
JSON
1 line
3.6 KiB
JSON
{"ast":null,"code":"import { Subscriber } from '../Subscriber';\nimport { ArgumentOutOfRangeError } from '../util/ArgumentOutOfRangeError';\nimport { empty } from '../observable/empty';\nexport function take(count) {\n return source => {\n if (count === 0) {\n return empty();\n } else {\n return source.lift(new TakeOperator(count));\n }\n };\n}\n\nclass TakeOperator {\n constructor(total) {\n this.total = total;\n\n if (this.total < 0) {\n throw new ArgumentOutOfRangeError();\n }\n }\n\n call(subscriber, source) {\n return source.subscribe(new TakeSubscriber(subscriber, this.total));\n }\n\n}\n\nclass TakeSubscriber extends Subscriber {\n constructor(destination, total) {\n super(destination);\n this.total = total;\n this.count = 0;\n }\n\n _next(value) {\n const total = this.total;\n const count = ++this.count;\n\n if (count <= total) {\n this.destination.next(value);\n\n if (count === total) {\n this.destination.complete();\n this.unsubscribe();\n }\n }\n }\n\n}","map":{"version":3,"names":["Subscriber","ArgumentOutOfRangeError","empty","take","count","source","lift","TakeOperator","constructor","total","call","subscriber","subscribe","TakeSubscriber","destination","_next","value","next","complete","unsubscribe"],"sources":["D:/MobileDev/WRB/WrenchBoard2023a/node_modules/rxjs/_esm2015/internal/operators/take.js"],"sourcesContent":["import { Subscriber } from '../Subscriber';\nimport { ArgumentOutOfRangeError } from '../util/ArgumentOutOfRangeError';\nimport { empty } from '../observable/empty';\nexport function take(count) {\n return (source) => {\n if (count === 0) {\n return empty();\n }\n else {\n return source.lift(new TakeOperator(count));\n }\n };\n}\nclass TakeOperator {\n constructor(total) {\n this.total = total;\n if (this.total < 0) {\n throw new ArgumentOutOfRangeError;\n }\n }\n call(subscriber, source) {\n return source.subscribe(new TakeSubscriber(subscriber, this.total));\n }\n}\nclass TakeSubscriber extends Subscriber {\n constructor(destination, total) {\n super(destination);\n this.total = total;\n this.count = 0;\n }\n _next(value) {\n const total = this.total;\n const count = ++this.count;\n if (count <= total) {\n this.destination.next(value);\n if (count === total) {\n this.destination.complete();\n this.unsubscribe();\n }\n }\n }\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