asv-hlps 1.0.68 → 1.0.69
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/lib/cjs/utils.d.ts +3 -0
- package/lib/cjs/utils.js +20 -1
- package/lib/esm/utils.d.ts +3 -0
- package/lib/esm/utils.js +16 -0
- package/package.json +1 -1
package/lib/cjs/utils.d.ts
CHANGED
|
@@ -68,3 +68,6 @@ export declare const padStartWithZero: (num: any, targetLength: number) => any;
|
|
|
68
68
|
export declare const padEndWithZero: (num: any, targetLength: number) => any;
|
|
69
69
|
export declare const isBirthday: (birthDayDate: any) => boolean;
|
|
70
70
|
export declare const insertAtInArray: (array: any[], index: number, ...elements: any) => void;
|
|
71
|
+
export declare const randomInteger: (max: number) => number;
|
|
72
|
+
export declare const randomRgbColor: () => number[];
|
|
73
|
+
export declare const randomHexColor: () => string;
|
package/lib/cjs/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validEmail = exports.convertToCfa = exports.packAndUnit = exports.unCheckedAll = exports.inputChecked = exports.arrayMultiChecked = 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.absFromSequence = exports.reformatDates = exports.formatToStringCfa = exports.formatToString = exports.wakeUp = exports.sleep = exports.limitTo = exports.titleCase = exports.toObjectDate = 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;
|
|
4
|
-
exports.insertAtInArray = exports.isBirthday = exports.padEndWithZero = exports.padStartWithZero = exports.calculPercent = void 0;
|
|
4
|
+
exports.randomHexColor = exports.randomRgbColor = exports.randomInteger = exports.insertAtInArray = exports.isBirthday = exports.padEndWithZero = exports.padStartWithZero = exports.calculPercent = void 0;
|
|
5
5
|
const formatDateYmdHypen = (date) => {
|
|
6
6
|
return (0, exports.formatDateYmd)(date, "-");
|
|
7
7
|
};
|
|
@@ -399,3 +399,22 @@ const insertAtInArray = (array, index, ...elements) => {
|
|
|
399
399
|
array.splice(index, 0, ...elements);
|
|
400
400
|
};
|
|
401
401
|
exports.insertAtInArray = insertAtInArray;
|
|
402
|
+
const randomInteger = (max) => {
|
|
403
|
+
return Math.floor(Math.random() * (max + 1));
|
|
404
|
+
};
|
|
405
|
+
exports.randomInteger = randomInteger;
|
|
406
|
+
const randomRgbColor = () => {
|
|
407
|
+
let r = (0, exports.randomInteger)(255);
|
|
408
|
+
let g = (0, exports.randomInteger)(255);
|
|
409
|
+
let b = (0, exports.randomInteger)(255);
|
|
410
|
+
return [r, g, b];
|
|
411
|
+
};
|
|
412
|
+
exports.randomRgbColor = randomRgbColor;
|
|
413
|
+
const randomHexColor = () => {
|
|
414
|
+
let [r, g, b] = (0, exports.randomRgbColor)();
|
|
415
|
+
let hr = r.toString(16).padStart(2, "0");
|
|
416
|
+
let hg = g.toString(16).padStart(2, "0");
|
|
417
|
+
let hb = b.toString(16).padStart(2, "0");
|
|
418
|
+
return "#" + hr + hg + hb;
|
|
419
|
+
};
|
|
420
|
+
exports.randomHexColor = randomHexColor;
|
package/lib/esm/utils.d.ts
CHANGED
|
@@ -68,3 +68,6 @@ export declare const padStartWithZero: (num: any, targetLength: number) => any;
|
|
|
68
68
|
export declare const padEndWithZero: (num: any, targetLength: number) => any;
|
|
69
69
|
export declare const isBirthday: (birthDayDate: any) => boolean;
|
|
70
70
|
export declare const insertAtInArray: (array: any[], index: number, ...elements: any) => void;
|
|
71
|
+
export declare const randomInteger: (max: number) => number;
|
|
72
|
+
export declare const randomRgbColor: () => number[];
|
|
73
|
+
export declare const randomHexColor: () => string;
|
package/lib/esm/utils.js
CHANGED
|
@@ -340,3 +340,19 @@ export const isBirthday = (birthDayDate) => {
|
|
|
340
340
|
export const insertAtInArray = (array, index, ...elements) => {
|
|
341
341
|
array.splice(index, 0, ...elements);
|
|
342
342
|
};
|
|
343
|
+
export const randomInteger = (max) => {
|
|
344
|
+
return Math.floor(Math.random() * (max + 1));
|
|
345
|
+
};
|
|
346
|
+
export const randomRgbColor = () => {
|
|
347
|
+
let r = randomInteger(255);
|
|
348
|
+
let g = randomInteger(255);
|
|
349
|
+
let b = randomInteger(255);
|
|
350
|
+
return [r, g, b];
|
|
351
|
+
};
|
|
352
|
+
export const randomHexColor = () => {
|
|
353
|
+
let [r, g, b] = randomRgbColor();
|
|
354
|
+
let hr = r.toString(16).padStart(2, "0");
|
|
355
|
+
let hg = g.toString(16).padStart(2, "0");
|
|
356
|
+
let hb = b.toString(16).padStart(2, "0");
|
|
357
|
+
return "#" + hr + hg + hb;
|
|
358
|
+
};
|