@cranberry-money/shared-utils 4.11.0 → 4.12.0

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.
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Generic collection and array utilities
3
+ * Pure functions for common array operations with type safety
4
+ */
5
+ /**
6
+ * Sort array of objects by a string field
7
+ * @param items - Array of objects to sort
8
+ * @param fieldName - Name of the field to sort by
9
+ * @returns New sorted array
10
+ */
11
+ export declare function sortByStringField<T>(items: T[], fieldName: keyof T): T[];
12
+ /**
13
+ * Filter array by text search in a specific field (case-insensitive)
14
+ * @param items - Array of objects to filter
15
+ * @param fieldName - Name of the field to search in
16
+ * @param searchTerm - Search term
17
+ * @returns Filtered array
18
+ */
19
+ export declare function filterByTextSearch<T>(items: T[], fieldName: keyof T, searchTerm: string): T[];
20
+ /**
21
+ * Filter array by boolean field
22
+ * @param items - Array of objects to filter
23
+ * @param fieldName - Name of the boolean field
24
+ * @param value - Boolean value to filter by
25
+ * @returns Filtered array
26
+ */
27
+ export declare function filterByBooleanField<T>(items: T[], fieldName: keyof T, value: boolean): T[];
28
+ /**
29
+ * Find item by exact field match
30
+ * @param items - Array of objects to search
31
+ * @param fieldName - Name of the field to match
32
+ * @param value - Value to match
33
+ * @returns Found item or undefined
34
+ */
35
+ export declare function findByField<T>(items: T[], fieldName: keyof T, value: unknown): T | undefined;
36
+ /**
37
+ * Find item by case-insensitive string field match
38
+ * @param items - Array of objects to search
39
+ * @param fieldName - Name of the string field to match
40
+ * @param value - String value to match (case-insensitive)
41
+ * @returns Found item or undefined
42
+ */
43
+ export declare function findByStringField<T>(items: T[], fieldName: keyof T, value: string): T | undefined;
44
+ /**
45
+ * Extract values from a specific field and sort them
46
+ * @param items - Array of objects
47
+ * @param fieldName - Name of the field to extract
48
+ * @returns Sorted array of extracted values
49
+ */
50
+ export declare function extractAndSortField<T, K extends keyof T>(items: T[], fieldName: K): T[K][];
51
+ /**
52
+ * Group array items by the first character of a string field
53
+ * @param items - Array of objects to group
54
+ * @param fieldName - Name of the string field to group by
55
+ * @returns Object with first letters as keys and arrays of items as values
56
+ */
57
+ export declare function groupByFirstLetter<T>(items: T[], fieldName: keyof T): Record<string, T[]>;
58
+ /**
59
+ * Group array items by a field value
60
+ * @param items - Array of objects to group
61
+ * @param fieldName - Name of the field to group by
62
+ * @returns Object with field values as keys and arrays of items as values
63
+ */
64
+ export declare function groupByField<T, K extends keyof T>(items: T[], fieldName: K): Record<string, T[]>;
65
+ /**
66
+ * Check if any item in array has a specific boolean field value
67
+ * @param items - Array of objects to check
68
+ * @param fieldName - Name of the boolean field
69
+ * @param value - Boolean value to check for
70
+ * @returns true if any item matches, false otherwise
71
+ */
72
+ export declare function hasItemWithFieldValue<T>(items: T[], fieldName: keyof T, value: unknown): boolean;
73
+ /**
74
+ * Count items that match a field value
75
+ * @param items - Array of objects to count
76
+ * @param fieldName - Name of the field to check
77
+ * @param value - Value to count
78
+ * @returns Number of matching items
79
+ */
80
+ export declare function countByFieldValue<T>(items: T[], fieldName: keyof T, value: unknown): number;
81
+ //# sourceMappingURL=collections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../src/collections.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAMxE;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC,EAAE,CAM7F;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,GA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utilities
3
+ * Pure functions for common array operations with type safety
4
+ */
5
+ /**
6
+ * Sort array of objects by a string field
7
+ * @param items - Array of objects to sort
8
+ * @param fieldName - Name of the field to sort by
9
+ * @returns New sorted array
10
+ */
11
+ export function sortByStringField(items, fieldName) {
12
+ return [...items].sort((a, b) => {
13
+ const aValue = String(a[fieldName]);
14
+ const bValue = String(b[fieldName]);
15
+ return aValue.localeCompare(bValue);
16
+ });
17
+ }
18
+ /**
19
+ * Filter array by text search in a specific field (case-insensitive)
20
+ * @param items - Array of objects to filter
21
+ * @param fieldName - Name of the field to search in
22
+ * @param searchTerm - Search term
23
+ * @returns Filtered array
24
+ */
25
+ export function filterByTextSearch(items, fieldName, searchTerm) {
26
+ const lowercaseSearch = searchTerm.toLowerCase();
27
+ return items.filter(item => {
28
+ const fieldValue = String(item[fieldName]).toLowerCase();
29
+ return fieldValue.includes(lowercaseSearch);
30
+ });
31
+ }
32
+ /**
33
+ * Filter array by boolean field
34
+ * @param items - Array of objects to filter
35
+ * @param fieldName - Name of the boolean field
36
+ * @param value - Boolean value to filter by
37
+ * @returns Filtered array
38
+ */
39
+ export function filterByBooleanField(items, fieldName, value) {
40
+ return items.filter(item => Boolean(item[fieldName]) === value);
41
+ }
42
+ /**
43
+ * Find item by exact field match
44
+ * @param items - Array of objects to search
45
+ * @param fieldName - Name of the field to match
46
+ * @param value - Value to match
47
+ * @returns Found item or undefined
48
+ */
49
+ export function findByField(items, fieldName, value) {
50
+ return items.find(item => item[fieldName] === value);
51
+ }
52
+ /**
53
+ * Find item by case-insensitive string field match
54
+ * @param items - Array of objects to search
55
+ * @param fieldName - Name of the string field to match
56
+ * @param value - String value to match (case-insensitive)
57
+ * @returns Found item or undefined
58
+ */
59
+ export function findByStringField(items, fieldName, value) {
60
+ const lowercaseValue = value.toLowerCase();
61
+ return items.find(item => {
62
+ const fieldValue = String(item[fieldName]).toLowerCase();
63
+ return fieldValue === lowercaseValue;
64
+ });
65
+ }
66
+ /**
67
+ * Extract values from a specific field and sort them
68
+ * @param items - Array of objects
69
+ * @param fieldName - Name of the field to extract
70
+ * @returns Sorted array of extracted values
71
+ */
72
+ export function extractAndSortField(items, fieldName) {
73
+ return items.map(item => item[fieldName]).sort();
74
+ }
75
+ /**
76
+ * Group array items by the first character of a string field
77
+ * @param items - Array of objects to group
78
+ * @param fieldName - Name of the string field to group by
79
+ * @returns Object with first letters as keys and arrays of items as values
80
+ */
81
+ export function groupByFirstLetter(items, fieldName) {
82
+ return items.reduce((groups, item) => {
83
+ const fieldValue = String(item[fieldName]);
84
+ const firstLetter = fieldValue.charAt(0).toUpperCase();
85
+ if (!groups[firstLetter]) {
86
+ groups[firstLetter] = [];
87
+ }
88
+ groups[firstLetter].push(item);
89
+ return groups;
90
+ }, {});
91
+ }
92
+ /**
93
+ * Group array items by a field value
94
+ * @param items - Array of objects to group
95
+ * @param fieldName - Name of the field to group by
96
+ * @returns Object with field values as keys and arrays of items as values
97
+ */
98
+ export function groupByField(items, fieldName) {
99
+ return items.reduce((groups, item) => {
100
+ const fieldValue = String(item[fieldName]);
101
+ if (!groups[fieldValue]) {
102
+ groups[fieldValue] = [];
103
+ }
104
+ groups[fieldValue].push(item);
105
+ return groups;
106
+ }, {});
107
+ }
108
+ /**
109
+ * Check if any item in array has a specific boolean field value
110
+ * @param items - Array of objects to check
111
+ * @param fieldName - Name of the boolean field
112
+ * @param value - Boolean value to check for
113
+ * @returns true if any item matches, false otherwise
114
+ */
115
+ export function hasItemWithFieldValue(items, fieldName, value) {
116
+ return items.some(item => item[fieldName] === value);
117
+ }
118
+ /**
119
+ * Count items that match a field value
120
+ * @param items - Array of objects to count
121
+ * @param fieldName - Name of the field to check
122
+ * @param value - Value to count
123
+ * @returns Number of matching items
124
+ */
125
+ export function countByFieldValue(items, fieldName, value) {
126
+ return items.filter(item => item[fieldName] === value).length;
127
+ }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * File download utilities
3
+ * Browser-based file download functionality
4
+ */
5
+ /**
6
+ * Download a blob as a file
7
+ * Creates a temporary download link and triggers the download
8
+ * @param blob - The blob to download
9
+ * @param filename - The filename for the downloaded file
10
+ */
11
+ export declare function downloadBlob(blob: Blob, filename: string): void;
12
+ /**
13
+ * Download text content as a file
14
+ * @param content - Text content to download
15
+ * @param filename - The filename for the downloaded file
16
+ * @param mimeType - MIME type for the file (default: text/plain)
17
+ */
18
+ export declare function downloadTextFile(content: string, filename: string, mimeType?: string): void;
19
+ /**
20
+ * Download JSON data as a file
21
+ * @param data - JavaScript object to serialize and download
22
+ * @param filename - The filename for the downloaded file (should end with .json)
23
+ */
24
+ export declare function downloadJsonFile(data: unknown, filename: string): void;
25
+ /**
26
+ * Generate a timestamped filename
27
+ * @param baseName - Base name for the file (without extension)
28
+ * @param extension - File extension (with or without leading dot)
29
+ * @param includeTime - Whether to include time in timestamp (default: false)
30
+ * @returns Timestamped filename
31
+ */
32
+ export declare function generateTimestampedFilename(baseName: string, extension: string, includeTime?: boolean): string;
33
+ /**
34
+ * Download data URL as a file
35
+ * @param dataUrl - Data URL (data:mime/type;base64,data)
36
+ * @param filename - The filename for the downloaded file
37
+ */
38
+ export declare function downloadDataUrl(dataUrl: string, filename: string): void;
39
+ /**
40
+ * Download CSV data as a file
41
+ * @param data - Array of objects to convert to CSV
42
+ * @param filename - The filename for the downloaded file (should end with .csv)
43
+ * @param headers - Optional custom headers (uses object keys if not provided)
44
+ */
45
+ export declare function downloadCsvFile<T extends Record<string, unknown>>(data: T[], filename: string, headers?: string[]): void;
46
+ //# sourceMappingURL=downloads.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"downloads.d.ts","sourceRoot":"","sources":["../src/downloads.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAS/D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAqB,GAAG,IAAI,CAGzG;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAGtE;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,GAAE,OAAe,GAAG,MAAM,CASrH;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAOvE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/D,IAAI,EAAE,CAAC,EAAE,EACT,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,EAAE,GACjB,IAAI,CAqBN"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * File download utilities
3
+ * Browser-based file download functionality
4
+ */
5
+ /**
6
+ * Download a blob as a file
7
+ * Creates a temporary download link and triggers the download
8
+ * @param blob - The blob to download
9
+ * @param filename - The filename for the downloaded file
10
+ */
11
+ export function downloadBlob(blob, filename) {
12
+ const url = window.URL.createObjectURL(blob);
13
+ const link = document.createElement('a');
14
+ link.href = url;
15
+ link.setAttribute('download', filename);
16
+ document.body.appendChild(link);
17
+ link.click();
18
+ document.body.removeChild(link);
19
+ window.URL.revokeObjectURL(url);
20
+ }
21
+ /**
22
+ * Download text content as a file
23
+ * @param content - Text content to download
24
+ * @param filename - The filename for the downloaded file
25
+ * @param mimeType - MIME type for the file (default: text/plain)
26
+ */
27
+ export function downloadTextFile(content, filename, mimeType = 'text/plain') {
28
+ const blob = new Blob([content], { type: mimeType });
29
+ downloadBlob(blob, filename);
30
+ }
31
+ /**
32
+ * Download JSON data as a file
33
+ * @param data - JavaScript object to serialize and download
34
+ * @param filename - The filename for the downloaded file (should end with .json)
35
+ */
36
+ export function downloadJsonFile(data, filename) {
37
+ const jsonString = JSON.stringify(data, null, 2);
38
+ downloadTextFile(jsonString, filename, 'application/json');
39
+ }
40
+ /**
41
+ * Generate a timestamped filename
42
+ * @param baseName - Base name for the file (without extension)
43
+ * @param extension - File extension (with or without leading dot)
44
+ * @param includeTime - Whether to include time in timestamp (default: false)
45
+ * @returns Timestamped filename
46
+ */
47
+ export function generateTimestampedFilename(baseName, extension, includeTime = false) {
48
+ const now = new Date();
49
+ const dateString = now.toISOString().split('T')[0]; // YYYY-MM-DD
50
+ const timeString = now.toTimeString().split(' ')[0]?.replace(/:/g, '-') || '00-00-00'; // HH-MM-SS
51
+ const cleanExtension = extension.startsWith('.') ? extension : `.${extension}`;
52
+ const timestamp = includeTime ? `${dateString}-${timeString}` : dateString;
53
+ return `${baseName}-${timestamp}${cleanExtension}`;
54
+ }
55
+ /**
56
+ * Download data URL as a file
57
+ * @param dataUrl - Data URL (data:mime/type;base64,data)
58
+ * @param filename - The filename for the downloaded file
59
+ */
60
+ export function downloadDataUrl(dataUrl, filename) {
61
+ const link = document.createElement('a');
62
+ link.href = dataUrl;
63
+ link.setAttribute('download', filename);
64
+ document.body.appendChild(link);
65
+ link.click();
66
+ document.body.removeChild(link);
67
+ }
68
+ /**
69
+ * Download CSV data as a file
70
+ * @param data - Array of objects to convert to CSV
71
+ * @param filename - The filename for the downloaded file (should end with .csv)
72
+ * @param headers - Optional custom headers (uses object keys if not provided)
73
+ */
74
+ export function downloadCsvFile(data, filename, headers) {
75
+ if (data.length === 0) {
76
+ throw new Error('Cannot create CSV from empty data array');
77
+ }
78
+ const csvHeaders = headers || Object.keys(data[0] || {});
79
+ const csvRows = data.map(row => csvHeaders
80
+ .map(header => {
81
+ const value = row[header];
82
+ // Escape commas and quotes in CSV values
83
+ const stringValue = String(value ?? '');
84
+ return stringValue.includes(',') || stringValue.includes('"')
85
+ ? `"${stringValue.replace(/"/g, '""')}"`
86
+ : stringValue;
87
+ })
88
+ .join(','));
89
+ const csvContent = [csvHeaders.join(','), ...csvRows].join('\n');
90
+ downloadTextFile(csvContent, filename, 'text/csv');
91
+ }
package/dist/index.d.ts CHANGED
@@ -21,4 +21,6 @@ export type { DeviceInfo, TokenRefreshResponse, TokenRefreshError, AutoRefreshHa
21
21
  export { isTokenExpired, isTokenExpiringSoon, getTimeUntilExpiry, formatTimeUntilExpiry, parseDeviceInfo, isRefreshSuccess, getRefreshErrorMessage, createAutoRefreshHandler, } from './auth';
22
22
  export type { InstrumentTypeInfo, InstrumentBasicInfo, PriceChangeResult, PriceSnapshot, FormattedPriceChange, TradeableInstrument, MarketDataInfo, } from './instruments';
23
23
  export { formatInstrumentPrice, getCurrencySymbol, getInstrumentType, formatInstrumentName, calculatePriceChange, formatPriceChange, isInstrumentTradeable, formatMarketCap, formatVolume, hasMarketData, } from './instruments';
24
+ export { sortByStringField, filterByTextSearch, filterByBooleanField, findByField, findByStringField, extractAndSortField, groupByFirstLetter, groupByField, hasItemWithFieldValue, countByFieldValue, } from './collections';
25
+ export { downloadBlob, downloadTextFile, downloadJsonFile, generateTimestampedFilename, downloadDataUrl, downloadCsvFile, } from './downloads';
24
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAGtC,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAGjF,OAAO,EACL,8BAA8B,EAC9B,qCAAqC,EACrC,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,YAAY,GACb,MAAM,YAAY,CAAC;AAGpB,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,W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oB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,YAAY,EACZ,aAAa,GACd,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,2BAA2B,EAC3B,eAAe,EACf,eAAe,GAChB,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -20,3 +20,7 @@ export { isNumericOnly, validatePassword, isValidTokenFormat, formatVerification
20
20
  export { hasActiveFilters, countActiveFilters, clearAllFilters, updateFilters, isFilterEmpty, removeEmptyFilters, mergeFilters, areFiltersEqual, createFilterPredicate, } from './filters';
21
21
  export { isTokenExpired, isTokenExpiringSoon, getTimeUntilExpiry, formatTimeUntilExpiry, parseDeviceInfo, isRefreshSuccess, getRefreshErrorMessage, createAutoRefreshHandler, } from './auth';
22
22
  export { formatInstrumentPrice, getCurrencySymbol, getInstrumentType, formatInstrumentName, calculatePriceChange, formatPriceChange, isInstrumentTradeable, formatMarketCap, formatVolume, hasMarketData, } from './instruments';
23
+ // Collection utilities
24
+ export { sortByStringField, filterByTextSearch, filterByBooleanField, findByField, findByStringField, extractAndSortField, groupByFirstLetter, groupByField, hasItemWithFieldValue, countByFieldValue, } from './collections';
25
+ // Download utilities
26
+ export { downloadBlob, downloadTextFile, downloadJsonFile, generateTimestampedFilename, downloadDataUrl, downloadCsvFile, } from './downloads';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cranberry-money/shared-utils",
3
- "version": "4.11.0",
3
+ "version": "4.12.0",
4
4
  "description": "Shared utility functions for MyPortfolio platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",