XingFramework/Relayer

View on GitHub
src/relayer/serializers/ManyResourceSerializer.js

Summary

Maintainability
A
2 hrs
Test Coverage
import Serializer from "./Serializer.js";
import ResourceSerializer from "./ResourceSerializer.js";
import {Inject, factory} from "../injector.js";

export default class ManyResourceSerializer extends Serializer {

  constructor(resourceSerializerFactory, resource) {
    super(resource);
    this.resourceSerializerFactory = resourceSerializerFactory;
  }

  serialize() {
    return this.resource.map((resource) => this.resourceSerializerFactory(resource).serialize());
  }
}

Inject(factory(ResourceSerializer))(ManyResourceSerializer);