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

encourage users to list reducers in execution order #24

Closed
YiningChen opened this issue Nov 28, 2017 · 2 comments
Closed

encourage users to list reducers in execution order #24

YiningChen opened this issue Nov 28, 2017 · 2 comments

Comments

@YiningChen
Copy link

YiningChen commented Nov 28, 2017

To make users more cognizant of reducers' execution order, encourage them to list the reducers in execution order. For example, given this code:

const input = {
  a: {
    text: 'Hello World'
  }
}

dataPoint.addEntities({
  'hash:example': {
    addValues: {
      b: { text: 'See You Later' }
    },
    mapKeys: {
      a: '$a.text',
      b: '$b.text',
    },
  }
})


dataPoint.transform('hash:example', input)

A user might expect { a: 'Hello World', b: 'See You Later' }
But instead they'll get { a: 'Hello World', b: { text: 'See You Later' } }

Therefore a warning should be given when reducers aren't in execution order

@acatl
Copy link
Collaborator

acatl commented Nov 28, 2017

The only concern I have around this is that JS itself does not guarantee the order of keys, from my experience, Object key order is usually respected, at least in Node environments. where I have seen that this is not the case is when parsing from JSON to js.

Aside from this, I think this feature is a great idea and we should try to implement it.

@acatl
Copy link
Collaborator

acatl commented Jan 2, 2018

closing because of #73

@acatl acatl closed this as completed Jan 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants