Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add object flattening #13

Merged
merged 3 commits into from
May 4, 2021
Merged

Conversation

AntonBazhal
Copy link
Contributor

No description provided.

default: '_',
describe: 'delimiter to use when flattening outputs',
type: 'string'
})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried adding implies, but it does not work with defaults

return Object.keys(parsed).reduce((memo, key) =>
Object.assign(memo, { [key]: parsed[key].value }), {});
const addValue = (key, value, acc) => {
return typeof value === 'object' && options.flatten
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typeof null is object, do you think anything coming back might blow up?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, good point. TF does not return top-level outputs that are nulls or empty strings, but nested values can be nulls. I updated the check and test.

@dougmoscrop dougmoscrop merged commit c759c6c into dougmoscrop:master May 4, 2021
@AntonBazhal AntonBazhal deleted the flatten branch May 4, 2021 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants