nintendo-switch-eshop
Advanced tools
Comparing version 2.2.8 to 3.0.0
@@ -5,2 +5,11 @@ # Changelog | ||
## [3.0.0](https://github.com/lmmfranco/nintendo-switch-eshop/compare/v2.2.8...v3.0.0) (2020-02-04) | ||
### ⚠ BREAKING CHANGES | ||
* getGamesAmerica's options no longer takes a "shop" property | ||
* remove the "shop" property from getGamesAmerica ([15a8a3c](https://github.com/lmmfranco/nintendo-switch-eshop/commit/15a8a3c58c94d6e0e3180458da0c8dc526a4bea2)), closes [#124](https://github.com/lmmfranco/nintendo-switch-eshop/issues/124) | ||
### [2.2.8](https://github.com/lmmfranco/nintendo-switch-eshop/compare/v2.2.7...v2.2.8) (2019-12-20) | ||
@@ -7,0 +16,0 @@ |
@@ -173,9 +173,2 @@ import { Country } from 'country-data'; | ||
} | ||
export interface USRequestOptions extends RequestOptions { | ||
/** | ||
* Either `'retail'`, `'ncom'` or `'all'`. | ||
* @default ncom | ||
*/ | ||
shop?: 'retail' | 'ncom' | 'all' | 'unfiltered'; | ||
} | ||
export interface EURequestOptions extends RequestOptions { | ||
@@ -182,0 +175,0 @@ /** Game information locale. (EU Only) */ |
@@ -13,3 +13,3 @@ import * as interfaces from './interfaces'; | ||
*/ | ||
export declare const getGamesAmerica: (options?: interfaces.USRequestOptions, offset?: number, games?: interfaces.GameUS[]) => Promise<interfaces.GameUS[]>; | ||
export declare const getGamesAmerica: (options?: interfaces.RequestOptions, offset?: number, games?: interfaces.GameUS[]) => Promise<interfaces.GameUS[]>; | ||
/** | ||
@@ -16,0 +16,0 @@ * Fetches all games on japanese eShops |
@@ -34,12 +34,2 @@ "use strict"; | ||
/** | ||
* TypeGuard to check if the variable is an array of strings | ||
* | ||
* @param array Array to check | ||
* @returns Boolean representing whether the input is an array | ||
* @private | ||
*/ | ||
const isStringArray = (array) => { | ||
return Array.isArray(array); | ||
}; | ||
/** | ||
* Fetches all games on american eshops | ||
@@ -57,20 +47,3 @@ * | ||
const limit = hasProp(options, 'limit') ? options.limit : constants.US_GAME_LIST_LIMIT; | ||
const shopProp = hasProp(options, 'shop') ? options.shop : 'ncom'; | ||
let shop = shopProp === 'all' ? ['ncom', 'retail'] : shopProp; | ||
shop = shop === 'unfiltered' ? undefined : shop; | ||
const page = Math.floor(offset / limit); | ||
const shopMapper = (shopType) => { | ||
switch (shopType) { | ||
case 'ncom': | ||
return 'filterShops:On Nintendo.com'; | ||
case 'retail': | ||
return 'filterShops:On retail'; | ||
default: | ||
return ''; | ||
} | ||
}; | ||
let shopFilters = ['']; | ||
if (shop) { | ||
shopFilters = isStringArray(shop) ? shop.map(value => shopMapper(value)) : shopMapper(shop); | ||
} | ||
const sortingOptions = { | ||
@@ -89,3 +62,2 @@ direction: constants.US_GET_GAMES_OPTIONS.direction, | ||
[constants.US_GET_GAMES_OPTIONS.system], | ||
shopFilters | ||
], | ||
@@ -127,3 +99,2 @@ hitsPerPage: limit, | ||
[constants.US_GET_GAMES_OPTIONS.system], | ||
shopFilters | ||
], | ||
@@ -153,3 +124,2 @@ facets: [ | ||
[`categories:${category}`], | ||
shopFilters | ||
]), | ||
@@ -166,3 +136,2 @@ hitsPerPage: 100, | ||
[`priceRange:${priceRange}`], | ||
shopFilters | ||
]), | ||
@@ -169,0 +138,0 @@ facets: [ |
{ | ||
"name": "nintendo-switch-eshop", | ||
"version": "2.2.8", | ||
"version": "3.0.0", | ||
"description": "Unofficial API lib for Nintendo Switch eShop game listing and pricing information.", | ||
@@ -22,6 +22,6 @@ "author": "lmmfranco", | ||
"dependencies": { | ||
"@favware/querystring": "^4.1.3", | ||
"@favware/querystring": "^4.2.0", | ||
"@types/country-data": "^0.0.1", | ||
"country-data": "^0.0.31", | ||
"fast-xml-parser": "^3.15.1", | ||
"fast-xml-parser": "^3.16.0", | ||
"node-fetch": "^2.6.0", | ||
@@ -31,22 +31,22 @@ "tslib": "latest" | ||
"devDependencies": { | ||
"@commitlint/cli": "^8.2.0", | ||
"@commitlint/config-conventional": "^8.2.0", | ||
"@favware/eslint-config": "^3.1.6", | ||
"@favware/ts-config": "^1.1.1", | ||
"@types/jest": "^24.0.23", | ||
"@types/node": "^12.12.17", | ||
"@commitlint/cli": "^8.3.5", | ||
"@commitlint/config-conventional": "^8.3.4", | ||
"@favware/eslint-config": "^3.2.0", | ||
"@favware/ts-config": "^1.1.2", | ||
"@types/jest": "^25.1.1", | ||
"@types/node": "^13.5.0", | ||
"@types/node-fetch": "^2.5.4", | ||
"common-tags": "^1.8.0", | ||
"cz-conventional-changelog": "^3.0.2", | ||
"eslint": "^6.7.2", | ||
"husky": "^3.1.0", | ||
"jest": "^24.9.0", | ||
"lint-staged": "^9.5.0", | ||
"replace": "^1.1.1", | ||
"standard-version": "^7.0.1", | ||
"ts-jest": "^24.2.0", | ||
"ts-node": "^8.5.4", | ||
"typedoc": "^0.15.4", | ||
"eslint": "^6.8.0", | ||
"husky": "^4.2.1", | ||
"jest": "^25.1.0", | ||
"lint-staged": "^10.0.2", | ||
"replace": "^1.1.5", | ||
"standard-version": "^7.1.0", | ||
"ts-jest": "^25.0.0", | ||
"ts-node": "^8.6.2", | ||
"typedoc": "^0.16.8", | ||
"typedoc-plugin-nojekyll": "^1.0.1", | ||
"typescript": "^3.7.3" | ||
"typescript": "^3.7.5" | ||
}, | ||
@@ -82,5 +82,4 @@ "files": [ | ||
"lint-staged": { | ||
"*.{js,ts}": [ | ||
"yarn lint", | ||
"git add" | ||
"*.ts": [ | ||
"yarn lint" | ||
] | ||
@@ -87,0 +86,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
72267
838
Updated@favware/querystring@^4.2.0
Updatedfast-xml-parser@^3.16.0