Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

asksteem

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asksteem - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

8

examples/search.js
var AskSteem = require('../index.js')
AskSteem.search({q: 'amy winehouse', include: 'meta'}, function(error, response, request) {
console.log(request.request.uri)
console.log(response.results.length + ' results found')
var query = 'amy winehouse'
AskSteem.search({q: query, include: 'meta'}, function(error, response, request) {
if (error) console.log(error, request)
else console.log(response.results.length+' results for '+query)
})
'use strict';
var request = require('request');
var fetch = require('fetch');

@@ -57,3 +57,3 @@ var pathVarsRe = /\${([^\}]+)}/g;

function buildWrapperFn(root, parseResult, method, requestModule, requestOptions, shouldParseJson) {
function buildWrapperFn(root, parseResult, method, fetch, requestOptions, shouldParseJson) {
requestOptions = requestOptions || {};

@@ -69,6 +69,4 @@

var uri = buildUri(root, args, parseResult);
var next = shouldParseJson ? getParseJsonFn(cb) : cb;
Object.assign(requestOptions, moreRequestOptions);
requestOptions.uri = uri;
requestOptions.method = method.toUpperCase();

@@ -78,3 +76,3 @@ requestOptions.body = body;

return requestModule(requestOptions, next);
return fetch.fetchUrl(uri, requestOptions, getParseJsonFn(cb));
}

@@ -90,7 +88,6 @@ } else {

requestOptions.uri = uri;
requestOptions.method = method.toUpperCase();
requestOptions.credentials = "omit";
return requestModule(requestOptions, getParseJsonFn(cb));
return fetch.fetchUrl(uri, requestOptions, getParseJsonFn(cb));
}

@@ -138,3 +135,2 @@ }

var requestDefaults = config.requestDefaults;
var requestModule = requestDefaults ? request.defaults(requestDefaults) : request;
var wrapper = {};

@@ -156,3 +152,3 @@

parseResult = parse(pathPattern);
wrapper[key] = buildWrapperFn(root, parseResult, method, requestModule, requestOptions, shouldParseJson);
wrapper[key] = buildWrapperFn(root, parseResult, method, fetch, requestOptions, shouldParseJson);
});

@@ -159,0 +155,0 @@

{
"name": "asksteem",
"version": "0.0.4",
"version": "0.0.5",
"description": "Wrapper for the AskSteem API",

@@ -16,4 +16,4 @@ "main": "index.js",

"dependencies": {
"request": "^2.83.0"
"fetch": "^1.1.0"
}
}
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc