nordnet-next-api
Advanced tools
Comparing version 4.1.1 to 4.1.4
@@ -7,3 +7,3 @@ 'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
@@ -32,2 +32,6 @@ exports.setConfig = setConfig; | ||
var merge = function merge(one, two) { | ||
return Object.assign({}, one, two); | ||
}; | ||
var defaultHeaders = { | ||
@@ -37,5 +41,5 @@ accept: 'application/json' | ||
var postDefaultHeaders = Object.assign({ | ||
'content-type': 'application/x-www-form-urlencoded' | ||
}, defaultHeaders); | ||
function postDefaultHeaders() { | ||
return merge({ 'content-type': 'application/x-www-form-urlencoded' }, defaultHeaders); | ||
} | ||
@@ -52,3 +56,3 @@ var state = { | ||
function setConfig() { | ||
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
@@ -68,4 +72,4 @@ configKeys.forEach(function (key) { | ||
function get(url) { | ||
var params = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
var headers = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; | ||
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var headers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
@@ -83,4 +87,4 @@ var options = { | ||
function post(url) { | ||
var params = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
var headers = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; | ||
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var headers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
@@ -98,8 +102,5 @@ var options = { | ||
function postJson(url) { | ||
var params = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
var headers = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; | ||
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var headers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var merge = function merge(one, two) { | ||
return Object.assign({}, one, two); | ||
}; | ||
return post(url, params, merge(headers, { 'Content-type': 'application/json' })); | ||
@@ -109,4 +110,4 @@ } | ||
function put(url) { | ||
var params = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
var headers = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; | ||
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var headers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
@@ -124,8 +125,5 @@ var options = { | ||
function putJson(url) { | ||
var params = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
var headers = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; | ||
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var headers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var merge = function merge(one, two) { | ||
return Object.assign({}, one, two); | ||
}; | ||
return put(url, params, merge(headers, { 'Content-type': 'application/json' })); | ||
@@ -135,4 +133,4 @@ } | ||
function del(url) { | ||
var params = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
var headers = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; | ||
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var headers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
@@ -244,3 +242,3 @@ var options = { | ||
function buildUrl(path) { | ||
var query = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1]; | ||
var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
@@ -267,3 +265,3 @@ var queryParams = query.length ? query.join('&') : ''; | ||
function isNotValidPath(url) { | ||
var params = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
@@ -288,3 +286,3 @@ return !!(url.match(regUrlParam) || []).map(function (key) { | ||
function buildParams() { | ||
var params = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
@@ -301,3 +299,3 @@ return Object.keys(params).map(function (key) { | ||
function getDefaultMethodHeaders(method) { | ||
return method === 'post' || method === 'put' ? postDefaultHeaders : defaultHeaders; | ||
return method === 'post' || method === 'put' ? postDefaultHeaders() : defaultHeaders; | ||
} | ||
@@ -304,0 +302,0 @@ |
{ | ||
"name": "nordnet-next-api", | ||
"version": "4.1.1", | ||
"version": "4.1.4", | ||
"description": "Nordnet nExt API Javascript client", | ||
@@ -58,3 +58,3 @@ "main": "lib/index.js", | ||
"karma-mocha-reporter": "1.0.2", | ||
"karma-phantomjs-launcher": "0.1.4", | ||
"karma-phantomjs-launcher": "^1.0.2", | ||
"karma-sinon": "1.0.4", | ||
@@ -66,3 +66,3 @@ "karma-source-map-support": "1.0.0", | ||
"mocha-loader": "^0.7.1", | ||
"phantomjs": "^1.9.17", | ||
"phantomjs": "^2.1.7", | ||
"rimraf": "^2.3.4", | ||
@@ -69,0 +69,0 @@ "sinon": "^1.15.4", |
@@ -11,2 +11,4 @@ import es6Promise from 'es6-promise'; | ||
const merge = (one, two) => Object.assign({}, one, two); | ||
const defaultHeaders = { | ||
@@ -16,5 +18,8 @@ accept: 'application/json', | ||
const postDefaultHeaders = Object.assign({ | ||
'content-type': 'application/x-www-form-urlencoded', | ||
}, defaultHeaders); | ||
function postDefaultHeaders() { | ||
return merge( | ||
{ 'content-type': 'application/x-www-form-urlencoded' }, | ||
defaultHeaders | ||
); | ||
} | ||
@@ -64,3 +69,2 @@ const state = { | ||
export function postJson(url, params = {}, headers = {}) { | ||
const merge = (one, two) => Object.assign({}, one, two); | ||
return post(url, params, merge(headers, { 'Content-type': 'application/json' })); | ||
@@ -81,3 +85,2 @@ } | ||
export function putJson(url, params = {}, headers = {}) { | ||
const merge = (one, two) => Object.assign({}, one, two); | ||
return put(url, params, merge(headers, { 'Content-type': 'application/json' })); | ||
@@ -232,3 +235,3 @@ } | ||
function getDefaultMethodHeaders(method) { | ||
return method === 'post' || method === 'put' ? postDefaultHeaders : defaultHeaders; | ||
return method === 'post' || method === 'put' ? postDefaultHeaders() : defaultHeaders; | ||
} | ||
@@ -235,0 +238,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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
54326
1387
4