@6river/reason-guard
Advanced tools
Comparing version 5.1.2 to 6.0.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.altGuard = void 0; | ||
const notGuard_1 = require("./notGuard"); | ||
const NegatableGuard_1 = require("../NegatableGuard"); | ||
const notGuard_1 = require("./notGuard"); | ||
/** | ||
@@ -7,0 +7,0 @@ * A guard that narrows an A/B choice to a single alternative |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.andGuard = void 0; | ||
const NegatableGuard_1 = require("../NegatableGuard"); | ||
const notGuard_1 = require("./notGuard"); | ||
const orGuard_1 = require("./orGuard"); | ||
const NegatableGuard_1 = require("../NegatableGuard"); | ||
const andGuard = (left, right) => (0, NegatableGuard_1.buildNegatable)(() => getRawAnd(left, right), () => getRawNegatedAnd(left, right)); | ||
@@ -8,0 +8,0 @@ exports.andGuard = andGuard; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.orGuard = void 0; | ||
const andGuard_1 = require("./andGuard"); | ||
const notGuard_1 = require("./notGuard"); | ||
const NegatableGuard_1 = require("../NegatableGuard"); | ||
const ReasonGuard_1 = require("../ReasonGuard"); | ||
const andGuard_1 = require("./andGuard"); | ||
const notGuard_1 = require("./notGuard"); | ||
const orGuard = (left, right) => (0, NegatableGuard_1.buildNegatable)(() => getRawOr(left, right), () => getRawNegatedOr(left, right)); | ||
@@ -9,0 +9,0 @@ exports.orGuard = orGuard; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.thenGuard = void 0; | ||
const NegatableGuard_1 = require("../NegatableGuard"); | ||
const notGuard_1 = require("./notGuard"); | ||
const orGuard_1 = require("./orGuard"); | ||
const NegatableGuard_1 = require("../NegatableGuard"); | ||
const thenGuard = (left, right) => (0, NegatableGuard_1.buildNegatable)(() => getRawThen(left, right), () => getRawNegatedThen(left, right)); | ||
@@ -8,0 +8,0 @@ exports.thenGuard = thenGuard; |
@@ -30,2 +30,4 @@ "use strict"; | ||
Object.getOwnPropertySymbols(definition).forEach(checkProperty); | ||
// rule is wrong, doesn't understand calls to checkProperty | ||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | ||
if (!anyPassed && !anyFailed) { | ||
@@ -32,0 +34,0 @@ output?.push((0, ReasonGuard_1.errorLike)('definition had no guards')); |
@@ -8,3 +8,3 @@ export declare const isUndefined: import("./NegatableGuard").NegatableGuard<unknown, undefined, unknown>; | ||
export declare const isSymbol: import("./NegatableGuard").NegatableGuard<unknown, symbol, unknown>; | ||
export declare const isBigInt: import("./NegatableGuard").NegatableGuard<unknown, BigInt, unknown>; | ||
export declare const isBigInt: import("./NegatableGuard").NegatableGuard<unknown, bigint, unknown>; | ||
export declare const isObject: import("./NegatableGuard").NegatableGuard<unknown, object, unknown>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
require("mocha"); | ||
const assertGuards_1 = require("./assertGuards"); | ||
const arrayHasType_1 = require("../src/arrayHasType"); | ||
const primitiveGuards_1 = require("../src/primitiveGuards"); | ||
const assertGuards_1 = require("./assertGuards"); | ||
describe('array has type', function () { | ||
@@ -8,0 +8,0 @@ it('guards for correct type', function () { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const testCombinator_1 = require("./testCombinator"); | ||
const src_1 = require("../../src"); | ||
const testCombinator_1 = require("./testCombinator"); | ||
describe('alt', function () { | ||
@@ -6,0 +6,0 @@ (0, testCombinator_1.testOneArgCombinator)('~', [false, true, false, true], src_1.altGuard); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const chai_1 = require("chai"); | ||
const testCombinator_1 = require("./testCombinator"); | ||
const src_1 = require("../../src"); | ||
const testCombinator_1 = require("./testCombinator"); | ||
describe('and', function () { | ||
@@ -7,0 +7,0 @@ it('behaves as && at runtime', function () { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const testCombinator_1 = require("./testCombinator"); | ||
const src_1 = require("../../src"); | ||
const testCombinator_1 = require("./testCombinator"); | ||
describe('Builders', function () { | ||
@@ -6,0 +6,0 @@ context('ands', function () { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const testCombinator_1 = require("./testCombinator"); | ||
const src_1 = require("../../src"); | ||
const testCombinator_1 = require("./testCombinator"); | ||
describe('not', function () { | ||
@@ -6,0 +6,0 @@ context('pure not', function () { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const testCombinator_1 = require("./testCombinator"); | ||
const src_1 = require("../../src"); | ||
const testCombinator_1 = require("./testCombinator"); | ||
describe('or', function () { | ||
@@ -6,0 +6,0 @@ (0, testCombinator_1.testTwoArgCombinator)('|', [false, true, true, true], src_1.orGuard); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const testCombinator_1 = require("./testCombinator"); | ||
const src_1 = require("../../src"); | ||
const testCombinator_1 = require("./testCombinator"); | ||
describe('then', function () { | ||
@@ -6,0 +6,0 @@ it('behaves as && at runtime', function () { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const assertGuards_1 = require("./assertGuards"); | ||
const instanceGuards_1 = require("../src/instanceGuards"); | ||
const assertGuards_1 = require("./assertGuards"); | ||
describe('instance guards', function () { | ||
@@ -6,0 +6,0 @@ context('isArray', function () { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const chai_1 = require("chai"); | ||
const assertGuards_1 = require("./assertGuards"); | ||
const src_1 = require("../src"); | ||
const assertGuards_1 = require("./assertGuards"); | ||
describe('NegatableGuard', function () { | ||
@@ -7,0 +7,0 @@ context(src_1.buildNegatable.name, function () { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const assertGuards_1 = require("./assertGuards"); | ||
const src_1 = require("../src"); | ||
const assertGuards_1 = require("./assertGuards"); | ||
const commonValues = [0, 'string', false, () => null, new Date(), null, undefined, []]; | ||
@@ -6,0 +6,0 @@ function testPropertyBadValues(guard, base, prop, correctIndex, values = commonValues) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const assertGuards_1 = require("./assertGuards"); | ||
const src_1 = require("../src"); | ||
const assertGuards_1 = require("./assertGuards"); | ||
describe('parse guards', function () { | ||
@@ -6,0 +6,0 @@ context('number', function () { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const primitive = require("../src/primitiveGuards"); | ||
const assertGuards_1 = require("./assertGuards"); | ||
const benchGuards_1 = require("./benchGuards"); | ||
const primitive = require("../src/primitiveGuards"); | ||
describe('primitive guards', function () { | ||
@@ -7,0 +7,0 @@ context('isNumber', function () { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
require("mocha"); | ||
const assertGuards_1 = require("./assertGuards"); | ||
const src_1 = require("../src"); | ||
const property = require("../src/propertyGuards"); | ||
const assertGuards_1 = require("./assertGuards"); | ||
const values = [0, 'string', false, () => null, new Date(), null, undefined, []]; | ||
@@ -8,0 +8,0 @@ class TestBase { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const chai_1 = require("chai"); | ||
const assertGuards_1 = require("./assertGuards"); | ||
const src_1 = require("../src"); | ||
const assertGuards_1 = require("./assertGuards"); | ||
const trueGuard = (_) => true; | ||
@@ -7,0 +7,0 @@ describe(src_1.isRecord.name, function () { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const assertGuards_1 = require("./assertGuards"); | ||
const restricting = require("../src/restrictingGuards"); | ||
const assertGuards_1 = require("./assertGuards"); | ||
describe('restricting guards', function () { | ||
@@ -6,0 +6,0 @@ context('isDateOrStringDate', function () { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const chai_1 = require("chai"); | ||
const assertGuards_1 = require("./assertGuards"); | ||
const src_1 = require("../src"); | ||
const tupleGuards_1 = require("../src/tupleGuards"); | ||
const assertGuards_1 = require("./assertGuards"); | ||
// half the point of this spec file is to verify it compiles cleanly | ||
@@ -8,0 +8,0 @@ // sadly there are some negative tests of that sort we'd like to have, but can't do that with mocha |
@@ -8,19 +8,18 @@ { | ||
"contributors": [], | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@6river/commitlint-config-6river": "^2.2.56", | ||
"@6river/prettier-config": "^1.0.53", | ||
"@commitlint/cli": "^14.1.0", | ||
"@6river/commitlint-config-6river": "^2.2.94", | ||
"@6river/prettier-config": "^1.1.8", | ||
"@commitlint/cli": "^17.4.2", | ||
"@types/chai": "4.1.7", | ||
"@types/mocha": "^5.2.7", | ||
"@types/node": "10.14.15", | ||
"@typescript-eslint/eslint-plugin": "^5.3.0", | ||
"@typescript-eslint/parser": "^5.3.0", | ||
"@types/node": "16.18.11", | ||
"@typescript-eslint/eslint-plugin": "^5.48.2", | ||
"@typescript-eslint/parser": "^5.48.2", | ||
"chai": "4.2.0", | ||
"eslint": "^8.1.0", | ||
"eslint-config-6river": "^6.0.3", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-6river": "^1.0.6", | ||
"eslint-plugin-import": "^2.25.2", | ||
"eslint-plugin-mocha": "^9.0.0", | ||
"eslint": "^8.32.0", | ||
"eslint-config-6river": "^6.0.44", | ||
"eslint-config-prettier": "^8.6.0", | ||
"eslint-plugin-6river": "^1.0.7", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-mocha": "^10.1.0", | ||
"husky": "3.0.2", | ||
@@ -36,3 +35,3 @@ "mocha": "^9.1.3", | ||
"engines": { | ||
"node": "\u003e= 14.17.6" | ||
"node": "\u003e= 16.19.0" | ||
}, | ||
@@ -70,3 +69,3 @@ "husky": { | ||
}, | ||
"version": "5.1.2" | ||
"version": "6.0.0" | ||
} |
@@ -0,4 +1,4 @@ | ||
import { notGuard } from './notGuard'; | ||
import { buildNegatable } from '../NegatableGuard'; | ||
import { ReasonGuard } from '../ReasonGuard'; | ||
import { notGuard } from './notGuard'; | ||
@@ -5,0 +5,0 @@ /** |
@@ -0,5 +1,5 @@ | ||
import { notGuard } from './notGuard'; | ||
import { orGuard } from './orGuard'; | ||
import { buildNegatable } from '../NegatableGuard'; | ||
import { ReasonGuard } from '../ReasonGuard'; | ||
import { notGuard } from './notGuard'; | ||
import { orGuard } from './orGuard'; | ||
@@ -6,0 +6,0 @@ export const andGuard = <FROM, LEFT extends FROM, RIGHT extends FROM>( |
@@ -1,2 +0,1 @@ | ||
import { ReasonGuard } from '../ReasonGuard'; | ||
import { andGuard } from './andGuard'; | ||
@@ -6,2 +5,3 @@ import { notGuard } from './notGuard'; | ||
import { thenGuard } from './thenGuard'; | ||
import { ReasonGuard } from '../ReasonGuard'; | ||
@@ -8,0 +8,0 @@ export class FluentGuardBuilder<FROM, TO extends FROM> { |
@@ -0,5 +1,5 @@ | ||
import { andGuard } from './andGuard'; | ||
import { notGuard } from './notGuard'; | ||
import { buildNegatable } from '../NegatableGuard'; | ||
import { ErrorLike, errorLike, ReasonGuard } from '../ReasonGuard'; | ||
import { andGuard } from './andGuard'; | ||
import { notGuard } from './notGuard'; | ||
@@ -6,0 +6,0 @@ export const orGuard = <FROM, LEFT extends FROM, RIGHT extends FROM>( |
@@ -0,5 +1,5 @@ | ||
import { notGuard } from './notGuard'; | ||
import { orGuard } from './orGuard'; | ||
import { buildNegatable } from '../NegatableGuard'; | ||
import { ReasonGuard } from '../ReasonGuard'; | ||
import { notGuard } from './notGuard'; | ||
import { orGuard } from './orGuard'; | ||
@@ -6,0 +6,0 @@ export const thenGuard = <FROM, MID extends FROM, TO extends MID>( |
@@ -82,2 +82,4 @@ import { thenGuard } from './Combinators'; | ||
// rule is wrong, doesn't understand calls to checkProperty | ||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | ||
if (!anyPassed && !anyFailed) { | ||
@@ -84,0 +86,0 @@ output?.push(errorLike('definition had no guards')); |
@@ -42,3 +42,3 @@ import { checkerToGuard } from './Checker'; | ||
export const isSymbol = getPrimitiveTypeCheck<symbol>('symbol'); | ||
export const isBigInt = getPrimitiveTypeCheck<BigInt>('bigint'); | ||
export const isBigInt = getPrimitiveTypeCheck<bigint>('bigint'); | ||
export const isObject = andGuard(getPrimitiveTypeCheck<object>('object'), notGuard(isNull)); |
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
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
271671
3292
0