Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(res => {
res.success.should.equal(1)
isGuid(res.claim.id).should.be.true()
res.claim.rank.should.equal('normal')
res.claim.mainsnak.snaktype.should.equal('value')
res.claim.mainsnak.datavalue.value.time.should.equal('-0028-00-00T00:00:00Z')
done()
})
})
.then(res => {
res.success.should.equal(1)
isGuid(res.claim.id).should.be.true()
res.claim.rank.should.equal('normal')
res.claim.mainsnak.snaktype.should.equal('value')
res.claim.mainsnak.datavalue.value.should.equal(value)
done()
})
})
module.exports = (API, generalConfig) => (params, reqConfig) => {
var { id, guid, property, oldValue, newValue } = params
if (isGuid(guid)) {
id = guid.split('$')[0]
} else {
const values = { oldValue, newValue }
if (oldValue === newValue) {
return error_.reject("old and new claim values can't be the same", 400, values)
}
if (typeof oldValue !== typeof newValue) {
return error_.reject('old and new claim should have the same type', 400, values)
}
}
const config = validateAndEnrichConfig(generalConfig, reqConfig)
return getEntityClaims(id, config)
.then(claims => {
var claim
guid: guid => {
if (!_.isNonEmptyString(guid)) {
throw error_.new('missing guid', { guid })
}
if (!isGuid(guid)) {
throw error_.new('invalid guid', { guid })
}
},
hash: hash => {
guids.forEach(guid => {
if (!isGuid(guid)) throw error_.new('invalid guid', { guid })
})
return {