decodeVID - decode the version id * @param {string} versionId - version ID * @return {(Error|string|undefined)} - return Invalid Argument if decryption * fails due to improper format, otherwise undefined or the decoded version id
(versionId)
| 19 | * fails due to improper format, otherwise undefined or the decoded version id |
| 20 | */ |
| 21 | function decodeVID(versionId) { |
| 22 | if (versionId === 'null') { |
| 23 | return versionId; |
| 24 | } |
| 25 | |
| 26 | let decoded; |
| 27 | const invalidErr = errorInstances.InvalidArgument.customizeDescription('Invalid version id specified'); |
| 28 | try { |
| 29 | decoded = versionIdUtils.decode(versionId); |
| 30 | } catch { |
| 31 | return invalidErr; |
| 32 | } |
| 33 | |
| 34 | if (decoded instanceof Error) { |
| 35 | return invalidErr; |
| 36 | } |
| 37 | |
| 38 | return decoded; |
| 39 | } |
| 40 | |
| 41 | /** decodeVersionId - decode the version id from a query object |
| 42 | * @param {object} [reqQuery] - request query object |
no outgoing calls
no test coverage detected