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

@markuplint/ml-config

Package Overview
Dependencies
Maintainers
1
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@markuplint/ml-config - npm Package Compare versions

Comparing version 2.0.0-dev.2021116.0 to 2.0.0-dev.2021116.1

80

lib/merge-config.js

@@ -32,2 +32,42 @@ "use strict";

exports.mergeConfig = mergeConfig;
function mergeRule(a, b) {
// Particular behavior:
//
// If the right-side value is false, return false.
// In short; The `false` makes the rule to be disabled absolutely.
if (b === false || (!isRuleConfigValue(b) && b.value === false)) {
return false;
}
if (a === undefined) {
return b;
}
if (isRuleConfigValue(b)) {
if (isRuleConfigValue(a)) {
if (Array.isArray(a) && Array.isArray(b)) {
return [...a, ...b];
}
return b;
}
const value = Array.isArray(a.value) && Array.isArray(b) ? [...a.value, b] : b;
const res = {
...a,
value,
};
deleteUndefProp(res);
return res;
}
const severity = b.severity || (!isRuleConfigValue(a) ? a.severity : undefined);
const value = b.value || (isRuleConfigValue(a) ? a : a.value);
const option = mergeObject(!isRuleConfigValue(a) ? a.option : undefined, b.option);
const reason = b.reason || (!isRuleConfigValue(a) ? a.reason : undefined);
const res = {
severity,
value,
option,
reason,
};
deleteUndefProp(res);
return res;
}
exports.mergeRule = mergeRule;
function mergeObject(a, b) {

@@ -112,42 +152,2 @@ if (a == null) {

}
function mergeRule(a, b) {
// Particular behavior:
//
// If the right-side value is false, return false.
// In short; The `false` makes the rule to be disabled absolutely.
if (b === false || (!isRuleConfigValue(b) && b.value === false)) {
return false;
}
if (a === undefined) {
return b;
}
if (isRuleConfigValue(b)) {
if (isRuleConfigValue(a)) {
if (Array.isArray(a) && Array.isArray(b)) {
return [...a, ...b];
}
return b;
}
const value = Array.isArray(a.value) && Array.isArray(b) ? [...a.value, b] : b;
const res = {
...a,
value,
};
deleteUndefProp(res);
return res;
}
const severity = b.severity || (!isRuleConfigValue(a) ? a.severity : undefined);
const value = b.value || (isRuleConfigValue(a) ? a : a.value);
const option = mergeObject(!isRuleConfigValue(a) ? a.option : undefined, b.option);
const reason = b.reason || (!isRuleConfigValue(a) ? a.reason : undefined);
const res = {
severity,
value,
option,
reason,
};
deleteUndefProp(res);
return res;
}
exports.mergeRule = mergeRule;
function isRuleConfigValue(v) {

@@ -154,0 +154,0 @@ switch (typeof v) {

@@ -44,2 +44,5 @@ export interface Config {

export interface NodeRule {
/**
* @deprecated
*/
tagName?: string;

@@ -54,2 +57,5 @@ selector?: string;

export interface ChildNodeRule {
/**
* @deprecated
*/
tagName?: string;

@@ -56,0 +62,0 @@ selector?: string;

{
"name": "@markuplint/ml-config",
"version": "2.0.0-dev.2021116.0",
"version": "2.0.0-dev.2021116.1",
"description": "JSON Schema and TypeScript types of markuplint configure JSON",

@@ -26,3 +26,3 @@ "repository": "git@github.com:markuplint/markuplint.git",

},
"gitHead": "9a97f1e837bd86d72bd3980b0fb11245c6b3e8f7"
"gitHead": "e2cae0bdc2088bf40c4301171e939c7281d2f602"
}

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