Socket
Socket
Sign inDemoInstall

@babel/helper-validator-option

Package Overview
Dependencies
Maintainers
4
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/helper-validator-option - npm Package Compare versions

Comparing version 7.18.6 to 7.21.0

lib/find-suggestion.js.map

20

lib/find-suggestion.js

@@ -10,23 +10,18 @@ "use strict";

} = Math;
function levenshtein(a, b) {
let t = [],
u = [],
i,
j;
u = [],
i,
j;
const m = a.length,
n = b.length;
n = b.length;
if (!m) {
return n;
}
if (!n) {
return m;
}
for (j = 0; j <= n; j++) {
t[j] = j;
}
for (i = 1; i <= m; i++) {

@@ -36,12 +31,11 @@ for (u = [i], j = 1; j <= n; j++) {

}
t = u;
}
return u[n];
}
function findSuggestion(str, arr) {
const distances = arr.map(el => levenshtein(el, str));
return arr[distances.indexOf(min(...distances))];
}
}
//# sourceMappingURL=find-suggestion.js.map

@@ -18,5 +18,5 @@ "use strict";

});
var _validator = require("./validator");
var _findSuggestion = require("./find-suggestion");
var _findSuggestion = require("./find-suggestion");
//# sourceMappingURL=index.js.map

@@ -7,5 +7,3 @@ "use strict";

exports.OptionValidator = void 0;
var _findSuggestion = require("./find-suggestion");
class OptionValidator {

@@ -15,6 +13,4 @@ constructor(descriptor) {

}
validateTopLevelOptions(options, TopLevelOptionShape) {
const validOptionNames = Object.keys(TopLevelOptionShape);
for (const option of Object.keys(options)) {

@@ -27,3 +23,2 @@ if (!validOptionNames.includes(option)) {

}
validateBooleanOption(name, value, defaultValue) {

@@ -35,6 +30,4 @@ if (value === undefined) {

}
return value;
}
validateStringOption(name, value, defaultValue) {

@@ -46,6 +39,4 @@ if (value === undefined) {

}
return value;
}
invariant(condition, message) {

@@ -56,9 +47,8 @@ if (!condition) {

}
formatMessage(message) {
return `${this.descriptor}: ${message}`;
}
}
exports.OptionValidator = OptionValidator;
exports.OptionValidator = OptionValidator;
//# sourceMappingURL=validator.js.map
{
"name": "@babel/helper-validator-option",
"version": "7.18.6",
"version": "7.21.0",
"description": "Validate plugin/preset options",

@@ -5,0 +5,0 @@ "repository": {

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