Skip to content

Commit

Permalink
fix(shared): get utils not work on function
Browse files Browse the repository at this point in the history
  • Loading branch information
unnoq committed Nov 19, 2024
1 parent d00f4e3 commit 7e5011f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/proud-ghosts-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@orpc/shared": patch
---

fix: get utils not work on function
5 changes: 5 additions & 0 deletions .changeset/red-rice-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@orpc/server": patch
---

fix: dynamic params not work well
10 changes: 8 additions & 2 deletions packages/shared/src/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,21 @@ export function get(
let preSegment: string | number = 'root'

for (const segment of segments) {
if (typeof currentRef !== 'object' || currentRef === null) {
if (
(typeof currentRef !== 'object' && typeof currentRef !== 'function') ||
currentRef === null
) {
return undefined
}

currentRef = currentRef[preSegment]
preSegment = segment
}

if (typeof currentRef !== 'object' || currentRef === null) {
if (
(typeof currentRef !== 'object' && typeof currentRef !== 'function') ||
currentRef === null
) {
return undefined
}

Expand Down

0 comments on commit 7e5011f

Please sign in to comment.