Socket
Socket
Sign inDemoInstall

searchitunes

Package Overview
Dependencies
1
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.5.1 to 2.5.3

1

example.js

@@ -19,1 +19,2 @@ // Load module

;

4

package.json

@@ -9,3 +9,3 @@ {

"description": "Search the Apple iTunes Store and App Store with this lightweight module",
"version": "2.5.1",
"version": "2.5.3",
"repository": {

@@ -42,3 +42,3 @@ "type": "git",

"license": "Unlicense",
"tonicExampleFilename": "example.js",
"runkitExampleFilename": "example.js",
"scripts": {

@@ -45,0 +45,0 @@ "test": "dotest"

@@ -40,8 +40,14 @@ # searchitunes

## Search by parameters
## Interface
**( params )**
The module exports only one function.
Arguments must be wrapped in an object.
It returns a Promise.
The module returns a promise.
## Configuration
The parameters below can be included along with the
normal API params.
param | type | default | description

@@ -53,2 +59,17 @@ :-----------|:-------|:----------------|:-----------

```js
itunes ({
timeout: 8000,
entity: 'software',
term: 'github',
})
```
## Search API
For searching in the iTunes databases you simply include
the search params in your request. The function will
resolve with an object.
- [Search-API docs](https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/#overview)

@@ -75,2 +96,3 @@ - [Live demo](https://npm.runkit.com/searchitunes)

- upc
- trackId

@@ -77,0 +99,0 @@ When you lookup a `trackId` from a search response it will be automatically

@@ -15,5 +15,5 @@ /*

*
* @param {object} obj Object to process
*
* @return {Promise<boolean>} `true` = yes
*
* @param {object} obj Object to process
*/

@@ -42,29 +42,8 @@

/**
* Send HTTP request
*
* @return {Promise<object>}
* @param {object} options httpreq.doRequest options
*/
function httpRequest (options) {
return new Promise ((resolve, reject) => {
doRequest (options, (err, res) => {
if (err) {
reject (err);
return;
}
resolve (res);
});
});
}
/**
* Process HTTP response
*
* @return {Promise<object|array>}
*
* @param {object} res Response
* @param {bool} [first=false] Only first result
*
* @return {Promise<object|array>}
*/

@@ -74,3 +53,3 @@

res,
first,
first = false,
}) {

@@ -100,5 +79,5 @@ return new Promise ((resolve, reject) => {

*
* @param {object} params Parameters to send along
* @param {number} [timeout=5000] Wait timeout in ms
* @param {string} [userAgent] Custom User-Agent header
* @param {object} params Parameters to send along
* @param {number} [params.timeout=5000] Wait timeout in ms
* @param {string} [params.userAgent] Custom User-Agent header
*/

@@ -108,3 +87,3 @@

let res;
let first = false;
let first;
let options = {

@@ -145,4 +124,5 @@ method: 'POST',

// Process request
res = await httpRequest (options);
res = await doRequest (options);
return httpResponse ({ res, first });
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc