Calculators & Reference

Weight Calculator

Items sold by weight rather than by unit, with their price per kilogram and weight range, for the Weight Calculator. 13 items are included.


Type

WeightItem

FieldTypeDescription
idstringStable identifier
namestringDisplay name
imgstringPath to the item's icon, relative to images/
pricePerKgnumberSell price per kilogram in Dinks
minWeightnumberMinimum weight in kilograms
maxWeightnumberMaximum weight in kilograms

Factory

import { weightItems } from 'dinkum-data'

weightItems() // all 13 items
weightItems(source) // wrap a pre-filtered array

Methods

Sorts

MethodSignatureDefaultDescription
sortByPricePerKgsortByPricePerKg(order?: 'asc' | 'desc')'desc'Sort by price per kilogram.

Terminal methods

MethodReturnsDescription
get()WeightItem[]All results
first()WeightItem | undefinedFirst result
find(id)WeightItem | undefinedFind by id
findByName(name)WeightItem | undefinedCase-insensitive exact name match
search(query)WeightItem[]Case-insensitive partial name match
count()numberNumber of results

Examples

import { weightItems } from 'dinkum-data'

// Estimate the sell value of a weighed item
const item = weightItems().findByName('Aquamarine')!
const estimate = item.pricePerKg * item.maxWeight

// Most valuable weighed items per kilogram
weightItems().sortByPricePerKg().get()

Next steps

  • See the query builder guide for sort method patterns shared across modules
  • Browse Minerals for related sell-price-bearing items
  • Read the core concepts page for the shared QueryBase terminal methods used here
Previous
Calendar