MCPcopy Create free account
hub / github.com/evilsocket/islazy / GetTypeObject

Method GetTypeObject

plugin/plugin.go:128–158  ·  view source on GitHub ↗

GetTypeObject returns the type of the object by its name

(name string)

Source from the content-addressed store, hash-verified

126
127// GetTypeObject returns the type of the object by its name
128func (p *Plugin) GetTypeObject(name string) string {
129 if obj, found := p.objects[name]; !found {
130 return ""
131 } else if obj.IsPrimitive() {
132 if obj.IsBoolean() {
133 return "BooleanPrimitive"
134 } else if obj.IsNumber() {
135 return "NumberPrimitive"
136 } else if obj.IsString() {
137 return "StringPrimitive"
138 }
139 } else if obj.IsObject() {
140 switch obj.Class() {
141 case "Array":
142 return "ArrayObject"
143 case "String":
144 return "StringObject"
145 case "Boolean":
146 return "BooleanObject"
147 case "Number":
148 return "NumberObject"
149 case "Date":
150 return "DateObject"
151 case "RegExp":
152 return "RegExpObject"
153 case "Error":
154 return "ErrorObject"
155 }
156 }
157 return ""
158}
159
160// IsStringPrimitive returns true if the object with a
161// given name is a javascript primitive string

Callers 10

IsStringPrimitiveMethod · 0.95
IsBooleanPrimitiveMethod · 0.95
IsNumberPrimitiveMethod · 0.95
IsArrayObjectMethod · 0.95
IsStringObjectMethod · 0.95
IsBooleanObjectMethod · 0.95
IsNumberObjectMethod · 0.95
IsDateObjectMethod · 0.95
IsRegExpObjectMethod · 0.95
IsErrorObjectMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected