🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

d2core

Package Overview
Dependencies
Maintainers
0
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d2core - npm Package Compare versions

Comparing version

to
23.0.9

dayjs/dayjs.ts

80

dayjs/duration.d.ts

@@ -1,2 +0,78 @@

declare function _default(option: any, Dayjs: any, dayjs: any): void;
export default _default;
import { PluginFunc } from 'dayjs'
import { OpUnitType, UnitTypeLongPlural } from 'dayjs';
declare const plugin: PluginFunc
export as namespace plugin;
export = plugin
declare namespace plugin {
/**
* @deprecated Please use more strict types
*/
type DurationInputType = string | number | object
/**
* @deprecated Please use more strict types
*/
type DurationAddType = number | object | Duration
type DurationUnitsObjectType = Partial<{
[unit in Exclude<UnitTypeLongPlural, "dates"> | "weeks"]: number
}>;
type DurationUnitType = Exclude<OpUnitType, "date" | "dates">
type CreateDurationType =
((units: DurationUnitsObjectType) => Duration)
& ((time: number, unit?: DurationUnitType) => Duration)
& ((ISO_8601: string) => Duration)
type AddDurationType = CreateDurationType & ((duration: Duration) => Duration)
interface Duration {
new (input: string | number | object, unit?: string, locale?: string): Duration
clone(): Duration
humanize(withSuffix?: boolean): string
milliseconds(): number
asMilliseconds(): number
seconds(): number
asSeconds(): number
minutes(): number
asMinutes(): number
hours(): number
asHours(): number
days(): number
asDays(): number
weeks(): number
asWeeks(): number
as(unit: DurationUnitType): number
get(unit: DurationUnitType): number
add: AddDurationType
subtract: AddDurationType
format(formatStr?: string): string
locale(locale: string): Duration
}
}
declare module 'dayjs' {
interface Dayjs {
add(duration: plugin.Duration): Dayjs
subtract(duration: plugin.Duration): Dayjs
}
/**
* @param time If unit is not present, time treated as number of milliseconds
*/
export const duration: plugin.CreateDurationType;
export function isDuration(d: any): d is plugin.Duration
}

@@ -12,22 +12,32 @@ import { MILLISECONDS_A_DAY, MILLISECONDS_A_HOUR, MILLISECONDS_A_MINUTE, MILLISECONDS_A_SECOND, MILLISECONDS_A_WEEK } from 'dayjs/esm/constant';

};
var isDuration = function isDuration(d) {
return d instanceof Duration;
};
}; // eslint-disable-line no-use-before-define
var $d;
var $u;
var wrapper = function wrapper(input, instance, unit) {
return new Duration(input, unit, instance.$l);
};
}; // eslint-disable-line no-use-before-define
var prettyUnit = function prettyUnit(unit) {
return $u.p(unit) + "s";
};
var isNegative = function isNegative(number) {
return number < 0;
};
var roundNumber = function roundNumber(number) {
return isNegative(number) ? Math.ceil(number) : Math.floor(number);
};
var absolute = function absolute(number) {
return Math.abs(number);
};
var getNumberUnitFormat = function getNumberUnitFormat(number, unit) {

@@ -40,2 +50,3 @@ if (!number) {

}
if (isNegative(number)) {

@@ -47,2 +58,3 @@ return {

}
return {

@@ -53,7 +65,10 @@ negative: false,

};
var Duration = function () {
var Duration = /*#__PURE__*/function () {
function Duration(input, unit, locale) {
var _this = this;
this.$d = {};
this.$l = locale;
if (input === undefined) {

@@ -63,5 +78,7 @@ this.$ms = 0;

}
if (unit) {
return wrapper(input * unitToMS[prettyUnit(unit)], this);
}
if (typeof input === 'number') {

@@ -72,2 +89,3 @@ this.$ms = input;

}
if (typeof input === 'object') {

@@ -80,4 +98,6 @@ Object.keys(input).forEach(function (k) {

}
if (typeof input === 'string') {
var d = input.match(durationRegex);
if (d) {

@@ -97,7 +117,11 @@ var properties = d.slice(2);

}
return this;
}
var _proto = Duration.prototype;
_proto.calMilliseconds = function calMilliseconds() {
var _this2 = this;
this.$ms = Object.keys(this.$d).reduce(function (total, unit) {

@@ -107,2 +131,3 @@ return total + (_this2.$d[unit] || 0) * unitToMS[unit];

};
_proto.parseFromMilliseconds = function parseFromMilliseconds() {

@@ -120,2 +145,3 @@ var $ms = this.$ms;

};
_proto.format = function format(formatStr) {

@@ -141,35 +167,40 @@ var str = formatStr || 'YYYY-MM-DDTHH:mm:ss';

};
_proto.as = function as(unit) {
return this.$ms / unitToMS[prettyUnit(unit)];
};
_proto.get = function get(unit) {
var base = this.$ms;
var pUnit = prettyUnit(unit);
if (pUnit === 'milliseconds') {
base %= 1000;
}
else if (pUnit === 'weeks') {
} else if (pUnit === 'weeks') {
base = roundNumber(base / unitToMS[pUnit]);
}
else {
} else {
base = this.$d[pUnit];
}
return base || 0;
return base || 0; // a === 0 will be true on both 0 and -0
};
_proto.add = function add(input, unit, isSubtract) {
var another;
if (unit) {
another = input * unitToMS[prettyUnit(unit)];
}
else if (isDuration(input)) {
} else if (isDuration(input)) {
another = input.$ms;
}
else {
} else {
another = wrapper(input, this).$ms;
}
return wrapper(this.$ms + another * (isSubtract ? -1 : 1), this);
};
_proto.subtract = function subtract(input, unit) {
return this.add(input, unit, true);
};
_proto.locale = function locale(l) {

@@ -180,57 +211,78 @@ var that = this.clone();

};
_proto.clone = function clone() {
return wrapper(this.$ms, this);
};
_proto.humanize = function humanize(withSuffix) {
return $d().add(this.$ms, 'ms').locale(this.$l).fromNow(!withSuffix);
};
_proto.valueOf = function valueOf() {
return this.asMilliseconds();
};
_proto.milliseconds = function milliseconds() {
return this.get('milliseconds');
};
_proto.asMilliseconds = function asMilliseconds() {
return this.as('milliseconds');
};
_proto.seconds = function seconds() {
return this.get('seconds');
};
_proto.asSeconds = function asSeconds() {
return this.as('seconds');
};
_proto.minutes = function minutes() {
return this.get('minutes');
};
_proto.asMinutes = function asMinutes() {
return this.as('minutes');
};
_proto.hours = function hours() {
return this.get('hours');
};
_proto.asHours = function asHours() {
return this.as('hours');
};
_proto.days = function days() {
return this.get('days');
};
_proto.asDays = function asDays() {
return this.as('days');
};
_proto.weeks = function weeks() {
return this.get('weeks');
};
_proto.asWeeks = function asWeeks() {
return this.as('weeks');
};
return Duration;
}();
var manipulateDuration = function manipulateDuration(date, duration, k) {
return date.add(duration.days() * k, 'd').add(duration.hours() * k, 'h').add(duration.minutes() * k, 'm').add(duration.seconds() * k, 's').add(duration.milliseconds() * k, 'ms');
};
const funct = (option, Dayjs, dayjs) => {
};
}
export default (function (option, Dayjs, dayjs) {
$d = dayjs;
$u = dayjs().$utils();
dayjs.duration = function (input, unit) {

@@ -242,5 +294,7 @@ var $l = dayjs.locale();

};
dayjs.isDuration = isDuration;
var oldAdd = Dayjs.prototype.add;
var oldSubtract = Dayjs.prototype.subtract;
Dayjs.prototype.add = function (value, unit) {

@@ -250,4 +304,6 @@ if (isDuration(value)) {

}
return oldAdd.bind(this)(value, unit);
};
Dayjs.prototype.subtract = function (value, unit) {

@@ -257,5 +313,5 @@ if (isDuration(value)) {

}
return oldSubtract.bind(this)(value, unit);
};
});
//# sourceMappingURL=duration.js.map
});

@@ -1,2 +0,117 @@

declare function _exports(...args: any[]): any;
export = _exports;
// TypeScript Version: 2.9
/**
* Translates the given text.
* @param text Text to translate
* @param defaultNumOrFormatting Number OR formatting to use in translation
* @param numOrFormattingOrContext Number OR formatting OR context to use in translation
* @param formattingOrContext Format OR context to use in translation
* @param context Context to be used when translating
*/
declare function i18n(text: string | number,
defaultNumOrFormatting?: number | i18n.FormattingContext,
numOrFormattingOrContext?: number | i18n.FormattingContext,
formattingOrContext?: i18n.FormattingContext,
context?: i18n.FormattingContext): string;
declare namespace i18n {
interface Values {
[index: string]: string | Array<string | Array<string | number | null>> | {[key: string]: string};
}
interface FormattingContext {
[key: string]: string;
}
interface ContextOpts {
matches: FormattingContext;
values: Values;
}
interface DataOpts {
values?: Values;
contexts?: ContextOpts[];
}
namespace translator {
namespace constructor {
let name: string;
}
/**
* Translates the given text.
* @param text Text to translate
* @param defaultNumOrFormatting Number OR formatting to use in translation
* @param numOrFormattingOrContext Number OR formatting OR context to use in translation
* @param formattingOrContext Format OR context to use in translation
* @param context Context to use in translation
*/
function translate(text: string | number,
defaultNumOrFormatting?: number | FormattingContext,
numOrFormattingOrContext?: number | FormattingContext,
formattingOrContext?: FormattingContext,
context?: FormattingContext): string;
/**
* Adds data (values and contexts) to i18n instance.
* @param data The language data: { "values": { "Yes": "はい", "No": "いいえ" } }
*/
function add(data: DataOpts | object): void; // object is an alternate parameter type to allow imports from JSON files
/**
* Sets the context globally. This context will be used when translating all strings unless a different context is provided when calling i18n().
* @param key The key for the context, e.g. "gender".
* @param value The value for the context, e.g. "female".
*/
function setContext(key: string,
value: string): void;
/**
* Adds extension to i18n instance.
* @param ext Extension to add
*/
function extend(ext: (text: string,
number: number,
formatting: FormattingContext,
data: Values) => string | number): void;
/**
* Clears the context for the given key.
* @param key The key to clear
*/
function clearContext(key: string): void;
/**
* Destroys all translation and context data.
*/
function reset(): void;
/**
* Destroys all translation data. Useful for when you change languages.
*/
function resetData(): void;
/**
* Destroys all context data.
*/
function resetContext(): void;
/**
* Translates all the keys in a hash. Useful for translating the i18n property that exists for some lovely.io packages.
* @param hash Hash containing the strings to be translated.
* @param context Context to be used when translating the hash values.
*/
function translateHash(hash: {[key: string]: string},
context?: FormattingContext): object;
let data: DataOpts;
}
/**
* Creates a new i18n instance.
* @param data Data to add to new i18n instance
*/
function create(data?: DataOpts | object): typeof i18n;
}
export = i18n;

107

i18n/i18n.js

@@ -1,23 +0,22 @@

"use strict";
(function () {
// http://i18njs.com
(function() {
'use strict';
var __bind = function (fn, me) { return function () { return fn.apply(me, arguments); }; };
(function (root, factory) {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
return define([], function () {
return define([], function() {
return root.i18n = factory();
});
}
else if (typeof module === 'object' && module.exports) {
} else if (typeof module === 'object' && module.exports) {
return module.exports = factory();
}
else {
} else {
return root.i18n = factory();
}
})((typeof self !== "undefined" && self !== null ? self : this), function () {
})((typeof self !== "undefined" && self !== null ? self : this), function() {
var Translator, i18n, translator;
Translator = (function () {
Translator = (function() {
function Translator() {
this.translate = __bind(this.translate, this);
this.data = {
this.translate = __bind(this.translate, this); this.data = {
values: {},

@@ -28,9 +27,12 @@ contexts: []

}
Translator.prototype.translate = function (text, defaultNumOrFormatting, numOrFormattingOrContext, formattingOrContext, context) {
Translator.prototype.translate = function(text, defaultNumOrFormatting, numOrFormattingOrContext, formattingOrContext, context) {
var defaultText, formatting, isObject, num;
if (context == null) {
context = this.globalContext;
}
isObject = function (obj) {
isObject = function(obj) {
var type;
type = typeof obj;

@@ -44,4 +46,3 @@ return type === "function" || type === "object" && !!obj;

context = numOrFormattingOrContext || this.globalContext;
}
else {
} else {
if (typeof defaultNumOrFormatting === "number") {

@@ -52,4 +53,3 @@ defaultText = null;

context = formattingOrContext || this.globalContext;
}
else {
} else {
defaultText = defaultNumOrFormatting;

@@ -60,4 +60,3 @@ if (typeof numOrFormattingOrContext === "number") {

context = context;
}
else {
} else {
num = null;

@@ -74,9 +73,10 @@ formatting = numOrFormattingOrContext;

return this.translateHash(text, context);
}
else {
} else {
return this.translateText(text, num, formatting, context, defaultText);
}
};
Translator.prototype.add = function (d) {
Translator.prototype.add = function(d) {
var c, k, v, _i, _len, _ref, _ref1, _results;
if ((d.values != null)) {

@@ -99,16 +99,21 @@ _ref = d.values;

};
Translator.prototype.setContext = function (key, value) {
Translator.prototype.setContext = function(key, value) {
return this.globalContext[key] = value;
};
Translator.prototype.extend = function (ext) {
Translator.prototype.extend = function(ext) {
return this.extension = ext;
};
Translator.prototype.clearContext = function (key) {
Translator.prototype.clearContext = function(key) {
return this.globalContext[key] = null;
};
Translator.prototype.reset = function () {
Translator.prototype.reset = function() {
this.resetData();
return this.resetContext();
};
Translator.prototype.resetData = function () {
Translator.prototype.resetData = function() {
return this.data = {

@@ -119,7 +124,10 @@ values: {},

};
Translator.prototype.resetContext = function () {
Translator.prototype.resetContext = function() {
return this.globalContext = {};
};
Translator.prototype.translateHash = function (hash, context) {
Translator.prototype.translateHash = function(hash, context) {
var k, v;
for (k in hash) {

@@ -133,4 +141,6 @@ v = hash[k];

};
Translator.prototype.translateText = function (text, num, formatting, context, defaultText) {
Translator.prototype.translateText = function(text, num, formatting, context, defaultText) {
var contextData, result;
if (context == null) {

@@ -154,4 +164,6 @@ context = this.globalContext;

};
Translator.prototype.findTranslation = function (text, num, formatting, data, defaultText) {
Translator.prototype.findTranslation = function(text, num, formatting, data, defaultText) {
var a, b, c, d, e, result, triple, value, _i, _len;
value = data[text];

@@ -166,4 +178,3 @@ if (value == null) {

return this.applyFormatting(value, num, formatting);
}
else {
} else {
return this.useOriginalText(defaultText || text, num, formatting);

@@ -176,4 +187,3 @@ }

}
}
else {
} else {
if (value instanceof Array || value.length) {

@@ -196,3 +206,4 @@ a = num === null;

};
Translator.prototype.applyNumbers = function (str, num) {
Translator.prototype.applyNumbers = function(str, num) {
str = str.replace("-%n", String(-num));

@@ -202,4 +213,6 @@ str = str.replace("%n", String(num));

};
Translator.prototype.getContextData = function (data, context) {
Translator.prototype.getContextData = function(data, context) {
var c, equal, key, value, _i, _len, _ref, _ref1;
if (data.contexts == null) {

@@ -223,3 +236,4 @@ return null;

};
Translator.prototype.useOriginalText = function (text, num, formatting) {
Translator.prototype.useOriginalText = function(text, num, formatting) {
if (num == null) {

@@ -230,4 +244,6 @@ return this.applyFormatting(text, num, formatting);

};
Translator.prototype.applyFormatting = function (text, num, formatting) {
Translator.prototype.applyFormatting = function(text, num, formatting) {
var ind, regex;
for (ind in formatting) {

@@ -239,3 +255,5 @@ regex = new RegExp("%{" + ind + "}", "g");

};
return Translator;
})();

@@ -245,4 +263,5 @@ translator = new Translator();

i18n.translator = translator;
i18n.create = function (data) {
i18n.create = function(data) {
var trans;
trans = new Translator();

@@ -258,3 +277,3 @@ if (data != null) {

});
}).call(this);
//# sourceMappingURL=i18n.js.map
}).call(this);

@@ -1,14 +0,37 @@

export class LocaleHolder {
static initValues(): void;
static setLocale(language: any, formattingLocale: any): Promise<void>;
static getDateFormat(showYear: any): any;
static getDateTimeFormat(showYear: any, showSeconds: any, showMillis: any): any;
static getTimeFormat(showSeconds: any, showMillis: any): any;
static formatNumber(value: any, fractionDigits: any, omitGrouping: any): any;
static getNumberFormatter(fractionDigits: any, omitGrouping: any): any;
static parseNumber(text: any, fractionDigits: any): void;
static getDecimalSeparator(locale: any): string;
static getGroupSeparator(locale: any): string;
static formatBytes(bytes: any, decimals?: number): string;
static getDurationFormat(showDays: any, showMillis: any): string;
declare namespace localeHolder {
type LanguageIsoCode = "en" | "sk" | "cs" | "ru" | "kk" | "sr" | "uk";
class LocaleHolder {
static setLocale: (language: LanguageIsoCode, formattingLocale?: string) => Promise<void>
static locale: LanguageIsoCode
static uiLocale: any | undefined
static localeData: any | undefined
static formattingLocale: string
static decimalSeparator: string
static groupSeparator: string
static formatNumber(value: number, fractionDigits?: number, omitGrouping?: boolean): string
static formatBytes(bytes: number, decimals: number): string
static getNumberFormatter(fractionDigits: number, useGrouping?: boolean): {
format(value: number): string
}
static getDateFormat(showYear?: boolean): string
static getDateTimeFormat(showYear?: boolean, showSeconds?: boolean, showMillis?: boolean): string
static getTimeFormat(showSeconds?: boolean, showMillis?: boolean): string
static getDurationFormat(showDays?: boolean, showMillis?: boolean): string
}
}
export = localeHolder;
import dayjs from "dayjs";
import parseDecimalNumber from "parse-decimal-number";
import parseDecimalNumber from "parse-decimal-number"
export class LocaleHolder {

@@ -9,2 +10,4 @@ static initValues() {

LocaleHolder.formattingLocale = "en-GB";
// number localization - defaults
LocaleHolder.decimalSeparator = ".";

@@ -14,2 +17,4 @@ LocaleHolder.groupSeparator = ",";

LocaleHolder.numberFormattersWithoutGrouping = [];
// date localization - defaults
LocaleHolder.formatDate = `L`;

@@ -23,2 +28,3 @@ LocaleHolder.formatDateWithoutYear = `L`;

LocaleHolder.formatDateHourMinSecMsWithoutYear = `L LTS${LocaleHolder.decimalSeparator}SSS`;
LocaleHolder.formatHourMin = `LT`;

@@ -28,34 +34,31 @@ LocaleHolder.formatHourMinSec = `LTS`;

}
static async setLocale(language, formattingLocale) {
LocaleHolder.initValues();
LocaleHolder.locale = language;
let uiLocalePromise;
let momentLocalePromise = null;
if (language === "sk") {
uiLocalePromise = import("antd/es/locale/sk_SK");
momentLocalePromise = import("dayjs/locale/sk");
uiLocalePromise = import ("antd/es/locale/sk_SK");
momentLocalePromise = import ("dayjs/locale/sk");
} else if (language === "cs") {
uiLocalePromise = import ("antd/es/locale/cs_CZ");
momentLocalePromise = import ("dayjs/locale/cs");
} else if (language === "uk") {
uiLocalePromise = import ("antd/es/locale/uk_UA");
momentLocalePromise = import ("dayjs/locale/uk");
} else if (language === "ru") {
uiLocalePromise = import ("antd/es/locale/ru_RU");
momentLocalePromise = import ("dayjs/locale/ru");
} else if (language === "kk") {
uiLocalePromise = import ("antd/es/locale/ru_RU");
momentLocalePromise = import ("dayjs/locale/kk");
} else if (language === "sr") {
uiLocalePromise = import ("antd/es/locale/sr_RS");
momentLocalePromise = import ("dayjs/locale/sr");
} else {
uiLocalePromise = import ("antd/es/locale/en_GB");
}
else if (language === "cs") {
uiLocalePromise = import("antd/es/locale/cs_CZ");
momentLocalePromise = import("dayjs/locale/cs");
}
else if (language === "uk") {
uiLocalePromise = import("antd/es/locale/uk_UA");
momentLocalePromise = import("dayjs/locale/uk");
}
else if (language === "ru") {
uiLocalePromise = import("antd/es/locale/ru_RU");
momentLocalePromise = import("dayjs/locale/ru");
}
else if (language === "kk") {
uiLocalePromise = import("antd/es/locale/ru_RU");
momentLocalePromise = import("dayjs/locale/kk");
}
else if (language === "sr") {
uiLocalePromise = import("antd/es/locale/sr_RS");
momentLocalePromise = import("dayjs/locale/sr");
}
else {
uiLocalePromise = import("antd/es/locale/en_GB");
}
LocaleHolder.formattingLocale = formattingLocale ? formattingLocale : language;

@@ -66,4 +69,6 @@ if (momentLocalePromise) {

}
const localeData = dayjs.localeData();
LocaleHolder.formatHourMin = localeData.longDateFormat(`LT`);
// replace H to HH
if (LocaleHolder.formatHourMin.indexOf("HH") < 0) {

@@ -76,2 +81,3 @@ LocaleHolder.formatHourMin = LocaleHolder.formatHourMin.replace("H", "HH").replace("h", "HH").replace("A", "").trim();

}
LocaleHolder.formatDate = localeData.longDateFormat('L');

@@ -83,8 +89,11 @@ LocaleHolder.formatDateWithoutYear = LocaleHolder.formatDate.replace(/[^MD\.]*Y+[^MD]*/, "");

LocaleHolder.formatDateHourMinSecWithoutYear = `${LocaleHolder.formatDateWithoutYear} ${LocaleHolder.formatHourMinSec}`;
LocaleHolder.uiLocale = (await uiLocalePromise).default;
LocaleHolder.decimalSeparator = LocaleHolder.getDecimalSeparator(LocaleHolder.formattingLocale);
LocaleHolder.groupSeparator = LocaleHolder.getGroupSeparator(LocaleHolder.formattingLocale);
LocaleHolder.formatHourMinSecMs = `${LocaleHolder.formatHourMinSec}${LocaleHolder.decimalSeparator}SSS`;
LocaleHolder.formatDateHourMinSecMs = `${LocaleHolder.formatDate} ${LocaleHolder.formatHourMinSecMs}`;
LocaleHolder.formatDateHourMinSecMsWithoutYear = `${LocaleHolder.formatDateWithoutYear} ${LocaleHolder.formatHourMinSecMs}`;
LocaleHolder.currentNumberFormatter = Intl.NumberFormat(LocaleHolder.formattingLocale);

@@ -96,10 +105,11 @@ parseDecimalNumber.setOptions({

}
static getDateFormat(showYear) {
if (showYear) {
return LocaleHolder.formatDate;
}
else {
} else {
return LocaleHolder.formatDateWithoutYear;
}
}
static getDateTimeFormat(showYear, showSeconds, showMillis) {

@@ -110,21 +120,16 @@ if (showYear) {

return LocaleHolder.formatDateHourMinSecMs;
}
else {
} else {
return LocaleHolder.formatDateHourMinSec;
}
}
else {
} else {
return LocaleHolder.formatDateHourMin;
}
}
else {
} else {
if (showSeconds) {
if (showMillis) {
return LocaleHolder.formatDateHourMinSecMsWithoutYear;
}
else {
} else {
return LocaleHolder.formatDateHourMinSecWithoutYear;
}
}
else {
} else {
return LocaleHolder.formatDateHourMinWithoutYear;

@@ -134,2 +139,3 @@ }

}
static getTimeFormat(showSeconds, showMillis) {

@@ -139,11 +145,10 @@ if (showSeconds) {

return LocaleHolder.formatHourMinSecMs;
}
else {
} else {
return LocaleHolder.formatHourMinSec;
}
}
else {
} else {
return LocaleHolder.formatHourMin;
}
}
static formatNumber(value, fractionDigits, omitGrouping) {

@@ -153,2 +158,3 @@ let formatter = this.getNumberFormatter(fractionDigits, omitGrouping);

}
static getNumberFormatter(fractionDigits, omitGrouping) {

@@ -159,3 +165,3 @@ let formatter = undefined;

if (!numberFormatters["undefined-fraction-digits"]) {
const options = {};
const options = {}
if (omitGrouping) {

@@ -166,8 +172,6 @@ options.useGrouping = false;

numberFormatters["undefined-fraction-digits"] = formatter;
}
else {
} else {
formatter = numberFormatters["undefined-fraction-digits"];
}
}
else {
} else {
if (!numberFormatters[fractionDigits]) {

@@ -183,4 +187,3 @@ const options = {

numberFormatters[fractionDigits] = formatter;
}
else {
} else {
formatter = numberFormatters[fractionDigits];

@@ -191,2 +194,3 @@ }

}
static parseNumber(text, fractionDigits) {

@@ -198,2 +202,3 @@ const value = parseDecimalNumber(text);

}
static getDecimalSeparator(locale) {

@@ -206,2 +211,3 @@ const numberWithDecimalSeparator = 1.1;

}
static getGroupSeparator(locale) {

@@ -214,5 +220,5 @@ const numberWithDecimalSeparator = 1000;

}
static formatBytes(bytes, decimals = 2) {
if (bytes === 0)
return '0 Bytes';
if (bytes === 0) return '0 Bytes';
const k = 1024;

@@ -224,2 +230,3 @@ const dm = decimals < 0 ? 0 : decimals;

}
static getDurationFormat(showDays, showMillis) {

@@ -229,12 +236,9 @@ if (showDays) {

return `DDDDD HH:mm:ss${LocaleHolder.decimalSeparator}SSS`;
}
else {
} else {
return "DDDDD HH:mm:ss";
}
}
else {
} else {
if (showMillis) {
return `HH:mm:ss${LocaleHolder.decimalSeparator}SSS`;
}
else {
} else {
return "HH:mm:ss";

@@ -245,2 +249,1 @@ }

}
//# sourceMappingURL=localeHolder.js.map
{
"name": "d2core",
"version": "23.0.8",
"version": "23.0.9",
"description": "Core types and utilities library.",
"author": "Ipesoft s.r.o.",
"license": "MIT",
"dependencies": {
"dayjs": "1.11.11"
"peerDependencies": {
"dayjs": "1.x"
},

@@ -10,0 +10,0 @@ "scripts": {

{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "lib/esm",
"resolveJsonModule": true,
"allowJs": true,
"sourceMap": true,
"inlineSources": true
},
"include": [
"./**/*",
"./**/*.json",
],
"exclude": [
"node_modules",
"lib"
]
}
"extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "lib/esm",
"resolveJsonModule": true,
"allowJs": true,
"sourceMap": true,
"inlineSources": true
},
"include": [
"./**/*",
"./**/*.json",
],
"exclude": [
"node_modules",
"lib"
]
}
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"composite": true
}
}
"extends": "../tsconfig.base.json",
"compilerOptions": {
"composite": true,
},
}