@juice789/tf2items
Version:
tf2 item schema thingys
24 lines (22 loc) • 555 B
JavaScript
export const skuFromItem753 = ({
market_hash_name,
game,
border,
type,
}) => [
753,
(type === '2' && border) ? `${type}-${border}` : type,
game,
encodeURIComponent(market_hash_name)
].filter(Boolean).join(';')
export const itemFromSku753 = (sku) => {
const [x, type, game, market_hash_name] = sku.split(';')
const item = {
type: type[0],
border: type[2],
game,
market_hash_name: decodeURIComponent(market_hash_name)
}
item.sku = sku
return item
}