nintendo-switch-eshop
Advanced tools
Comparing version 3.0.1 to 3.0.2
@@ -5,2 +5,4 @@ # Changelog | ||
### [3.0.2](https://github.com/lmmfranco/nintendo-switch-eshop/compare/v3.0.1...v3.0.2) (2020-07-08) | ||
### [3.0.1](https://github.com/lmmfranco/nintendo-switch-eshop/compare/v3.0.0...v3.0.1) (2020-02-04) | ||
@@ -7,0 +9,0 @@ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.EshopError = exports.PRICE_LIST_LIMIT = exports.PRICE_GET_OPTIONS = exports.PRICE_GET_URL = exports.JP_NSUID_REGEX = exports.JP_GAME_CODE_REGEX = exports.JP_GAME_CHECK_CODE = exports.JP_GET_GAMES_URL = exports.EU_GAME_LIST_LIMIT = exports.EU_DEFAULT_LOCALE = exports.EU_GAME_CODE_REGEX = exports.EU_GAME_CHECK_CODE = exports.EU_GET_GAMES_URL = exports.EU_GET_GAMES_OPTIONS = exports.US_ALGOLIA_HEADERS = exports.US_PRICE_RANGES = exports.US_GAME_LIST_LIMIT = exports.US_GAME_CODE_REGEX = exports.US_GAME_CHECK_CODE = exports.US_GET_GAMES_URL = exports.US_ALGOLIA_KEY = exports.US_ALGOLIA_ID = exports.US_GET_GAMES_OPTIONS = void 0; | ||
/** Options used for getting US gmaes */ | ||
@@ -4,0 +5,0 @@ exports.US_GET_GAMES_OPTIONS = { system: 'platform:Nintendo Switch', sort: 'title', direction: 'asc' }; |
@@ -1,6 +0,5 @@ | ||
import { getGamesAmerica } from './nintendo-switch-eshop'; | ||
export * from './nintendo-switch-eshop'; | ||
export * from './constants'; | ||
export * from './interfaces'; | ||
export default getGamesAmerica; | ||
export * from './nintendo-switch-eshop'; | ||
export { getGamesAmerica as default } from './nintendo-switch-eshop'; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const nintendo_switch_eshop_1 = require("./nintendo-switch-eshop"); | ||
__export(require("./nintendo-switch-eshop")); | ||
__export(require("./constants")); | ||
__export(require("./interfaces")); | ||
exports.default = nintendo_switch_eshop_1.getGamesAmerica; | ||
__exportStar(require("./constants"), exports); | ||
__exportStar(require("./interfaces"), exports); | ||
__exportStar(require("./nintendo-switch-eshop"), exports); | ||
var nintendo_switch_eshop_1 = require("./nintendo-switch-eshop"); | ||
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return nintendo_switch_eshop_1.getGamesAmerica; } }); | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Region = void 0; | ||
/** | ||
@@ -4,0 +5,0 @@ * Predefined options for the unit system |
@@ -39,3 +39,3 @@ import * as interfaces from './interfaces'; | ||
*/ | ||
export declare const getPrices: (country: string, gameIds: string | string[], offset?: number, prices?: interfaces.TitleData[]) => Promise<interfaces.PriceResponse>; | ||
export declare const getPrices: (country: string, gameIds: string[] | string, offset?: number, prices?: interfaces.TitleData[]) => Promise<interfaces.PriceResponse>; | ||
/** | ||
@@ -93,3 +93,3 @@ * Gets all active eShops given a list of countries. | ||
*/ | ||
export declare const parseGameCode: (game: interfaces.GameEU | interfaces.GameUS | interfaces.GameJP, region: interfaces.Region) => string | null; | ||
export declare const parseGameCode: (game: interfaces.GameUS | interfaces.GameEU | interfaces.GameJP, region: interfaces.Region) => string | null; | ||
/** | ||
@@ -102,3 +102,3 @@ * Extracts NSUID information from the game object. | ||
*/ | ||
export declare const parseNSUID: (game: interfaces.GameEU | interfaces.GameUS | interfaces.GameJP, region: interfaces.Region) => string | null; | ||
export declare const parseNSUID: (game: interfaces.GameUS | interfaces.GameEU | interfaces.GameJP, region: interfaces.Region) => string | null; | ||
//# sourceMappingURL=nintendo-switch-eshop.d.ts.map |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -14,14 +33,8 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const querystring_1 = require("@favware/querystring"); | ||
exports.parseNSUID = exports.parseGameCode = exports.getActiveShops = exports.getShopsAsia = exports.getShopsEurope = exports.getShopsAmerica = exports.getShopsByCountryCodes = exports.getPrices = exports.getGamesEurope = exports.getGamesJapan = exports.getGamesAmerica = void 0; | ||
const country_data_1 = require("country-data"); | ||
const fast_xml_parser_1 = require("fast-xml-parser"); | ||
const node_fetch_1 = __importDefault(require("node-fetch")); | ||
const querystring_1 = require("querystring"); | ||
const util_1 = require("util"); | ||
@@ -45,10 +58,2 @@ const constants = __importStar(require("./constants")); | ||
/** | ||
* Checks if object has a certain property | ||
* | ||
* @param obj Object to traverse | ||
* @param prop Property to find | ||
* @private | ||
*/ | ||
const hasProp = (obj, prop) => obj && prop in obj; | ||
/** | ||
* Fetches all games on american eshops | ||
@@ -65,4 +70,5 @@ * | ||
exports.getGamesAmerica = (options = {}, offset = 0, games = []) => __awaiter(void 0, void 0, void 0, function* () { | ||
const limit = hasProp(options, 'limit') ? options.limit : constants.US_GAME_LIST_LIMIT; | ||
const page = Math.floor(offset / limit); | ||
var _a; | ||
const limit = (_a = Reflect.get(options, 'limit')) !== null && _a !== void 0 ? _a : constants.US_GAME_LIST_LIMIT; | ||
const page = Math.floor(offset / (limit)); | ||
const sortingOptions = { | ||
@@ -92,3 +98,3 @@ direction: constants.US_GET_GAMES_OPTIONS.direction, | ||
try { | ||
if (hasProp(options, 'limit')) { | ||
if (Reflect.has(options, 'limit')) { | ||
const gamesUS = yield node_fetch_1.default(constants.US_GET_GAMES_URL, body); | ||
@@ -99,3 +105,3 @@ if (!gamesUS.ok) | ||
const accumulatedGames = arrayRemoveDuplicates(games.concat(filteredResponse.results[0].hits), 'slug'); | ||
if (!hasProp(options, 'limit') && filteredResponse.results[0].hits.length + offset < filteredResponse.results[0].nbHits) { | ||
if (!Reflect.has(options, 'limit') && filteredResponse.results[0].hits.length + offset < filteredResponse.results[0].nbHits) { | ||
return yield exports.getGamesAmerica(options, offset + limit, accumulatedGames); | ||
@@ -102,0 +108,0 @@ } |
{ | ||
"name": "nintendo-switch-eshop", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "Unofficial API lib for Nintendo Switch eShop game listing and pricing information.", | ||
@@ -12,6 +12,7 @@ "author": "lmmfranco", | ||
"lint": "eslint src __tests__ --ext js,ts --fix", | ||
"build": "tsc", | ||
"start": "tsc -w", | ||
"build": "tsc -b src", | ||
"watch": "tsc -b src -w", | ||
"clean": "tsc -b src --clean", | ||
"docs": "typedoc", | ||
"prepublishOnly": "tsc", | ||
"prepublishOnly": "tsc -b src", | ||
"sversion": "standard-version", | ||
@@ -23,29 +24,29 @@ "commit": "git-cz", | ||
"dependencies": { | ||
"@favware/querystring": "^4.2.0", | ||
"@types/country-data": "^0.0.1", | ||
"country-data": "^0.0.31", | ||
"fast-xml-parser": "^3.16.0", | ||
"fast-xml-parser": "^3.17.4", | ||
"node-fetch": "^2.6.0" | ||
}, | ||
"devDependencies": { | ||
"@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", | ||
"@commitlint/cli": "^9.0.1", | ||
"@commitlint/config-conventional": "^9.0.1", | ||
"@favware/eslint-config": "^5.1.0", | ||
"@favware/ts-config": "^3.0.2", | ||
"@types/jest": "^26.0.4", | ||
"@types/node": "^14.0.19", | ||
"@types/node-fetch": "^2.5.7", | ||
"common-tags": "^1.8.0", | ||
"cz-conventional-changelog": "^3.0.2", | ||
"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.2.0", | ||
"ts-node": "^8.6.2", | ||
"typedoc": "^0.16.8", | ||
"cz-conventional-changelog": "^3.2.0", | ||
"eslint": "^7.4.0", | ||
"husky": "^4.2.5", | ||
"jest": "^26.1.0", | ||
"jest-circus": "^26.1.0", | ||
"lint-staged": "^10.2.11", | ||
"replace": "^1.2.0", | ||
"standard-version": "^8.0.0", | ||
"ts-jest": "^26.1.1", | ||
"ts-node": "^8.10.2", | ||
"typedoc": "^0.17.8", | ||
"typedoc-plugin-nojekyll": "^1.0.1", | ||
"typescript": "^3.7.5" | ||
"typescript": "^3.9.6" | ||
}, | ||
@@ -52,0 +53,0 @@ "files": [ |
<div align="center"> | ||
<p> | ||
<a href="https://www.npmjs.com/package/nintendo-switch-eshop"><img src="https://storage.googleapis.com/data-sunlight-146313.appspot.com/website-project-icons/nintendoeshop.png" height="200" alt="logo"/></a> | ||
<a href="https://www.npmjs.com/package/nintendo-switch-eshop"><img src="https://cdn.favware.tech/img/nintendoeshop.png" height="200" alt="logo"/></a> | ||
</p> | ||
@@ -16,3 +16,3 @@ | ||
[](https://github.com/lmmfranco/nintendo-switch-eshop/blob/master/LICENSE.md) | ||
[](https://github.com/lmmfranco/nintendo-switch-eshop/blob/master/LICENSE) | ||
[](https://www.npmjs.com/package/nintendo-switch-eshop) | ||
@@ -48,2 +48,27 @@ [](https://www.npmjs.com/package/nintendo-switch-eshop) | ||
## [API Documentation](https://lmmfranco.github.io/nintendo-switch-eshop) | ||
## [API Documentation](https://lmmfranco.github.io/nintendo-switch-eshop) | ||
## Contributors ✨ | ||
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): | ||
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> | ||
<!-- prettier-ignore-start --> | ||
<!-- markdownlint-disable --> | ||
<table> | ||
<tr> | ||
<td align="center"><a href="https://github.com/lmmfranco"><img src="https://avatars2.githubusercontent.com/u/5719409?v=4?s=100" width="100px;" alt=""/><br /><sub><b>lmmfranco</b></sub></a><br /><a href="https://github.com/lmmfranco/nintendo-switch-eshop/commits?author=lmmfranco" title="Code">💻</a> <a href="#ideas-lmmfranco" title="Ideas, Planning, & Feedback">🤔</a> <a href="#projectManagement-lmmfranco" title="Project Management">📆</a> <a href="#question-lmmfranco" title="Answering Questions">💬</a> <a href="https://github.com/lmmfranco/nintendo-switch-eshop/pulls?q=is%3Apr+reviewed-by%3Almmfranco" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/lmmfranco/nintendo-switch-eshop/commits?author=lmmfranco" title="Documentation">📖</a></td> | ||
<td align="center"><a href="https://favware.tech/"><img src="https://avatars3.githubusercontent.com/u/4019718?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jeroen Claassens</b></sub></a><br /><a href="https://github.com/lmmfranco/nintendo-switch-eshop/commits?author=Favna" title="Code">💻</a> <a href="#ideas-Favna" title="Ideas, Planning, & Feedback">🤔</a> <a href="#projectManagement-Favna" title="Project Management">📆</a> <a href="#question-Favna" title="Answering Questions">💬</a> <a href="https://github.com/lmmfranco/nintendo-switch-eshop/pulls?q=is%3Apr+reviewed-by%3AFavna" title="Reviewed Pull Requests">👀</a> <a href="#userTesting-Favna" title="User Testing">📓</a> <a href="#maintenance-Favna" title="Maintenance">🚧</a> <a href="https://github.com/lmmfranco/nintendo-switch-eshop/commits?author=Favna" title="Documentation">📖</a></td> | ||
<td align="center"><a href="https://github.com/mmakarios"><img src="https://avatars0.githubusercontent.com/u/9814055?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Michel Makarios</b></sub></a><br /><a href="https://github.com/lmmfranco/nintendo-switch-eshop/commits?author=mmakarios" title="Documentation">📖</a></td> | ||
<td align="center"><a href="http://iulianonofrei.com/"><img src="https://avatars0.githubusercontent.com/u/5748627?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Iulian Onofrei</b></sub></a><br /><a href="https://github.com/lmmfranco/nintendo-switch-eshop/commits?author=revolter" title="Documentation">📖</a></td> | ||
<td align="center"><a href="https://github.com/Lililiuliu"><img src="https://avatars3.githubusercontent.com/u/52712459?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Lililiuliu</b></sub></a><br /><a href="https://github.com/lmmfranco/nintendo-switch-eshop/issues?q=author%3ALililiuliu" title="Bug reports">🐛</a> <a href="https://github.com/lmmfranco/nintendo-switch-eshop/commits?author=Lililiuliu" title="Code">💻</a></td> | ||
<td align="center"><a href="https://github.com/ende124"><img src="https://avatars1.githubusercontent.com/u/3050747?v=4?s=100" width="100px;" alt=""/><br /><sub><b>ende124</b></sub></a><br /><a href="https://github.com/lmmfranco/nintendo-switch-eshop/issues?q=author%3Aende124" title="Bug reports">🐛</a> <a href="https://github.com/lmmfranco/nintendo-switch-eshop/commits?author=ende124" title="Code">💻</a></td> | ||
<td align="center"><a href="https://github.com/junyeonglee"><img src="https://avatars3.githubusercontent.com/u/53418618?v=4?s=100" width="100px;" alt=""/><br /><sub><b>junyeonglee</b></sub></a><br /><a href="https://github.com/lmmfranco/nintendo-switch-eshop/issues?q=author%3Ajunyeonglee" title="Bug reports">🐛</a> <a href="https://github.com/lmmfranco/nintendo-switch-eshop/commits?author=junyeonglee" title="Code">💻</a></td> | ||
</tr> | ||
</table> | ||
<!-- markdownlint-enable --> | ||
<!-- prettier-ignore-end --> | ||
<!-- ALL-CONTRIBUTORS-LIST:END --> | ||
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! |
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
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
280596
4
21
874
72
21
- Removed@favware/querystring@^4.2.0
- Removed@favware/querystring@4.3.1(transitive)
Updatedfast-xml-parser@^3.17.4