Exemplo n.º 1
0
// IsSelector - Checks if value is a selector.
func IsSelector(value action.Format) bool {
	// If value is a string it's a selector
	if _, ok := value.String(); ok {
		return true
	}

	// Maybe it's a map ?
	m, ok := value.Map()
	if !ok {
		return false
	}

	// If we formatted this map save it
	value.Value = m

	// If map contains $path it's a selector
	if !m.Get("$path").IsNil() {
		return true
	}

	// If map contains $extract it's a selector
	if !m.Get("$extract").IsNil() {
		return true
	}

	return false
}