https://github.com/itsdouges/gw2-resource-utils
Creates maps of gw2 resources with associated helper utilities.
https://github.com/itsdouges/gw2-resource-utils
Last synced: 11 months ago
JSON representation
Creates maps of gw2 resources with associated helper utilities.
- Host: GitHub
- URL: https://github.com/itsdouges/gw2-resource-utils
- Owner: itsdouges
- License: mit
- Created: 2017-06-13T13:06:07.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-14T00:08:58.000Z (over 8 years ago)
- Last Synced: 2025-02-20T08:18:17.801Z (11 months ago)
- Language: JavaScript
- Size: 363 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# [gw2-resource-utils](https://github.com/madou/gw2-resource-utils)
[](https://www.npmjs.com/package/gw2-resource-utils)
[](https://www.npmjs.com/package/gw2-resource-utils)
[](https://travis-ci.org/madou/gw2-resource-utils)
[](https://codecov.io/gh/madou/gw2-resource-utils)
[](https://david-dm.org/madou/gw2-resource-utils)
Creates maps of gw2 resources with associated helper utilities.
## Installation
```sh
npm install gw2-resource-utils
```
## Api
### `build (resourceName: string) => Promise`
```javascript
import { build } from 'gw2-resource-utils';
const nameToIdMap = await build('items');
// { "MONSTER ONLY Moa Unarmed Pet":1 ... }
```
#### `ResourceMap`
```json
{
"Item Name": 10
}
```
### `exact (map: ResourceMap, itemName: string) => ?number`
```javascript
import { exact } from 'gw2-resource-utils';
const itemId = exact(nameToIdMap, 'MONSTER ONLY Moa Unarmed Pet');
// 1
```
### `fuzzy (map: ResourceMap, itemName: string) => ?number`
```javascript
import { fuzzy } from 'gw2-resource-utils';
const items = fuzzy(nameToIdMap, 'monster');
// { "Legendary Kudu's Monster Loot Box": 65497, ... }
```
### Testing
```bash
npm test
```