How to use the wikibase-sdk.isPropertyId 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 / format_properties_data.js View on Github external
module.exports = (pattern, filter, includeAllDetails, includeTypes) => data => {
  // Special case: when the pattern is a property id, just log the property
  if (isPropertyId(pattern) && data[pattern] != null) {
    const prop = pattern
    const obj = {}
    obj[prop] = getValue(data[prop], includeAllDetails, includeTypes)
    return JSON.stringify(obj, null, 2)
  }

  const propsData = {}

  for (let prop in data) {
    let propData = data[prop]
    if (!filter || filter(propData)) {
      let value = getValue(data[prop], includeAllDetails, includeTypes)
      propsData[prop] = value
    }
  }
github maxlath / wikibase-cli / lib / parse_props.js View on Github external
const getPropsAndSubKeys = propStr => {
  const [ prop, subkey ] = propStr.split('.')
  if (isPropertyId(prop)) return lazyProps.claims(prop)
  else if (prop.match(langPattern)) return lazyProps.terms(prop)
  else if (isSitelinkKey(prop)) return lazyProps.sitelinks(prop)
  else return [ { prop, subkey } ]
}
github maxlath / wikibase-cli / lib / format_statement_element_value.js View on Github external
property: value => {
    if (isPropertyId(value)) {
      return `wdt:${value}`
    } else {
      errors_.exit(`invalid property: ${value}`)
    }
  },
  object: value => {
github maxlath / wikibase-edit / lib / validate.js View on Github external
property: property => {
    if (!_.isNonEmptyString(property)) {
      throw error_.new('missing property', { property })
    }
    if (!isPropertyId(property)) {
      throw error_.new('invalid property', { property })
    }
  },
  language: language => {