internal IJSCSGlue Map(object ifrom, object iadditional=null)
        {
            if (ifrom == null)
                return new JSGenericObject(_IJSOBuilder.CreateNull(), ifrom);

            IJSCSGlue res = null;
            res = _Cacher.GetCached(ifrom);
            if (res != null)
            {
                return res;
            }

            if (ifrom is ICommand)
                return new JSCommand(_IJSOBuilder, ifrom as ICommand);

            if (ifrom is ISimpleCommand)
                return new JSSimpleCommand(_IJSOBuilder, ifrom as ISimpleCommand);

            if (ifrom is IResultCommand)
                return new JSResultCommand(_IJSOBuilder, ifrom as IResultCommand);

            JSValue value;
            if (_Basic.Solve(ifrom, out value))
            {
                return new JSBasicObject(value, ifrom);
            }

            if (ifrom.GetType().IsEnum)
            {
                var trueres = new JSBasicObject(_IJSOBuilder.CreateEnum((Enum)ifrom), ifrom);
                _Cacher.CacheLocal(ifrom, trueres);
                return trueres;
            }

            IEnumerable ienfro = ifrom as IEnumerable;
            if ((ienfro!=null) && Convert(ienfro, out res))
            {
                return res;
            }

            JSObject resobject = _IJSOBuilder.CreateJSO();
   
            JSGenericObject gres = new JSGenericObject(new JSValue(resobject), ifrom);
            _Cacher.Cache(ifrom, gres);

            MappNested(ifrom, resobject,gres);
            MappNested(iadditional, resobject, gres);

            return gres;
        }
        internal IJSCSGlue Map(object ifrom, object iadditional = null)
        {
            if (ifrom == null)
            {
                return(new JSGenericObject(_IJSOBuilder.CreateNull(), ifrom));
            }

            IJSCSGlue res = null;

            res = _Cacher.GetCached(ifrom);
            if (res != null)
            {
                return(res);
            }

            if (ifrom is ICommand)
            {
                return(new JSCommand(_IJSOBuilder, ifrom as ICommand));
            }

            if (ifrom is ISimpleCommand)
            {
                return(new JSSimpleCommand(_IJSOBuilder, ifrom as ISimpleCommand));
            }

            if (ifrom is IResultCommand)
            {
                return(new JSResultCommand(_IJSOBuilder, ifrom as IResultCommand));
            }

            JSValue value;

            if (_Basic.Solve(ifrom, out value))
            {
                return(new JSBasicObject(value, ifrom));
            }

            if (ifrom.GetType().IsEnum)
            {
                var trueres = new JSBasicObject(_IJSOBuilder.CreateEnum((Enum)ifrom), ifrom);
                _Cacher.CacheLocal(ifrom, trueres);
                return(trueres);
            }

            IEnumerable ienfro = ifrom as IEnumerable;

            if ((ienfro != null) && Convert(ienfro, out res))
            {
                return(res);
            }

            JSObject resobject = _IJSOBuilder.CreateJSO();

            JSGenericObject gres = new JSGenericObject(new JSValue(resobject), ifrom);

            _Cacher.Cache(ifrom, gres);

            MappNested(ifrom, resobject, gres);
            MappNested(iadditional, resobject, gres);

            return(gres);
        }