asv-hlps 1.3.6 → 1.3.7

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.
@@ -33,7 +33,9 @@ export declare const limitTo: (value: string, limit?: number, trail?: string) =>
33
33
  export declare const sleep: (ms: number) => Promise<unknown>;
34
34
  export declare const wakeUp: (sleep: any) => void;
35
35
  export declare const formatToString: (val: number, separator?: string, currency?: string) => string;
36
+ export declare const currencyFormatter: (val: number, separator?: string, currency?: string) => string;
36
37
  export declare const formatToStringCfa: (val: number) => string;
38
+ export declare const currencyFormatterCfa: (val: number) => string;
37
39
  export declare const reformatDates: (fromDate: any, toDate: any) => {
38
40
  fromDate: any;
39
41
  toDate: any;
@@ -97,4 +99,4 @@ export declare const returnBool: (tob?: boolean) => boolean;
97
99
  export declare const monthStringName: (date: string | Date, format?: "MMM" | "MMMM", options?: {
98
100
  en?: true;
99
101
  }) => string;
100
- export declare const dateFormatter: (date: Date | string, format?: "ymd" | "dmy" | "dmyfr", separator?: "/" | "-") => string;
102
+ export declare const dateFormatter: (date: Date | string, format?: "ymd" | "dmy" | "dmy-hm" | "dmyfr", separator?: "/" | "-") => string;
package/lib/cjs/utils.js CHANGED
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.packAndUnit = exports.unCheckedAll = exports.inputChecked = exports.arrayMultiChecked = exports.getPeriodDateColor = exports.getColorAccordingToDate = exports.genRandomColour = exports.formatNgbDate = exports.dateToString = exports.replaceSpacesWith = exports.replaceAllIn = exports.sesStorageGet = exports.sesStorageSet = exports.genSequenceRef = exports.removeBackSlashOccurences = exports.removeString = exports.deepClone = exports.findFirstSequenceMissing = exports.fillNumWithZero = exports.findSequencesMissing = exports.sequencesToNumbers = exports.notInSequence = exports.reformatDates = exports.formatToStringCfa = exports.formatToString = exports.wakeUp = exports.sleep = exports.limitTo = exports.titleCase = exports.toObjectDate = exports.removeDuplicateObjects = exports.removeDuplicatesByKey = exports.removeDuplicates = exports.getRandomColor = exports.getNbOfDaysBetweenTwoDates = exports.displayDateRangeFr = exports.calPercent = exports.percentOf = exports.genDateMinutesStep = exports.convertFrDateToEnDate = exports.convertEnDateToFr = exports.formatDateMd = exports.formatDateYm = exports.formatDateYmFirstDay = exports.formatDateYmd = exports.formatFromAndToDate = exports.formatDateYmHypen = exports.formatDateFirstDayFr = exports.formatDateYmdHypenFr = exports.formatDateYmdHypen = void 0;
7
- exports.dateFormatter = exports.monthStringName = exports.returnBool = exports.formatAmountToString = exports.reduceSum = exports.sumAmount = exports.fillEndWithZero = exports.fillStartWithZero = exports.absFromSequence = exports.returnDates = exports.displayFrDatePeriode = exports.getArrayOfRandomColor = exports.randomHslColor = exports.randomHexColor = exports.randomRgbColor = exports.randomInteger = exports.insertAtInArray = exports.isBirthday = exports.padEndWithZero = exports.padStartWithZero = exports.formatMonthYearToLocaleString = exports.calculPercent = exports.validEmail = exports.convertToCfa = void 0;
6
+ exports.inputChecked = exports.arrayMultiChecked = exports.getPeriodDateColor = exports.getColorAccordingToDate = exports.genRandomColour = exports.formatNgbDate = exports.dateToString = exports.replaceSpacesWith = exports.replaceAllIn = exports.sesStorageGet = exports.sesStorageSet = exports.genSequenceRef = exports.removeBackSlashOccurences = exports.removeString = exports.deepClone = exports.findFirstSequenceMissing = exports.fillNumWithZero = exports.findSequencesMissing = exports.sequencesToNumbers = exports.notInSequence = exports.reformatDates = exports.currencyFormatterCfa = exports.formatToStringCfa = exports.currencyFormatter = exports.formatToString = exports.wakeUp = exports.sleep = exports.limitTo = exports.titleCase = exports.toObjectDate = exports.removeDuplicateObjects = exports.removeDuplicatesByKey = exports.removeDuplicates = exports.getRandomColor = exports.getNbOfDaysBetweenTwoDates = exports.displayDateRangeFr = exports.calPercent = exports.percentOf = exports.genDateMinutesStep = exports.convertFrDateToEnDate = exports.convertEnDateToFr = exports.formatDateMd = exports.formatDateYm = exports.formatDateYmFirstDay = exports.formatDateYmd = exports.formatFromAndToDate = exports.formatDateYmHypen = exports.formatDateFirstDayFr = exports.formatDateYmdHypenFr = exports.formatDateYmdHypen = void 0;
7
+ exports.dateFormatter = exports.monthStringName = exports.returnBool = exports.formatAmountToString = exports.reduceSum = exports.sumAmount = exports.fillEndWithZero = exports.fillStartWithZero = exports.absFromSequence = exports.returnDates = exports.displayFrDatePeriode = exports.getArrayOfRandomColor = exports.randomHslColor = exports.randomHexColor = exports.randomRgbColor = exports.randomInteger = exports.insertAtInArray = exports.isBirthday = exports.padEndWithZero = exports.padStartWithZero = exports.formatMonthYearToLocaleString = exports.calculPercent = exports.validEmail = exports.convertToCfa = exports.packAndUnit = exports.unCheckedAll = void 0;
8
8
  const dayjs_1 = __importDefault(require("dayjs"));
9
9
  require("dayjs/locale/fr");
10
10
  const formatDateYmdHypen = (date) => {
@@ -174,16 +174,28 @@ const wakeUp = (sleep) => {
174
174
  clearInterval(sleep);
175
175
  };
176
176
  exports.wakeUp = wakeUp;
177
+ // -- to remove later
177
178
  const formatToString = (val, separator = " ", currency = "") => {
178
179
  // return String(val).replace(/(.)(?=(\d{3})+$)/g, '$1,');
179
180
  return String(val).replace(/(.)(?=(\d{3})+$)/g, "$1" + separator + "") + currency;
180
181
  };
181
182
  exports.formatToString = formatToString;
183
+ const currencyFormatter = (val, separator = " ", currency = "") => {
184
+ // return String(val).replace(/(.)(?=(\d{3})+$)/g, '$1,');
185
+ return String(val).replace(/(.)(?=(\d{3})+$)/g, "$1" + separator + "") + currency;
186
+ };
187
+ exports.currencyFormatter = currencyFormatter;
188
+ // -- to remove later
182
189
  const formatToStringCfa = (val) => {
183
190
  // return String(val).replace(/(.)(?=(\d{3})+$)/g, '$1 ') + ' CFA';
184
191
  return (0, exports.formatToString)(val, " ", " FCFA");
185
192
  };
186
193
  exports.formatToStringCfa = formatToStringCfa;
194
+ const currencyFormatterCfa = (val) => {
195
+ // return String(val).replace(/(.)(?=(\d{3})+$)/g, '$1 ') + ' CFA';
196
+ return (0, exports.currencyFormatter)(val, " ", " FCFA");
197
+ };
198
+ exports.currencyFormatterCfa = currencyFormatterCfa;
187
199
  // const = reformatDates(fromDate: string, toDate: string) => {
188
200
  const reformatDates = (fromDate, toDate) => {
189
201
  if (fromDate === undefined || fromDate === null) {
@@ -609,6 +621,8 @@ const dateFormatter = (date, format, separator = "-") => {
609
621
  return (0, dayjs_1.default)(date).format(`"YYYY${separator}MM${separator}DD"`);
610
622
  case "dmy":
611
623
  return (0, dayjs_1.default)(date).format(`DD${separator}MM${separator}YYYY`);
624
+ case "dmy-hm":
625
+ return (0, dayjs_1.default)(date).format(`DD${separator}MM${separator}YYYY HH:mm`);
612
626
  case "dmyfr":
613
627
  return (0, dayjs_1.default)(date).locale("fr").format("dddd DD MMMM YYYY");
614
628
  default:
@@ -33,7 +33,9 @@ export declare const limitTo: (value: string, limit?: number, trail?: string) =>
33
33
  export declare const sleep: (ms: number) => Promise<unknown>;
34
34
  export declare const wakeUp: (sleep: any) => void;
35
35
  export declare const formatToString: (val: number, separator?: string, currency?: string) => string;
36
+ export declare const currencyFormatter: (val: number, separator?: string, currency?: string) => string;
36
37
  export declare const formatToStringCfa: (val: number) => string;
38
+ export declare const currencyFormatterCfa: (val: number) => string;
37
39
  export declare const reformatDates: (fromDate: any, toDate: any) => {
38
40
  fromDate: any;
39
41
  toDate: any;
@@ -97,4 +99,4 @@ export declare const returnBool: (tob?: boolean) => boolean;
97
99
  export declare const monthStringName: (date: string | Date, format?: "MMM" | "MMMM", options?: {
98
100
  en?: true;
99
101
  }) => string;
100
- export declare const dateFormatter: (date: Date | string, format?: "ymd" | "dmy" | "dmyfr", separator?: "/" | "-") => string;
102
+ export declare const dateFormatter: (date: Date | string, format?: "ymd" | "dmy" | "dmy-hm" | "dmyfr", separator?: "/" | "-") => string;
package/lib/esm/utils.js CHANGED
@@ -142,14 +142,24 @@ export const sleep = (ms) => {
142
142
  export const wakeUp = (sleep) => {
143
143
  clearInterval(sleep);
144
144
  };
145
+ // -- to remove later
145
146
  export const formatToString = (val, separator = " ", currency = "") => {
146
147
  // return String(val).replace(/(.)(?=(\d{3})+$)/g, '$1,');
147
148
  return String(val).replace(/(.)(?=(\d{3})+$)/g, "$1" + separator + "") + currency;
148
149
  };
150
+ export const currencyFormatter = (val, separator = " ", currency = "") => {
151
+ // return String(val).replace(/(.)(?=(\d{3})+$)/g, '$1,');
152
+ return String(val).replace(/(.)(?=(\d{3})+$)/g, "$1" + separator + "") + currency;
153
+ };
154
+ // -- to remove later
149
155
  export const formatToStringCfa = (val) => {
150
156
  // return String(val).replace(/(.)(?=(\d{3})+$)/g, '$1 ') + ' CFA';
151
157
  return formatToString(val, " ", " FCFA");
152
158
  };
159
+ export const currencyFormatterCfa = (val) => {
160
+ // return String(val).replace(/(.)(?=(\d{3})+$)/g, '$1 ') + ' CFA';
161
+ return currencyFormatter(val, " ", " FCFA");
162
+ };
153
163
  // const = reformatDates(fromDate: string, toDate: string) => {
154
164
  export const reformatDates = (fromDate, toDate) => {
155
165
  if (fromDate === undefined || fromDate === null) {
@@ -529,6 +539,8 @@ export const dateFormatter = (date, format, separator = "-") => {
529
539
  return dayjs(date).format(`"YYYY${separator}MM${separator}DD"`);
530
540
  case "dmy":
531
541
  return dayjs(date).format(`DD${separator}MM${separator}YYYY`);
542
+ case "dmy-hm":
543
+ return dayjs(date).format(`DD${separator}MM${separator}YYYY HH:mm`);
532
544
  case "dmyfr":
533
545
  return dayjs(date).locale("fr").format("dddd DD MMMM YYYY");
534
546
  default:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asv-hlps",
3
- "version": "1.3.6",
3
+ "version": "1.3.7",
4
4
  "description": "helpers",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",