Skip to content

Commit

Permalink
fix(pojos): adjust code smell
Browse files Browse the repository at this point in the history
  • Loading branch information
nartc committed Jan 30, 2021
1 parent 3b0550d commit 4682fbf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions packages/pojos/src/lib/storages/pojos-metadata.storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class PojosMetadataStorage implements MetadataStorage<string> {
while (i--) {
const metadata = metadataList[i];
// skip existing
if (resultMetadataList.some(([metaKey]) => metaKey === metadata[0])) {
if (resultMetadataList.some(([key]) => key === metadata[0])) {
continue;
}
resultMetadataList.push(metadataList[i]);
Expand All @@ -46,7 +46,9 @@ export class PojosMetadataStorage implements MetadataStorage<string> {
metaKey: string,
key: string
): Metadata<string> | undefined {
return this.getMetadata(metaKey).find(([metaKey]) => metaKey === key);
return this.getMetadata(metaKey).find(
([innerMetaKey]) => innerMetaKey === key
);
}

has(metaKey: string): boolean {
Expand Down
8 changes: 6 additions & 2 deletions packages/pojos/src/lib/utils/instantiate.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ export function instantiate<TModel extends Dictionary<TModel>>(
}

if (isDefined(valueAtKey)) {
const [result] = instantiate(metadataStorage, metaResult, valueAtKey);
obj[key] = result;
const [instantiateResult] = instantiate(
metadataStorage,
metaResult,
valueAtKey
);
obj[key] = instantiateResult;
continue;
}

Expand Down

0 comments on commit 4682fbf

Please sign in to comment.