asv-hlps 1.3.96 → 1.3.97

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.
@@ -92,6 +92,7 @@ export declare const fillStartWithZero: (num: string | number, targetLength: num
92
92
  export declare const fillEndWithZero: (num: string | number, targetLength: number) => string;
93
93
  export declare const sumAmount: (tobs: any[], property: string) => number;
94
94
  export declare const reduceSum: (tobs: any[], property: string) => number;
95
+ export declare const reduceTimes: (tobs: any[], propA: string, propB: string) => number;
95
96
  export declare const formatAmountToString: (amount: number, opt?: {
96
97
  math?: "ceil" | "floor";
97
98
  currency?: "cfa";
package/lib/cjs/utils.js CHANGED
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.unCheckedAll = exports.inputChecked = exports.arrayMultiChecked = exports.getPeriodDateColor = exports.getColorAccordingToDate = exports.genRandomColour = exports.formatNgbDate = exports.getNbOfDaysBetweenTwoDates = exports.displayDateRangeFr = exports.reformatDates = exports.firstDayOfDate = exports.dateToString = exports.dateDiff = exports.dateFormatter = exports.replaceSpacesWith = exports.replaceAllIn = exports.toPlural = exports.sesStorageGet = exports.sesStorageSet = exports.genSequenceRef = exports.refGenerator = exports.removeBackSlashOccurences = exports.stringifyFormatter = exports.removeString = exports.diffArraysByProp = exports.diffArraysByFunc = exports.deepClone = exports.findFirstSequenceMissing = exports.fillNumWithZero = exports.findSequencesMissing = exports.sequencesToNumbers = exports.notInSequence = exports.currencyFormatterCfa = exports.formatToStringCfa = exports.currencyFormatter = exports.formatToString = exports.checkAuth = exports.wakeUp = exports.sleep = exports.limitTo = exports.titleCase = exports.toObjectDate = exports.duplicateObjects = exports.removeDuplicateObjects = exports.getRandomColor = exports.calPercent = exports.percentOf = exports.genDateMinutesStep = exports.formatDateFirstDayFr = exports.isEmpty = void 0;
7
- exports.checkObjInArray = exports.arraySome = exports.winMaxHeight = exports.toggleProp = exports.roundLastNDigits = exports.removeParamKeyName = exports.countryIsoToFlag = 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 = void 0;
7
+ exports.checkObjInArray = exports.arraySome = exports.winMaxHeight = exports.toggleProp = exports.roundLastNDigits = exports.removeParamKeyName = exports.countryIsoToFlag = exports.monthStringName = exports.returnBool = exports.formatAmountToString = exports.reduceTimes = 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 = void 0;
8
8
  const dayjs_1 = __importDefault(require("dayjs"));
9
9
  const relativeTime_1 = __importDefault(require("dayjs/plugin/relativeTime"));
10
10
  const lodash_1 = __importDefault(require("lodash"));
@@ -683,6 +683,14 @@ const reduceSum = (tobs, property) => {
683
683
  }, 0);
684
684
  };
685
685
  exports.reduceSum = reduceSum;
686
+ const reduceTimes = (tobs, propA, propB) => {
687
+ return tobs.reduce((prev, curr) => {
688
+ if (curr && curr[propA] !== null && curr[propB] !== null) {
689
+ return +prev + +curr[propA] * +curr[propB];
690
+ }
691
+ }, 0);
692
+ };
693
+ exports.reduceTimes = reduceTimes;
686
694
  const formatAmountToString = (amount, opt) => {
687
695
  let getAmount = amount;
688
696
  switch (opt === null || opt === void 0 ? void 0 : opt.math) {
@@ -92,6 +92,7 @@ export declare const fillStartWithZero: (num: string | number, targetLength: num
92
92
  export declare const fillEndWithZero: (num: string | number, targetLength: number) => string;
93
93
  export declare const sumAmount: (tobs: any[], property: string) => number;
94
94
  export declare const reduceSum: (tobs: any[], property: string) => number;
95
+ export declare const reduceTimes: (tobs: any[], propA: string, propB: string) => number;
95
96
  export declare const formatAmountToString: (amount: number, opt?: {
96
97
  math?: "ceil" | "floor";
97
98
  currency?: "cfa";
package/lib/esm/utils.js CHANGED
@@ -605,6 +605,13 @@ export const reduceSum = (tobs, property) => {
605
605
  }
606
606
  }, 0);
607
607
  };
608
+ export const reduceTimes = (tobs, propA, propB) => {
609
+ return tobs.reduce((prev, curr) => {
610
+ if (curr && curr[propA] !== null && curr[propB] !== null) {
611
+ return +prev + +curr[propA] * +curr[propB];
612
+ }
613
+ }, 0);
614
+ };
608
615
  export const formatAmountToString = (amount, opt) => {
609
616
  let getAmount = amount;
610
617
  switch (opt === null || opt === void 0 ? void 0 : opt.math) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asv-hlps",
3
- "version": "1.3.96",
3
+ "version": "1.3.97",
4
4
  "description": "helpers",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",