Exemple #1
0
        public string Encode()
        {
            var builder  = new StringBuilder("[");
            var hasFirst = false;

            foreach (var item in _items)
            {
                if (hasFirst)
                {
                    builder.Append(", ");
                }
                else
                {
                    hasFirst = true;
                }
                builder.Append(JsExpressionFactory.create(item).Encode());
            }
            builder.Append("]");
            return(builder.ToString());
        }
Exemple #2
0
        public string Encode()
        {
            var builder  = new StringBuilder("{");
            var hasFirst = false;

            foreach (var key in _map.Keys)
            {
                if (hasFirst)
                {
                    builder.Append(", ");
                }
                else
                {
                    hasFirst = true;
                }
                builder.Append(JsExpressionFactory.create(key).Encode());
                builder.Append(":");
                builder.Append(JsExpressionFactory.create(_map[key]).Encode());
            }
            builder.Append("}");
            return(builder.ToString());
        }
Exemple #3
0
        public string Encode()
        {
            var builder = new StringBuilder(_method);

            builder.Append("(");
            var argumentProcessed = false;

            foreach (var param in _args)
            {
                if (argumentProcessed)
                {
                    builder.Append(", ");
                }
                else
                {
                    argumentProcessed = true;
                }
                var expr = JsExpressionFactory.create(param);
                builder.Append(expr.Encode());
            }
            builder.Append(")");
            return(builder.ToString());
        }