Files
xen-orchestra/@xen-orchestra/xapi/_extractOpaqueRef.js
2022-03-23 09:48:07 +01:00

12 lines
215 B
JavaScript

'use strict'
const OPAQUE_REF_RE = /OpaqueRef:[0-9a-z-]+/
module.exports = str => {
const matches = OPAQUE_REF_RE.exec(str)
if (!matches) {
throw new Error('no opaque ref found')
}
return matches[0]
}