@sankhyalabs/core 5.11.0-dev.1 → 5.11.0-dev.2
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.
|
@@ -47,7 +47,7 @@ ___
|
|
|
47
47
|
|
|
48
48
|
### compareUndefined
|
|
49
49
|
|
|
50
|
-
▸ `Static`
|
|
50
|
+
▸ `Static` **compareUndefined**(`isUndefinedA`, `isUndefinedB`): `undefined` \| `number`
|
|
51
51
|
|
|
52
52
|
#### Parameters
|
|
53
53
|
|
|
@@ -62,7 +62,7 @@ ___
|
|
|
62
62
|
|
|
63
63
|
#### Defined in
|
|
64
64
|
|
|
65
|
-
src/dataunit/sorting/FieldComparator.ts:
|
|
65
|
+
src/dataunit/sorting/FieldComparator.ts:26
|
|
66
66
|
|
|
67
67
|
___
|
|
68
68
|
|
|
@@ -84,4 +84,4 @@ ___
|
|
|
84
84
|
|
|
85
85
|
#### Defined in
|
|
86
86
|
|
|
87
|
-
src/dataunit/sorting/FieldComparator.ts:
|
|
87
|
+
src/dataunit/sorting/FieldComparator.ts:16
|
|
@@ -3,5 +3,5 @@ import { FieldDescriptor } from "../metadata/UnitMetadata.js";
|
|
|
3
3
|
export declare class FieldComparator {
|
|
4
4
|
static compare(field: FieldDescriptor, recordA: Record, recordB: Record, asc?: boolean): number;
|
|
5
5
|
static compareValues(descriptor: FieldDescriptor, valueA: any, valueB: any): number;
|
|
6
|
-
|
|
6
|
+
static compareUndefined(isUndefinedA: boolean, isUndefinedB: boolean): number | undefined;
|
|
7
7
|
}
|
|
@@ -3,13 +3,13 @@ export class FieldComparator {
|
|
|
3
3
|
static compare(field, recordA, recordB, asc = true) {
|
|
4
4
|
const valueA = (asc ? recordA : recordB)[field.name];
|
|
5
5
|
const valueB = (asc ? recordB : recordA)[field.name];
|
|
6
|
+
return FieldComparator.compareValues(field, valueA, valueB);
|
|
7
|
+
}
|
|
8
|
+
static compareValues(descriptor, valueA, valueB) {
|
|
6
9
|
const undefinedComparison = this.compareUndefined(valueA == undefined, valueB == undefined);
|
|
7
10
|
if (undefinedComparison != undefined) {
|
|
8
11
|
return undefinedComparison;
|
|
9
12
|
}
|
|
10
|
-
return FieldComparator.compareValues(field, valueA, valueB);
|
|
11
|
-
}
|
|
12
|
-
static compareValues(descriptor, valueA, valueB) {
|
|
13
13
|
return compareValues(valueA, valueB, descriptor);
|
|
14
14
|
}
|
|
15
15
|
static compareUndefined(isUndefinedA, isUndefinedB) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldComparator.js","sourceRoot":"","sources":["../../../src/dataunit/sorting/FieldComparator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,MAAM,OAAO,eAAe;IAEjB,MAAM,CAAC,OAAO,CAAC,KAAsB,EAAE,OAAe,EAAE,OAAe,EAAE,MAAe,IAAI;QAE/F,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"FieldComparator.js","sourceRoot":"","sources":["../../../src/dataunit/sorting/FieldComparator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,MAAM,OAAO,eAAe;IAEjB,MAAM,CAAC,OAAO,CAAC,KAAsB,EAAE,OAAe,EAAE,OAAe,EAAE,MAAe,IAAI;QAE/F,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAGrD,OAAO,eAAe,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAChE,CAAC;IAEM,MAAM,CAAC,aAAa,CAAC,UAA2B,EAAE,MAAW,EAAE,MAAW;QAC7E,MAAM,mBAAmB,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,IAAI,SAAS,EAAE,MAAM,IAAI,SAAS,CAAC,CAAC;QAE5F,IAAG,mBAAmB,IAAI,SAAS,EAAC;YAChC,OAAO,mBAAmB,CAAC;SAC9B;QAED,OAAO,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,CAAA;IACpD,CAAC;IAEM,MAAM,CAAC,gBAAgB,CAAC,YAAqB,EAAE,YAAqB;QAEvE,IAAG,CAAC,YAAY,IAAI,CAAC,YAAY,EAAC;YAC9B,OAAO;SACV;QAED,IAAG,YAAY,IAAI,YAAY,EAAC;YAC5B,OAAO,CAAC,CAAC;SACZ;QAED,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -9,20 +9,21 @@ export class FieldComparator{
|
|
|
9
9
|
const valueA = (asc ? recordA : recordB)[field.name];
|
|
10
10
|
const valueB = (asc ? recordB : recordA)[field.name];
|
|
11
11
|
|
|
12
|
+
|
|
13
|
+
return FieldComparator.compareValues(field, valueA, valueB);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public static compareValues(descriptor: FieldDescriptor, valueA: any, valueB: any): number{
|
|
12
17
|
const undefinedComparison = this.compareUndefined(valueA == undefined, valueB == undefined);
|
|
13
|
-
|
|
18
|
+
|
|
14
19
|
if(undefinedComparison != undefined){
|
|
15
20
|
return undefinedComparison;
|
|
16
21
|
}
|
|
17
22
|
|
|
18
|
-
return FieldComparator.compareValues(field, valueA, valueB);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public static compareValues(descriptor: FieldDescriptor, valueA: any, valueB: any): number{
|
|
22
23
|
return compareValues(valueA, valueB, descriptor)
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
public static compareUndefined(isUndefinedA: boolean, isUndefinedB: boolean): number | undefined {
|
|
26
27
|
|
|
27
28
|
if(!isUndefinedA && !isUndefinedB){
|
|
28
29
|
return;
|