@asod/field 0.1.0-canary.0 → 0.1.0-canary.1
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/field.d.ts +6 -6
- package/dist/index.d.ts +30 -25
- package/dist/utils/guards.d.ts +2 -2
- package/package.json +3 -2
- package/dist/global.d.ts +0 -1
package/dist/field.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
type FieldOperationConfig<TValue extends
|
|
3
|
-
func: IOperation<TValue>;
|
|
1
|
+
import { type Field } from './declarations/index';
|
|
2
|
+
type FieldOperationConfig<TValue extends Field.OperationValue> = {
|
|
3
|
+
func: Field.IOperation<TValue>;
|
|
4
4
|
neutralValue: TValue;
|
|
5
5
|
};
|
|
6
|
-
type FieldOperationsConfig<TValue extends
|
|
6
|
+
type FieldOperationsConfig<TValue extends Field.OperationValue> = {
|
|
7
7
|
add: FieldOperationConfig<TValue>;
|
|
8
8
|
sub: FieldOperationConfig<TValue>;
|
|
9
9
|
mul: FieldOperationConfig<TValue>;
|
|
10
10
|
div: FieldOperationConfig<TValue>;
|
|
11
11
|
};
|
|
12
|
-
type FieldConfig<TValue extends
|
|
12
|
+
type FieldConfig<TValue extends Field.OperationValue> = {
|
|
13
13
|
operations: FieldOperationsConfig<TValue>;
|
|
14
14
|
};
|
|
15
|
-
declare class Field<TValue extends
|
|
15
|
+
declare class Field<TValue extends Field.OperationValue> implements Field.IField<TValue> {
|
|
16
16
|
private readonly _operations;
|
|
17
17
|
constructor(config: FieldConfig<TValue>);
|
|
18
18
|
add(a: TValue, b: TValue): TValue;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,46 +1,51 @@
|
|
|
1
1
|
/// <reference path="global.d.ts" />
|
|
2
2
|
|
|
3
|
+
import ASOD from '@asod/core';
|
|
3
4
|
import { type Comparator } from '@asod/compare';
|
|
4
5
|
|
|
5
6
|
declare const ABSTRACT_OPERATION_ID: unique symbol;
|
|
6
7
|
|
|
7
8
|
type AbstractOperationId = typeof ABSTRACT_OPERATION_ID;
|
|
8
9
|
|
|
9
|
-
declare
|
|
10
|
-
|
|
10
|
+
declare module '@asod/core' {
|
|
11
|
+
namespace Field {
|
|
12
|
+
/* Common */
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
interface IComparable {
|
|
15
|
+
comparator?: Comparator;
|
|
16
|
+
}
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
/* Operation */
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
interface IOperationValue extends IComparable {}
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
(a: TValue, b: TValue): TValue;
|
|
22
|
-
}
|
|
22
|
+
type OperationValue = Primitive | IOperationValue;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
interface IOperation<TValue extends OperationValue> {
|
|
25
|
+
(a: TValue, b: TValue): TValue;
|
|
26
|
+
}
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
[ABSTRACT_OPERATION_ID]: IOperation<TValue>;
|
|
28
|
-
}
|
|
28
|
+
/* Group */
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
interface IGroup<TValue extends OperationValue> {
|
|
31
|
+
[ABSTRACT_OPERATION_ID]: IOperation<TValue>;
|
|
32
|
+
}
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
/* Ring */
|
|
35
|
+
|
|
36
|
+
// prettier-ignore
|
|
37
|
+
interface IRing<TValue extends OperationValue> extends Omit<IGroup<TValue>, AbstractOperationId> {
|
|
38
|
+
add: IOperation<TValue>;
|
|
39
|
+
mul: IOperation<TValue>;
|
|
40
|
+
}
|
|
37
41
|
|
|
38
|
-
|
|
42
|
+
/* Field */
|
|
39
43
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
// prettier-ignore
|
|
45
|
+
interface IField<TValue extends OperationValue> extends Omit<IRing<TValue>, AbstractOperationId> {
|
|
46
|
+
sub: IOperation<TValue>;
|
|
47
|
+
div: IOperation<TValue>;
|
|
48
|
+
}
|
|
44
49
|
}
|
|
45
50
|
}
|
|
46
51
|
|
package/dist/utils/guards.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const isComparable: (value:
|
|
1
|
+
import { type Field } from '../declarations/index';
|
|
2
|
+
export declare const isComparable: (value: Field.OperationValue) => value is Field.IComparable;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asod/field",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "0.1.0-canary.
|
|
4
|
+
"version": "0.1.0-canary.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Oleg Putseiko <oleg.putseiko@gmail.com> (https://github.com/oleg-putseiko)",
|
|
7
7
|
"keywords": [],
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"yarn": "4.10.3"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@asod/compare": "^0.1.1-canary.1"
|
|
59
|
+
"@asod/compare": "^0.1.1-canary.1",
|
|
60
|
+
"@asod/core": "^0.1.0-canary.0"
|
|
60
61
|
}
|
|
61
62
|
}
|
package/dist/global.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
type Primitive = string | number | bigint | boolean | symbol | null | undefined;
|