Skip to content

Conversation

@xinatcg
Copy link
Contributor

@xinatcg xinatcg commented Aug 15, 2025

Based on the Go runtime code, the function supports 2nd parameter as a default value.

code reference

https://github.com/heroiclabs/nakama/blob/b04438720b4bf2e848c7a98fce1290447f3fbf12/server/runtime_javascript_nakama.go#L8556C1-L8559C4

defVal := goja.Undefined()
		if f.Argument(1) != goja.Undefined() && f.Argument(1) != goja.Null() {
			defVal = f.Argument(1)
		}

base on the go runtime code, the function supports 2nd parameter as defaultValue
Copy link
Member

@sesposito sesposito left a comment

Choose a reason for hiding this comment

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

Just a small nit, but otherwise LGTM

* Get local cache data by key.
*
* @param key - local cache key.
* @param defaultValue - defaultValue if it cannot find.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @param defaultValue - defaultValue if it cannot find.
* @param defaultValue - default value returned if entry for key is not found.

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.

2 participants