public IEnumerable IndexingFunction(IEnumerable <object> items)
        {
            try
            {
                foreach (var item in items)
                {
                    _engine.ResetCallStack();
                    _engine.ResetStatementsCount();
                    _engine.ResetTimeoutTicks();

                    if (JavaScriptIndexUtils.GetValue(_engine, item, out JsValue jsItem) == false)
                    {
                        continue;
                    }
                    {
                        _oneItemArray[0] = jsItem;
                        try
                        {
                            jsItem = MapFunc.Call(JsValue.Null, _oneItemArray);
                        }catch (JavaScriptException jse)
                        {
                            var(message, success) = JavaScriptIndexFuncException.PrepareErrorMessageForJavaScriptIndexFuncException(MapString, jse);
                            if (success == false)
                            {
                                throw new JavaScriptIndexFuncException($"Failed to execute {MapString}", jse);
                            }
                            throw new JavaScriptIndexFuncException($"Failed to execute map script, {message}", jse);
                        } catch (Exception e)
                        {
                            throw new JavaScriptIndexFuncException($"Failed to execute {MapString}", e);
                        }
                        if (jsItem.IsArray())
                        {
                            var array = jsItem.AsArray();
                            foreach (var(prop, val) in array.GetOwnProperties())
                            {
                                if (prop == "length")
                                {
                                    continue;
                                }
                                yield return(val.Value);
                            }
                        }
                        else if (jsItem.IsObject())
                        {
                            yield return(jsItem.AsObject());
                        }
                        // we ignore everything else by design, we support only
                        // objects and arrays, anything else is discarded
                    }

                    _resolver.ExplodeArgsOn(null, null);
                }
            }
            finally
            {
                _oneItemArray[0] = null;
            }
        }
        public IEnumerable IndexingFunction(IEnumerable <dynamic> items)
        {
            try
            {
                EnsureGroupItemCreated();
                foreach (DynamicBlittableJson item in items)
                {
                    if (_groupedItems.TryGetValue(item.BlittableJson, out var list) == false)
                    {
                        list = new List <BlittableJsonReaderObject>();
                        _groupedItems[item.BlittableJson] = list;
                    }
                    list.Add(item.BlittableJson);
                }
                foreach (var item in _groupedItems.Values)
                {
                    Engine.ResetCallStack();
                    Engine.ResetStatementsCount();
                    Engine.ResetTimeoutTicks();

                    _oneItemArray[0] = ConstructValues(item);
                    JsValue jsItem = null;
                    try
                    {
                        jsItem = Reduce.Call(JsValue.Null, _oneItemArray).AsObject();
                    }
                    catch (JavaScriptException jse)
                    {
                        var(message, success) = JavaScriptIndexFuncException.PrepareErrorMessageForJavaScriptIndexFuncException(ReduceString, jse);
                        if (success == false)
                        {
                            throw new JavaScriptIndexFuncException($"Failed to execute {ReduceString}", jse);
                        }
                        throw new JavaScriptIndexFuncException($"Failed to execute reduce script, {message}", jse);
                    }
                    catch (Exception e)
                    {
                        throw new JavaScriptIndexFuncException($"Failed to execute {ReduceString}", e);
                    }
                    yield return(jsItem);

                    _resolver.ExplodeArgsOn(null, null);
                }
            }
            finally
            {
                _oneItemArray[0] = null;
                _groupedItems.Clear();
            }
        }