Skip to content

Releases: Nicklason/node-tf2-sku

v1.1.3

26 Oct 23:05
Compare
Choose a tag to compare
  • Fixed problem with output and output quality b992f5d

v1.1.2...v1.1.3

v1.1.2

25 Aug 01:13
Compare
Choose a tag to compare

v1.1.1...v1.1.2

v1.1.1

24 Jun 14:25
Compare
Choose a tag to compare

v1.1.0...v1.1.1

Published module

14 Mar 18:54
Compare
Choose a tag to compare

node-tf2-sku

Format items as strings or objects

What is an SKU

SKU is the abbreviation of stock keeping unit. These SKUs make it possible to represent items as readable strings, and convert them to and from objects.

The SKU can safely be used to identify items, since they contain all information about them.

Examples

const SKU = require('tf2-sku');

// SKU of a Mann Co. Supply Crate Key - 5021 is the defindex, 6 is the quality
const sku = '5021;6';

// Converts the sku string into an item object
const item = SKU.fromString(sku);
/* ->
{
    defindex: 5021,
    quality: 6,
    craftable: true,
    killstreak: 0,
    australium: false,
    festive: false,
    effect: null,
    paintkit: null,
    wear: null,
    quality2: null,
    target: null,
    craftnumber: null
}
*/
const SKU = require('tf2-sku');

// Mann Co. Supply Crate Key
const item = {
    defindex: 5021,
    quality: 6,
    craftable: true,
    killstreak: 0,
    australium: false,
    festive: false,
    effect: null,
    paintkit: null,
    wear: null,
    quality2: null,
    target: null,
    craftnumber: null
};

// Converts the item object into an sku string
const sku = SKU.fromObject(item);
// -> '5021;6'