// ByName resolves the given name to the numeric code and the number of minor
// unit digits to display for the given currency.
326103
func ByName(s string) (int, int) {
	code := codes[s]
	return code, minorUnits[code]
}
565780
func (s *Status) WithName(name string) *Status {
	// TODO: We plan to add a WithDetails method to add semantic metadata to
	// Statuses soon.
	if s == nil {
		return nil
	}

	return &Status{
		code:    s.code,
		name:    name,
		message: s.message,
	}
}
8050
func (sc *SkinCollection) GetByName(name string) (*Skin, error) {
	if skin, ok := sc.db[name]; ok {
		return &skin, nil
	}
	return nil, fmt.Errorf("no such skin: '%s'", name)
}
893544
func (g *Generator) MaleName() (first, middle, last string) {
	first = g.OneStringOf(maleFirstNames...)
	middle = g.OneStringOf(maleFirstNames...)
	if g.FlipCoin(80) {
		first += "-" + g.OneStringOf(maleFirstNames...)
	} else if g.FlipCoin(80) {
		middle += "-" + g.OneStringOf(maleFirstNames...)
	}
	last = g.OneStringOf(lastNames...)
	return
}
863538
func IsValidName(name string) bool {
	// doesn't contain the prefix
	if !strings.HasPrefix(name, Prefix) {
		return false
	}
	// it's required to have at least the following chars `x-x-0`
	suffix := name[len(Prefix):]
	if len(suffix) < 5 {
		return false
	}
	// lastly check the last part is a number
	lastHyphen := strings.LastIndex(suffix, "-")
	revision := suffix[lastHyphen+1:]
	_, err := strconv.Atoi(revision)
	return err == nil
}
630495
func (b *Base) Name() string {
	b.mutex.RLock()
	defer b.mutex.RUnlock()

	return b.name
}
406305
func (s *Services) WithName(name string) (*Service, error) {
	for _, services := range *s {
		for i := range services {
			service := services[i]
			if strings.EqualFold(name, service.Name) {
				return &service, nil
			}
		}
	}

	return nil, fmt.Errorf("no service with name %s", name)
}
659104
func (s *Service) Name(name string) (*ResultName, error) {
	entry, err := s.nameReg.GetName(name)
	if err != nil {
		return nil, err
	}
	if entry == nil {
		return nil, fmt.Errorf("name %s not found", name)
	}
	return &ResultName{Entry: entry}, nil
}
882580
func (c *Client) RegistrationByName(name string) (r contract.Registration, err error) {
	conn := c.Pool.Get()
	defer conn.Close()

	err = getObjectByHash(conn, db.ExportCollection+":name", name, unmarshalObject, &r)
	return r, err
}
804795
func (prof *Profiles) ByName(name string) (*User, error) {
	body, err := prof.inst.sendSimpleRequest(urlUserByName, name)
	if err == nil {
		resp := userResp{}
		err = json.Unmarshal(body, &resp)
		if err == nil {
			user := &resp.User
			user.inst = prof.inst
			return user, err
		}
	}
	return nil, err
}
539183
func formatName(name string) string {
	ret := []rune(name)
	if len(ret) > 0 {
		ret[0] = unicode.ToLower(ret[0])
	}
	return string(ret)
}
88308
func TypeName(x interface{}) string {
	return strings.ToLower(reflect.Indirect(reflect.ValueOf(x)).Type().Name())
}
406867
func (c *Command) Name() string {
	name := c.Use
	i := strings.Index(name, " ")
	if i >= 0 {
		name = name[:i]
	}
	return name
}
543451
func TypeByName(typeName string) Type {
	initOnce.Do(discoverTypes)
	return Type2(types[typeName])
}
84645
func SourceByName(name string) (Source, error) {
	for s, n := range sourceNames {
		if n == name {
			return s, nil
		}
	}
	return -1, fmt.Errorf("unknown source %q", name)
}
1311286
func (osx OSX) Name() (result string) {
	path := "/System/Library/CoreServices/Setup Assistant.app/Contents/Resources/en.lproj/OSXSoftwareLicense.rtf"
	bytes, err := ioutil.ReadFile(path)

	if err != nil {
		return ""
	}

	data := string(bytes)
	rCodename := regexp.MustCompile(codenamePattern)

	subs := rCodename.FindAllStringSubmatch(data, 1)
	if len(subs) == 0 {
		return
	}

	find := subs[0]
	if len(find) < 1 {
		return
	}

	return string(find[1])
}
221507
func UserName() string {
	gender := randGender()
	switch r.Intn(3) {
	case 0:
		return lookup("en", gender+"_first_names", false) + lookup(lang, gender+"_last_names", false)
	case 1:
		return Character() + lookup(lang, gender+"_last_names", false)
	default:
		return strings.Replace(WordsN(r.Intn(3)+1), " ", "_", -1)
	}
}