"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Chainable_1 = require("../Chainable");
class ChainableLimiter extends Chainable_1.ChainableFilter {
    constructor(limit) {
        super();
        this.counter = 0;
        this.limit = limit;
    }
    me() {
        return this;
    }
    take(error, item) {
        const result = this.give(error, item);
        this.counter++;
        if (this.counter >= this.limit) {
            return false;
        }
        else
            return result;
    }
}
exports.ChainableLimiter = ChainableLimiter;
//# sourceMappingURL=ChainableLimiter.js.map