public ValueTask <IObject[]> EvaluateArray(IExecutionContext executionContext, CancellationToken token) { var array = executionContext.Engine().Eval(_program, startNewScope: true).AsArray(); var result = new IObject[array.GetLength()]; foreach (var pair in array.GetOwnProperties()) { if (ArrayInstance.IsArrayIndex(pair.Key, out var index)) { result[index] = new EcmaScriptObject(array.Get(pair.Key)); } } return(new ValueTask <IObject[]>(result)); }
public ValueTask <IObject> GetValue(IExecutionContext executionContext, CancellationToken token) { var obj = new EcmaScriptObject(executionContext.Engine().Eval(_program, startNewScope: true)); return(new ValueTask <IObject>(obj)); }