You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Testing Jing (3.0.0-beta-1828) I can´t get a spread operator to work on .NET instances.
Working ok:
private static void TestJintExpressionPureJs()
{
var engine = new Engine();
var result = engine
.Execute("({supplier: 'S1', ...{number: 42}})")
.GetCompletionValue()
.ToObject() as IDictionary<string, object>;
Console.WriteLine(result["supplier"]); //"S1"
Console.WriteLine(result["number"]); //"42"
}
Not working as expected:
private static void TestJintExpression()
{
var engine = new Engine();
IDictionary<string, object> state = new Dictionary<string, object>
{
{"invoice", new Dictionary<string, object> {["number"] = "42"}}
};
engine.SetValue("state", state);
var result = engine
.Execute("({supplier: 'S1', ...state.invoice})")
.GetCompletionValue()
.ToObject() as IDictionary<string, object>;
Console.WriteLine(result["supplier"]); //"S1"
Console.WriteLine(result["number"]); //exception key not found
}
Neither:
private static void TestJintFunc()
{
var engine = new Engine();
IDictionary<string, object> state = new Dictionary<string, object>
{
{"invoice", new Dictionary<string, object> {["number"] = "42"}}
};
engine.SetValue("state", state);
var result = engine
.Execute("function getValue() { return {supplier: 'S1', ...state.invoice}; }")
.Invoke("getValue")
.ToObject() as IDictionary<string, object>;
Console.WriteLine(result["supplier"]); //"S1"
Console.WriteLine(result["number"]); //exception key not found
}
I already tried to export an ExpandoObject with the same result.
Is this feature supported?
Thanks in advance
Really great work!
The text was updated successfully, but these errors were encountered:
Thanks for reporting. Wrapped CLR objects currently don't expose an iterator which is needed for spread and also some other functionality. I've created a PR to address this and your test cases now pass.
Testing Jing (3.0.0-beta-1828) I can´t get a spread operator to work on .NET instances.
Working ok:
Not working as expected:
Neither:
I already tried to export an ExpandoObject with the same result.
Is this feature supported?
Thanks in advance
Really great work!
The text was updated successfully, but these errors were encountered: