// ToMap is used to walk the tree and convert it to a map.
329163
func (t *deducerTrie) ToMap() map[string]pathDeducer {
	m := make(map[string]pathDeducer)
	t.RLock()
	t.t.Walk(func(s string, d interface{}) bool {
		m[s] = d.(pathDeducer)
		return false
	})

	t.RUnlock()
	return m
}
806487
func (c *IDTokenClaims) ToMap() map[string]interface{} {
	var ret = Copy(c.Extra)
	ret["sub"] = c.Subject
	ret["iss"] = c.Issuer
	ret["jti"] = c.JTI

	if len(c.Audience) > 0 {
		ret["aud"] = c.Audience
	} else {
		ret["aud"] = []string{}
	}

	if len(c.Nonce) >= 0 {
		ret["nonce"] = c.Nonce
	}

	if len(c.AccessTokenHash) > 0 {
		ret["at_hash"] = c.AccessTokenHash
	}

	if len(c.JTI) == 0 {
		ret["jti"] = uuid.New()
	}

	if len(c.CodeHash) > 0 {
		ret["c_hash"] = c.CodeHash
	}

	if !c.AuthTime.IsZero() {
		ret["auth_time"] = c.AuthTime.Unix()
	}

	if len(c.AuthenticationContextClassReference) > 0 {
		ret["acr"] = c.AuthenticationContextClassReference
	}

	ret["iat"] = float64(c.IssuedAt.Unix())
	ret["exp"] = float64(c.ExpiresAt.Unix())
	ret["rat"] = float64(c.RequestedAt.Unix())
	return ret

}
1185070
func (c WriteCondition) toMap() map[string]interface{} {
	result := make(map[string]interface{})
	for k, v := range c.conditions {
		result[k] = v
	}
	return result
}
568948
func (f *File) TOML() string {
	s := make([]string, len(f.Files))
	for k, v := range f.Files {
		if v.Typ == "stdout" {
			s[k] = strconv.Quote(v.Typ)
			continue
		}
		s[k] = strconv.Quote(v.Path)
	}
	return fmt.Sprintf(`[[outputs.%s]]
  ## Files to write to, "stdout" is a specially handled file.
  files = [%s]
`, f.PluginName(), strings.Join(s, ", "))
}
854338
func (k *CacheKey) ToMapKey() string {
	b, _ := bufPool.Get().(*bytes.Buffer)
	if b == nil {
		b = &bytes.Buffer{}
	} else {
		b.Reset()
	}
	defer bufPool.Put(b)
	b.WriteString(k.Key)
	b.WriteByte(0)
	for _, s := range k.Scopes {
		b.WriteString(s)
		b.WriteByte(0)
	}
	return b.String()
}
1134615
func Merge(fromMap, ToMap interface{}) interface{} {
	switch fromMap := fromMap.(type) {
	case map[string]interface{}:
		ToMap, ok := ToMap.(map[string]interface{})
		if !ok {
			return fromMap
		}
		for keyToMap, valueToMap := range ToMap {
			if valueFromMap, ok := fromMap[keyToMap]; ok {
				fromMap[keyToMap] = Merge(valueFromMap, valueToMap)
			} else {
				fromMap[keyToMap] = valueToMap
			}
		}
	case nil:
		// merge(nil, map[string]interface{...}) -> map[string]interface{...}
		ToMap, ok := ToMap.(map[string]interface{})
		if ok {
			return ToMap
		}
	}
	return fromMap
}
1194825
func (c *Content) ToMap() map[string]interface{} {
	res := make(map[string]interface{})
	res[RepositoryKey] = c.Repository
	res[BranchKey] = c.Branch
	res[FileNameKey] = c.FileName
	res[LineNumberKey] = c.LineNumber
	res[CodebaseIDKey] = c.CodebaseID
	return res
}
623039
func (s *Application) Tree(args ...*echo.Echo) (r map[string]map[string]map[string]map[string]string) {
	core := s.Core
	if len(args) > 0 {
		core = args[0]
	}
	nrs := core.NamedRoutes()
	rs := core.Routes()
	r = map[string]map[string]map[string]map[string]string{}
	for name, indexes := range nrs {
		p := strings.LastIndex(name, `/`)
		s := strings.Split(name[p+1:], `.`)
		var appName, ctlName, actName string
		switch len(s) {
		case 3:
			if !strings.HasSuffix(s[2], `-fm`) {
				continue
			}
			actName = strings.TrimSuffix(s[2], `-fm`)
			ctlName = strings.TrimPrefix(s[1], `(`)
			ctlName = strings.TrimPrefix(ctlName, `*`)
			ctlName = strings.TrimSuffix(ctlName, `)`)
			p2 := strings.LastIndex(name[0:p], `/`)
			appName = name[p2+1 : p]
		default:
			continue
		}
		if _, ok := r[appName]; !ok {
			r[appName] = map[string]map[string]map[string]string{}
		}
		if _, ok := r[appName][ctlName]; !ok {
			r[appName][ctlName] = map[string]map[string]string{}
		}
		if _, ok := r[appName][ctlName][actName]; !ok {
			r[appName][ctlName][actName] = map[string]string{}
			for _, index := range indexes {
				route := rs[index]
				if _, ok := r[appName][ctlName][actName][route.Method]; !ok {
					r[appName][ctlName][actName][route.Method] = route.Method
				}
			}
		}
	}
	return
}
655808
func (t *Trie) Walk(start []byte, handle func(key []byte, value interface{}) bool) bool {
	var seek bool
	if start != nil {
		seek = true
	}
	return walk(&t.root, start, &seek, handle)
}
944680
func (b *UpdateStmt) SetMap(m map[string]interface{}) *UpdateStmt {
	for col, val := range m {
		b.Set(col, val)
	}
	return b
}
965779
func A(m map[string]interface{}) Args {
	args := make(Args, 0, len(m))
	for name, value := range m {
		args = append(args, Arg{name, value})
	}
	return args
}
994703
func TupleToMap(args []interface{}) (map[interface{}]interface{}, error) {
	if len(args)%2 != 0 {
		return nil, errors.New("Odd number of elements in args for TupleToMap")
	}
	m := make(map[interface{}]interface{})
	var key interface{}
	for i, o := range args {
		if i%2 == 1 {
			m[key] = o
		} else {
			key = o
		}
	}
	return m, nil
}
263177
func xmlToMap(doc []byte, r bool) (map[string]interface{}, error) {
	b := bytes.NewReader(doc)
	p := xml.NewDecoder(b)
	p.CharsetReader = X2jCharsetReader
	return xmlToMapParser("", nil, p, r)
}
22912
func (f nullFunc) toMap() map[Key]ValueSet {
	if !f.k.IsValid() {
		return nil
	}

	return map[Key]ValueSet{
		f.k: NewValueSet(NewBoolValue(f.value)),
	}
}
519251
func ToMap(kvs []interface{}) map[string]interface{} {
	m := map[string]interface{}{}

	if len(kvs) == 0 {
		return m
	}

	if len(kvs)%2 == 1 {
		kvs = append(kvs, nil)
	}

	for i := 0; i < len(kvs); i += 2 {
		merge(m, kvs[i], kvs[i+1])
	}

	return m
}
806517
func (c *MountConfig) toMap() (opts map[string]string) {
	isDarwin := runtime.GOOS == "darwin"
	opts = make(map[string]string)

	// Enable permissions checking in the kernel. See the comments on
	// InodeAttributes.Mode.
	opts["default_permissions"] = ""

	// HACK(jacobsa): Work around what appears to be a bug in systemd v219, as
	// shipped in Ubuntu 15.04, where it automatically unmounts any file system
	// that doesn't set an explicit name.
	//
	// When Ubuntu contains systemd v220, this workaround should be removed and
	// the systemd bug reopened if the problem persists.
	//
	// Cf. https://github.com/bazil/fuse/issues/89
	// Cf. https://bugs.freedesktop.org/show_bug.cgi?id=90907
	fsname := c.FSName
	if runtime.GOOS == "linux" && fsname == "" {
		fsname = "some_fuse_file_system"
	}

	// Special file system name?
	if fsname != "" {
		opts["fsname"] = fsname
	}

	subtype := c.Subtype
	if subtype != "" {
		opts["subtype"] = subtype
	}

	// Read only?
	if c.ReadOnly {
		opts["ro"] = ""
	}

	// Handle OS X options.
	if isDarwin {
		if !c.EnableVnodeCaching {
			opts["novncache"] = ""
		}

		if c.VolumeName != "" {
			// Cf. https://github.com/osxfuse/osxfuse/wiki/Mount-options#volname
			opts["volname"] = c.VolumeName
		}
	}

	// OS X: disable the use of "Apple Double" (._foo and .DS_Store) files, which
	// just add noise to debug output and can have significant cost on
	// network-based file systems.
	//
	// Cf. https://github.com/osxfuse/osxfuse/wiki/Mount-options
	if isDarwin {
		opts["noappledouble"] = ""
	}

	// Last but not least: other user-supplied options.
	for k, v := range c.Options {
		opts[k] = v
	}

	return
}
424975
func valuesToMap(values map[string][]string) map[string]interface{} {
	ret := make(map[string]interface{})

	for key, value := range values {
		if len(value) > 0 {
			ret[key] = value[0]
		}
	}

	return ret
}