Util

WikidataPain. Util

# new Util()

Methods

# (static) commonParameters(parameters, configopt) → {Object}

Parameters:
Name Type Attributes Description
parameters Object
config Object <optional>
Properties
Name Type Attributes Description
editgroup string <optional>
summary string <optional>
Returns:
Type
Object

# (static) comparePropertyValues(leftSnakMap, rightSnakMap) → {WikidataPain.PrecisionComparison}

Parameters:
Name Type Description
leftSnakMap Object.<string, Array.<WikidataPain.Snak>>
rightSnakMap Object.<string, Array.<WikidataPain.Snak>>

# (static) currentEntityId() → (nullable) {string}

Get the entity-ID of the entity that's currently open.
Returns:
Type
string

# (static) dissectQsTimestamp(date) → {DissectedTime}

Parameters:
Name Type Description
date string
Returns:
Type
DissectedTime

# (static) entityIdFromClaimId(claimId) → {string}

Parameters:
Name Type Description
claimId string Wikidata claim-ID.
Returns:
Wikidata Q-ID which the claimId belongs to.
Type
string

# (async, static) filterAsync(array, callbackFn) → {Promise.<Array.<T>>}

Parameters:
Name Type Description
array Array.<T>
callbackFn function
Returns:
Type
Promise.<Array.<T>>

# (static) formatDates(input) → {string}

Try to format a English/German date with day-precision as a QuickStatement date.
Parameters:
Name Type Description
input string
Returns:
Type
string

# (static) invertPrecision(precision) → {WikidataPain.PrecisionComparison}

Reverses the "direction" of a precision comparison.
Parameters:
Name Type Description
precision WikidataPain.PrecisionComparison

# (static) makeArrayUnique(array) → {Array.<T>}

Parameters:
Name Type Description
array Array.<T>
Returns:
Type
Array.<T>

# (static) normaliseClaimId(claimId) → {string}

Normalises claim IDs as returned by WDQS.
Parameters:
Name Type Description
claimId string
Returns:
Type
string

# (async, static) quickStatementsLineToStatement(qsLine) → {WikidataPain.Statement}

Convert QuickStatement-line to Statement.
Parameters:
Name Type Description
qsLine Array.<string>
Returns:
Type
WikidataPain.Statement

# (static) randomClaimId(entity) → {string}

Parameters:
Name Type Description
entity string Wikidata claim-ID.
Returns:
Type
string

# (static) randomEditGroup() → {string}

Returns a random ID which can be used for EditGroups.
Returns:
Type
string

# (static) randomUuidV4() → {string}

Random UUID which can be used as claim-id. Stolen from StackOverflow (of course): https://stackoverflow.com/a/2117523
Returns:
Type
string

# (static) sleep(ms) → {Promise.<void>}

Waits the given number of miliseconds using `setTimeout`, then resolves the promise.
Parameters:
Name Type Description
ms number
Returns:
Type
Promise.<void>

# (static) summary(editgroup, summary) → {string}

Parameters:
Name Type Default Description
editgroup string null
summary string null
Returns:
Type
string