Skip to content

Commit

Permalink
chore: remove unnecessary logic in getKeyAndValueFromMessage
Browse files Browse the repository at this point in the history
Signed-off-by: Sai Sankeerth <[email protected]>
  • Loading branch information
Sai Sankeerth committed Nov 8, 2023
1 parent 53fdb76 commit 8fb7668
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/v0/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -660,10 +660,7 @@ const getValueFromMessage = (message, sourceKeys) => {
};

const getKeyAndValueFromMessage = (message, sourceKeys) => {
if (Array.isArray(sourceKeys) && sourceKeys.length > 0) {
if (sourceKeys.length === 1) {
logger.warn('List with single element is not ideal. Use it as string instead');
}
if (Array.isArray(sourceKeys)) {
// got the possible sourceKeys
// eslint-disable-next-line no-restricted-syntax
for (const sourceKey of sourceKeys) {
Expand All @@ -678,11 +675,6 @@ const getKeyAndValueFromMessage = (message, sourceKeys) => {
// got a single key
// - we don't need to iterate over a loop for a single possible value
return { value: get(message, sourceKeys), key: sourceKeys };

Check warning on line 677 in src/v0/util/index.js

View check run for this annotation

Codecov / codecov/patch

src/v0/util/index.js#L677

Added line #L677 was not covered by tests
} else {
// wrong sourceKey type. abort
// DEVELOPER ERROR
// TODO - think of a way to crash the pod
throw new PlatformError('Wrong sourceKey type or blank sourceKey array');
}
return { value: null, key: '' };
};
Expand Down

0 comments on commit 8fb7668

Please sign in to comment.