react-util-tools 1.0.24 → 1.0.26

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/index.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import Decimal from 'decimal.js';
2
2
  export { default as Decimal, Decimal as DecimalType } from 'decimal.js';
3
+ import * as XLSX from 'xlsx';
4
+ export { XLSX };
5
+ export { BookType, CellObject, JSON2SheetOpts, ParsingOptions, Range, Sheet2JSONOpts, WorkBook, WorkSheet, WritingOptions } from 'xlsx';
3
6
 
4
7
  declare function throttleFn<T extends (...args: any[]) => any>(fn: T, wait?: number, options?: {
5
8
  leading?: boolean;
@@ -167,4 +170,68 @@ declare function floor(value: number | string | Decimal, decimalPlaces?: number)
167
170
  declare function abs(value: number | string | Decimal): number;
168
171
  declare function negate(value: number | string | Decimal): number;
169
172
 
170
- export { type CookieOptions, abs, add, addDaysToDate, addDaysUTC, addMonthsToDate, addMonthsUTC, ceil, clearAllCookies, debounceFn as debounce, divide, equals, floor, formatDate, formatDateOnly, formatMoney, formatMoneyToChinese, formatNumber, formatPercent, formatRelativeTime, formatTimeOnly, formatUTC, formatUTCDateOnly, formatUTCTimeOnly, fromUTC, getAllCookies, getAllQueryParams, getBrowser, getBrowserEngine, getBrowserVersion, getCookie, getDaysDiff, getDeviceInfo, getDevicePixelRatio, getDeviceType, getEndOfDay, getEndOfMonth, getEndOfWeek, getEndOfYear, getHoursDiff, getMinutesDiff, getOS, getQueryParam, getQueryParamAll, getScreenResolution, getStartOfDay, getStartOfMonth, getStartOfWeek, getStartOfYear, getTimestamp, getTimestampInSeconds, getTimezoneOffset, getTimezoneOffsetHours, getUTCAllWeeksInYear, getUTCDaysDiff, getUTCEndOfDay, getUTCEndOfMonth, getUTCHoursDiff, getUTCMinutesDiff, getUTCNow, getUTCStartOfDay, getUTCStartOfMonth, getUTCTimestamp, getUTCTimestampInSeconds, getUTCWeekEnd, getUTCWeekNumber, getUTCWeekStart, getUTCWeeksInYear, getUTCYearEnd, getUTCYearEndTimestamp, getUTCYearStart, getUTCYearStartTimestamp, getViewportSize, greaterThan, greaterThanOrEqual, hasCookie, isAfterDate, isAndroid, isBeforeDate, isDesktop, isIOS, isMobile, isSameDayDate, isTablet, isTouchDevice, isValidDate, isWeChat, lessThan, lessThanOrEqual, maskEmail, multiply, negate, parseDate, parseMoney, removeCookie, round, setCookie, subDaysFromDate, subDaysUTC, subMonthsFromDate, subMonthsUTC, subtract, throttleFn as throttle, toISOString, toUTC, unmaskEmail };
173
+ declare const read: typeof XLSX.read;
174
+ declare const readFile: typeof XLSX.readFile;
175
+ declare const write: typeof XLSX.write;
176
+ declare const writeFile: typeof XLSX.writeFile;
177
+ declare const writeFileXLSX: typeof XLSX.writeFileXLSX;
178
+ declare const utils: XLSX.XLSX$Utils;
179
+ declare function readExcelFile(file: File, options?: XLSX.ParsingOptions): Promise<XLSX.WorkBook>;
180
+ declare function workbookToJSON<T = any>(workbook: XLSX.WorkBook, sheetName?: string, options?: XLSX.Sheet2JSONOpts): T[];
181
+ declare function jsonToWorkbook<T = any>(data: T[], sheetName?: string, options?: XLSX.JSON2SheetOpts): XLSX.WorkBook;
182
+ declare function exportExcelFile(workbook: XLSX.WorkBook, filename?: string, options?: XLSX.WritingOptions): void;
183
+ declare function exportJSONToExcel<T = any>(data: T[], filename?: string, sheetName?: string, options?: XLSX.WritingOptions): void;
184
+ declare function readExcelToJSON<T = any>(file: File, sheetName?: string, parseOptions?: XLSX.ParsingOptions, jsonOptions?: XLSX.Sheet2JSONOpts): Promise<T[]>;
185
+ declare function getSheetNames(workbook: XLSX.WorkBook): string[];
186
+ declare function getSheet(workbook: XLSX.WorkBook, sheetName: string): XLSX.WorkSheet;
187
+ declare function sheetToCSV(worksheet: XLSX.WorkSheet, options?: XLSX.Sheet2CSVOpts): string;
188
+ declare function sheetToHTML(worksheet: XLSX.WorkSheet, options?: XLSX.Sheet2HTMLOpts): string;
189
+ declare function tableToSheet(table: HTMLElement | string, options?: XLSX.Table2SheetOpts): XLSX.WorkSheet;
190
+ declare function aoaToSheet(data: any[][], options?: XLSX.AOA2SheetOpts): XLSX.WorkSheet;
191
+ declare function sheetToAOA(worksheet: XLSX.WorkSheet, options?: XLSX.Sheet2JSONOpts): any[][];
192
+
193
+ declare function capitalize(str: string): string;
194
+ declare function camelCase(str: string): string;
195
+ declare function pascalCase(str: string): string;
196
+ declare function snakeCase(str: string): string;
197
+ declare function kebabCase(str: string): string;
198
+ declare function truncate(str: string, length: number, suffix?: string): string;
199
+ declare function trim(str: string): string;
200
+ declare function trimStart(str: string): string;
201
+ declare function trimEnd(str: string): string;
202
+ declare function reverse(str: string): string;
203
+ declare function repeat(str: string, count: number): string;
204
+ declare function padStart(str: string, length: number, padStr?: string): string;
205
+ declare function padEnd(str: string, length: number, padStr?: string): string;
206
+ declare function startsWith(str: string, searchString: string): boolean;
207
+ declare function endsWith(str: string, searchString: string): boolean;
208
+ declare function includes(str: string, searchString: string): boolean;
209
+ declare function replaceAll(str: string, search: string | RegExp, replacement: string): string;
210
+ declare function stripHtml(str: string): string;
211
+ declare function escapeHtml(str: string): string;
212
+ declare function unescapeHtml(str: string): string;
213
+ declare function toLowerCase(str: string): string;
214
+ declare function toUpperCase(str: string): string;
215
+ declare function titleCase(str: string): string;
216
+ declare function isEmpty(str: string): boolean;
217
+ declare function isNotEmpty(str: string): boolean;
218
+ declare function length(str: string): number;
219
+ declare function split(str: string, separator: string | RegExp): string[];
220
+ declare function extractNumbers(str: string): number[];
221
+ declare function removeSpaces(str: string): string;
222
+ declare function normalizeSpaces(str: string): string;
223
+ declare function countOccurrences(str: string, searchString: string): number;
224
+ declare function randomString(length: number, chars?: string): string;
225
+ declare function uuid(): string;
226
+ declare function maskPhone(phone: string): string;
227
+ declare function maskIdCard(idCard: string): string;
228
+ declare function maskBankCard(cardNumber: string): string;
229
+ declare function maskName(name: string): string;
230
+ declare function isValidPhone(phone: string): boolean;
231
+ declare function isValidEmail(email: string): boolean;
232
+ declare function isValidUrl(url: string): boolean;
233
+ declare function isValidIdCard(idCard: string): boolean;
234
+ declare function toBase64(str: string): string;
235
+ declare function fromBase64(base64: string): string;
236
+
237
+ export { type CookieOptions, abs, add, addDaysToDate, addDaysUTC, addMonthsToDate, addMonthsUTC, aoaToSheet, camelCase, capitalize, ceil, clearAllCookies, countOccurrences, debounceFn as debounce, divide, endsWith, equals, escapeHtml, exportExcelFile, exportJSONToExcel, extractNumbers, floor, formatDate, formatDateOnly, formatMoney, formatMoneyToChinese, formatNumber, formatPercent, formatRelativeTime, formatTimeOnly, formatUTC, formatUTCDateOnly, formatUTCTimeOnly, fromBase64, fromUTC, getAllCookies, getAllQueryParams, getBrowser, getBrowserEngine, getBrowserVersion, getCookie, getDaysDiff, getDeviceInfo, getDevicePixelRatio, getDeviceType, getEndOfDay, getEndOfMonth, getEndOfWeek, getEndOfYear, getHoursDiff, getMinutesDiff, getOS, getQueryParam, getQueryParamAll, getScreenResolution, getSheet, getSheetNames, getStartOfDay, getStartOfMonth, getStartOfWeek, getStartOfYear, getTimestamp, getTimestampInSeconds, getTimezoneOffset, getTimezoneOffsetHours, getUTCAllWeeksInYear, getUTCDaysDiff, getUTCEndOfDay, getUTCEndOfMonth, getUTCHoursDiff, getUTCMinutesDiff, getUTCNow, getUTCStartOfDay, getUTCStartOfMonth, getUTCTimestamp, getUTCTimestampInSeconds, getUTCWeekEnd, getUTCWeekNumber, getUTCWeekStart, getUTCWeeksInYear, getUTCYearEnd, getUTCYearEndTimestamp, getUTCYearStart, getUTCYearStartTimestamp, getViewportSize, greaterThan, greaterThanOrEqual, hasCookie, includes, isAfterDate, isAndroid, isBeforeDate, isDesktop, isEmpty, isIOS, isMobile, isNotEmpty, isSameDayDate, isTablet, isTouchDevice, isValidDate, isValidEmail, isValidIdCard, isValidPhone, isValidUrl, isWeChat, jsonToWorkbook, kebabCase, length, lessThan, lessThanOrEqual, maskBankCard, maskEmail, maskIdCard, maskName, maskPhone, multiply, negate, normalizeSpaces, padEnd, padStart, parseDate, parseMoney, pascalCase, randomString, read, readExcelFile, readExcelToJSON, readFile, removeCookie, removeSpaces, repeat, replaceAll, reverse, round, setCookie, sheetToAOA, sheetToCSV, sheetToHTML, snakeCase, split, startsWith, stripHtml, subDaysFromDate, subDaysUTC, subMonthsFromDate, subMonthsUTC, subtract, tableToSheet, throttleFn as throttle, titleCase, toBase64, toISOString, toLowerCase, toUTC, toUpperCase, trim, trimEnd, trimStart, truncate, unescapeHtml, unmaskEmail, utils, uuid, workbookToJSON, write, writeFile, writeFileXLSX };
package/dist/index.js CHANGED
@@ -843,19 +843,338 @@ function negate(value) {
843
843
  return 0;
844
844
  }
845
845
  }
846
+
847
+ // src/excel/index.ts
848
+ import * as XLSX from "xlsx";
849
+ var {
850
+ read: read2,
851
+ readFile,
852
+ write,
853
+ writeFile: writeFile2,
854
+ writeFileXLSX,
855
+ utils: utils2
856
+ } = XLSX;
857
+ function readExcelFile(file, options) {
858
+ return new Promise((resolve, reject) => {
859
+ const reader = new FileReader();
860
+ reader.onload = (e) => {
861
+ try {
862
+ const data = e.target?.result;
863
+ const workbook = XLSX.read(data, options);
864
+ resolve(workbook);
865
+ } catch (error) {
866
+ reject(error);
867
+ }
868
+ };
869
+ reader.onerror = () => {
870
+ reject(new Error("Failed to read file"));
871
+ };
872
+ reader.readAsArrayBuffer(file);
873
+ });
874
+ }
875
+ function workbookToJSON(workbook, sheetName, options) {
876
+ const sheet = sheetName ? workbook.Sheets[sheetName] : workbook.Sheets[workbook.SheetNames[0]];
877
+ if (!sheet) {
878
+ throw new Error(`Sheet "${sheetName}" not found`);
879
+ }
880
+ return XLSX.utils.sheet_to_json(sheet, options);
881
+ }
882
+ function jsonToWorkbook(data, sheetName = "Sheet1", options) {
883
+ const worksheet = XLSX.utils.json_to_sheet(data, options);
884
+ const workbook = XLSX.utils.book_new();
885
+ XLSX.utils.book_append_sheet(workbook, worksheet, sheetName);
886
+ return workbook;
887
+ }
888
+ function exportExcelFile(workbook, filename = "export.xlsx", options) {
889
+ XLSX.writeFile(workbook, filename, options);
890
+ }
891
+ function exportJSONToExcel(data, filename = "export.xlsx", sheetName = "Sheet1", options) {
892
+ const workbook = jsonToWorkbook(data, sheetName);
893
+ exportExcelFile(workbook, filename, options);
894
+ }
895
+ async function readExcelToJSON(file, sheetName, parseOptions, jsonOptions) {
896
+ const workbook = await readExcelFile(file, parseOptions);
897
+ return workbookToJSON(workbook, sheetName, jsonOptions);
898
+ }
899
+ function getSheetNames(workbook) {
900
+ return workbook.SheetNames;
901
+ }
902
+ function getSheet(workbook, sheetName) {
903
+ const sheet = workbook.Sheets[sheetName];
904
+ if (!sheet) {
905
+ throw new Error(`Sheet "${sheetName}" not found`);
906
+ }
907
+ return sheet;
908
+ }
909
+ function sheetToCSV(worksheet, options) {
910
+ return XLSX.utils.sheet_to_csv(worksheet, options);
911
+ }
912
+ function sheetToHTML(worksheet, options) {
913
+ return XLSX.utils.sheet_to_html(worksheet, options);
914
+ }
915
+ function tableToSheet(table, options) {
916
+ return XLSX.utils.table_to_sheet(table, options);
917
+ }
918
+ function aoaToSheet(data, options) {
919
+ return XLSX.utils.aoa_to_sheet(data, options);
920
+ }
921
+ function sheetToAOA(worksheet, options) {
922
+ return XLSX.utils.sheet_to_json(worksheet, { ...options, header: 1 });
923
+ }
924
+
925
+ // src/string/index.ts
926
+ function capitalize(str) {
927
+ if (!str) return "";
928
+ return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
929
+ }
930
+ function camelCase(str) {
931
+ if (!str) return "";
932
+ return str.replace(/[-_\s]+(.)?/g, (_, char) => char ? char.toUpperCase() : "").replace(/^[A-Z]/, (char) => char.toLowerCase());
933
+ }
934
+ function pascalCase(str) {
935
+ if (!str) return "";
936
+ const camel = camelCase(str);
937
+ return camel.charAt(0).toUpperCase() + camel.slice(1);
938
+ }
939
+ function snakeCase(str) {
940
+ if (!str) return "";
941
+ return str.replace(/([A-Z])/g, "_$1").replace(/[-\s]+/g, "_").replace(/^_/, "").toLowerCase();
942
+ }
943
+ function kebabCase(str) {
944
+ if (!str) return "";
945
+ return str.replace(/([A-Z])/g, "-$1").replace(/[_\s]+/g, "-").replace(/^-/, "").toLowerCase();
946
+ }
947
+ function truncate(str, length2, suffix = "...") {
948
+ if (!str || str.length <= length2) return str;
949
+ return str.slice(0, length2) + suffix;
950
+ }
951
+ function trim(str) {
952
+ return str ? str.trim() : "";
953
+ }
954
+ function trimStart(str) {
955
+ return str ? str.trimStart() : "";
956
+ }
957
+ function trimEnd(str) {
958
+ return str ? str.trimEnd() : "";
959
+ }
960
+ function reverse(str) {
961
+ if (!str) return "";
962
+ return str.split("").reverse().join("");
963
+ }
964
+ function repeat(str, count) {
965
+ if (!str || count <= 0) return "";
966
+ return str.repeat(count);
967
+ }
968
+ function padStart(str, length2, padStr = " ") {
969
+ if (!str) return padStr.repeat(length2);
970
+ return str.padStart(length2, padStr);
971
+ }
972
+ function padEnd(str, length2, padStr = " ") {
973
+ if (!str) return padStr.repeat(length2);
974
+ return str.padEnd(length2, padStr);
975
+ }
976
+ function startsWith(str, searchString) {
977
+ if (!str) return false;
978
+ return str.startsWith(searchString);
979
+ }
980
+ function endsWith(str, searchString) {
981
+ if (!str) return false;
982
+ return str.endsWith(searchString);
983
+ }
984
+ function includes(str, searchString) {
985
+ if (!str) return false;
986
+ return str.includes(searchString);
987
+ }
988
+ function replaceAll(str, search, replacement) {
989
+ if (!str) return "";
990
+ if (typeof search === "string") {
991
+ return str.split(search).join(replacement);
992
+ }
993
+ return str.replace(search, replacement);
994
+ }
995
+ function stripHtml(str) {
996
+ if (!str) return "";
997
+ return str.replace(/<[^>]*>/g, "");
998
+ }
999
+ function escapeHtml(str) {
1000
+ if (!str) return "";
1001
+ const map = {
1002
+ "&": "&amp;",
1003
+ "<": "&lt;",
1004
+ ">": "&gt;",
1005
+ '"': "&quot;",
1006
+ "'": "&#39;"
1007
+ };
1008
+ return str.replace(/[&<>"']/g, (char) => map[char]);
1009
+ }
1010
+ function unescapeHtml(str) {
1011
+ if (!str) return "";
1012
+ const map = {
1013
+ "&amp;": "&",
1014
+ "&lt;": "<",
1015
+ "&gt;": ">",
1016
+ "&quot;": '"',
1017
+ "&#39;": "'"
1018
+ };
1019
+ return str.replace(/&(amp|lt|gt|quot|#39);/g, (entity) => map[entity]);
1020
+ }
1021
+ function toLowerCase(str) {
1022
+ return str ? str.toLowerCase() : "";
1023
+ }
1024
+ function toUpperCase(str) {
1025
+ return str ? str.toUpperCase() : "";
1026
+ }
1027
+ function titleCase(str) {
1028
+ if (!str) return "";
1029
+ return str.toLowerCase().split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
1030
+ }
1031
+ function isEmpty(str) {
1032
+ return !str || str.trim().length === 0;
1033
+ }
1034
+ function isNotEmpty(str) {
1035
+ return !isEmpty(str);
1036
+ }
1037
+ function length(str) {
1038
+ if (!str) return 0;
1039
+ return Array.from(str).length;
1040
+ }
1041
+ function split(str, separator) {
1042
+ if (!str) return [];
1043
+ return str.split(separator);
1044
+ }
1045
+ function extractNumbers(str) {
1046
+ if (!str) return [];
1047
+ const matches = str.match(/\d+(\.\d+)?/g);
1048
+ return matches ? matches.map(Number) : [];
1049
+ }
1050
+ function removeSpaces(str) {
1051
+ if (!str) return "";
1052
+ return str.replace(/\s+/g, "");
1053
+ }
1054
+ function normalizeSpaces(str) {
1055
+ if (!str) return "";
1056
+ return str.replace(/\s+/g, " ").trim();
1057
+ }
1058
+ function countOccurrences(str, searchString) {
1059
+ if (!str || !searchString) return 0;
1060
+ return str.split(searchString).length - 1;
1061
+ }
1062
+ function randomString(length2, chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
1063
+ let result = "";
1064
+ for (let i = 0; i < length2; i++) {
1065
+ result += chars.charAt(Math.floor(Math.random() * chars.length));
1066
+ }
1067
+ return result;
1068
+ }
1069
+ function uuid() {
1070
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
1071
+ const r = Math.random() * 16 | 0;
1072
+ const v = c === "x" ? r : r & 3 | 8;
1073
+ return v.toString(16);
1074
+ });
1075
+ }
1076
+ function maskPhone(phone) {
1077
+ if (!phone || phone.length < 11) return phone;
1078
+ return phone.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
1079
+ }
1080
+ function maskIdCard(idCard) {
1081
+ if (!idCard || idCard.length < 18) return idCard;
1082
+ return idCard.replace(/(\d{6})\d{8}(\d{4})/, "$1********$2");
1083
+ }
1084
+ function maskBankCard(cardNumber) {
1085
+ if (!cardNumber || cardNumber.length < 16) return cardNumber;
1086
+ return cardNumber.replace(/(\d{4})\d+(\d{4})/, "$1 **** **** $2");
1087
+ }
1088
+ function maskName(name) {
1089
+ if (!name) return "";
1090
+ if (name.length === 2) {
1091
+ return name.charAt(0) + "*";
1092
+ }
1093
+ return name.charAt(0) + "*".repeat(name.length - 2) + name.charAt(name.length - 1);
1094
+ }
1095
+ function isValidPhone(phone) {
1096
+ if (!phone) return false;
1097
+ return /^1[3-9]\d{9}$/.test(phone);
1098
+ }
1099
+ function isValidEmail(email) {
1100
+ if (!email) return false;
1101
+ return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
1102
+ }
1103
+ function isValidUrl(url) {
1104
+ if (!url) return false;
1105
+ try {
1106
+ new URL(url);
1107
+ return true;
1108
+ } catch {
1109
+ return false;
1110
+ }
1111
+ }
1112
+ function isValidIdCard(idCard) {
1113
+ if (!idCard) return false;
1114
+ return /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(idCard);
1115
+ }
1116
+ function toBase64(str) {
1117
+ if (!str) return "";
1118
+ if (typeof window !== "undefined" && window.btoa) {
1119
+ try {
1120
+ return window.btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (_, p1) => {
1121
+ return String.fromCharCode(parseInt(p1, 16));
1122
+ }));
1123
+ } catch {
1124
+ return "";
1125
+ }
1126
+ }
1127
+ try {
1128
+ const BufferClass = globalThis.Buffer;
1129
+ return BufferClass ? BufferClass.from(str, "utf-8").toString("base64") : "";
1130
+ } catch {
1131
+ return "";
1132
+ }
1133
+ }
1134
+ function fromBase64(base64) {
1135
+ if (!base64) return "";
1136
+ if (typeof window !== "undefined" && window.atob) {
1137
+ try {
1138
+ const binary = window.atob(base64);
1139
+ const bytes = new Uint8Array(binary.length);
1140
+ for (let i = 0; i < binary.length; i++) {
1141
+ bytes[i] = binary.charCodeAt(i);
1142
+ }
1143
+ return new TextDecoder().decode(bytes);
1144
+ } catch {
1145
+ return "";
1146
+ }
1147
+ }
1148
+ try {
1149
+ const BufferClass = globalThis.Buffer;
1150
+ return BufferClass ? BufferClass.from(base64, "base64").toString("utf-8") : "";
1151
+ } catch {
1152
+ return "";
1153
+ }
1154
+ }
846
1155
  export {
847
1156
  default2 as Decimal,
1157
+ XLSX,
848
1158
  abs,
849
1159
  add,
850
1160
  addDaysToDate,
851
1161
  addDaysUTC,
852
1162
  addMonthsToDate,
853
1163
  addMonthsUTC,
1164
+ aoaToSheet,
1165
+ camelCase,
1166
+ capitalize,
854
1167
  ceil,
855
1168
  clearAllCookies,
1169
+ countOccurrences,
856
1170
  debounceFn as debounce,
857
1171
  divide,
1172
+ endsWith,
858
1173
  equals,
1174
+ escapeHtml,
1175
+ exportExcelFile,
1176
+ exportJSONToExcel,
1177
+ extractNumbers,
859
1178
  floor,
860
1179
  formatDate,
861
1180
  formatDateOnly,
@@ -868,6 +1187,7 @@ export {
868
1187
  formatUTC,
869
1188
  formatUTCDateOnly,
870
1189
  formatUTCTimeOnly,
1190
+ fromBase64,
871
1191
  fromUTC,
872
1192
  getAllCookies,
873
1193
  getAllQueryParams,
@@ -889,6 +1209,8 @@ export {
889
1209
  getQueryParam,
890
1210
  getQueryParamAll,
891
1211
  getScreenResolution,
1212
+ getSheet,
1213
+ getSheetNames,
892
1214
  getStartOfDay,
893
1215
  getStartOfMonth,
894
1216
  getStartOfWeek,
@@ -920,34 +1242,84 @@ export {
920
1242
  greaterThan,
921
1243
  greaterThanOrEqual,
922
1244
  hasCookie,
1245
+ includes,
923
1246
  isAfterDate,
924
1247
  isAndroid,
925
1248
  isBeforeDate,
926
1249
  isDesktop,
1250
+ isEmpty,
927
1251
  isIOS,
928
1252
  isMobile,
1253
+ isNotEmpty,
929
1254
  isSameDayDate,
930
1255
  isTablet,
931
1256
  isTouchDevice,
932
1257
  isValidDate,
1258
+ isValidEmail,
1259
+ isValidIdCard,
1260
+ isValidPhone,
1261
+ isValidUrl,
933
1262
  isWeChat,
1263
+ jsonToWorkbook,
1264
+ kebabCase,
1265
+ length,
934
1266
  lessThan,
935
1267
  lessThanOrEqual,
1268
+ maskBankCard,
936
1269
  maskEmail,
1270
+ maskIdCard,
1271
+ maskName,
1272
+ maskPhone,
937
1273
  multiply,
938
1274
  negate,
1275
+ normalizeSpaces,
1276
+ padEnd,
1277
+ padStart,
939
1278
  parseDate,
940
1279
  parseMoney,
1280
+ pascalCase,
1281
+ randomString,
1282
+ read2 as read,
1283
+ readExcelFile,
1284
+ readExcelToJSON,
1285
+ readFile,
941
1286
  removeCookie,
1287
+ removeSpaces,
1288
+ repeat,
1289
+ replaceAll,
1290
+ reverse,
942
1291
  round,
943
1292
  setCookie,
1293
+ sheetToAOA,
1294
+ sheetToCSV,
1295
+ sheetToHTML,
1296
+ snakeCase,
1297
+ split,
1298
+ startsWith,
1299
+ stripHtml,
944
1300
  subDaysFromDate,
945
1301
  subDaysUTC,
946
1302
  subMonthsFromDate,
947
1303
  subMonthsUTC,
948
1304
  subtract,
1305
+ tableToSheet,
949
1306
  throttleFn as throttle,
1307
+ titleCase,
1308
+ toBase64,
950
1309
  toISOString,
1310
+ toLowerCase,
951
1311
  toUTC,
952
- unmaskEmail
1312
+ toUpperCase,
1313
+ trim,
1314
+ trimEnd,
1315
+ trimStart,
1316
+ truncate,
1317
+ unescapeHtml,
1318
+ unmaskEmail,
1319
+ utils2 as utils,
1320
+ uuid,
1321
+ workbookToJSON,
1322
+ write,
1323
+ writeFile2 as writeFile,
1324
+ writeFileXLSX
953
1325
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-util-tools",
3
- "version": "1.0.24",
4
- "description": "A collection of useful utilities: throttle, debounce, date formatting, device detection, money formatting, decimal calculations and more",
3
+ "version": "1.0.26",
4
+ "description": "A collection of useful utilities: throttle, debounce, date formatting, device detection, money formatting, decimal calculations, Excel processing and more",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.js",
@@ -36,6 +36,10 @@
36
36
  "browser-detection",
37
37
  "money-format",
38
38
  "url-params",
39
+ "excel",
40
+ "xlsx",
41
+ "sheetjs",
42
+ "cookie",
39
43
  "typescript"
40
44
  ],
41
45
  "author": "alice & bobby",
@@ -62,6 +66,7 @@
62
66
  "dependencies": {
63
67
  "date-fns": "^4.1.0",
64
68
  "date-fns-tz": "^3.2.0",
65
- "decimal.js": "^10.6.0"
69
+ "decimal.js": "^10.6.0",
70
+ "xlsx": "^0.18.5"
66
71
  }
67
72
  }