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.20211115.0 to 2.0.0-rc.0

3

lib/merge-config.d.ts

@@ -1,2 +0,3 @@

import type { Config } from './types';
import type { Config, Nullable, AnyRule } from './types';
export declare function mergeConfig(a: Config, b: Config): Config;
export declare function mergeRule(a: Nullable<AnyRule>, b: AnyRule): AnyRule;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mergeConfig = void 0;
exports.mergeRule = exports.mergeConfig = void 0;
const tslib_1 = require("tslib");

@@ -32,2 +32,42 @@ const deepmerge_1 = (0, tslib_1.__importDefault)(require("deepmerge"));

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,32 +152,2 @@ if (a == null) {

}
function mergeRule(a, b) {
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 res = {
severity,
value,
option,
};
deleteUndefProp(res);
return res;
}
function isRuleConfigValue(v) {

@@ -144,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;

@@ -65,2 +65,9 @@ "use strict";

}
if (rule.reason != null) {
const exchangedValue = exchangeValue(rule.reason, data);
rule = {
...rule,
reason: exchangedValue ? `${exchangedValue}` : undefined,
};
}
return rule;

@@ -67,0 +74,0 @@ }

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

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

},
"gitHead": "11bcb81138ae11362add9b502124011735cc784a"
"gitHead": "67134f1addbdd271ad1d425de8f296d1875dbf25"
}

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