0.1.2 • Published 7 years ago

gw2-resource-utils v0.1.2

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

gw2-resource-utils

NPM version NPM downloads Build Status codecov Dependency Status

Creates maps of gw2 resources with associated helper utilities.

Installation

npm install gw2-resource-utils

Api

build (resourceName: string) => Promise<ResourceMap>

import { build } from 'gw2-resource-utils';

const nameToIdMap = await build('items');
// { "MONSTER ONLY Moa Unarmed Pet":1 ... }

ResourceMap

{
 "Item Name": 10
}

exact (map: ResourceMap, itemName: string) => ?number

import { exact } from 'gw2-resource-utils';

const itemId = exact(nameToIdMap, 'MONSTER ONLY Moa Unarmed Pet');
// 1

fuzzy (map: ResourceMap, itemName: string) => ?number

import { fuzzy } from 'gw2-resource-utils';

const items = fuzzy(nameToIdMap, 'monster');
// { "Legendary Kudu's Monster Loot Box": 65497, ... }

Testing

npm test