Xapi#getObject(): behave nicely when a XAPI object is passed.
This commit is contained in:
parent
6fcc148105
commit
16a9f44d4d
@ -301,11 +301,13 @@ export class Xapi extends EventEmitter {
|
||||
// this lib), UUID (unique identifier that some objects have) or
|
||||
// opaque reference (internal to XAPI).
|
||||
getObject (idOrUuidOrRef, defaultValue) {
|
||||
const object = (
|
||||
const object = isString(idOrUuidOrRef)
|
||||
? (
|
||||
// if there is an UUID, it is also the $id.
|
||||
this._objects.all[idOrUuidOrRef] ||
|
||||
this._objectsByRefs[idOrUuidOrRef]
|
||||
)
|
||||
: this._objects.all[idOrUuidOrRef.$id]
|
||||
|
||||
if (object) return object
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user