Socket
Socket
Sign inDemoInstall

baset-baseliner-md

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

baset-baseliner-md - npm Package Compare versions

Comparing version 0.12.0 to 0.12.1

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

<a name="0.12.1"></a>
## [0.12.1](https://github.com/Igmat/baset/compare/v0.12.0...v0.12.1) (2018-05-29)
### Bug Fixes
* **baseliner-md:** change html beatifier package ([0078675](https://github.com/Igmat/baset/commit/0078675))
<a name="0.12.0"></a>

@@ -8,0 +19,0 @@ # [0.12.0](https://github.com/Igmat/baset/compare/v0.11.1...v0.12.0) (2018-05-03)

42

dist/index.js

@@ -16,3 +16,3 @@ "use strict";

const baset_core_1 = require("baset-core");
const html_beautify_1 = __importDefault(require("html-beautify"));
const clean_html_1 = require("clean-html");
const markdown_1 = require("markdown");

@@ -22,4 +22,12 @@ const pixelmatch_1 = __importDefault(require("pixelmatch"));

const util_1 = require("util");
function htmlBeautify(src) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise(resolve => clean_html_1.clean(src, resolve));
});
}
function uglifyJson(json) {
return baset_core_1.utils.normalizeEndings(json).split('\n').map(line => line.trim()).join('');
}
function isEmptyJsonSting(json) {
return !json || json === '[]' || json === '{}';
return !json || json === '[]' || json === '{}' || uglifyJson(json) === '{"default": {}}';
}

@@ -48,3 +56,3 @@ const knownTypeTemplates = {

${!isEmptyJsonSting(json) ? renderJson(json) : ''}
${known.map(renderKnown)}
${known.map(renderKnown).join('')}
`;

@@ -58,4 +66,4 @@ class MDBaseliner extends baset_core_1.AbstractBaseliner {

const known = results.length === 1
? this.cutKnownTypes(results[0], 'exports')
: this.cutKnownTypes(results, 'exports');
? yield this.cutKnownTypes(results[0], 'exports')
: yield this.cutKnownTypes(results, 'exports');
return mdTemplate(yield this.jsonBaseliner.create(results), known);

@@ -66,8 +74,11 @@ });

const known = results.length === 1
? this.cutKnownTypes(results[0], 'exports')
: this.cutKnownTypes(results, 'exports');
? yield this.cutKnownTypes(results[0], 'exports')
: yield this.cutKnownTypes(results, 'exports');
const oldBase = this.parse(baselineValue);
const newJsonValues = yield this.jsonBaseliner.create(results);
const newJson = (isEmptyJsonSting(newJsonValues))
? '{}'
: newJsonValues;
let isEqual = true;
if (baset_core_1.utils.normalizeEndings(newJsonValues) !== baset_core_1.utils.normalizeEndings(oldBase.json))
if (baset_core_1.utils.normalizeEndings(newJson) !== baset_core_1.utils.normalizeEndings(oldBase.json))
isEqual = false;

@@ -115,3 +126,3 @@ if (!(yield compareKnownTypes(oldBase.knownEntities, known)))

};
this.cutKnownTypes = (parent, path, key) => {
this.cutKnownTypes = (parent, path, key) => __awaiter(this, void 0, void 0, function* () {
const obj = (key !== undefined)

@@ -123,3 +134,3 @@ ? parent[key]

if (Array.isArray(obj)) {
return [].concat(...obj.map((value, index) => this.cutKnownTypes(obj, `${path}[${index}]`, index)));
return [].concat(...yield Promise.all(obj.map((value, index) => this.cutKnownTypes(obj, `${path}[${index}]`, index))));
}

@@ -136,3 +147,3 @@ const type = obj[baset_core_1.dataTypes.image]

src: (type === baset_core_1.dataTypes.html)
? html_beautify_1.default(obj.value)
? yield htmlBeautify(obj.value)
: obj.value,

@@ -144,5 +155,5 @@ };

}
return [].concat(...Object.keys(obj)
.map(index => this.cutKnownTypes(obj, `${path}.${index}`, index)));
};
return [].concat(...yield Promise.all(Object.keys(obj)
.map(index => this.cutKnownTypes(obj, `${path}.${index}`, index))));
});
this.jsonBaseliner = new baset_baseliner_json_1.default({});

@@ -168,4 +179,5 @@ }

else {
if (baset_core_1.utils.normalizeEndings(value.src) !== baset_core_1.utils.normalizeEndings(newValue.src))
if (baset_core_1.utils.normalizeEndings(value.src) !== baset_core_1.utils.normalizeEndings(newValue.src)) {
return false;
}
}

@@ -172,0 +184,0 @@ }

{
"name": "baset-baseliner-md",
"version": "0.12.0",
"version": "0.12.1",
"description": "JSON baseliner plugin for BaseT project.",

@@ -45,3 +45,3 @@ "author": "Ihor Chulinda <ichulinda@gmail.com>",

"baset-core": "^0.12.0",
"html-beautify": "^1.0.4",
"clean-html": "^1.5.0",
"markdown": "^0.5.0",

@@ -48,0 +48,0 @@ "pixelmatch": "^4.0.2",

Sorry, the diff of this file is not supported yet

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