From a725f4517f85ea3790ea2305322baed4ef4a912e Mon Sep 17 00:00:00 2001 From: Taylor Downs Date: Mon, 25 Jan 2021 13:46:09 +0000 Subject: [PATCH] fix docs for post --- lib/Adaptor.js | 2 +- lib/Utils.js | 18 ------------------ src/Adaptor.js | 2 +- src/Utils.js | 22 ++-------------------- 4 files changed, 4 insertions(+), 40 deletions(-) diff --git a/lib/Adaptor.js b/lib/Adaptor.js index 0df94bb..6e19a61 100644 --- a/lib/Adaptor.js +++ b/lib/Adaptor.js @@ -202,7 +202,6 @@ function get(path, params, callback) { * @public * @example * post("/myendpoint", { - * @function * body: {"foo": "bar"}, * headers: {"content-type": "application/json"}, * authentication: {username: "user", password: "pass"}, @@ -211,6 +210,7 @@ function get(path, params, callback) { * return state; * } * ) + * @function * @param {string} path - Path to resource * @param {object} params - Body, Query, Headers and Authentication parameters * @param {function} callback - (Optional) Callback function diff --git a/lib/Utils.js b/lib/Utils.js index 1a274c1..2528ac2 100644 --- a/lib/Utils.js +++ b/lib/Utils.js @@ -8,7 +8,6 @@ exports.setAuth = setAuth; exports.assembleError = assembleError; exports.tryJson = tryJson; exports.mapToAxiosConfig = mapToAxiosConfig; -exports.recursivelyExpandReferences = recursivelyExpandReferences; var _formData = _interopRequireDefault(require("form-data")); @@ -115,20 +114,3 @@ function mapToAxiosConfig(requestConfig) { }; } - -function recursivelyExpandReferences(thing) { - return state => { - if (typeof thing !== 'object') return typeof thing == 'function' ? thing(state) : thing; - let result = (0, _fp.mapValues)(function (value) { - if (Array.isArray(value)) { - return value.map(item => { - return recursivelyExpandReferences(item)(state); - }); - } else { - return recursivelyExpandReferences(value)(state); - } - })(thing); - if (Array.isArray(thing)) result = Object.values(result); - return result; - }; -} diff --git a/src/Adaptor.js b/src/Adaptor.js index 1db1e93..f092a54 100644 --- a/src/Adaptor.js +++ b/src/Adaptor.js @@ -133,7 +133,6 @@ export function get(path, params, callback) { * @public * @example * post("/myendpoint", { - * @function * body: {"foo": "bar"}, * headers: {"content-type": "application/json"}, * authentication: {username: "user", password: "pass"}, @@ -142,6 +141,7 @@ export function get(path, params, callback) { * return state; * } * ) + * @function * @param {string} path - Path to resource * @param {object} params - Body, Query, Headers and Authentication parameters * @param {function} callback - (Optional) Callback function diff --git a/src/Utils.js b/src/Utils.js index d71e744..7fd46fb 100644 --- a/src/Utils.js +++ b/src/Utils.js @@ -1,5 +1,5 @@ import FormData from 'form-data'; -import { mapValues, isEmpty } from 'lodash/fp'; +import { isEmpty } from 'lodash/fp'; export function setUrl(configuration, path) { if (configuration && configuration.baseUrl) @@ -103,22 +103,4 @@ export function mapToAxiosConfig(requestConfig) { // cancelToken, // decompress, }; -} - -export function recursivelyExpandReferences(thing) { - return state => { - if (typeof thing !== 'object') - return typeof thing == 'function' ? thing(state) : thing; - let result = mapValues(function (value) { - if (Array.isArray(value)) { - return value.map(item => { - return recursivelyExpandReferences(item)(state); - }); - } else { - return recursivelyExpandReferences(value)(state); - } - })(thing); - if (Array.isArray(thing)) result = Object.values(result); - return result; - }; -} +} \ No newline at end of file