graycoreio/daffodil

View on GitHub
libs/content/src/helpers/block-array-to-collection.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { daffArrayToDict } from '@daffodil/core';

import {
  DaffContentBlock,
  DaffContentBlockCollection,
} from '../models/public_api';

export const daffContentBlockArrayToCollection = <T extends DaffContentBlock = DaffContentBlock>(ary: T[]): DaffContentBlockCollection =>
  daffArrayToDict<T>(ary, block => block.id);