Comparing version 1.4.1 to 1.4.2
@@ -80,16 +80,3 @@ var Bequest = (function () { | ||
var data = args[0], | ||
headers = args[1], | ||
callback = args[2]; | ||
var serializedData = data; | ||
if ((typeof data === 'undefined' ? 'undefined' : _typeof(data)) === 'object' && data !== null) { | ||
serializedData = Ajax.serialize(data); | ||
var join = url.indexOf('?') > -1 ? '&' : '?'; | ||
url = url + join + serializedData; | ||
} | ||
Ajax.request(url, 'GET', null, headers, callback); | ||
return Ajax.request.apply(Ajax, [url, 'GET'].concat(args)); | ||
} | ||
@@ -103,3 +90,3 @@ }, { | ||
Ajax.request.apply(Ajax, [url, 'POST'].concat(args)); | ||
return Ajax.request.apply(Ajax, [url, 'POST'].concat(args)); | ||
} | ||
@@ -113,3 +100,3 @@ }, { | ||
Ajax.request.apply(Ajax, [url, 'PUT'].concat(args)); | ||
return Ajax.request.apply(Ajax, [url, 'PUT'].concat(args)); | ||
} | ||
@@ -123,3 +110,3 @@ }, { | ||
Ajax.request.apply(Ajax, [url, 'HEAD'].concat(args)); | ||
return Ajax.request.apply(Ajax, [url, 'HEAD'].concat(args)); | ||
} | ||
@@ -133,3 +120,3 @@ }, { | ||
Ajax.request.apply(Ajax, [url, 'DELETE'].concat(args)); | ||
return Ajax.request.apply(Ajax, [url, 'DELETE'].concat(args)); | ||
} | ||
@@ -143,3 +130,3 @@ }, { | ||
Ajax.request.apply(Ajax, [url, 'OPTIONS'].concat(args)); | ||
return Ajax.request.apply(Ajax, [url, 'OPTIONS'].concat(args)); | ||
} | ||
@@ -193,3 +180,3 @@ | ||
if (headers === null) { | ||
if (headers === null || typeof headers === 'undefined') { | ||
headers = {}; | ||
@@ -206,2 +193,14 @@ } | ||
if ((typeof data === 'undefined' ? 'undefined' : _typeof(data)) === 'object' && data !== null && method === 'GET') { | ||
var serializedData = data; | ||
if ((typeof data === 'undefined' ? 'undefined' : _typeof(data)) === 'object' && data !== null) { | ||
serializedData = Ajax.serialize(data); | ||
var join = url.indexOf('?') > -1 ? '&' : '?'; | ||
url = url + join + serializedData; | ||
data = null; | ||
} | ||
} | ||
var xhr = new XMLHttpRequest(); | ||
@@ -208,0 +207,0 @@ |
37
index.js
@@ -24,33 +24,23 @@ /* eslint-env browser */ | ||
static get(url, ...args) { | ||
const [data, headers, callback] = args; | ||
let serializedData = data; | ||
if (typeof data === 'object' && data !== null) { | ||
serializedData = Ajax.serialize(data); | ||
const join = url.indexOf('?') > -1 ? '&' : '?'; | ||
url = url + join + serializedData; | ||
} | ||
Ajax.request(url, 'GET', null, headers, callback); | ||
return Ajax.request(url, 'GET', ...args); | ||
} | ||
static post(url, ...args) { | ||
Ajax.request(url, 'POST', ...args); | ||
return Ajax.request(url, 'POST', ...args); | ||
} | ||
static put(url, ...args) { | ||
Ajax.request(url, 'PUT', ...args); | ||
return Ajax.request(url, 'PUT', ...args); | ||
} | ||
static head(url, ...args) { | ||
Ajax.request(url, 'HEAD', ...args); | ||
return Ajax.request(url, 'HEAD', ...args); | ||
} | ||
static del(url, ...args) { | ||
Ajax.request(url, 'DELETE', ...args); | ||
return Ajax.request(url, 'DELETE', ...args); | ||
} | ||
static options(url, ...args) { | ||
Ajax.request(url, 'OPTIONS', ...args); | ||
return Ajax.request(url, 'OPTIONS', ...args); | ||
} | ||
@@ -93,3 +83,3 @@ | ||
if (headers === null) { | ||
if (headers === null || typeof headers === 'undefined') { | ||
headers = {}; | ||
@@ -106,2 +96,15 @@ } | ||
if (typeof data === 'object' && | ||
data !== null && method === 'GET') { | ||
let serializedData = data; | ||
if (typeof data === 'object' && data !== null) { | ||
serializedData = Ajax.serialize(data); | ||
const join = url.indexOf('?') > -1 ? '&' : '?'; | ||
url = url + join + serializedData; | ||
data = null; | ||
} | ||
} | ||
const xhr = new XMLHttpRequest(); | ||
@@ -108,0 +111,0 @@ |
{ | ||
"name": "bequest", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "An ajax class", | ||
@@ -11,3 +11,3 @@ "main": "dist/ajax.js", | ||
"dev": "scriptkit dev", | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"test": "cat test/bequest.test.dist.js | tape-run --static . --browser phantomjs --render tap-spec", | ||
"prepublish": "scriptkit" | ||
@@ -36,11 +36,13 @@ }, | ||
"eslint-config-firstandthird": "3.2.0", | ||
"eslint-plugin-import": "2.7.0", | ||
"scriptkit": "0.2.0" | ||
"eslint-plugin-import": "2.2.0", | ||
"phantomjs-prebuilt": "2.1.14", | ||
"scriptkit": "0.2.0", | ||
"tap-spec": "4.1.1", | ||
"tape-rollup": "4.6.4", | ||
"tape-run": "2.2.0" | ||
}, | ||
"scriptkit": { | ||
"test": { | ||
"enabled": false | ||
}, | ||
"files": { | ||
"dist/ajax.js": "index.js" | ||
"dist/ajax.js": "index.js", | ||
"test/bequest.test.dist.js": "test/bequest.test.js" | ||
}, | ||
@@ -47,0 +49,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
714769
17
6937
0
7
8
2