Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 29 days 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 7 years ago)
- Default Branch: master
- Last Pushed: 2017-06-14T00:08:58.000Z (over 7 years ago)
- Last Synced: 2024-10-12T23:42:30.421Z (about 1 month 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)
[![NPM version](http://img.shields.io/npm/v/gw2-resource-utils.svg?style=flat-square)](https://www.npmjs.com/package/gw2-resource-utils)
[![NPM downloads](http://img.shields.io/npm/dm/gw2-resource-utils.svg?style=flat-square)](https://www.npmjs.com/package/gw2-resource-utils)
[![Build Status](http://img.shields.io/travis/madou/gw2-resource-utils/master.svg?style=flat-square)](https://travis-ci.org/madou/gw2-resource-utils)
[![codecov](https://codecov.io/gh/madou/gw2-resource-utils/branch/master/graph/badge.svg)](https://codecov.io/gh/madou/gw2-resource-utils)
[![Dependency Status](http://img.shields.io/david/madou/gw2-resource-utils.svg?style=flat-square)](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
```