MCPcopy
hub / github.com/BishopFox/jsluice / IsStringy

Method IsStringy

tree.go:470–486  ·  view source on GitHub ↗

IsStringy returns true if a Node is a string or is an expression starting with a string (e.g. a string concatenation expression).

()

Source from the content-addressed store, hash-verified

468// or is an expression starting with a string
469// (e.g. a string concatenation expression).
470func (n *Node) IsStringy() bool {
471 if n.Type() == "string" {
472 return true
473 }
474
475 c := n.Content()
476 if len(c) == 0 {
477 return false
478 }
479
480 switch c[0:1] {
481 case `"`, "'", "`":
482 return true
483 default:
484 return false
485 }
486}
487
488// CaptureName returns the name given to a node in a
489// query if one exists, and an empty string otherwise

Callers 3

matchJQueryFunction · 0.80
AllURLMatchersFunction · 0.80
matchXHRFunction · 0.80

Calls 2

TypeMethod · 0.95
ContentMethod · 0.95

Tested by

no test coverage detected