github.com/isyscore/isc-gobase@v1.5.3-0.20231218061332-cbc7451899e9/isc/mapobj_ext.go (about)

     1  package isc
     2  
     3  type ISCMapToMap[K comparable, V any, R any] struct {
     4  	ISCMap[K, V]
     5  }
     6  
     7  func MapToMapFrom[K comparable, V any, R any](m ISCMap[K, V]) ISCMapToMap[K, V, R] {
     8  	return ISCMapToMap[K, V, R]{
     9  		m,
    10  	}
    11  }
    12  
    13  func (m ISCMapToMap[K, V, R]) FlatMap(f func(K, V) []R) ISCList[R] {
    14  	return MapFlatMap(m.ISCMap, f)
    15  }
    16  
    17  func (m ISCMapToMap[K, V, R]) FlatMapTo(dest *[]R, f func(K, V) []R) ISCList[R] {
    18  	return MapFlatMapTo(m.ISCMap, dest, f)
    19  }
    20  
    21  func (m ISCMapToMap[K, V, R]) Map(f func(K, V) R) ISCList[R] {
    22  	return MapMap(m.ISCMap, f)
    23  }
    24  
    25  func (m ISCMapToMap[K, V, R]) MapTo(dest *[]R, f func(K, V) R) ISCList[R] {
    26  	return MapMapTo(m.ISCMap, dest, f)
    27  }