using System; using System.Collections.Generic; using System.Linq; namespace jive { static public class MappingExtensions { static public Output map_using(this Input item, Converter conversion) { return conversion(item); } static public Output map_using(this Input item, Mapper mapper) { return map_using(item, x => mapper.map_from(x)); } static public Output map_using(this Input item, Mapper mapper) { return map_using(item, x => mapper.map_from(x)); } static public IEnumerable map_all_using(this IEnumerable items, Converter mapper) { return null == items ? Enumerable.Empty() : items.Select(x => mapper(x)); } static public IEnumerable map_all_using(this IEnumerable items, Mapper mapper) { return map_all_using(items, x => mapper.map_from(x)); } static public IEnumerable map_all_using(this IEnumerable items, Mapper mapper) { return map_all_using(items, x => mapper.map_from(x)); } static public Mapper then(this Mapper left, Mapper right) { return new ChainedMapper(left, right); } } }