Skip to content

fix(get): Read a key spelled exactly as the path first - #121

Merged
techniq merged 1 commit into
nextfrom
fix/get-exact-key
Dec 1, 2026
Merged

techniq merged 1 commit into
nextfrom
fix/get-exact-key

Conversation

@techniq

@techniq techniq commented Dec 1, 2026

Copy link
Copy Markdown
Owner

get(obj, 'a.b') always split the string into a path, so a key that contains a period or bracket ({ "temp.max": 5 }) could not be read. It now reads a key spelled exactly as the path first and only follows it as a nested path when no such key exists, the same rule lodash's _.get uses.

get({ 'temp.max': 5 }, 'temp.max'); // 5 (was undefined)
get({ temp: { max: 5 } }, 'temp.max'); // 5 (unchanged)
get({ 'a.b': 'flat', a: { b: 'nested' } }, 'a.b'); // 'flat'

Behaviour change: if an object has both a flat "a.b" key and a nested a.b, the flat key now wins.

Reported against LayerChart in techniq/layerchart#1040, where y="temp.max" drew nothing.

🤖 Generated with Claude Code

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Deploying layerstack with  Cloudflare Pages  Cloudflare Pages

Latest commit: e72543b
Status:🚫  Build failed.

View logs

@changeset-bot

changeset-bot Bot commented Dec 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e72543b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@layerstack/utils Patch
@layerstack/docs Patch
@layerstack/svelte-actions Patch
@layerstack/svelte-state Patch
@layerstack/svelte-stores Patch
@layerstack/svelte-table Patch
@layerstack/docs-site Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor
built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
layerstack ✅ Ready (View Log) Visit Preview e72543b

@pkg-pr-new

pkg-pr-new Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@layerstack/docs

npm i https://pkg.pr.new/@layerstack/docs@121

@layerstack/svelte-actions

npm i https://pkg.pr.new/@layerstack/svelte-actions@121

@layerstack/svelte-state

npm i https://pkg.pr.new/@layerstack/svelte-state@121

@layerstack/svelte-stores

npm i https://pkg.pr.new/@layerstack/svelte-stores@121

@layerstack/svelte-table

npm i https://pkg.pr.new/@layerstack/svelte-table@121

@layerstack/tailwind

npm i https://pkg.pr.new/@layerstack/tailwind@121

@layerstack/utils

npm i https://pkg.pr.new/@layerstack/utils@121

commit: e72543b

@techniq
techniq merged commit ca91b68 into next Dec 1, 2026
5 of 6 checks passed
@techniq
techniq deleted the fix/get-exact-key branch December 1, 2026 23:14
@github-actions github-actions Bot mentioned this pull request Dec 1, 2026

This branch was successfully deployed

1 active deployment
Preview — e72543bd Deployed Dec 1, 2026 by github-actions[bot]
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.

1 participant