// Map returns a copy of the string s with all its characters modified
// according to the mapping function. If mapping returns a negative value, the character is
// dropped from the string with no replacement.
485288
func stringsMap(mapping func(rune) rune, s string) string {
	// In the worst case, the string can grow when mapped, making
	// things unpleasant. But it's so rare we barge in assuming it's
	// fine. It could also shrink but that falls out naturally.

	// The output buffer b is initialized on demand, the first
	// time a character differs.
	var b strings.Builder

	for i, c := range s {
		r := mapping(c)
		if r == c {
			continue
		}

		b.Grow(len(s) + utf8.UTFMax)
		b.WriteString(s[:i])
		if r >= 0 {
			b.WriteRune(r)
		}

		if c == utf8.RuneError {
			// RuneError is the result of either decoding
			// an invalid sequence or '\uFFFD'. Determine
			// the correct number of bytes we need to advance.
			_, w := utf8.DecodeRuneInString(s[i:])
			i += w
		} else {
			i += utf8.RuneLen(c)
		}

		s = s[i:]
		break
	}

	// Fast path for unchanged input
	if b.Cap() == 0 { // didn't call b.Grow above
		return s
	}

	for _, c := range s {
		r := mapping(c)

		if r >= 0 {
			// common case
			// Due to inlining, it is more performant to determine if WriteByte should be
			// invoked rather than always call WriteRune
			if r < utf8.RuneSelf {
				b.WriteByte(byte(r))
			} else {
				// r is not a ASCII rune.
				b.WriteRune(r)
			}
		}
	}

	return b.String()
}
123131
func (t Result) Map() map[string]Result {
	if t.Type != JSON {
		return map[string]Result{}
	}
	r := t.arrayOrMap('{', false)
	return r.o
}
629477
func (f *Feed) Map(bytes []byte) error {
	return json.Unmarshal(bytes, f)
}
736404
func (s Seq) Map(mapfn func(i int, v float64) float64) Seq {
	output := make([]float64, s.Len())
	for i := 0; i < s.Len(); i++ {
		mapfn(i, s.GetValue(i))
	}
	return Seq{Array(output)}
}
647567
func (j *Json) Map() (map[string]interface{}, error) {
	if m, ok := (j.data).(map[string]interface{}); ok {
		return m, nil
	}
	return nil, errors.New("type assertion to map[string]interface{} failed")
}
197899
func (m *Model) Map(words []string) map[string]Vector {
	result := make(map[string]Vector)
	for _, w := range words {
		if v, ok := m.words[w]; ok {
			result[w] = v
		}
	}
	return result
}
23149
func CopyMapStringString(m map[string]string) map[string]string {
	l := len(m)
	if l == 0 {
		return nil
	}

	c := make(map[string]string, l)
	for k, v := range m {
		c[k] = v
	}
	return c
}
1057950
func (r *Reply) Map() (map[string]string, error) {
	if r.IsNil() {
		return nil, ErrNil
	}
	if !r.IsArray() {
		return nil, ErrType
	}
	if len(r.arrayValue)%2 != 0 {
		return nil, ErrType
	}
	m := make(map[string]string)
	for i := 0; i < len(r.arrayValue)/2; i++ {
		first, err := r.arrayValue[2*i].String()
		if err != nil {
			continue
		}
		second, err := r.arrayValue[2*i+1].String()
		if err != nil && err != ErrNil {
			continue
		}
		m[first] = second
	}
	return m, nil
}
1004773
func (mp MultiPoint) Map() map[string]interface{} {
	result := make(map[string]interface{})
	result[COORDINATES] = mp.Coordinates
	result[TYPE] = MULTIPOINT
	return result
}
207003
func (this Map) String() string {
	wr := bytes.NewBuffer(nil)
	fmt.Fprint(wr, "Map[")
	for k, v := range this {
		fmt.Fprintf(wr, "%v: %v", k, print(v))
	}
	fmt.Fprintf(wr, "]")
	return wr.String()
}
899499
func (i *injector) Map(val interface{}) TypeMapper {
	i.values[reflect.TypeOf(val)] = reflect.ValueOf(val)
	return i
}
1179508
func (r *Response) Map(fn MapResponseFunc) *Response {
	r.Mappers = append(r.Mappers, fn)
	return r
}
740784
func (p *pathObject) Map(call goja.FunctionCall) goja.Value {
	return p.ForEach(call)
}
336502
func (ctrl *GameController) Mapping() string {
	mappingString := C.SDL_GameControllerMapping(ctrl.cptr())
	defer C.free(unsafe.Pointer(mappingString))
	return C.GoString(mappingString)
}
1330631
func (a Tags) Map() map[string]string {
	m := make(map[string]string, len(a))
	for _, t := range a {
		m[string(t.Key)] = string(t.Value)
	}
	return m
}
617082
func (s Shrink) Map(f interface{}) Shrink {
	mapperVal := reflect.ValueOf(f)
	mapperType := mapperVal.Type()

	if mapperVal.Kind() != reflect.Func {
		panic(fmt.Sprintf("Param of Map has to be a func, but is %v", mapperType.Kind()))
	}
	if mapperType.NumIn() != 1 {
		panic(fmt.Sprintf("Param of Map has to be a func with one param, but is %v", mapperType.NumIn()))
	}
	if mapperType.NumOut() != 1 {
		panic(fmt.Sprintf("Param of Map has to be a func with one return value, but is %v", mapperType.NumOut()))
	}

	return func() (interface{}, bool) {
		value, ok := s()
		if ok {
			return mapperVal.Call([]reflect.Value{reflect.ValueOf(value)})[0].Interface(), ok
		}
		return nil, false
	}
}
539328
func (n Headers) Map() (map[string]string, error) {
	m := make(map[string]string)
	err := json.Unmarshal(n, &m)
	return m, err
}