Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

leaf-converter

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leaf-converter - npm Package Compare versions

Comparing version 1.3.1 to 1.4.0

10

CHANGELOG.md

@@ -5,2 +5,12 @@ # Change Log

<a name="1.4.0"></a>
# [1.4.0](https://github.com/forsigner/leaf-converter/compare/v1.3.1...v1.4.0) (2018-01-16)
### Features
* improve md ([7426cca](https://github.com/forsigner/leaf-converter/commit/7426cca))
<a name="1.3.1"></a>

@@ -7,0 +17,0 @@ ## [1.3.1](https://github.com/forsigner/leaf-converter/compare/v1.3.0...v1.3.1) (2018-01-16)

2

lib/object-to-md/constant.js

@@ -5,3 +5,3 @@ 'use strict';

var REQUEST = '\n# Request\n\n```js\n<%= request %>\n```\n';
var REQUEST = '\n# Request\n\n```js\n// <%= type %>\n<%= request %>\n```\n';

@@ -8,0 +8,0 @@ var RESPONSE = '\n\n## Scene <%= scene %>\n\n```yaml\ndesc: <%= desc %>\nmock: <%= enableMock %>\ndelay: <%= delay %>\n```\n\n```js\n<%= body %>\n```\n';

@@ -14,2 +14,6 @@ 'use strict';

if (_.isEmpty(obj)) return '';
var method = obj.basic.method;
console.log('-------------------------');
console.log(method);
var basic = obj.basic,

@@ -19,3 +23,3 @@ request = obj.request,

return [toBasic(basic), toRequest(request)].concat(_toConsumableArray(toResponses(responses))).join('');
return [toBasic(basic), toRequest(request, method)].concat(_toConsumableArray(toResponses(responses))).join('');
};

@@ -15,18 +15,15 @@ 'use strict';

var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var method = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'GET';
if (_.isEmpty(obj)) return '';
return compileRequest(obj);
return compileRequest(obj, method);
};
function compileRequest(request) {
var requestObj = {};
Object.keys(request).forEach(function (item) {
if (_.isEmpty(request[item])) return;
requestObj[item] = schemeToObject(toJS(request[item]), { comment: true });
});
function compileRequest(request, method) {
var requestType = method === 'GET' ? 'query' : 'body';
var requestObj = schemeToObject(toJS(request[requestType] || {}), { comment: true });
var requestContent = stringify(requestObj);
var compiledRequest = _.template(REQUEST);
return compiledRequest({ request: requestContent });
var type = method === 'GET' ? 'query object' : 'request body';
return compiledRequest({ request: requestContent, type: type });
}

@@ -27,7 +27,12 @@ 'use strict';

var compiledResponse = _.template(RESPONSE);
var _item$mock$options = item.mock.options,
options = _item$mock$options === undefined ? {} : _item$mock$options;
var delay = options.delay,
enable = options.enable;
return compiledResponse({
scene: key + 1,
desc: item.description,
delay: item.mock.delay,
enableMock: item.mock.enable,
delay: delay,
enableMock: enable,
body: responseContent

@@ -34,0 +39,0 @@ });

{
"name": "leaf-converter",
"description": "",
"version": "1.3.1",
"version": "1.4.0",
"main": "lib/index.js",

@@ -6,0 +6,0 @@ "author": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc