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

Modifiers only process properties with separators #38

Closed
ackushiw opened this issue Jul 28, 2019 · 2 comments
Closed

Modifiers only process properties with separators #38

ackushiw opened this issue Jul 28, 2019 · 2 comments

Comments

@ackushiw
Copy link

Modifiers on root properties do not process the transformation

var dot = require('dot-object');

var row = {
  'nr': 200,
  'nested.nr': 200,
};

var mods = {
  'nr': [val => val * 2],
  'nested.nr': [val => val * 2]
};

dot.object(row, mods);

console.log(row);

Result:

{
  nr: 200,
  nested: {
    nr: 400
  }
}

Expected:

{
  nr: 400,
  nested: {
     nr: 400
  }
}
@rhalff
Copy link
Owner

rhalff commented Jul 28, 2019

This should work if override is set to true.

There is also a test preventing this:

should not process non dot value with modifier when override is false

This test however doesn't make much sense to me now and causes unexpected and even erroneous behavior, so I'll update the test and remove the requirement to set override to true.

@rhalff rhalff closed this as completed in 7df7f5c Jul 28, 2019
@rhalff
Copy link
Owner

rhalff commented Jul 28, 2019

Fixed in new version released as v1.9.0

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

No branches or pull requests

2 participants