prevwong/reka.js

Inconsistent Behavior When Passing Object Literals to Functions

Closed this issue · 0 comments

K1NZ54 commented

We're encountering an issue in our codebase where the behavior of functions varies depending on how an object literal is passed to them. Specifically, the function works as expected when an object is directly passed to it, but fails when the object is assigned to a variable and then passed.

Steps to Reproduce

Create an object literal: let test = {"value": "1"};
Call a function (e.g., someFunction) directly with the object literal: $someFunction(test); (This works as expected)
Now try calling the function by first assigning the object to a variable: let index = $someFunction(test); (This does not work)

Expected Behavior

Both methods of calling any function should produce the same result, regardless of whether the object is passed directly or assigned to a variable first.

Actual Behavior

The function only works as expected when the object literal is directly passed to it.

Additional Context

This issue occurs only within specific contexts, like within certain functions. It works as expected when declaring variables outside of functions.