function createEntityCollections(collections) {
    return (collections !== null && collections !== void 0 ? collections : {
        ids: [],
        entities: {}
    });
}

function createIdsMapOf(entities, primaryKey = 'id') {
    const map = {};
    for (const entity of entities) {
        if (entity.hasOwnProperty(primaryKey)) {
            const keyId = entity[primaryKey];
            map[keyId] = entity;
        }
        else {
            throw new Error(`The current entity doesn't have primaryKey - ${primaryKey}.`);
        }
    }
    return map;
}

/**
 * Generated bundle index. Do not edit.
 */

export { createEntityCollections, createIdsMapOf };
//# sourceMappingURL=angular-ru-cdk-entity.mjs.map
