Socket
Socket
Sign inDemoInstall

@6river/reason-guard

Package Overview
Dependencies
0
Maintainers
4
Versions
52
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.0 to 5.0.1-node.1

10

dist/src/Checker.js

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

if (typeof result === 'string') {
confirmations?.push(result);
confirmations === null || confirmations === void 0 ? void 0 : confirmations.push(result);
return true;

@@ -24,7 +24,7 @@ }

if (result instanceof ContextError_1.CompositeError) {
errors?.push(...result.errors);
errors === null || errors === void 0 ? void 0 : errors.push(...result.errors);
}
else {
// can't get here if we got a positive confirmation
errors?.push(result);
errors === null || errors === void 0 ? void 0 : errors.push(result);
}

@@ -40,3 +40,3 @@ return false;

if (typeof result === 'string') {
errors?.push((0, ReasonGuard_1.errorLike)(`negation of: ${result}`));
errors === null || errors === void 0 ? void 0 : errors.push((0, ReasonGuard_1.errorLike)(`negation of: ${result}`));
return false;

@@ -49,3 +49,3 @@ }

// can't get here if we got a positive inner confirmation
confirmations?.push(result.message);
confirmations === null || confirmations === void 0 ? void 0 : confirmations.push(result.message);
return true;

@@ -52,0 +52,0 @@ };

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

if (innerConfirmations) {
errors?.push((0, ReasonGuard_1.errorLike)(innerConfirmations[innerConfirmations.length - 1]));
errors === null || errors === void 0 ? void 0 : errors.push((0, ReasonGuard_1.errorLike)(innerConfirmations[innerConfirmations.length - 1]));
}

@@ -30,3 +30,3 @@ return false;

if (innerErrors) {
confirmations?.push(innerErrors[0].message);
confirmations === null || confirmations === void 0 ? void 0 : confirmations.push(innerErrors[0].message);
}

@@ -37,3 +37,3 @@ return true;

catch (err) {
errors?.push(err);
errors === null || errors === void 0 ? void 0 : errors.push(err);
return false;

@@ -40,0 +40,0 @@ }

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

if (left(input, innerErrors, innerConfirmations)) {
confirmations?.push(...innerConfirmations);
confirmations === null || confirmations === void 0 ? void 0 : confirmations.push(...innerConfirmations);
return true;

@@ -23,10 +23,10 @@ }

if (right(input, innerErrors, innerConfirmations)) {
confirmations?.push(...innerConfirmations);
confirmations === null || confirmations === void 0 ? void 0 : confirmations.push(...innerConfirmations);
return true;
}
errors?.push((0, ReasonGuard_1.errorLike)(`${innerErrors[0].message}, and ${innerErrors[1].message}`));
errors === null || errors === void 0 ? void 0 : errors.push((0, ReasonGuard_1.errorLike)(`${innerErrors[0].message}, and ${innerErrors[1].message}`));
return false;
}
catch (err) {
errors?.push(err);
errors === null || errors === void 0 ? void 0 : errors.push(err);
return false;

@@ -33,0 +33,0 @@ }

@@ -13,7 +13,7 @@ "use strict";

const unnegatableTrueGuard = (input, errors, confirmations) => {
confirmations?.push('true');
confirmations === null || confirmations === void 0 ? void 0 : confirmations.push('true');
return true;
};
const unnegatableFalseGuard = (input, errors) => {
errors?.push((0, ReasonGuard_1.errorLike)('false'));
errors === null || errors === void 0 ? void 0 : errors.push((0, ReasonGuard_1.errorLike)('false'));
return false;

@@ -20,0 +20,0 @@ };

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

if (!anyPassed && !anyFailed) {
output?.push((0, ReasonGuard_1.errorLike)('definition had no guards'));
output === null || output === void 0 ? void 0 : output.push((0, ReasonGuard_1.errorLike)('definition had no guards'));
return false;

@@ -34,0 +34,0 @@ }

@@ -126,7 +126,7 @@ "use strict";

if (values.has(input)) {
confirmations?.push(`is ${String(input)}`);
confirmations === null || confirmations === void 0 ? void 0 : confirmations.push(`is ${String(input)}`);
return true;
}
else {
errors?.push((0, ReasonGuard_1.errorLike)(`not in ${keys}`));
errors === null || errors === void 0 ? void 0 : errors.push((0, ReasonGuard_1.errorLike)(`not in ${keys}`));
return false;

@@ -136,3 +136,3 @@ }

catch (err) {
errors?.push(err);
errors === null || errors === void 0 ? void 0 : errors.push(err);
return false;

@@ -139,0 +139,0 @@ }

@@ -34,6 +34,11 @@ "use strict";

console.log(negativeResults, 'negative results');
let offset = 50;
if (process.env.CI) {
// CI runners are slow
offset += 50;
}
for (const mode of Object.keys(negativeResults)) {
chai_1.assert.isAtMost(negativeResults[mode].nsPerCall,
// negative results should be no more than 50ns+50% slower than positives
positiveResults[mode].nsPerCall * 1.5 + 50, `negative result for ${mode} should be within 50%+50ns of positive result ${positiveResults[mode].nsPerCall}`);
positiveResults[mode].nsPerCall * 1.5 + offset, `negative result for ${mode} should be within 50%+${offset}ns of positive result ${positiveResults[mode].nsPerCall}`);
}

@@ -80,4 +85,4 @@ }

// new ones
errors?.splice(0);
confirmations?.splice(0);
errors === null || errors === void 0 ? void 0 : errors.splice(0);
confirmations === null || confirmations === void 0 ? void 0 : confirmations.splice(0);
guard(values[i], errors, confirmations);

@@ -84,0 +89,0 @@ }

@@ -35,3 +35,3 @@ {

"engines": {
"node": "\u003e= 14.17.6"
"node": "\u003e= 12.0.0"
},

@@ -69,3 +69,3 @@ "husky": {

},
"version": "5.0.0"
"version": "5.0.1-node.1"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc