How to use the wikibase-sdk.isNumericId 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-cli / lib / tolerant_id_parser.js View on Github external
module.exports = input => {
  const match = input.match(/(Q|P)\d+/)

  if (match) {
    const id = match[0]
    if (isEntityId(id)) return id
  }

  if (isNumericId(input)) return `Q${input}`

  throw errors_.new('invalid id', input)
}