예제 #1
0
        public static PipeValue Map(this PipeValue value, PipeLambda map)
        {
            CommonHelper.ConfirmNotNull(map, "map");
            PipeValuePropertyEnumerator enumerator = value.GetEnumerator();
            PipeValueObjectBuilder      collection = new PipeValueObjectBuilder(value.IsArray);

            while (enumerator.MoveNext())
            {
                collection.Add(map.Invoke(enumerator), enumerator.CurrentKey);
            }
            return(collection);
        }
예제 #2
0
            public string MatchEvaluator(Match m)
            {
                PipeValueObjectBuilder collection = new PipeValueObjectBuilder(false);

                foreach (Group group in m.Groups)
                {
                    collection.Add(group.Value, collection.Count.ToString());
                }
                collection.Add(m.Index, "index");
                collection.Add(input, "input");
                return((string)replacement.Invoke(collection));
            }
예제 #3
0
        public static PipeValue Where(this PipeValue value, PipeLambda filter)
        {
            CommonHelper.ConfirmNotNull(filter, "filter");
            PipeValuePropertyEnumerator enumerator = value.GetEnumerator();
            PipeValueObjectBuilder      collection = new PipeValueObjectBuilder(value.IsArray);

            while (enumerator.MoveNext())
            {
                if ((bool)filter.Invoke(enumerator))
                {
                    collection.Add(enumerator.CurrentValue, enumerator.CurrentKey);
                }
            }
            return(collection);
        }