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

Odd behavior on values ending in . #11

Closed
alexraginskiy opened this issue Sep 24, 2019 · 5 comments · Fixed by jonschlinkert/set-value#21
Closed

Odd behavior on values ending in . #11

alexraginskiy opened this issue Sep 24, 2019 · 5 comments · Fixed by jonschlinkert/set-value#21
Labels

Comments

@alexraginskiy
Copy link

alexraginskiy commented Sep 24, 2019

Grouped values ending in a period create unexpected results, with an intermediary grouping for an empty string. Periods in the middle of the value have no effect, as expected.

Input without trailing .:

groupArray(
  [{ name: 'foo', value: 1 }, { name: 'foo.bar', value: 2 }],
  'name'
)

Output:

{
  "foo": [
    {
      "name": "foo",
      "value": 1
    }
  ],
  "foo.bar": [
    {
      "name": "foo.bar",
      "value": 2
    }
  ]
}

Input with trailing .:

groupArray(
  [{ name: 'foo', value: 1 }, { name: 'foo.bar.', value: 2 }], 
  'name'
)

Output:

{
  "foo": [
    {
      "name": "foo",
      "value": 1
    }
  ],
  "foo.bar\\": {
    "": [
      {
        "name": "foo.bar.",
        "value": 2
      }
    ]
  }
}
@doowb doowb added the bug label Sep 24, 2019
@doowb
Copy link
Owner

doowb commented Sep 24, 2019

Thanks for the examples. I'll try to look into this as soon as I can (it might not be until the weekend though). If you discover anything before that, please let me know.

@GlennKintscher
Copy link

GlennKintscher commented Mar 24, 2020

@doowb Any updates on this? I am facing the same problem

Edit: I created a PR in the repo of the library that causes the problem.

@doowb
Copy link
Owner

doowb commented Apr 1, 2020

A PR on another library closed this issue. I'm reopening it until I can test it out to see if anything else is necessary here.

@GlennKintscher
Copy link

@doowb I created the PR specifically for this issue and it works fine with the changes, so there should nothing to do be left :)

doowb added a commit that referenced this issue Apr 1, 2020
@doowb
Copy link
Owner

doowb commented Apr 1, 2020

@GlennKintscher thanks for the PR!

I just wanted to make sure that the group-array dependencies were correct after set-value was published.

It all looks good and I added a test here to verify that it works correctly, so I'll close this now.

Thanks again!

@doowb doowb closed this as completed Apr 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants