// Through will check if we should fallthrough for qname. Note that we've named the
// variable in each plugin "Fall", so this then reads Fall.Through().
1184
func (f F) Through(qname string) bool {
	return plugin.Zones(f.Zones).Matches(qname) != ""
}
322089
func (bridge *Bridge) GetLightByName(name string) (Light, error) {
	lights, _ := bridge.GetAllLights()
	for _, light := range lights {
		if light.Name == name {
			return light, nil
		}
	}
	errOut := fmt.Sprintf("Error: Light name '%s' not found. ", name)
	return Light{}, errors.New(errOut)
}
194393
func (ln *line) isVariable() bool {
	if !ln.isTopIndent() {
		return false
	}

	_, _, err := variableNV(ln)

	return err == nil
}
492743
func (w *Writer) WriteThrough(p []byte) (n int, err error) {
	if w.err != nil {
		return 0, w.err
	}
	if w.Buffered() != 0 {
		return 0, ErrNotEmpty
	}

	w.err = writeFrame(w.dest, w.state, w.opCode(), false, p)
	if w.err == nil {
		n = len(p)
	}

	w.dirty = true
	w.fragmented = true

	return n, w.err
}
1076228
func (ps Params) ByName(name string) string {
	for i := range ps {
		if ps[i].Key == name {
			return ps[i].Value
		}
	}
	return ""
}
612085
func (c *Chan) Do(f func(Path)) {
	defer c.Close()
	for {
		x := <-(*c).c
		if x == nil {
			break
		}
		f(x)
	}
}
841418
func ReadPluginRoute(name string) (PluginRoute, bool, error) {
	routing, err := readPluginRouting()
	if err != nil {
		return PluginRoute{}, false, err
	}

	route, found := routing.RouteMap[name]
	return route, found, nil
}
229512
func (im *Image) For(each func(x, y int) BGRA) {
	for x := im.Rect.Min.X; x < im.Rect.Max.X; x++ {
		for y := im.Rect.Min.Y; y < im.Rect.Max.Y; y++ {
			im.SetBGRA(x, y, each(x, y))
		}
	}
}
160535
func (m *Mapper) TraversalsByName(t reflect.Type, names []string) [][]int {
	r := make([][]int, 0, len(names))
	m.TraversalsByNameFunc(t, names, func(_ int, i []int) error {
		if i == nil {
			r = append(r, []int{})
		} else {
			r = append(r, i)
		}

		return nil
	})
	return r
}
719162
func (m *PluginManager) GetByName(name string) (*plugin.Plugin, error) {
	plNameVersion := strings.Split(name, ":")
	version := ""
	if len(plNameVersion) > 1 {
		version = plNameVersion[1]
	}
	return m.GetByNameVersion(plNameVersion[0], version)
}
505246
func (p *patternNames) VariableName(value string) string {
	num, ok := p.values[value]
	if !ok {
		if p.values == nil {
			p.values = make(map[string]int)
		}
		num = p.last
		p.last++
		p.values[value] = num
	}
	return fmt.Sprintf("%s%d", p.prefix, num)
}
245928
func (r *ChannelRouter) ForAllOutgoingChannels(cb func(*channeldb.ChannelEdgeInfo,
	*channeldb.ChannelEdgePolicy) error) error {

	return r.selfNode.ForEachChannel(nil, func(_ *bbolt.Tx, c *channeldb.ChannelEdgeInfo,
		e, _ *channeldb.ChannelEdgePolicy) error {

		if e == nil {
			return fmt.Errorf("Channel from self node has no policy")
		}

		return cb(c, e)
	})
}
224787
func SortByName(plugins []Plugin) {
	byName := func(p1, p2 *Plugin) bool {
		return p1.Name < p2.Name
	}

	sortBy(byName).sort(plugins)
}
602425
func (p *Parameter) ByName(name string) (string, error) {
	if i, has := p.names[name]; has {
		return p.findParam(i)
	}
	return "", fmt.Errorf("Parameter not found")
}
781861
func For(msg string, timeout, interval time.Duration, f func() (bool, error)) error {
	log.Infof("Wait for %s [timeout: %s, interval: %s]", msg, timeout, interval)

	var lastErr string
	timeUp := time.After(timeout)
	for {
		select {
		case <-timeUp:
			return fmt.Errorf("time limit exceeded: last error: %s", lastErr)
		default:
		}

		stop, err := f()
		if stop {
			return nil
		}
		if err != nil {
			lastErr = err.Error()
		}

		time.Sleep(interval)
	}
}
307178
func (bridge *Bridge) GetSceneByName(name string) (Scene, error) {

	scenes, _ := bridge.GetAllScenes()

	// Iterate in reverse, as later entries seem to be the newest
	for i := len(scenes) - 1; i >= 0; i-- {
		if scenes[i].Name == name {
			return scenes[i], nil
		}
	}

	errOut := fmt.Sprintf("Error: Scene name '%s' not found. ", name)
	return Scene{}, errors.New(errOut)
}
224897
func FilterByScopeName(name string) func(db *gorm.DB) *gorm.DB {
	return func(db *gorm.DB) *gorm.DB {
		return db.Where("name = ?", name)
	}
}