mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 22:49:28 -07:00
Remove null values
This commit is contained in:
parent
e9fdeb0bf8
commit
c7bd4fe81e
1 changed files with 7 additions and 7 deletions
14
src/claim.js
14
src/claim.js
|
@ -76,11 +76,11 @@ class Claim {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this._uri = uri || null
|
this._uri = uri || ''
|
||||||
this._fingerprint = fingerprint || null
|
this._fingerprint = fingerprint || ''
|
||||||
this._status = E.ClaimStatus.INIT
|
this._status = E.ClaimStatus.INIT
|
||||||
this._matches = null
|
this._matches = []
|
||||||
this._verification = null
|
this._verification = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
get uri () {
|
get uri () {
|
||||||
|
@ -116,7 +116,7 @@ class Claim {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
// Verify validity of URI
|
// Verify validity of URI
|
||||||
if (uri && !validUrl.isUri(uri)) {
|
if (uri.length > 0 && !validUrl.isUri(uri)) {
|
||||||
throw new Error('The URI was invalid')
|
throw new Error('The URI was invalid')
|
||||||
}
|
}
|
||||||
// Remove leading and trailing spaces
|
// Remove leading and trailing spaces
|
||||||
|
@ -154,7 +154,7 @@ class Claim {
|
||||||
if (this._status !== E.ClaimStatus.INIT) {
|
if (this._status !== E.ClaimStatus.INIT) {
|
||||||
throw new Error('This claim was already matched')
|
throw new Error('This claim was already matched')
|
||||||
}
|
}
|
||||||
if (this._uri === null) {
|
if (this._uri.length === 0 || !validUrl.isUri(this._uri)) {
|
||||||
throw new Error('This claim has no URI')
|
throw new Error('This claim has no URI')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ class Claim {
|
||||||
if (this._status === E.ClaimStatus.VERIFIED) {
|
if (this._status === E.ClaimStatus.VERIFIED) {
|
||||||
throw new Error('This claim has already been verified')
|
throw new Error('This claim has already been verified')
|
||||||
}
|
}
|
||||||
if (this._fingerprint === null) {
|
if (this._fingerprint.length === 0) {
|
||||||
throw new Error('This claim has no fingerprint')
|
throw new Error('This claim has no fingerprint')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue