dyo-tools 0.1.0-rc1

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.
Files changed (78) hide show
  1. package/.c8rc.json +4 -0
  2. package/.eslintignore +2 -0
  3. package/.eslintrc.json +41 -0
  4. package/Makefile +34 -0
  5. package/README.md +0 -0
  6. package/TODO.md +18 -0
  7. package/babel.config.js +1 -0
  8. package/dist/core/DTBunch.d.ts +32 -0
  9. package/dist/core/DTBunch.js +283 -0
  10. package/dist/core/DTBunch.js.map +1 -0
  11. package/dist/core/DTComponent.d.ts +20 -0
  12. package/dist/core/DTComponent.js +41 -0
  13. package/dist/core/DTComponent.js.map +1 -0
  14. package/dist/core/DTComponentWithMeta.d.ts +9 -0
  15. package/dist/core/DTComponentWithMeta.js +32 -0
  16. package/dist/core/DTComponentWithMeta.js.map +1 -0
  17. package/dist/core/DTElement.d.ts +13 -0
  18. package/dist/core/DTElement.js +46 -0
  19. package/dist/core/DTElement.js.map +1 -0
  20. package/dist/core/DTError.d.ts +13 -0
  21. package/dist/core/DTError.js +28 -0
  22. package/dist/core/DTError.js.map +1 -0
  23. package/dist/core/DTPlayer.d.ts +8 -0
  24. package/dist/core/DTPlayer.js +30 -0
  25. package/dist/core/DTPlayer.js.map +1 -0
  26. package/dist/index.d.ts +6 -0
  27. package/dist/index.js +16 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/tsconfig.tsbuildinfo +1321 -0
  30. package/dist/types/index.d.ts +58 -0
  31. package/dist/types/index.js +15 -0
  32. package/dist/types/index.js.map +1 -0
  33. package/dist/utils/filters.d.ts +6 -0
  34. package/dist/utils/filters.js +39 -0
  35. package/dist/utils/filters.js.map +1 -0
  36. package/docs/.nojekyll +1 -0
  37. package/docs/assets/highlight.css +22 -0
  38. package/docs/assets/icons.css +1043 -0
  39. package/docs/assets/icons.png +0 -0
  40. package/docs/assets/icons@2x.png +0 -0
  41. package/docs/assets/main.js +52 -0
  42. package/docs/assets/search.js +1 -0
  43. package/docs/assets/style.css +1388 -0
  44. package/docs/assets/widgets.png +0 -0
  45. package/docs/assets/widgets@2x.png +0 -0
  46. package/docs/classes/DTBunch.html +265 -0
  47. package/docs/classes/DTComponent.html +49 -0
  48. package/docs/classes/DTComponentWithMeta.html +73 -0
  49. package/docs/classes/DTElement.html +95 -0
  50. package/docs/classes/DTError.html +32 -0
  51. package/docs/classes/DTPlayer.html +86 -0
  52. package/docs/index.html +1 -0
  53. package/docs/modules.html +1 -0
  54. package/jest.config.js +6 -0
  55. package/package.json +41 -0
  56. package/src/core/DTBunch.ts +600 -0
  57. package/src/core/DTComponent.ts +135 -0
  58. package/src/core/DTComponentWithMeta.ts +62 -0
  59. package/src/core/DTElement.ts +96 -0
  60. package/src/core/DTError.ts +78 -0
  61. package/src/core/DTPlayer.ts +57 -0
  62. package/src/index.ts +7 -0
  63. package/src/types/index.ts +76 -0
  64. package/src/utils/filters.ts +64 -0
  65. package/test/core/DTBunch.double.ts +150 -0
  66. package/test/core/DTBunch.spec.ts +1374 -0
  67. package/test/core/DTComponent.double.ts +69 -0
  68. package/test/core/DTComponent.spec.ts +182 -0
  69. package/test/core/DTComponentWithMeta.double.ts +88 -0
  70. package/test/core/DTComponentWithMeta.spec.ts +112 -0
  71. package/test/core/DTElement.double.ts +27 -0
  72. package/test/core/DTElement.spec.ts +181 -0
  73. package/test/core/DTError.double.ts +43 -0
  74. package/test/core/DTError.spec.ts +106 -0
  75. package/test/core/DTPlayer.double.ts +49 -0
  76. package/test/core/DTPlayer.spec.ts +102 -0
  77. package/test/utils/filters.spec.ts +109 -0
  78. package/tsconfig.json +21 -0
@@ -0,0 +1,135 @@
1
+ import * as uuid from 'uuid';
2
+
3
+ export default abstract class DYOToolsComponent {
4
+ /**
5
+ * Component unique ID. Use uuid v4 generator.
6
+ */
7
+ protected _id: string;
8
+
9
+ /**
10
+ * Component specific and accessible label.
11
+ * If not provided, the key is set with ID by default.
12
+ */
13
+ protected _key: string;
14
+
15
+ /**
16
+ * Component Parent Context.
17
+ *
18
+ * A component can have only one *physical context*, and be managed by a parent Component.
19
+ */
20
+ protected _context?: DYOToolsComponent;
21
+
22
+ /**
23
+ * Higher Level Component category.
24
+ *
25
+ * Describing component Type, like Element, Bunch, Manager...
26
+ */
27
+ protected abstract _componentType: string;
28
+
29
+ /**
30
+ * Second Level Component category.
31
+ *
32
+ * Describing component Domain, like Card, Dice, Token...
33
+ */
34
+ protected _domain?: string;
35
+
36
+ /**
37
+ * Third Level Component category.
38
+ *
39
+ * Describing component extra type, like Hand, Deck, Trick...
40
+ */
41
+ protected _subKind?: string;
42
+
43
+ /**
44
+ * Set automatic unique _id and _key.
45
+ *
46
+ * @param key Optional Key to set. If not provided, set the _key with the _id value.
47
+ */
48
+ constructor(key?: string) {
49
+ this._id = uuid.v4();
50
+ this._key = key || this._id;
51
+ }
52
+
53
+ /**
54
+ * Getter for _id property.
55
+ */
56
+ getId(): string {
57
+ return this._id;
58
+ }
59
+
60
+ /**
61
+ * Getter for _key property.
62
+ */
63
+ getKey(): string {
64
+ return this._key;
65
+ }
66
+
67
+ /**
68
+ * Getter for _context property.
69
+ *
70
+ * @param contextType If provided, the getter parse all component level hierarchy to find the corresponding component
71
+ * with **contextType** as _componentType value, and returns it. Return undefined if not found.
72
+ *
73
+ * @returns Direct parent Component or higher level Component if filtered with **contextType**.
74
+ * Returns undefined if context doesn't exist.
75
+ */
76
+ getContext(contextType?: string): DYOToolsComponent | undefined {
77
+ if (this._context) {
78
+ if (!contextType || this._context.getComponentType() === contextType) {
79
+ return this._context;
80
+ }
81
+ return this._context.getContext(contextType);
82
+ }
83
+ return undefined;
84
+ }
85
+
86
+ /**
87
+ * Setter for _context property.
88
+ */
89
+ setContext(value: DYOToolsComponent): void {
90
+ this._context = value;
91
+ }
92
+
93
+ /**
94
+ * Remove the current context of component
95
+ */
96
+ removeContext(): void {
97
+ this._context = undefined;
98
+ }
99
+
100
+ /**
101
+ * Getter for _componentType property.
102
+ */
103
+ getComponentType(): string {
104
+ return this._componentType;
105
+ }
106
+
107
+ /**
108
+ * Getter for _domain property.
109
+ */
110
+ getDomain(): string {
111
+ return this._domain;
112
+ }
113
+
114
+ /**
115
+ * Getter for _subKind property.
116
+ */
117
+ getSubKind(): string {
118
+ return this._subKind;
119
+ }
120
+
121
+ /**
122
+ * Abstract method for copying the Component and returning it.
123
+ */
124
+ abstract copy(): DYOToolsComponent;
125
+
126
+ /**
127
+ * Abstract method for JSON Object representation of the component and returning it.
128
+ */
129
+ abstract toObject(): unknown;
130
+
131
+ /**
132
+ * Abstract method for String representation of the component and returning it.
133
+ */
134
+ abstract toString(): string;
135
+ }
@@ -0,0 +1,62 @@
1
+ import DYOToolsComponent from './DTComponent';
2
+ import { DTAcceptedMetaData } from '../types';
3
+
4
+ export default abstract class DYOToolsComponentWithMeta<IComponentMeta extends DTAcceptedMetaData> extends DYOToolsComponent {
5
+ /**
6
+ * Component meta data.
7
+ * Defined by generic type IComponentMeta.
8
+ * @default {}
9
+ */
10
+ protected _meta : Partial<IComponentMeta> = {} as Partial<IComponentMeta>;
11
+
12
+ /**
13
+ * Getter for one meta by key.
14
+ *
15
+ * @param metaKey Key name of one meta data.
16
+ *
17
+ * @returns Associated meta **metaKey** value or undefined if not found.
18
+ */
19
+ getMeta<K extends keyof IComponentMeta>(metaKey : K) : IComponentMeta[K] | undefined {
20
+ return this._meta && this._meta[metaKey];
21
+ }
22
+
23
+ /**
24
+ * Setter for one meta by key.
25
+ *
26
+ * @param metaKey Key name of the meta data to update.
27
+ * @param metaValue New value to set into the meta data.
28
+ */
29
+ setMeta<K extends keyof IComponentMeta>(metaKey : K, metaValue : IComponentMeta[K]) : void {
30
+ this._meta[metaKey] = metaValue;
31
+ }
32
+
33
+ /**
34
+ * Returns multiple defined keys values of meta data.
35
+ *
36
+ * @param metaKeys Array of keys to filter for meta data. If not provided or empty, returns all keys.
37
+ *
38
+ * @returns Meta data object with **metaKeys** provided keys only.
39
+ */
40
+ getManyMeta(metaKeys : Array<keyof IComponentMeta> = []) : Partial<IComponentMeta> {
41
+ const arrayMeta: Partial<IComponentMeta> = {} as Partial<IComponentMeta>;
42
+ if (!metaKeys.length) {
43
+ return this._meta;
44
+ }
45
+
46
+ metaKeys.forEach((key) => {
47
+ if (this._meta && this._meta[key]) {
48
+ arrayMeta[key] = this._meta[key];
49
+ }
50
+ });
51
+ return arrayMeta;
52
+ }
53
+
54
+ /**
55
+ * Set multiple meta data.
56
+ *
57
+ * @param metaValues Object of meta data to set, according to the meta data property type.
58
+ */
59
+ setManyMeta(metaValues : Partial<IComponentMeta>) : void {
60
+ this._meta = { ...this._meta, ...metaValues };
61
+ }
62
+ }
@@ -0,0 +1,96 @@
1
+ import DYOToolsComponentWithMeta from './DTComponentWithMeta';
2
+ import DYOToolsPlayer from './DTPlayer';
3
+ import { DTAcceptedMetaData, DTElementToObject } from '../types';
4
+
5
+ export default class DYOToolsElement<
6
+ IComponentMeta extends DTAcceptedMetaData,
7
+ > extends DYOToolsComponentWithMeta<IComponentMeta> {
8
+ /**
9
+ * Defining component type to "element".
10
+ */
11
+ protected _componentType = 'element';
12
+
13
+ /**
14
+ * DTPlayer instance who owns the current element
15
+ */
16
+ private _owner?: DYOToolsPlayer<DTAcceptedMetaData>;
17
+
18
+ /**
19
+ * Getter for _owner property.
20
+ */
21
+ getOwner(): DYOToolsPlayer<DTAcceptedMetaData> {
22
+ return this._owner;
23
+ }
24
+
25
+ /**
26
+ * Setter for _owner property.
27
+ */
28
+ setOwner(value: DYOToolsPlayer<DTAcceptedMetaData>): void {
29
+ this._owner = value;
30
+ }
31
+
32
+ /**
33
+ * Remove the current owner of element.
34
+ */
35
+ removeOwner(): void {
36
+ this._owner = undefined;
37
+ }
38
+
39
+ /**
40
+ * Create and return a new DTElement instance by applying from current instance :
41
+ * - Copy _key property
42
+ * - Copy _meta property
43
+ *
44
+ * @returns New DTElement instance copied.
45
+ */
46
+ copy(): DYOToolsElement<IComponentMeta> {
47
+ const copyElement = new DYOToolsElement<IComponentMeta>(this._key);
48
+ copyElement.setManyMeta({ ...this.getManyMeta() });
49
+
50
+ return copyElement;
51
+ }
52
+
53
+ /**
54
+ * Return JSON Object representation of the Element instance.
55
+ *
56
+ * JSON Object returned has the following structure :
57
+ * * **id** : _id property of the Element.
58
+ * * **key** : _key property of the Element.
59
+ * * **type** : _componentType property of the Element.
60
+ * * **owner** : String representation of the current _owner property of the Element (only if defined).
61
+ * * **meta** : JSON Object of all current metadata in _meta property of the Element (only if not empty).
62
+ *
63
+ * @returns JSON Object representation of the Element.
64
+ */
65
+ toObject(): DTElementToObject<IComponentMeta> {
66
+ const objectElement: DTElementToObject<IComponentMeta> = {
67
+ id: this._id,
68
+ key: this._key,
69
+ type: this._componentType,
70
+ };
71
+
72
+ if (this._owner) {
73
+ objectElement.owner = this._owner.toString();
74
+ }
75
+
76
+ if (this._meta && Object.keys(this._meta).length > 0) {
77
+ objectElement.meta = { ...this.getManyMeta() };
78
+ }
79
+
80
+ return objectElement;
81
+ }
82
+
83
+ /**
84
+ * Return String representation of the Element instance.
85
+ *
86
+ * @returns String representation of the Element.
87
+ */
88
+ toString(): string {
89
+ let ownerKey = '';
90
+ if (this._owner) {
91
+ ownerKey = ` - Owner: ${this._owner.getKey()}`;
92
+ }
93
+
94
+ return `Component ${this._key} - Type: Element${ownerKey}`;
95
+ }
96
+ }
@@ -0,0 +1,78 @@
1
+ import DYOToolsComponent from './DTComponent';
2
+
3
+ export default class DYOToolsError extends Error {
4
+ /**
5
+ * Error code.
6
+ *
7
+ * Available error codes are :
8
+ * * **id_conflict** : _id property conflict between two DTComponent in the same context.
9
+ * * **key_conflict** : _key property conflict between two DTComponent in the same context.
10
+ */
11
+ protected code: string;
12
+
13
+ /**
14
+ * Error trigger date.
15
+ */
16
+ protected timestamp: Date;
17
+
18
+ /**
19
+ * DTComponent which trigger the error during its current execution process.
20
+ */
21
+ protected initiator?: DYOToolsComponent;
22
+
23
+ /**
24
+ * DTComponent which is directly involved in the error trigger.
25
+ */
26
+ protected convicted?: DYOToolsComponent;
27
+
28
+ /**
29
+ * Set all property for a new DTError.
30
+ *
31
+ * @param code
32
+ * @param message
33
+ * @param initiator
34
+ * @param convicted
35
+ */
36
+ constructor(code: string, message: string, initiator?: DYOToolsComponent, convicted?: DYOToolsComponent) {
37
+ super(message);
38
+ this.code = code;
39
+ this.timestamp = new Date();
40
+ this.initiator = initiator;
41
+ this.convicted = convicted;
42
+ }
43
+
44
+ /**
45
+ * Getter for code property.
46
+ */
47
+ getCode(): string {
48
+ return this.code;
49
+ }
50
+
51
+ /**
52
+ * Getter for message property (inherited from Error).
53
+ */
54
+ getMessage(): string {
55
+ return this.message;
56
+ }
57
+
58
+ /**
59
+ * Getter for timestamp property.
60
+ */
61
+ getTimestamp(): Date {
62
+ return this.timestamp;
63
+ }
64
+
65
+ /**
66
+ * Getter for initiator property.
67
+ */
68
+ getInitiator(): DYOToolsComponent {
69
+ return this.initiator;
70
+ }
71
+
72
+ /**
73
+ * Getter for convicted property.
74
+ */
75
+ getConvicted(): DYOToolsComponent {
76
+ return this.convicted;
77
+ }
78
+ }
@@ -0,0 +1,57 @@
1
+ import DYOToolsComponentWithMeta from './DTComponentWithMeta';
2
+ import { DTAcceptedMetaData, DTPlayerToObject } from '../types';
3
+
4
+ export default class DYOToolsPlayer<IComponentMeta extends DTAcceptedMetaData> extends DYOToolsComponentWithMeta<IComponentMeta> {
5
+ /**
6
+ * Defining component type to "player".
7
+ */
8
+ protected _componentType = 'player';
9
+
10
+ /**
11
+ * Create and return a new DTPlayer instance by applying from current instance :
12
+ * - Copy _key property
13
+ * - Copy _meta property
14
+ *
15
+ * @returns New DTPlayer instance copied.
16
+ */
17
+ copy(): DYOToolsPlayer<IComponentMeta> {
18
+ const copyElement = new DYOToolsPlayer<IComponentMeta>(this._key);
19
+ copyElement.setManyMeta({ ...this.getManyMeta() });
20
+
21
+ return copyElement;
22
+ }
23
+
24
+ /**
25
+ * Return JSON Object representation of the Player instance.
26
+ *
27
+ * JSON Object returned has the following structure :
28
+ * * **id** : _id property of the Player.
29
+ * * **key** : _key property of the Player.
30
+ * * **type** : _componentType property of the Player.
31
+ * * **meta** : JSON Object of all current metadata in _meta property of the Player (only if not empty).
32
+ *
33
+ * @returns JSON Object representation of the Player.
34
+ */
35
+ toObject(): DTPlayerToObject<IComponentMeta> {
36
+ const objectPlayer: DTPlayerToObject<IComponentMeta> = {
37
+ id: this._id,
38
+ key: this._key,
39
+ type: this._componentType,
40
+ };
41
+
42
+ if (this._meta && Object.keys(this._meta).length > 0) {
43
+ objectPlayer.meta = { ...this.getManyMeta() };
44
+ }
45
+
46
+ return objectPlayer;
47
+ }
48
+
49
+ /**
50
+ * Return String representation of the Player instance.
51
+ *
52
+ * @returns String representation of the Player.
53
+ */
54
+ toString(): string {
55
+ return `Component ${this._key} - Type: Player`;
56
+ }
57
+ }
package/src/index.ts ADDED
@@ -0,0 +1,7 @@
1
+ // All exports
2
+ export { default as DTComponent } from './core/DTComponent';
3
+ export { default as DTComponentWithMeta } from './core/DTComponentWithMeta';
4
+ export { default as DTElement } from './core/DTElement';
5
+ export { default as DTBunch } from './core/DTBunch';
6
+ export { default as DTPlayer } from './core/DTPlayer';
7
+ export { default as DTError } from './core/DTError';
@@ -0,0 +1,76 @@
1
+ /** filters Methods * */
2
+ export enum FilterOperatorType {
3
+ EQ = '$eq',
4
+ IN = '$in',
5
+ NIN = '$nin',
6
+ NE = '$ne',
7
+ LTE = '$lte',
8
+ GTE = '$gte',
9
+ CONTAINS = '$contains',
10
+ NCONTAINS = '$ncontains',
11
+ }
12
+
13
+ export type StandardPrimitiveType = string | number | boolean | null;
14
+
15
+ /** DTComponent interfaces * */
16
+ export interface DTComponentToObject {
17
+ id: string
18
+ key: string
19
+ type: string
20
+ }
21
+
22
+ /** DTComponentWithMeta interfaces * */
23
+ export type DTAcceptedMetaDataValue = string | number | boolean | Array<string | number | boolean> | undefined;
24
+ export type DTAcceptedMetaData = Record<
25
+ string,
26
+ DTAcceptedMetaDataValue
27
+ >;
28
+
29
+ /** DTElement interfaces * */
30
+ export interface DTElementToObject<IComponentMeta> extends DTComponentToObject {
31
+ owner?: string
32
+ meta?: Partial<IComponentMeta>
33
+ }
34
+
35
+ /** DTBunch interfaces * */
36
+ export interface DTBunchOptionsEditable {
37
+ errors: boolean
38
+ uniqueKey: boolean
39
+ replaceIndex: boolean
40
+ inheritOwner: boolean
41
+ }
42
+
43
+ export interface DTBunchOptionsConstructor extends DTBunchOptionsEditable {
44
+ virtualContext: boolean
45
+ }
46
+
47
+ export interface DTBunchToObject<IComponentMeta> extends DTComponentToObject {
48
+ items: Array<DTElementToObject<DTAcceptedMetaData>>
49
+ owner?: string
50
+ meta?: Partial<IComponentMeta>
51
+ }
52
+
53
+ export type DTBunchFilterWithBaseOperator = {
54
+ [FilterOperatorType.EQ]: StandardPrimitiveType
55
+ [FilterOperatorType.IN]: Array<StandardPrimitiveType>
56
+ [FilterOperatorType.NIN]: Array<StandardPrimitiveType>
57
+ [FilterOperatorType.NE]: StandardPrimitiveType
58
+ };
59
+ export interface DTBunchFilterWithMetaOperator extends DTBunchFilterWithBaseOperator {
60
+ [FilterOperatorType.LTE]: number
61
+ [FilterOperatorType.GTE]: number
62
+ [FilterOperatorType.CONTAINS]: StandardPrimitiveType
63
+ [FilterOperatorType.NCONTAINS]: StandardPrimitiveType
64
+ }
65
+ export interface DTBunchFilters {
66
+ id: Partial<DTBunchFilterWithBaseOperator>
67
+ key: Partial<DTBunchFilterWithBaseOperator>
68
+ context: Partial<DTBunchFilterWithBaseOperator>
69
+ owner: Partial<DTBunchFilterWithBaseOperator>
70
+ meta: Record<string, Partial<DTBunchFilterWithMetaOperator>>
71
+ }
72
+
73
+ /** DTPlayer interfaces * */
74
+ export interface DTPlayerToObject<IComponentMeta> extends DTComponentToObject {
75
+ meta?: Partial<IComponentMeta>
76
+ }
@@ -0,0 +1,64 @@
1
+ import { FilterOperatorType, StandardPrimitiveType } from '../types';
2
+
3
+ export function validFiltersForItem(itemProp: StandardPrimitiveType,
4
+ filter: StandardPrimitiveType,
5
+ operator: FilterOperatorType.EQ): boolean;
6
+ export function validFiltersForItem(itemProp: StandardPrimitiveType,
7
+ filter: StandardPrimitiveType[],
8
+ operator: FilterOperatorType.IN | FilterOperatorType.NIN): boolean;
9
+ export function validFiltersForItem(itemProp: StandardPrimitiveType,
10
+ filter: StandardPrimitiveType,
11
+ operator: FilterOperatorType.NE): boolean;
12
+ export function validFiltersForItem(itemProp: number, filter: number,
13
+ operator: FilterOperatorType.LTE |
14
+ FilterOperatorType.GTE): boolean;
15
+ export function validFiltersForItem(itemProp: StandardPrimitiveType[],
16
+ filter: StandardPrimitiveType,
17
+ operator: FilterOperatorType.CONTAINS | FilterOperatorType.NCONTAINS): boolean;
18
+ export function validFiltersForItem(
19
+ itemProp: StandardPrimitiveType | StandardPrimitiveType[],
20
+ filter: StandardPrimitiveType | StandardPrimitiveType[],
21
+ operator: FilterOperatorType = FilterOperatorType.EQ,
22
+ ): boolean {
23
+ // $eq Filter
24
+ if (operator === FilterOperatorType.EQ) {
25
+ return itemProp === filter;
26
+ }
27
+ // $in Filter
28
+ if (operator === FilterOperatorType.IN) {
29
+ return filter ? (filter as StandardPrimitiveType[]).includes(itemProp as StandardPrimitiveType) : false;
30
+ }
31
+ // $nin Filter
32
+ if (operator === FilterOperatorType.NIN) {
33
+ return filter ? !(filter as StandardPrimitiveType[]).includes(itemProp as StandardPrimitiveType) : false;
34
+ }
35
+ // $ne Filter
36
+ /* c8 ignore next */
37
+ if (operator === FilterOperatorType.NE) {
38
+ return itemProp !== filter;
39
+ }
40
+ // $lte Filter
41
+ if (operator === FilterOperatorType.LTE) {
42
+ if (typeof itemProp === 'number' && typeof filter === 'number') {
43
+ return itemProp <= filter;
44
+ }
45
+ return false;
46
+ }
47
+ // $gte Filter
48
+ if (operator === FilterOperatorType.GTE) {
49
+ if (typeof itemProp === 'number' && typeof filter === 'number') {
50
+ return itemProp >= filter;
51
+ }
52
+ return false;
53
+ }
54
+ // $contains Filter
55
+ if (operator === FilterOperatorType.CONTAINS) {
56
+ return itemProp ? (itemProp as StandardPrimitiveType[]).includes(filter as StandardPrimitiveType) : false;
57
+ }
58
+ // $Ncontains Filter
59
+ if (operator === FilterOperatorType.NCONTAINS) {
60
+ return itemProp ? !(itemProp as StandardPrimitiveType[]).includes(filter as StandardPrimitiveType) : false;
61
+ }
62
+
63
+ return false;
64
+ }