Skip to content

Commit

Permalink
use Object.entries iteration
Browse files Browse the repository at this point in the history
Co-authored-by: Mitchell Hamilton <mitchell@hamil.town>
  • Loading branch information
dcousens and emmatown committed Aug 18, 2022
1 parent cb6623d commit 8f8916c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/core/src/lib/core/types-for-lists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,11 @@ function getListsWithInitialisedFields(
) {
const result: Record<string, PartiallyInitialisedList> = {};

for (const listKey in listsConfig) {
const list = listsConfig[listKey];
for (const [listKey, list] of Object.entries(listsConfig)) {
const intermediateList = intermediateLists[listKey];
const resultFields: Record<string, InitialisedField> = {};

for (const fieldKey in list.fields) {
const fieldFunc = list.fields[fieldKey];
for (const [fieldKey, fieldFunc] of Object.entries(list.fields)) {
if (typeof fieldFunc !== 'function') {
throw new Error(`The field at ${listKey}.${fieldKey} does not provide a function`);
}
Expand Down Expand Up @@ -493,9 +491,9 @@ export function initialiseLists(config: KeystoneConfig): Record<string, Initiali
Object.entries(intermediateLists).map(([listKey, list]) => {
const fields: Record<string, InitialisedField> = {};

for (const fieldKey in list.fields) {
for (const [fieldKey, field] of Object.entries(list.fields)) {
fields[fieldKey] = {
...list.fields[fieldKey],
...field,
dbField: list.resolvedDbFields[fieldKey],
};
}
Expand Down

0 comments on commit 8f8916c

Please sign in to comment.