Skip to content
New issue

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

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

Already on GitHub? # to your account

Key of Number 0 Leads to Unexpected Result #17

Closed
philippfromme opened this issue Mar 15, 2021 · 4 comments · Fixed by #18
Closed

Key of Number 0 Leads to Unexpected Result #17

philippfromme opened this issue Mar 15, 2021 · 4 comments · Fixed by #18
Labels
bug Something isn't working

Comments

@philippfromme
Copy link
Contributor

Describe the Bug

Using keys of the type number can lead to unexpected results due to this check: https://github.com/bpmn-io/min-dash/blob/v3.6.0/lib/object.js#L44

Steps to Reproduce

import { set } from "min-dash";

const target = {
  todos: [
    {
      name: "Buy milk"
    },
    {
      name: "Call mum"
    }
  ]
};

const path = ["todos", 0, "name"];

const value = "Buy eggs";

console.log(set(target, path, value)); // {0: Object, todos: "Buy eggs"}

CodeSandbox: https://codesandbox.io/s/min-dash-set-bug-18yhh?file=/src/index.js:0-276

Expected Behavior

set accepts keys of the type number as documented.

Environment

  • Library version: 3.6.0
@philippfromme philippfromme added the bug Something isn't working label Mar 15, 2021
@nikku nikku mentioned this issue Mar 15, 2021
@bpmn-io-tasks bpmn-io-tasks bot added the needs review Review pending label Mar 15, 2021
@nikku
Copy link
Member

nikku commented Mar 15, 2021

@philippfromme
Copy link
Contributor Author

👏

@fake-join fake-join bot closed this as completed in #18 Mar 15, 2021
@bpmn-io-tasks bpmn-io-tasks bot removed the needs review Review pending label Mar 15, 2021
@nikku
Copy link
Member

nikku commented Mar 15, 2021

Released fix via v3.6.1.

@philippfromme
Copy link
Contributor Author

🚀

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants