How to use the wikibase-sdk.isGuid function in wikibase-sdk

To help you get started, we’ve selected a few wikibase-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github maxlath / wikibase-edit / test / integration / claim / create.js View on Github external
.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()
      })
    })
github maxlath / wikibase-edit / test / integration / primitives.js View on Github external
.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()
          })
        })
github maxlath / wikibase-edit / lib / claim / update.js View on Github external
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
github maxlath / wikibase-edit / lib / validate.js View on Github external
guid: guid => {
    if (!_.isNonEmptyString(guid)) {
      throw error_.new('missing guid', { guid })
    }

    if (!isGuid(guid)) {
      throw error_.new('invalid guid', { guid })
    }
  },
  hash: hash => {
github maxlath / wikibase-edit / lib / claim / remove.js View on Github external
guids.forEach(guid => {
    if (!isGuid(guid)) throw error_.new('invalid guid', { guid })
  })
  return {