|
@@ -3,11 +3,6 @@ import { Chance } from 'chance';
|
|
import { JSFuck } from './enums/JSFuck';
|
|
import { JSFuck } from './enums/JSFuck';
|
|
|
|
|
|
export class Utils {
|
|
export class Utils {
|
|
- /**
|
|
|
|
- * @type {RegExp}
|
|
|
|
- */
|
|
|
|
- private static hexRepetitiveZerosRegExp: RegExp = new RegExp('^(0{2,})+(?!$)', '');
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* @type {Chance.Chance}
|
|
* @type {Chance.Chance}
|
|
*/
|
|
*/
|
|
@@ -62,14 +57,9 @@ export class Utils {
|
|
* @returns {string}
|
|
* @returns {string}
|
|
*/
|
|
*/
|
|
public static decToHex (dec: number): string {
|
|
public static decToHex (dec: number): string {
|
|
- const decToHexSliceValue: number = -6,
|
|
|
|
- exponent: number = 6,
|
|
|
|
- radix: number = 16;
|
|
|
|
-
|
|
|
|
- return (dec + Math.pow(radix, exponent))
|
|
|
|
- .toString(radix)
|
|
|
|
- .substr(decToHexSliceValue)
|
|
|
|
- .replace(Utils.hexRepetitiveZerosRegExp, '');
|
|
|
|
|
|
+ const radix: number = 16;
|
|
|
|
+
|
|
|
|
+ return Number(dec).toString(radix);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|