Comparing version 0.0.1 to 1.0.0
@@ -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); |
{ | ||
"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 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
1
4073
54
59
- Removedobject-assign@^4.0.1
- Removedqs@^5.1.0
- Removedobject-assign@4.1.1(transitive)
- Removedqs@5.2.1(transitive)