Skip to content

fix: check that a replacement is not mapped to itself#540

Open
gameroman wants to merge 3 commits intoe18e:mainfrom
gameroman:object-path
Open

fix: check that a replacement is not mapped to itself#540
gameroman wants to merge 3 commits intoe18e:mainfrom
gameroman:object-path

Conversation

@gameroman
Copy link
Copy Markdown
Contributor

@gameroman gameroman commented Apr 8, 2026

🔗 Linked issue

Closes #526
Closes #534

📚 Description

check that a replacement is not mapped to itself

@gameroman gameroman marked this pull request as ready for review April 8, 2026 14:48
deleteProperty(obj, 'foo.bar.baz') // [!code --]
objectPath.del(obj, 'foo.bar.baz') // [!code ++]
const value = getProperty(obj, 'foo.bar.baz')
```
Copy link
Copy Markdown
Contributor

@43081j 43081j Apr 8, 2026

Choose a reason for hiding this comment

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

Suggested change
```
```
Note that this is assuming you do not consume dot paths as user input. If you do, ensure you sanitize keys before accessing them (e.g. through `Object.hasOwn`).

"type": "module",
"moduleName": "dot-prop",
"replacements": ["dlv", "object-path"],
"replacements": ["dlv", "dset"],
Copy link
Copy Markdown
Contributor

@43081j 43081j Apr 8, 2026

Choose a reason for hiding this comment

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

this isn't quite right.

dlv and dset do different jobs, but by having both in this array, you're saying they are equal replacements to dot-prop.

probably best to leave it as dlv only and mention dset in the doc

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.

object-path is listed as a replacement for itself [Replacement]: dottie

2 participants