Comparing version 0.1.0 to 0.1.1
import { param } from '../param/index.js' | ||
import Promise from '../Promise/index.js' | ||
import { parseJSON } from '../json/index.js' | ||
import isPlainObject from './isPlainObject.js' | ||
const isObject = isType("Object") | ||
const noop = function() {} | ||
@@ -34,3 +35,3 @@ /** | ||
if (options.method === 'GET' && isObject(options.data)) { | ||
if (options.method === 'GET' && isPlainObject(options.data)) { | ||
if (!options.cache) { | ||
@@ -73,7 +74,5 @@ options.data._ = Math.random().toString().slice(2) | ||
} | ||
const setRequestHeader = (k, v) => { | ||
if ('setRequestHeader' in xhr) { | ||
xhr.setRequestHeader(k, v) | ||
} | ||
} | ||
const setRequestHeader = 'setRequestHeader' in xhr ? (k, v) => { | ||
xhr.setRequestHeader(k, v) | ||
} : noop | ||
@@ -121,3 +120,3 @@ if ('onload' in xhr) { | ||
let data = options.data | ||
if (isObject(data)) { | ||
if (isPlainObject(data)) { | ||
data = param(data) | ||
@@ -141,8 +140,2 @@ setRequestHeader('Content-Type', 'application/x-www-form-urlencoded') | ||
return target | ||
} | ||
function isType(type) { | ||
return function(obj) { | ||
return obj != null && toString.call(obj) == "[object " + type + "]" | ||
} | ||
} |
{ | ||
"name": "dx-lib", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "dx fe lib", | ||
@@ -14,4 +14,4 @@ "main": "index.js", | ||
"repository": { | ||
"type" : "git", | ||
"url" : "https://github.com/zenxds/dx-lib.git" | ||
"type": "git", | ||
"url": "https://github.com/zenxds/dx-lib.git" | ||
}, | ||
@@ -35,2 +35,3 @@ "ava": { | ||
"expect.js": "^0.3.1", | ||
"http-server": "^0.11.1", | ||
"puppeteer": "^1.1.1", | ||
@@ -37,0 +38,0 @@ "sinon": "^4.4.5" |
Sorry, the diff of this file is not supported yet
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
188958
38
1698
8