@duplojs/utils 1.1.7 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/kind.cjs +7 -0
- package/dist/common/kind.d.ts +4 -2
- package/dist/common/kind.mjs +7 -1
- package/dist/dataParser/base.cjs +3 -3
- package/dist/dataParser/base.d.ts +2 -2
- package/dist/dataParser/base.mjs +3 -3
- package/dist/dataParser/baseExtended.cjs +2 -2
- package/dist/dataParser/baseExtended.d.ts +1 -1
- package/dist/dataParser/baseExtended.mjs +2 -2
- package/dist/dataParser/error.cjs +4 -4
- package/dist/dataParser/error.d.ts +3 -3
- package/dist/dataParser/error.mjs +4 -4
- package/dist/dataParser/kind.cjs +7 -0
- package/dist/dataParser/kind.d.ts +1 -0
- package/dist/dataParser/kind.mjs +5 -0
- package/dist/dataParser/parsers/array/checkers/max.cjs +2 -2
- package/dist/dataParser/parsers/array/checkers/max.d.ts +1 -1
- package/dist/dataParser/parsers/array/checkers/max.mjs +2 -2
- package/dist/dataParser/parsers/array/checkers/min.cjs +2 -2
- package/dist/dataParser/parsers/array/checkers/min.d.ts +1 -1
- package/dist/dataParser/parsers/array/checkers/min.mjs +2 -2
- package/dist/dataParser/parsers/array/index.cjs +2 -2
- package/dist/dataParser/parsers/array/index.d.ts +1 -1
- package/dist/dataParser/parsers/array/index.mjs +2 -2
- package/dist/dataParser/parsers/bigint/checkers/max.cjs +2 -2
- package/dist/dataParser/parsers/bigint/checkers/max.d.ts +1 -1
- package/dist/dataParser/parsers/bigint/checkers/max.mjs +2 -2
- package/dist/dataParser/parsers/bigint/checkers/min.cjs +2 -2
- package/dist/dataParser/parsers/bigint/checkers/min.d.ts +1 -1
- package/dist/dataParser/parsers/bigint/checkers/min.mjs +2 -2
- package/dist/dataParser/parsers/bigint/index.cjs +2 -2
- package/dist/dataParser/parsers/bigint/index.d.ts +1 -1
- package/dist/dataParser/parsers/bigint/index.mjs +2 -2
- package/dist/dataParser/parsers/boolean.cjs +2 -2
- package/dist/dataParser/parsers/boolean.d.ts +1 -1
- package/dist/dataParser/parsers/boolean.mjs +2 -2
- package/dist/dataParser/parsers/empty.cjs +2 -2
- package/dist/dataParser/parsers/empty.d.ts +1 -1
- package/dist/dataParser/parsers/empty.mjs +2 -2
- package/dist/dataParser/parsers/lazy.cjs +2 -2
- package/dist/dataParser/parsers/lazy.d.ts +1 -1
- package/dist/dataParser/parsers/lazy.mjs +2 -2
- package/dist/dataParser/parsers/literal.cjs +3 -3
- package/dist/dataParser/parsers/literal.d.ts +1 -1
- package/dist/dataParser/parsers/literal.mjs +3 -3
- package/dist/dataParser/parsers/nil.cjs +2 -2
- package/dist/dataParser/parsers/nil.d.ts +1 -1
- package/dist/dataParser/parsers/nil.mjs +2 -2
- package/dist/dataParser/parsers/nullable.cjs +2 -2
- package/dist/dataParser/parsers/nullable.d.ts +1 -1
- package/dist/dataParser/parsers/nullable.mjs +2 -2
- package/dist/dataParser/parsers/number/checkers/int.cjs +2 -2
- package/dist/dataParser/parsers/number/checkers/int.d.ts +1 -1
- package/dist/dataParser/parsers/number/checkers/int.mjs +2 -2
- package/dist/dataParser/parsers/number/checkers/max.cjs +2 -2
- package/dist/dataParser/parsers/number/checkers/max.d.ts +1 -1
- package/dist/dataParser/parsers/number/checkers/max.mjs +2 -2
- package/dist/dataParser/parsers/number/checkers/min.cjs +2 -2
- package/dist/dataParser/parsers/number/checkers/min.d.ts +1 -1
- package/dist/dataParser/parsers/number/checkers/min.mjs +2 -2
- package/dist/dataParser/parsers/number/index.cjs +2 -2
- package/dist/dataParser/parsers/number/index.d.ts +1 -1
- package/dist/dataParser/parsers/number/index.mjs +2 -2
- package/dist/dataParser/parsers/object.cjs +2 -2
- package/dist/dataParser/parsers/object.d.ts +1 -1
- package/dist/dataParser/parsers/object.mjs +2 -2
- package/dist/dataParser/parsers/optional.cjs +2 -2
- package/dist/dataParser/parsers/optional.d.ts +1 -1
- package/dist/dataParser/parsers/optional.mjs +2 -2
- package/dist/dataParser/parsers/pipe.cjs +2 -2
- package/dist/dataParser/parsers/pipe.d.ts +1 -1
- package/dist/dataParser/parsers/pipe.mjs +2 -2
- package/dist/dataParser/parsers/record.cjs +2 -2
- package/dist/dataParser/parsers/record.d.ts +1 -1
- package/dist/dataParser/parsers/record.mjs +2 -2
- package/dist/dataParser/parsers/string/checkers/email.cjs +2 -2
- package/dist/dataParser/parsers/string/checkers/email.d.ts +1 -1
- package/dist/dataParser/parsers/string/checkers/email.mjs +2 -2
- package/dist/dataParser/parsers/string/checkers/max.cjs +2 -2
- package/dist/dataParser/parsers/string/checkers/max.d.ts +1 -1
- package/dist/dataParser/parsers/string/checkers/max.mjs +2 -2
- package/dist/dataParser/parsers/string/checkers/min.cjs +2 -2
- package/dist/dataParser/parsers/string/checkers/min.d.ts +1 -1
- package/dist/dataParser/parsers/string/checkers/min.mjs +2 -2
- package/dist/dataParser/parsers/string/checkers/regex.cjs +2 -2
- package/dist/dataParser/parsers/string/checkers/regex.d.ts +1 -1
- package/dist/dataParser/parsers/string/checkers/regex.mjs +2 -2
- package/dist/dataParser/parsers/string/checkers/url.cjs +2 -2
- package/dist/dataParser/parsers/string/checkers/url.d.ts +1 -1
- package/dist/dataParser/parsers/string/checkers/url.mjs +2 -2
- package/dist/dataParser/parsers/string/index.cjs +2 -2
- package/dist/dataParser/parsers/string/index.d.ts +1 -1
- package/dist/dataParser/parsers/string/index.mjs +2 -2
- package/dist/dataParser/parsers/templateLiteral.cjs +2 -2
- package/dist/dataParser/parsers/templateLiteral.d.ts +1 -1
- package/dist/dataParser/parsers/templateLiteral.mjs +2 -2
- package/dist/dataParser/parsers/transform.cjs +2 -2
- package/dist/dataParser/parsers/transform.d.ts +1 -1
- package/dist/dataParser/parsers/transform.mjs +2 -2
- package/dist/dataParser/parsers/tuple.cjs +2 -2
- package/dist/dataParser/parsers/tuple.d.ts +1 -1
- package/dist/dataParser/parsers/tuple.mjs +2 -2
- package/dist/dataParser/parsers/union.cjs +2 -2
- package/dist/dataParser/parsers/union.d.ts +1 -1
- package/dist/dataParser/parsers/union.mjs +2 -2
- package/dist/dataParser/parsers/unknown.cjs +2 -2
- package/dist/dataParser/parsers/unknown.d.ts +1 -1
- package/dist/dataParser/parsers/unknown.mjs +2 -2
- package/dist/either/bool/base.cjs +2 -2
- package/dist/either/bool/base.d.ts +1 -1
- package/dist/either/bool/base.mjs +2 -2
- package/dist/either/bool/falsy.cjs +4 -4
- package/dist/either/bool/falsy.d.ts +4 -4
- package/dist/either/bool/falsy.mjs +4 -4
- package/dist/either/bool/truthy.cjs +3 -3
- package/dist/either/bool/truthy.d.ts +5 -5
- package/dist/either/bool/truthy.mjs +3 -3
- package/dist/either/future/base.cjs +2 -2
- package/dist/either/future/base.d.ts +1 -1
- package/dist/either/future/base.mjs +2 -2
- package/dist/either/future/error.cjs +2 -2
- package/dist/either/future/error.d.ts +1 -1
- package/dist/either/future/error.mjs +2 -2
- package/dist/either/future/success.cjs +2 -2
- package/dist/either/future/success.d.ts +2 -2
- package/dist/either/future/success.mjs +2 -2
- package/dist/either/hasInformation.cjs +3 -3
- package/dist/either/hasInformation.d.ts +1 -1
- package/dist/either/hasInformation.mjs +1 -1
- package/dist/either/index.cjs +3 -2
- package/dist/either/index.d.ts +1 -1
- package/dist/either/index.mjs +1 -1
- package/dist/either/kind.cjs +9 -0
- package/dist/either/kind.d.ts +2 -0
- package/dist/either/kind.mjs +6 -0
- package/dist/either/left/create.cjs +3 -4
- package/dist/either/left/create.d.ts +2 -2
- package/dist/either/left/create.mjs +2 -3
- package/dist/either/left/error.cjs +2 -2
- package/dist/either/left/error.d.ts +1 -1
- package/dist/either/left/error.mjs +2 -2
- package/dist/either/left/fail.cjs +2 -2
- package/dist/either/left/fail.d.ts +1 -1
- package/dist/either/left/fail.mjs +2 -2
- package/dist/either/left/is.cjs +2 -2
- package/dist/either/left/is.mjs +1 -1
- package/dist/either/nullable/base.cjs +2 -2
- package/dist/either/nullable/base.d.ts +1 -1
- package/dist/either/nullable/base.mjs +2 -2
- package/dist/either/nullable/empty.cjs +2 -2
- package/dist/either/nullable/empty.d.ts +1 -1
- package/dist/either/nullable/empty.mjs +2 -2
- package/dist/either/nullable/filled.cjs +2 -2
- package/dist/either/nullable/filled.d.ts +1 -1
- package/dist/either/nullable/filled.mjs +2 -2
- package/dist/either/nullish/base.cjs +2 -2
- package/dist/either/nullish/base.d.ts +1 -1
- package/dist/either/nullish/base.mjs +2 -2
- package/dist/either/nullish/empty.cjs +2 -2
- package/dist/either/nullish/empty.d.ts +2 -2
- package/dist/either/nullish/empty.mjs +2 -2
- package/dist/either/nullish/filled.cjs +3 -3
- package/dist/either/nullish/filled.d.ts +1 -1
- package/dist/either/nullish/filled.mjs +3 -3
- package/dist/either/optional/base.cjs +2 -2
- package/dist/either/optional/base.d.ts +1 -1
- package/dist/either/optional/base.mjs +2 -2
- package/dist/either/optional/empty.cjs +4 -4
- package/dist/either/optional/empty.d.ts +3 -3
- package/dist/either/optional/empty.mjs +4 -4
- package/dist/either/optional/filled.cjs +4 -4
- package/dist/either/optional/filled.d.ts +3 -3
- package/dist/either/optional/filled.mjs +4 -4
- package/dist/either/right/create.cjs +3 -4
- package/dist/either/right/create.d.ts +2 -2
- package/dist/either/right/create.mjs +2 -3
- package/dist/either/right/is.cjs +2 -2
- package/dist/either/right/is.mjs +1 -1
- package/dist/either/right/ok.cjs +2 -2
- package/dist/either/right/ok.d.ts +1 -1
- package/dist/either/right/ok.mjs +2 -2
- package/dist/either/right/success.cjs +2 -2
- package/dist/either/right/success.d.ts +2 -2
- package/dist/either/right/success.mjs +2 -2
- package/dist/either/whenHasInformation.cjs +2 -2
- package/dist/either/whenHasInformation.d.ts +1 -1
- package/dist/either/whenHasInformation.mjs +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.mjs +1 -1
- package/dist/number/greater.cjs +12 -0
- package/dist/number/greater.d.ts +2 -0
- package/dist/number/greater.mjs +10 -0
- package/dist/number/greaterThan.cjs +12 -0
- package/dist/number/greaterThan.d.ts +2 -0
- package/dist/number/greaterThan.mjs +10 -0
- package/dist/number/index.cjs +8 -0
- package/dist/number/index.d.ts +4 -0
- package/dist/number/index.mjs +4 -0
- package/dist/number/less.cjs +12 -0
- package/dist/number/less.d.ts +2 -0
- package/dist/number/less.mjs +10 -0
- package/dist/number/lessThan.cjs +12 -0
- package/dist/number/lessThan.d.ts +2 -0
- package/dist/number/lessThan.mjs +10 -0
- package/dist/string/types/forbiddenCharacters.d.ts +5 -0
- package/dist/string/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/dist/either/base.cjs +0 -7
- package/dist/either/base.d.ts +0 -1
- package/dist/either/base.mjs +0 -5
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var kind = require('../../../common/kind.cjs');
|
|
4
3
|
var base = require('../../base.cjs');
|
|
5
4
|
var error = require('../../error.cjs');
|
|
5
|
+
var kind = require('../../kind.cjs');
|
|
6
6
|
|
|
7
|
-
const dataParserStringKind = kind.
|
|
7
|
+
const dataParserStringKind = kind.createDataParserKind("string");
|
|
8
8
|
function string(definition) {
|
|
9
9
|
return base.dataParserInit(dataParserStringKind, {
|
|
10
10
|
definition: {
|
|
@@ -7,7 +7,7 @@ export type DataParserStringCheckers = (DataParserCheckerUrl | DataParserChecker
|
|
|
7
7
|
export interface DataParserDefinitionString extends DataParserDefinition<DataParserStringCheckers> {
|
|
8
8
|
readonly coerce: boolean;
|
|
9
9
|
}
|
|
10
|
-
export declare const dataParserStringKind: import("../../../common").KindHandler<import("../../../common").KindDefinition<"
|
|
10
|
+
export declare const dataParserStringKind: import("../../../common").KindHandler<import("../../../common").KindDefinition<"@DataParser/string", unknown>>;
|
|
11
11
|
type _DataParserString<GenericDefinition extends DataParserDefinitionString> = (DataParser<GenericDefinition, string, string> & Kind<typeof dataParserStringKind.definition>);
|
|
12
12
|
export interface DataParserString<GenericDefinition extends DataParserDefinitionString = DataParserDefinitionString> extends _DataParserString<GenericDefinition> {
|
|
13
13
|
addChecker<GenericChecker extends readonly [
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createKind } from '../../../common/kind.mjs';
|
|
2
1
|
import { dataParserInit } from '../../base.mjs';
|
|
3
2
|
import { SymbolDataParserErrorIssue } from '../../error.mjs';
|
|
3
|
+
import { createDataParserKind } from '../../kind.mjs';
|
|
4
4
|
|
|
5
|
-
const dataParserStringKind =
|
|
5
|
+
const dataParserStringKind = createDataParserKind("string");
|
|
6
6
|
function string(definition) {
|
|
7
7
|
return dataParserInit(dataParserStringKind, {
|
|
8
8
|
definition: {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var escapeRegExp = require('../../common/escapeRegExp.cjs');
|
|
4
|
-
var kind = require('../../common/kind.cjs');
|
|
5
4
|
var pipe = require('../../common/pipe.cjs');
|
|
6
5
|
var innerPipe = require('../../common/innerPipe.cjs');
|
|
7
6
|
var when$1 = require('../../common/when.cjs');
|
|
@@ -22,8 +21,9 @@ var literal = require('./literal.cjs');
|
|
|
22
21
|
var empty = require('./empty.cjs');
|
|
23
22
|
var nil = require('./nil.cjs');
|
|
24
23
|
var boolean = require('./boolean.cjs');
|
|
24
|
+
var kind = require('../kind.cjs');
|
|
25
25
|
|
|
26
|
-
const dataParserTemplateLiteralKind = kind.
|
|
26
|
+
const dataParserTemplateLiteralKind = kind.createDataParserKind("template-literal");
|
|
27
27
|
function templateLiteral(template, definition) {
|
|
28
28
|
const pattern = pipe.pipe(template, map.map(innerPipe.innerPipe(when.when(isType.isType("string"), (value) => `(?:${escapeRegExp.escapeRegExp(value)})`), when.when(index$2.dataParserNumberKind.has, () => "(:?[0-9]+)"), when.when(index$1.dataParserBigIntKind.has, () => "(?:[0-9]+n)"), when.when(boolean.dataParserBooleanKind.has, () => "(?:true|false)"), when.when(nil.dataParserNilKind.has, () => "(?:null)"), when.when(empty.dataParserEmptyKind.has, () => "(?:undefined)"), when.when(literal.dataParserLiteralKind.has, (dataParser) => pipe.pipe(dataParser.definition.value, map.map(innerPipe.innerPipe(when$1.when(isType.isType("bigint"), (value) => `${value}n`), String, escapeRegExp.escapeRegExp)), join.join("|"), (pattern) => `(?:${pattern})`)), when.when(index.dataParserStringKind.has, innerPipe.innerPipe(whenElse.whenElse((dataParser) => !!dataParser.definition.checkers.length, (dataParser) => pipe.pipe(dataParser.definition.checkers, map.map((element) => pipe.pipe(element.definition.pattern.source, replace.replace(/^\^/, ""), replace.replace(/\$$/, ""))), join.join("")), () => "(?:[^]*)"))), when.when(dataParserTemplateLiteralKind.has, (dataParser) => pipe.pipe(dataParser.definition.pattern.source, replace.replace(/^\^/, ""), replace.replace(/\$$/, ""), (pattern) => `(?:${pattern})`)), exhaustive.exhaustive)), join.join(""), (pattern) => new RegExp(`^${pattern}$`));
|
|
29
29
|
return base.dataParserInit(dataParserTemplateLiteralKind, {
|
|
@@ -39,7 +39,7 @@ export interface DataParserDefinitionTemplateLiteral extends DataParserDefinitio
|
|
|
39
39
|
readonly template: TemplateLiteralShape;
|
|
40
40
|
readonly pattern: RegExp;
|
|
41
41
|
}
|
|
42
|
-
export declare const dataParserTemplateLiteralKind: import("../../common").KindHandler<import("../../common").KindDefinition<"
|
|
42
|
+
export declare const dataParserTemplateLiteralKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DataParser/template-literal", unknown>>;
|
|
43
43
|
type _DataParserTemplateLiteral<GenericDefinition extends DataParserDefinitionTemplateLiteral> = (DataParser<GenericDefinition, TemplateLiteralShapeOutput<GenericDefinition["template"]>, TemplateLiteralShapeInput<GenericDefinition["template"]>> & Kind<typeof dataParserTemplateLiteralKind.definition>);
|
|
44
44
|
export interface DataParserTemplateLiteral<GenericDefinition extends DataParserDefinitionTemplateLiteral = DataParserDefinitionTemplateLiteral> extends _DataParserTemplateLiteral<GenericDefinition> {
|
|
45
45
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { escapeRegExp } from '../../common/escapeRegExp.mjs';
|
|
2
|
-
import { createKind } from '../../common/kind.mjs';
|
|
3
2
|
import { pipe } from '../../common/pipe.mjs';
|
|
4
3
|
import { innerPipe } from '../../common/innerPipe.mjs';
|
|
5
4
|
import { when as when$1 } from '../../common/when.mjs';
|
|
@@ -20,8 +19,9 @@ import { dataParserLiteralKind } from './literal.mjs';
|
|
|
20
19
|
import { dataParserEmptyKind } from './empty.mjs';
|
|
21
20
|
import { dataParserNilKind } from './nil.mjs';
|
|
22
21
|
import { dataParserBooleanKind } from './boolean.mjs';
|
|
22
|
+
import { createDataParserKind } from '../kind.mjs';
|
|
23
23
|
|
|
24
|
-
const dataParserTemplateLiteralKind =
|
|
24
|
+
const dataParserTemplateLiteralKind = createDataParserKind("template-literal");
|
|
25
25
|
function templateLiteral(template, definition) {
|
|
26
26
|
const pattern = pipe(template, map(innerPipe(when(isType("string"), (value) => `(?:${escapeRegExp(value)})`), when(dataParserNumberKind.has, () => "(:?[0-9]+)"), when(dataParserBigIntKind.has, () => "(?:[0-9]+n)"), when(dataParserBooleanKind.has, () => "(?:true|false)"), when(dataParserNilKind.has, () => "(?:null)"), when(dataParserEmptyKind.has, () => "(?:undefined)"), when(dataParserLiteralKind.has, (dataParser) => pipe(dataParser.definition.value, map(innerPipe(when$1(isType("bigint"), (value) => `${value}n`), String, escapeRegExp)), join("|"), (pattern) => `(?:${pattern})`)), when(dataParserStringKind.has, innerPipe(whenElse((dataParser) => !!dataParser.definition.checkers.length, (dataParser) => pipe(dataParser.definition.checkers, map((element) => pipe(element.definition.pattern.source, replace(/^\^/, ""), replace(/\$$/, ""))), join("")), () => "(?:[^]*)"))), when(dataParserTemplateLiteralKind.has, (dataParser) => pipe(dataParser.definition.pattern.source, replace(/^\^/, ""), replace(/\$$/, ""), (pattern) => `(?:${pattern})`)), exhaustive)), join(""), (pattern) => new RegExp(`^${pattern}$`));
|
|
27
27
|
return dataParserInit(dataParserTemplateLiteralKind, {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var kind = require('../../common/kind.cjs');
|
|
4
3
|
var base = require('../base.cjs');
|
|
5
4
|
var error = require('../error.cjs');
|
|
5
|
+
var kind = require('../kind.cjs');
|
|
6
6
|
|
|
7
|
-
const dataParserTransformKind = kind.
|
|
7
|
+
const dataParserTransformKind = kind.createDataParserKind("transform");
|
|
8
8
|
function transform(inner, theFunction, definition) {
|
|
9
9
|
return base.dataParserInit(dataParserTransformKind, {
|
|
10
10
|
definition: {
|
|
@@ -6,7 +6,7 @@ export interface DataParserDefinitionTransform extends DataParserDefinition<neve
|
|
|
6
6
|
readonly inner: DataParsers;
|
|
7
7
|
theFunction(input: any, error: DataParserError): unknown;
|
|
8
8
|
}
|
|
9
|
-
export declare const dataParserTransformKind: import("../../common").KindHandler<import("../../common").KindDefinition<"
|
|
9
|
+
export declare const dataParserTransformKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DataParser/transform", unknown>>;
|
|
10
10
|
type _DataParserTransform<GenericDefinition extends DataParserDefinitionTransform> = (DataParser<GenericDefinition, Exclude<Awaited<ReturnType<GenericDefinition["theFunction"]>>, SymbolDataParserError | SymbolDataParserErrorIssue | SymbolDataParserErrorPromiseIssue>, Input<GenericDefinition["inner"]>> & Kind<typeof dataParserTransformKind.definition>);
|
|
11
11
|
export interface DataParserTransform<GenericDefinition extends DataParserDefinitionTransform = DataParserDefinitionTransform> extends _DataParserTransform<GenericDefinition> {
|
|
12
12
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createKind } from '../../common/kind.mjs';
|
|
2
1
|
import { dataParserInit, SymbolDataParserError } from '../base.mjs';
|
|
3
2
|
import { SymbolDataParserErrorPromiseIssue } from '../error.mjs';
|
|
3
|
+
import { createDataParserKind } from '../kind.mjs';
|
|
4
4
|
|
|
5
|
-
const dataParserTransformKind =
|
|
5
|
+
const dataParserTransformKind = createDataParserKind("transform");
|
|
6
6
|
function transform(inner, theFunction, definition) {
|
|
7
7
|
return dataParserInit(dataParserTransformKind, {
|
|
8
8
|
definition: {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var kind = require('../../common/kind.cjs');
|
|
4
3
|
var base = require('../base.cjs');
|
|
5
4
|
var error = require('../error.cjs');
|
|
5
|
+
var kind = require('../kind.cjs');
|
|
6
6
|
|
|
7
|
-
const dataParserTupleKind = kind.
|
|
7
|
+
const dataParserTupleKind = kind.createDataParserKind("tuple");
|
|
8
8
|
function tuple(shape, definition) {
|
|
9
9
|
return base.dataParserInit(dataParserTupleKind, {
|
|
10
10
|
definition: {
|
|
@@ -22,7 +22,7 @@ export interface DataParserDefinitionTuple extends DataParserDefinition<DataPars
|
|
|
22
22
|
readonly shape: TupleShape;
|
|
23
23
|
readonly rest?: DataParsers;
|
|
24
24
|
}
|
|
25
|
-
export declare const dataParserTupleKind: import("../../common").KindHandler<import("../../common").KindDefinition<"
|
|
25
|
+
export declare const dataParserTupleKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DataParser/tuple", unknown>>;
|
|
26
26
|
type _DataParserTuple<GenericDefinition extends DataParserDefinitionTuple> = (DataParser<GenericDefinition, DataParserTupleShapeOutput<GenericDefinition["shape"], GenericDefinition["rest"]>, DataParserTupleShapeInput<GenericDefinition["shape"], GenericDefinition["rest"]>> & Kind<typeof dataParserTupleKind.definition>);
|
|
27
27
|
export interface DataParserTuple<GenericDefinition extends DataParserDefinitionTuple = DataParserDefinitionTuple> extends _DataParserTuple<GenericDefinition> {
|
|
28
28
|
addChecker<GenericChecker extends [DataParserTupleCheckers, ...DataParserTupleCheckers[]]>(...args: GenericChecker): DataParserTuple<AddCheckersToDefinition<GenericDefinition, GenericChecker>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createKind } from '../../common/kind.mjs';
|
|
2
1
|
import { dataParserInit, SymbolDataParserError } from '../base.mjs';
|
|
3
2
|
import { SymbolDataParserErrorIssue, setErrorPath, popErrorPath } from '../error.mjs';
|
|
3
|
+
import { createDataParserKind } from '../kind.mjs';
|
|
4
4
|
|
|
5
|
-
const dataParserTupleKind =
|
|
5
|
+
const dataParserTupleKind = createDataParserKind("tuple");
|
|
6
6
|
function tuple(shape, definition) {
|
|
7
7
|
return dataParserInit(dataParserTupleKind, {
|
|
8
8
|
definition: {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var kind = require('../../common/kind.cjs');
|
|
4
3
|
var base = require('../base.cjs');
|
|
5
4
|
var error = require('../error.cjs');
|
|
5
|
+
var kind = require('../kind.cjs');
|
|
6
6
|
|
|
7
|
-
const dataParserUnionKind = kind.
|
|
7
|
+
const dataParserUnionKind = kind.createDataParserKind("union");
|
|
8
8
|
function union(options, definition) {
|
|
9
9
|
return base.dataParserInit(dataParserUnionKind, {
|
|
10
10
|
definition: {
|
|
@@ -5,7 +5,7 @@ export type UnionOptions = readonly [DataParsers, ...DataParsers[]];
|
|
|
5
5
|
export interface DataParserDefinitionUnion extends DataParserDefinition<never> {
|
|
6
6
|
readonly options: UnionOptions;
|
|
7
7
|
}
|
|
8
|
-
export declare const dataParserUnionKind: import("../../common").KindHandler<import("../../common").KindDefinition<"
|
|
8
|
+
export declare const dataParserUnionKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DataParser/union", unknown>>;
|
|
9
9
|
type _DataParserUnion<GenericDefinition extends DataParserDefinitionUnion> = (DataParser<GenericDefinition, Output<GenericDefinition["options"][number]>, Input<GenericDefinition["options"][number]>> & Kind<typeof dataParserUnionKind.definition>);
|
|
10
10
|
export interface DataParserUnion<GenericDefinition extends DataParserDefinitionUnion = DataParserDefinitionUnion> extends _DataParserUnion<GenericDefinition> {
|
|
11
11
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createKind } from '../../common/kind.mjs';
|
|
2
1
|
import { dataParserInit, SymbolDataParserError } from '../base.mjs';
|
|
3
2
|
import { SymbolDataParserErrorIssue } from '../error.mjs';
|
|
3
|
+
import { createDataParserKind } from '../kind.mjs';
|
|
4
4
|
|
|
5
|
-
const dataParserUnionKind =
|
|
5
|
+
const dataParserUnionKind = createDataParserKind("union");
|
|
6
6
|
function union(options, definition) {
|
|
7
7
|
return dataParserInit(dataParserUnionKind, {
|
|
8
8
|
definition: {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var kind = require('../../common/kind.cjs');
|
|
4
3
|
var base = require('../base.cjs');
|
|
4
|
+
var kind = require('../kind.cjs');
|
|
5
5
|
|
|
6
|
-
const dataParserUnknownKind = kind.
|
|
6
|
+
const dataParserUnknownKind = kind.createDataParserKind("unknown");
|
|
7
7
|
function unknown(definition) {
|
|
8
8
|
return base.dataParserInit(dataParserUnknownKind, {
|
|
9
9
|
definition: {
|
|
@@ -3,7 +3,7 @@ import { type DataParserDefinition, type DataParser } from "../base";
|
|
|
3
3
|
import { type MergeDefinition } from "../../dataParser/types";
|
|
4
4
|
export interface DataParserDefinitionUnknown extends DataParserDefinition<never> {
|
|
5
5
|
}
|
|
6
|
-
export declare const dataParserUnknownKind: import("../../common").KindHandler<import("../../common").KindDefinition<"
|
|
6
|
+
export declare const dataParserUnknownKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@DataParser/unknown", unknown>>;
|
|
7
7
|
type _DataParserUnknown<GenericDefinition extends DataParserDefinitionUnknown> = (DataParser<GenericDefinition, unknown, unknown> & Kind<typeof dataParserUnknownKind.definition>);
|
|
8
8
|
export interface DataParserUnknown<GenericDefinition extends DataParserDefinitionUnknown = DataParserDefinitionUnknown> extends _DataParserUnknown<GenericDefinition> {
|
|
9
9
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createKind } from '../../common/kind.mjs';
|
|
2
1
|
import { dataParserInit } from '../base.mjs';
|
|
2
|
+
import { createDataParserKind } from '../kind.mjs';
|
|
3
3
|
|
|
4
|
-
const dataParserUnknownKind =
|
|
4
|
+
const dataParserUnknownKind = createDataParserKind("unknown");
|
|
5
5
|
function unknown(definition) {
|
|
6
6
|
return dataParserInit(dataParserUnknownKind, {
|
|
7
7
|
definition: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const eitherBoolKind: import("
|
|
1
|
+
export declare const eitherBoolKind: import("../..").KindHandler<import("../..").KindDefinition<"@Either/bool", unknown>>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var kind = require('../../common/kind.cjs');
|
|
4
3
|
var unwrap = require('../../common/unwrap.cjs');
|
|
4
|
+
var kind = require('../kind.cjs');
|
|
5
|
+
var base = require('./base.cjs');
|
|
6
|
+
var create$1 = require('./create.cjs');
|
|
5
7
|
var create = require('../left/create.cjs');
|
|
6
8
|
var is = require('../left/is.cjs');
|
|
7
9
|
var is$1 = require('../right/is.cjs');
|
|
8
|
-
var create$1 = require('./create.cjs');
|
|
9
|
-
var base = require('./base.cjs');
|
|
10
10
|
|
|
11
|
-
const eitherBoolFalsyKind = kind.
|
|
11
|
+
const eitherBoolFalsyKind = kind.createEitherKind("bool-falsy");
|
|
12
12
|
function boolFalsy(value = undefined) {
|
|
13
13
|
return base.eitherBoolKind.setTo(eitherBoolFalsyKind.setTo(create.left("bool", value)));
|
|
14
14
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type EscapeVoid, type AnyValue, type Unwrap, type BreakGenericLink } from "../../common";
|
|
2
|
-
import { type EitherLeft } from "../left";
|
|
3
|
-
import { type EitherRight } from "../right";
|
|
4
|
-
import { bool } from "./create";
|
|
5
2
|
import { type Kind } from "../../common/kind";
|
|
6
3
|
import { eitherBoolKind } from "./base";
|
|
4
|
+
import { bool } from "./create";
|
|
5
|
+
import { type EitherLeft } from "../left";
|
|
6
|
+
import { type EitherRight } from "../right";
|
|
7
7
|
export type BoolFalsyValue = 0 | "" | undefined | null | false;
|
|
8
|
-
export declare const eitherBoolFalsyKind: import("../../common").KindHandler<import("../../common").KindDefinition<"
|
|
8
|
+
export declare const eitherBoolFalsyKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@Either/bool-falsy", unknown>>;
|
|
9
9
|
type _EitherBoolFalsy<GenericValue extends BoolFalsyValue = BoolFalsyValue> = (EitherLeft<"bool", GenericValue> & Kind<typeof eitherBoolKind.definition> & Kind<typeof eitherBoolFalsyKind.definition>);
|
|
10
10
|
export interface EitherBoolFalsy<GenericValue extends BoolFalsyValue = BoolFalsyValue> extends _EitherBoolFalsy<GenericValue> {
|
|
11
11
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { createKind } from '../../common/kind.mjs';
|
|
2
1
|
import { unwrap } from '../../common/unwrap.mjs';
|
|
2
|
+
import { createEitherKind } from '../kind.mjs';
|
|
3
|
+
import { eitherBoolKind } from './base.mjs';
|
|
4
|
+
import { bool } from './create.mjs';
|
|
3
5
|
import { left } from '../left/create.mjs';
|
|
4
6
|
import { isLeft } from '../left/is.mjs';
|
|
5
7
|
import { isRight } from '../right/is.mjs';
|
|
6
|
-
import { bool } from './create.mjs';
|
|
7
|
-
import { eitherBoolKind } from './base.mjs';
|
|
8
8
|
|
|
9
|
-
const eitherBoolFalsyKind =
|
|
9
|
+
const eitherBoolFalsyKind = createEitherKind("bool-falsy");
|
|
10
10
|
function boolFalsy(value = undefined) {
|
|
11
11
|
return eitherBoolKind.setTo(eitherBoolFalsyKind.setTo(left("bool", value)));
|
|
12
12
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var kind = require('../../common/kind.cjs');
|
|
4
3
|
var unwrap = require('../../common/unwrap.cjs');
|
|
4
|
+
var base = require('./base.cjs');
|
|
5
|
+
var kind = require('../kind.cjs');
|
|
5
6
|
var is$1 = require('../left/is.cjs');
|
|
6
7
|
var create = require('../right/create.cjs');
|
|
7
8
|
var is = require('../right/is.cjs');
|
|
8
9
|
var create$1 = require('./create.cjs');
|
|
9
|
-
var base = require('./base.cjs');
|
|
10
10
|
|
|
11
|
-
const eitherBoolTruthyKind = kind.
|
|
11
|
+
const eitherBoolTruthyKind = kind.createEitherKind("bool-truthy");
|
|
12
12
|
function boolTruthy(value) {
|
|
13
13
|
return base.eitherBoolKind.setTo(eitherBoolTruthyKind.setTo(create.right("bool", value)));
|
|
14
14
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type EitherRight } from "../right";
|
|
2
|
-
import { bool } from "./create";
|
|
3
|
-
import { type EitherLeft } from "../left";
|
|
4
|
-
import { type Kind } from "../../common/kind";
|
|
5
1
|
import { type EscapeVoid, type AnyValue, type Unwrap, type BreakGenericLink } from "../../common";
|
|
2
|
+
import { type Kind } from "../../common/kind";
|
|
6
3
|
import { eitherBoolKind } from "./base";
|
|
7
|
-
|
|
4
|
+
import { type EitherLeft } from "../left";
|
|
5
|
+
import { type EitherRight } from "../right";
|
|
6
|
+
import { bool } from "./create";
|
|
7
|
+
export declare const eitherBoolTruthyKind: import("../../common").KindHandler<import("../../common").KindDefinition<"@Either/bool-truthy", unknown>>;
|
|
8
8
|
type _EitherBoolTruthy<GenericValue extends unknown = unknown> = (EitherRight<"bool", GenericValue> & Kind<typeof eitherBoolKind.definition> & Kind<typeof eitherBoolTruthyKind.definition>);
|
|
9
9
|
export interface EitherBoolTruthy<GenericValue extends unknown = unknown> extends _EitherBoolTruthy<GenericValue> {
|
|
10
10
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { createKind } from '../../common/kind.mjs';
|
|
2
1
|
import { unwrap } from '../../common/unwrap.mjs';
|
|
2
|
+
import { eitherBoolKind } from './base.mjs';
|
|
3
|
+
import { createEitherKind } from '../kind.mjs';
|
|
3
4
|
import { isLeft } from '../left/is.mjs';
|
|
4
5
|
import { right } from '../right/create.mjs';
|
|
5
6
|
import { isRight } from '../right/is.mjs';
|
|
6
7
|
import { bool } from './create.mjs';
|
|
7
|
-
import { eitherBoolKind } from './base.mjs';
|
|
8
8
|
|
|
9
|
-
const eitherBoolTruthyKind =
|
|
9
|
+
const eitherBoolTruthyKind = createEitherKind("bool-truthy");
|
|
10
10
|
function boolTruthy(value) {
|
|
11
11
|
return eitherBoolKind.setTo(eitherBoolTruthyKind.setTo(right("bool", value)));
|
|
12
12
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var kind = require('
|
|
3
|
+
var kind = require('../kind.cjs');
|
|
4
4
|
|
|
5
|
-
const eitherFutureKind = kind.
|
|
5
|
+
const eitherFutureKind = kind.createEitherKind("future");
|
|
6
6
|
|
|
7
7
|
exports.eitherFutureKind = eitherFutureKind;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const eitherFutureKind: import("
|
|
1
|
+
export declare const eitherFutureKind: import("../..").KindHandler<import("../..").KindDefinition<"@Either/future", unknown>>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var kind = require('../../common/kind.cjs');
|
|
4
3
|
var create = require('../left/create.cjs');
|
|
4
|
+
var kind = require('../kind.cjs');
|
|
5
5
|
var base = require('./base.cjs');
|
|
6
6
|
|
|
7
|
-
const eitherFutureErrorKind = kind.
|
|
7
|
+
const eitherFutureErrorKind = kind.createEitherKind("future-error");
|
|
8
8
|
function futureError(value) {
|
|
9
9
|
return base.eitherFutureKind.setTo(eitherFutureErrorKind.setTo(create.left("future", value)));
|
|
10
10
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Kind } from "../../common/kind";
|
|
2
2
|
import { type EitherLeft } from "../left";
|
|
3
3
|
import { eitherFutureKind } from "./base";
|
|
4
|
-
export declare const eitherFutureErrorKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"
|
|
4
|
+
export declare const eitherFutureErrorKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"@Either/future-error", unknown>>;
|
|
5
5
|
type _EitherFutureError = (EitherLeft<"future", unknown> & Kind<typeof eitherFutureKind.definition> & Kind<typeof eitherFutureErrorKind.definition>);
|
|
6
6
|
export interface EitherFutureError extends _EitherFutureError {
|
|
7
7
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createKind } from '../../common/kind.mjs';
|
|
2
1
|
import { left } from '../left/create.mjs';
|
|
2
|
+
import { createEitherKind } from '../kind.mjs';
|
|
3
3
|
import { eitherFutureKind } from './base.mjs';
|
|
4
4
|
|
|
5
|
-
const eitherFutureErrorKind =
|
|
5
|
+
const eitherFutureErrorKind = createEitherKind("future-error");
|
|
6
6
|
function futureError(value) {
|
|
7
7
|
return eitherFutureKind.setTo(eitherFutureErrorKind.setTo(left("future", value)));
|
|
8
8
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var kind = require('
|
|
3
|
+
var kind = require('../kind.cjs');
|
|
4
4
|
var base = require('./base.cjs');
|
|
5
5
|
var create = require('../right/create.cjs');
|
|
6
6
|
|
|
7
|
-
const eitherFutureSuccessKind = kind.
|
|
7
|
+
const eitherFutureSuccessKind = kind.createEitherKind("future-success");
|
|
8
8
|
function futureSuccess(value) {
|
|
9
9
|
return base.eitherFutureKind.setTo(eitherFutureSuccessKind.setTo(create.right("future", value)));
|
|
10
10
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type EitherRight } from "../right";
|
|
2
1
|
import { type Kind } from "../../common/kind";
|
|
3
2
|
import { eitherFutureKind } from "./base";
|
|
4
|
-
|
|
3
|
+
import { type EitherRight } from "../right";
|
|
4
|
+
export declare const eitherFutureSuccessKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"@Either/future-success", unknown>>;
|
|
5
5
|
type _EitherFutureSuccess<GenericValue extends unknown = unknown> = (EitherRight<"future", GenericValue> & Kind<typeof eitherFutureKind.definition> & Kind<typeof eitherFutureSuccessKind.definition>);
|
|
6
6
|
export interface EitherFutureSuccess<GenericValue extends unknown = unknown> extends _EitherFutureSuccess<GenericValue> {
|
|
7
7
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createEitherKind } from '../kind.mjs';
|
|
2
2
|
import { eitherFutureKind } from './base.mjs';
|
|
3
3
|
import { right } from '../right/create.mjs';
|
|
4
4
|
|
|
5
|
-
const eitherFutureSuccessKind =
|
|
5
|
+
const eitherFutureSuccessKind = createEitherKind("future-success");
|
|
6
6
|
function futureSuccess(value) {
|
|
7
7
|
return eitherFutureKind.setTo(eitherFutureSuccessKind.setTo(right("future", value)));
|
|
8
8
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var kind = require('./kind.cjs');
|
|
4
4
|
|
|
5
5
|
function hasInformation(input, information) {
|
|
6
|
-
return
|
|
7
|
-
&&
|
|
6
|
+
return kind.eitherInformationKind.has(input)
|
|
7
|
+
&& kind.eitherInformationKind.getValue(input) === information;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
exports.hasInformation = hasInformation;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Kind } from "../common";
|
|
2
2
|
import { type EitherLeft } from "./left";
|
|
3
3
|
import { type EitherRight } from "./right";
|
|
4
|
-
import { eitherInformationKind } from "./
|
|
4
|
+
import { eitherInformationKind } from "./kind";
|
|
5
5
|
type Either = EitherRight | EitherLeft;
|
|
6
6
|
export declare function hasInformation<const GenericInput extends unknown, GenericInformation extends (GenericInput extends Either ? ReturnType<typeof eitherInformationKind.getValue<GenericInput>> : never)>(input: GenericInput, information: GenericInformation): input is Extract<GenericInput, Kind<typeof eitherInformationKind.definition, GenericInformation>>;
|
|
7
7
|
export {};
|
package/dist/either/index.cjs
CHANGED
|
@@ -34,7 +34,7 @@ var success$1 = require('./right/success.cjs');
|
|
|
34
34
|
var when$1 = require('./right/when.cjs');
|
|
35
35
|
var hasInformation = require('./hasInformation.cjs');
|
|
36
36
|
var whenHasInformation = require('./whenHasInformation.cjs');
|
|
37
|
-
var
|
|
37
|
+
var kind = require('./kind.cjs');
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
@@ -105,4 +105,5 @@ exports.success = success$1.success;
|
|
|
105
105
|
exports.whenIsRight = when$1.whenIsRight;
|
|
106
106
|
exports.hasInformation = hasInformation.hasInformation;
|
|
107
107
|
exports.whenHasInformation = whenHasInformation.whenHasInformation;
|
|
108
|
-
exports.
|
|
108
|
+
exports.createEitherKind = kind.createEitherKind;
|
|
109
|
+
exports.eitherInformationKind = kind.eitherInformationKind;
|
package/dist/either/index.d.ts
CHANGED
package/dist/either/index.mjs
CHANGED
|
@@ -32,4 +32,4 @@ export { eitherSuccessKind, success } from './right/success.mjs';
|
|
|
32
32
|
export { whenIsRight } from './right/when.mjs';
|
|
33
33
|
export { hasInformation } from './hasInformation.mjs';
|
|
34
34
|
export { whenHasInformation } from './whenHasInformation.mjs';
|
|
35
|
-
export { eitherInformationKind } from './
|
|
35
|
+
export { createEitherKind, eitherInformationKind } from './kind.mjs';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var kind = require('../common/kind.cjs');
|
|
4
|
+
|
|
5
|
+
const createEitherKind = kind.createKindNamespace("Either");
|
|
6
|
+
const eitherInformationKind = createEitherKind("information");
|
|
7
|
+
|
|
8
|
+
exports.createEitherKind = createEitherKind;
|
|
9
|
+
exports.eitherInformationKind = eitherInformationKind;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const createEitherKind: <GenericName extends string, GenericKindValue extends unknown = unknown>(name: GenericName & import("../string").ForbiddenCharacters<GenericName, "@" | "/">) => import("../common").KindHandler<import("../common").KindDefinition<`@Either/${GenericName}`, GenericKindValue>>;
|
|
2
|
+
export declare const eitherInformationKind: import("../common").KindHandler<import("../common").KindDefinition<"@Either/information", string>>;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var kind = require('../../common/kind.cjs');
|
|
4
3
|
var wrapValue = require('../../common/wrapValue.cjs');
|
|
5
|
-
var
|
|
4
|
+
var kind = require('../kind.cjs');
|
|
6
5
|
|
|
7
|
-
const eitherLeftKind = kind.
|
|
6
|
+
const eitherLeftKind = kind.createEitherKind("left");
|
|
8
7
|
function left(information, value = undefined) {
|
|
9
|
-
return eitherLeftKind.setTo(
|
|
8
|
+
return eitherLeftKind.setTo(kind.eitherInformationKind.setTo(wrapValue.wrapValue(value), information));
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
exports.eitherLeftKind = eitherLeftKind;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Kind } from "../../common/kind";
|
|
2
2
|
import { type WrappedValue } from "../../common/wrapValue";
|
|
3
|
-
import { eitherInformationKind } from "../
|
|
4
|
-
export declare const eitherLeftKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"
|
|
3
|
+
import { eitherInformationKind } from "../kind";
|
|
4
|
+
export declare const eitherLeftKind: import("../../common/kind").KindHandler<import("../../common/kind").KindDefinition<"@Either/left", unknown>>;
|
|
5
5
|
type _EitherLeft<GenericInformation extends string = string, GenericValue extends unknown = unknown> = (Kind<typeof eitherLeftKind.definition> & Kind<typeof eitherInformationKind.definition, GenericInformation> & WrappedValue<GenericValue>);
|
|
6
6
|
export interface EitherLeft<GenericInformation extends string = string, GenericValue extends unknown = unknown> extends _EitherLeft<GenericInformation, GenericValue> {
|
|
7
7
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { createKind } from '../../common/kind.mjs';
|
|
2
1
|
import { wrapValue } from '../../common/wrapValue.mjs';
|
|
3
|
-
import { eitherInformationKind } from '../
|
|
2
|
+
import { createEitherKind, eitherInformationKind } from '../kind.mjs';
|
|
4
3
|
|
|
5
|
-
const eitherLeftKind =
|
|
4
|
+
const eitherLeftKind = createEitherKind("left");
|
|
6
5
|
function left(information, value = undefined) {
|
|
7
6
|
return eitherLeftKind.setTo(eitherInformationKind.setTo(wrapValue(value), information));
|
|
8
7
|
}
|