mongo-seeding
Version:
The ultimate Node.js library for populating your MongoDB database.
23 lines • 727 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CollectionTransformer = void 0;
/**
* Transforms collections using transformer functions.
*/
class CollectionTransformer {
/**
* Transforms given collections using transformer functions.
*
* @param collections Array of collections
* @param transformers Array of transformer functions
*/
transform(collections, transformers) {
let arr = collections;
transformers.forEach((transformFn) => {
arr = arr.map((collection) => transformFn(collection));
});
return arr;
}
}
exports.CollectionTransformer = CollectionTransformer;
//# sourceMappingURL=transformer.js.map