Giter Club home page Giter Club logo

gw2-itemstats's Introduction

gw2-itemstats

version license Travis Coverage

This module loads itemstats combinations with real attribute values from the API by parsing all available items and matching them to /v2/itemstats.

Installation

Install this module with your favorite package manager, e.g. npm install gw2-itemstats.

Usage

import { getItemstats } from 'gw2-itemstats';

const language = 'en';

// get itemstats
const itemstats = getItemstats(language);

// get itemstats for rare level 78 weapons
const itemstatsRare78Weapons = getItemstats(language, {
    filter: (item) => item.rarity === 'Rare' && item.level === 78 && item.type === 'Weapon'
});

Result

Array of itemstats objects following this structure:

{
    id: 161,
    name: 'Berserker\'s',
    attributes: {
        CritDamage: 101,
        Power: 141,
        Precision: 101
    },
    level: 80,
    rarity: 'Ascended',
    type: 'Armor',
    subtype: 'Coat'
}

Options

Option Type Description
useCache bool Use the cache to lookup items and itemstats.
Default: true.
api Object Object containing the functions items and itemstats, both returning promises containing all items and itemstats that should be considered for resulting list.
Default: Uses gw2api-client to load all items and itemstats
cache Map Object used as cache following the Map interface.
Default: new Map()
filter function Callback used to filter the items. The first parameter is the item as it is returned from the API.
This is done after caching, to reuse the cache for different filters. Manually applying a filter in the api-option can reduce the cache size.
Default: (item) => true

License

gw2-itemstats is licensed under the MIT License.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.