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

jsonp-p

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsonp-p - npm Package Compare versions

Comparing version 0.0.1 to 1.0.0

33

lib/jsonp-p.js

@@ -20,15 +20,2 @@ /*!

var _objectAssign = require('object-assign');
var _objectAssign2 = _interopRequireDefault(_objectAssign);
var _qs = require('qs');
var _qs2 = _interopRequireDefault(_qs);
var qsStringifyOpts = {
arrayFormat: 'repeat',
strictNullHandling: true
};
/**

@@ -38,7 +25,7 @@ * jsonpP

* @param {String} url request url
* @param {Object} config for jsonp config
* timeout: 60000
* prefix: '__jp'
* name: prefix + incremented counter
* @param {Object} queryParams rest params
* @param {Object} config for jsonp opts
* param: 'callback',
* timeout: 60000,
* prefix: '__jp',
* name: prefix + Incremented counter
* @returns {Promise}

@@ -48,12 +35,4 @@ */

function jsonpP(url, config) {
for (var _len = arguments.length, queryParams = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
queryParams[_key - 2] = arguments[_key];
}
return new Promise(function (resolve, reject) {
var opts = (0, _objectAssign2['default'])({}, config, {
param: _qs2['default'].stringify(_objectAssign2['default'].apply(undefined, [{}].concat(queryParams)), qsStringifyOpts)
});
(0, _jsonp2['default'])(url, opts, function (err, res) {
(0, _jsonp2['default'])(url, config, function (err, res) {
if (err) reject(err);

@@ -60,0 +39,0 @@ resolve(res);

12

package.json
{
"name": "jsonp-p",
"version": "0.0.1",
"version": "1.0.0",
"description": "jsonp promisify wrapper.",

@@ -17,2 +17,8 @@ "repository": {

],
"keywords": [
"jsonp",
"promise",
"request",
"xhr"
],
"scripts": {

@@ -37,6 +43,4 @@ "lint": "eslint src",

"dependencies": {
"jsonp": "^0.2.0",
"object-assign": "^4.0.1",
"qs": "^5.1.0"
"jsonp": "^0.2.0"
}
}

@@ -22,10 +22,3 @@ # jsonp-p

// default
const jsonpConfig = {
timeout: 60000,
prefix: '__jp',
name: // prefix + incremented counter
};
jsonpP(url, jsonpConfig, ...restParams)
jsonpP(url, jsonpOpts)
.then(response => {})

@@ -32,0 +25,0 @@ .catch(error => {});

@@ -12,5 +12,12 @@ import { jsdom } from 'jsdom';

describe('.test()', () => {
describe('200', () => {
it('case 1', () => {
assert(true);
const expected = {
jsonpP: 'ok'
};
return jsonpP('http://www.mocky.io/v2/5611517d1200002c23953036')
.then(res => {
assert.deepEqual(res, expected, 'case 1');
})
.catch(err => console.log(err));
});

@@ -17,0 +24,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