UNPKG

made-collections

Version:
24 lines 573 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Chain = void 0; /** * Defines a chain for instances of objects. */ class Chain { _instances = []; constructor(...instances) { this.with(...instances); } count() { return this._instances.length; } with(...instances) { this._instances.push(...instances); return this; } invoke(func) { this._instances.forEach(async (instance) => await func(instance)); } } exports.Chain = Chain; //# sourceMappingURL=Chain.js.map