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

egg-leaf

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

egg-leaf - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

32

app/middleware/leaf.js

@@ -8,2 +8,3 @@ 'use strict';

const schemeToJSON = require('schema-to-json');
const formatLeafApiValue = require('format-leaf-api-value');

@@ -23,3 +24,3 @@ module.exports = () => {

const apiData = yield genApiData(apiFilePath);
this.body = removeSplitLine(apiData);
this.body = formatLeafApiValue(apiData);
};

@@ -163,30 +164,1 @@ };

// }
function getValue(value) {
const arr = value.split('|');
if (arr.length < 2) return value;
const maps = {
string: arr[0],
number: Number(arr[0]),
boolean: arr[0] === 'true',
};
return maps[arr[1]] ? maps[arr[1]] : arr[0];
}
function removeSplitLine(obj) {
if (obj === null || typeof obj !== 'object') {
return obj;
}
const temp = obj.constructor();
for (const key in obj) {
if (typeof obj[key] === 'string') {
temp[key] = getValue(obj[key]);
} else {
temp[key] = removeSplitLine(obj[key]);
}
}
return temp;
}

10

CHANGELOG.md

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

<a name="1.3.0"></a>
# [1.3.0](https://github.com/eggjs/egg-leaf/compare/v1.2.0...v1.3.0) (2017-12-26)
### Features
* use format-leaf-api-value ([236d4e1](https://github.com/eggjs/egg-leaf/commit/236d4e1))
<a name="1.2.0"></a>

@@ -7,0 +17,0 @@ # [1.2.0](https://github.com/eggjs/egg-leaf/compare/v1.1.0...v1.2.0) (2017-12-26)

{
"name": "egg-leaf",
"version": "1.2.0",
"version": "1.3.0",
"description": "Mock server for egg",

@@ -17,3 +17,4 @@ "eggPlugin": {

"decomment": "^0.9.0",
"md-to-schema": "^1.1.0",
"format-leaf-api-value": "^1.0.0",
"md-to-schema": "^1.1.1",
"mockjs": "^1.0.1-beta3",

@@ -20,0 +21,0 @@ "schema-to-json": "^1.0.0"

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