@qrvey/utils 1.3.0-0 → 1.3.0-11
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/bitbucket-pipelines.yml +25 -17
- package/dist/cjs/column_format/constants/CHART_GROUP.d.ts +4 -0
- package/dist/cjs/column_format/constants/CHART_GROUP.js +8 -0
- package/dist/cjs/column_format/constants/DATEGROUP_UNSUPPORT_FORMAT.d.ts +2 -0
- package/dist/cjs/column_format/constants/DATEGROUP_UNSUPPORT_FORMAT.js +16 -0
- package/dist/cjs/column_format/constants/DATEGROUP_WITHOUT_FORMAT.d.ts +12 -0
- package/dist/cjs/column_format/constants/DATEGROUP_WITHOUT_FORMAT.js +16 -0
- package/dist/cjs/column_format/constants/SHELF_TYPE.d.ts +7 -0
- package/dist/cjs/column_format/constants/SHELF_TYPE.js +11 -0
- package/dist/cjs/column_format/constants/STRING_FORMAT.d.ts +3 -0
- package/dist/cjs/column_format/constants/STRING_FORMAT.js +7 -0
- package/dist/cjs/column_format/constants/TABLE_TYPE.d.ts +5 -0
- package/dist/cjs/column_format/constants/TABLE_TYPE.js +9 -0
- package/dist/cjs/column_format/constants/index.d.ts +6 -0
- package/dist/cjs/column_format/constants/index.js +22 -0
- package/dist/cjs/column_format/helpers/columnTypeByChart.d.ts +16 -0
- package/dist/cjs/column_format/helpers/columnTypeByChart.js +28 -0
- package/dist/cjs/column_format/helpers/defineFormatV2.d.ts +11 -0
- package/dist/cjs/column_format/helpers/defineFormatV2.js +17 -0
- package/dist/cjs/column_format/helpers/defineTableChartFormat.d.ts +9 -0
- package/dist/cjs/column_format/helpers/defineTableChartFormat.js +71 -0
- package/dist/cjs/column_format/helpers/defineXYChartFormat.d.ts +11 -0
- package/dist/cjs/column_format/helpers/defineXYChartFormat.js +77 -0
- package/dist/cjs/column_format/helpers/index.d.ts +5 -0
- package/dist/cjs/column_format/helpers/index.js +21 -0
- package/dist/cjs/column_format/helpers/parseFormulaTypeByCharts.d.ts +7 -0
- package/dist/cjs/column_format/helpers/parseFormulaTypeByCharts.js +20 -0
- package/dist/cjs/column_format/index.d.ts +3 -0
- package/dist/cjs/column_format/index.js +19 -0
- package/dist/cjs/column_format/interfaces/IChartColumn.d.ts +23 -0
- package/dist/cjs/column_format/interfaces/IChartColumn.js +2 -0
- package/dist/cjs/column_format/interfaces/IChartGroupType.d.ts +2 -0
- package/dist/cjs/column_format/interfaces/IChartGroupType.js +2 -0
- package/dist/cjs/column_format/interfaces/IChartShelfType.d.ts +2 -0
- package/dist/cjs/column_format/interfaces/IChartShelfType.js +2 -0
- package/dist/cjs/column_format/interfaces/IChartTableType.d.ts +2 -0
- package/dist/cjs/column_format/interfaces/IChartTableType.js +2 -0
- package/dist/cjs/column_format/interfaces/IColumnFormatReturnType.d.ts +3 -0
- package/dist/cjs/column_format/interfaces/IColumnFormatReturnType.js +2 -0
- package/dist/cjs/column_format/interfaces/IColumnFormatSettings.d.ts +9 -0
- package/dist/cjs/column_format/interfaces/IColumnFormatSettings.js +2 -0
- package/dist/cjs/column_format/interfaces/IFormatStringType.d.ts +2 -0
- package/dist/cjs/column_format/interfaces/IFormatStringType.js +2 -0
- package/dist/cjs/column_format/interfaces/index.d.ts +7 -0
- package/dist/cjs/column_format/interfaces/index.js +23 -0
- package/dist/cjs/columns/interfaces/IColumnAggregate.d.ts +7 -0
- package/dist/cjs/columns/interfaces/IColumnAggregate.js +2 -0
- package/dist/cjs/columns/interfaces/IColumnDateGroupSettings.d.ts +7 -0
- package/dist/cjs/columns/interfaces/IColumnDateGroupSettings.js +2 -0
- package/dist/cjs/columns/interfaces/IColumnScale.d.ts +5 -0
- package/dist/cjs/columns/interfaces/IColumnScale.js +2 -0
- package/dist/cjs/dates/adapters/dateToHms.d.ts +6 -0
- package/dist/cjs/dates/adapters/dateToHms.js +18 -0
- package/dist/cjs/dates/adapters/dateToMdyDate.d.ts +6 -0
- package/dist/cjs/dates/adapters/dateToMdyDate.js +19 -0
- package/dist/cjs/dates/adapters/dateToMonthYear.d.ts +6 -0
- package/dist/cjs/dates/adapters/dateToMonthYear.js +18 -0
- package/dist/cjs/dates/adapters/dateToQuarterYear.d.ts +6 -0
- package/dist/cjs/dates/adapters/dateToQuarterYear.js +19 -0
- package/dist/cjs/dates/adapters/dateToWeekYear.d.ts +6 -0
- package/dist/cjs/dates/adapters/dateToWeekYear.js +19 -0
- package/dist/cjs/dates/adapters/dateToYear.d.ts +6 -0
- package/dist/cjs/dates/adapters/dateToYear.js +17 -0
- package/dist/cjs/dates/adapters/index.d.ts +11 -0
- package/dist/cjs/dates/adapters/index.js +27 -0
- package/dist/cjs/dates/adapters/mdyDateToDate.d.ts +1 -1
- package/dist/cjs/dates/adapters/monthYearToDate.d.ts +1 -1
- package/dist/cjs/dates/adapters/quarterYearToDate.d.ts +1 -1
- package/dist/cjs/dates/adapters/weekYearToDate.d.ts +1 -1
- package/dist/cjs/dates/adapters/yearToDate.d.ts +1 -1
- package/dist/cjs/dates/helpers/getDateByDateFormat.d.ts +1 -1
- package/dist/cjs/dates/helpers/getDatePickerPickLevel.d.ts +7 -0
- package/dist/cjs/dates/helpers/getDatePickerPickLevel.js +14 -0
- package/dist/cjs/dates/helpers/getFormattedDateByFormat.d.ts +8 -0
- package/dist/cjs/dates/helpers/getFormattedDateByFormat.js +36 -0
- package/dist/cjs/dates/helpers/includeDateTokens.d.ts +9 -0
- package/dist/cjs/dates/helpers/includeDateTokens.js +29 -0
- package/dist/cjs/dates/helpers/index.d.ts +4 -0
- package/dist/cjs/dates/helpers/index.js +4 -0
- package/dist/cjs/dates/index.d.ts +1 -0
- package/dist/cjs/dates/index.js +1 -0
- package/dist/cjs/filters/helpers/common/getFiltersByDatasetsColumns.d.ts +10 -0
- package/dist/cjs/filters/helpers/common/getFiltersByDatasetsColumns.js +27 -0
- package/dist/cjs/filters/helpers/common/index.d.ts +1 -0
- package/dist/cjs/filters/helpers/common/index.js +1 -0
- package/dist/cjs/filters/helpers/common/resolveFilterConditions.js +5 -5
- package/dist/cjs/filters/interfaces/common/IFSParamsToGetFilter.d.ts +1 -1
- package/dist/cjs/general/array/addPropertyToArrayOfObjects.d.ts +22 -0
- package/dist/cjs/general/array/addPropertyToArrayOfObjects.js +32 -0
- package/dist/cjs/general/array/index.d.ts +1 -0
- package/dist/cjs/general/array/index.js +1 -0
- package/dist/cjs/general/string/index.d.ts +2 -0
- package/dist/cjs/general/string/index.js +2 -0
- package/dist/cjs/general/string/padLeadingZeros.d.ts +1 -0
- package/dist/cjs/general/string/padLeadingZeros.js +12 -0
- package/dist/cjs/globalization/interfaces/style_themes/II18nStyleThemesTheme.d.ts +1 -0
- package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +3 -3
- package/dist/cjs/globalization/labels/style_themes/I18N_STYLE_THEMES.js +1 -0
- package/dist/cjs/globalization/service/i18nextBuilder.d.ts +9 -0
- package/dist/cjs/globalization/service/i18nextBuilder.js +3 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/interfaces/format/IFormatDefaultFormat.d.ts +5 -0
- package/dist/cjs/interfaces/format/IFormatDefaultFormat.js +2 -0
- package/dist/cjs/interfaces/format/IFormatOutputFormat.Interface.d.ts +3 -5
- package/dist/column_format/constants/CHART_GROUP.d.ts +4 -0
- package/dist/column_format/constants/CHART_GROUP.js +5 -0
- package/dist/column_format/constants/DATEGROUP_UNSUPPORT_FORMAT.d.ts +2 -0
- package/dist/column_format/constants/DATEGROUP_UNSUPPORT_FORMAT.js +13 -0
- package/dist/column_format/constants/DATEGROUP_WITHOUT_FORMAT.d.ts +12 -0
- package/dist/column_format/constants/DATEGROUP_WITHOUT_FORMAT.js +13 -0
- package/dist/column_format/constants/SHELF_TYPE.d.ts +7 -0
- package/dist/column_format/constants/SHELF_TYPE.js +8 -0
- package/dist/column_format/constants/STRING_FORMAT.d.ts +3 -0
- package/dist/column_format/constants/STRING_FORMAT.js +4 -0
- package/dist/column_format/constants/TABLE_TYPE.d.ts +5 -0
- package/dist/column_format/constants/TABLE_TYPE.js +6 -0
- package/dist/column_format/constants/index.d.ts +6 -0
- package/dist/column_format/constants/index.js +6 -0
- package/dist/column_format/helpers/columnTypeByChart.d.ts +16 -0
- package/dist/column_format/helpers/columnTypeByChart.js +24 -0
- package/dist/column_format/helpers/defineFormatV2.d.ts +11 -0
- package/dist/column_format/helpers/defineFormatV2.js +13 -0
- package/dist/column_format/helpers/defineTableChartFormat.d.ts +9 -0
- package/dist/column_format/helpers/defineTableChartFormat.js +67 -0
- package/dist/column_format/helpers/defineXYChartFormat.d.ts +11 -0
- package/dist/column_format/helpers/defineXYChartFormat.js +73 -0
- package/dist/column_format/helpers/index.d.ts +5 -0
- package/dist/column_format/helpers/index.js +5 -0
- package/dist/column_format/helpers/parseFormulaTypeByCharts.d.ts +7 -0
- package/dist/column_format/helpers/parseFormulaTypeByCharts.js +16 -0
- package/dist/column_format/index.d.ts +3 -0
- package/dist/column_format/index.js +3 -0
- package/dist/column_format/interfaces/IChartColumn.d.ts +23 -0
- package/dist/column_format/interfaces/IChartColumn.js +1 -0
- package/dist/column_format/interfaces/IChartGroupType.d.ts +2 -0
- package/dist/column_format/interfaces/IChartGroupType.js +1 -0
- package/dist/column_format/interfaces/IChartShelfType.d.ts +2 -0
- package/dist/column_format/interfaces/IChartShelfType.js +1 -0
- package/dist/column_format/interfaces/IChartTableType.d.ts +2 -0
- package/dist/column_format/interfaces/IChartTableType.js +1 -0
- package/dist/column_format/interfaces/IColumnFormatReturnType.d.ts +3 -0
- package/dist/column_format/interfaces/IColumnFormatReturnType.js +1 -0
- package/dist/column_format/interfaces/IColumnFormatSettings.d.ts +9 -0
- package/dist/column_format/interfaces/IColumnFormatSettings.js +1 -0
- package/dist/column_format/interfaces/IFormatStringType.d.ts +2 -0
- package/dist/column_format/interfaces/IFormatStringType.js +1 -0
- package/dist/column_format/interfaces/index.d.ts +7 -0
- package/dist/column_format/interfaces/index.js +7 -0
- package/dist/columns/interfaces/IColumnAggregate.d.ts +7 -0
- package/dist/columns/interfaces/IColumnAggregate.js +1 -0
- package/dist/columns/interfaces/IColumnDateGroupSettings.d.ts +7 -0
- package/dist/columns/interfaces/IColumnDateGroupSettings.js +1 -0
- package/dist/columns/interfaces/IColumnScale.d.ts +5 -0
- package/dist/columns/interfaces/IColumnScale.js +1 -0
- package/dist/dates/adapters/dateToHms.d.ts +6 -0
- package/dist/dates/adapters/dateToHms.js +14 -0
- package/dist/dates/adapters/dateToMdyDate.d.ts +6 -0
- package/dist/dates/adapters/dateToMdyDate.js +15 -0
- package/dist/dates/adapters/dateToMonthYear.d.ts +6 -0
- package/dist/dates/adapters/dateToMonthYear.js +14 -0
- package/dist/dates/adapters/dateToQuarterYear.d.ts +6 -0
- package/dist/dates/adapters/dateToQuarterYear.js +15 -0
- package/dist/dates/adapters/dateToWeekYear.d.ts +6 -0
- package/dist/dates/adapters/dateToWeekYear.js +15 -0
- package/dist/dates/adapters/dateToYear.d.ts +6 -0
- package/dist/dates/adapters/dateToYear.js +13 -0
- package/dist/dates/adapters/index.d.ts +11 -0
- package/dist/dates/adapters/index.js +11 -0
- package/dist/dates/adapters/mdyDateToDate.d.ts +1 -1
- package/dist/dates/adapters/monthYearToDate.d.ts +1 -1
- package/dist/dates/adapters/quarterYearToDate.d.ts +1 -1
- package/dist/dates/adapters/weekYearToDate.d.ts +1 -1
- package/dist/dates/adapters/yearToDate.d.ts +1 -1
- package/dist/dates/helpers/getDateByDateFormat.d.ts +1 -1
- package/dist/dates/helpers/getDatePickerPickLevel.d.ts +7 -0
- package/dist/dates/helpers/getDatePickerPickLevel.js +10 -0
- package/dist/dates/helpers/getFormattedDateByFormat.d.ts +8 -0
- package/dist/dates/helpers/getFormattedDateByFormat.js +32 -0
- package/dist/dates/helpers/includeDateTokens.d.ts +9 -0
- package/dist/dates/helpers/includeDateTokens.js +25 -0
- package/dist/dates/helpers/index.d.ts +4 -0
- package/dist/dates/helpers/index.js +4 -0
- package/dist/dates/index.d.ts +1 -0
- package/dist/dates/index.js +1 -0
- package/dist/filters/helpers/common/getFiltersByDatasetsColumns.d.ts +10 -0
- package/dist/filters/helpers/common/getFiltersByDatasetsColumns.js +23 -0
- package/dist/filters/helpers/common/index.d.ts +1 -0
- package/dist/filters/helpers/common/index.js +1 -0
- package/dist/filters/helpers/common/resolveFilterConditions.js +5 -5
- package/dist/filters/interfaces/common/IFSParamsToGetFilter.d.ts +1 -1
- package/dist/general/array/addPropertyToArrayOfObjects.d.ts +22 -0
- package/dist/general/array/addPropertyToArrayOfObjects.js +28 -0
- package/dist/general/array/index.d.ts +1 -0
- package/dist/general/array/index.js +1 -0
- package/dist/general/string/index.d.ts +2 -0
- package/dist/general/string/index.js +2 -0
- package/dist/general/string/padLeadingZeros.d.ts +1 -0
- package/dist/general/string/padLeadingZeros.js +8 -0
- package/dist/globalization/interfaces/style_themes/II18nStyleThemesTheme.d.ts +1 -0
- package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +3 -3
- package/dist/globalization/labels/style_themes/I18N_STYLE_THEMES.js +1 -0
- package/dist/globalization/service/i18nextBuilder.d.ts +9 -0
- package/dist/globalization/service/i18nextBuilder.js +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/interfaces/format/IFormatDefaultFormat.d.ts +5 -0
- package/dist/interfaces/format/IFormatDefaultFormat.js +1 -0
- package/dist/interfaces/format/IFormatOutputFormat.Interface.d.ts +3 -5
- package/jest.config.js +1 -0
- package/package.json +10 -11
- package/scripts/generating-docs/index.js +2 -2
- package/src/column_format/constants/CHART_GROUP.ts +4 -0
- package/src/column_format/constants/DATEGROUP_UNSUPPORT_FORMAT.ts +14 -0
- package/src/column_format/constants/DATEGROUP_WITHOUT_FORMAT.ts +12 -0
- package/src/column_format/constants/SHELF_TYPE.ts +7 -0
- package/src/column_format/constants/STRING_FORMAT.ts +3 -0
- package/src/column_format/constants/TABLE_TYPE.ts +5 -0
- package/src/column_format/constants/index.ts +6 -0
- package/src/column_format/helpers/columnTypeByChart.ts +27 -0
- package/src/column_format/helpers/defineFormatV2.ts +17 -0
- package/src/column_format/helpers/defineTableChartFormat.ts +70 -0
- package/src/column_format/helpers/defineXYChartFormat.ts +80 -0
- package/src/column_format/helpers/index.ts +5 -0
- package/src/column_format/helpers/parseFormulaTypeByCharts.ts +17 -0
- package/src/column_format/index.ts +3 -0
- package/src/column_format/interfaces/IChartColumn.ts +24 -0
- package/src/column_format/interfaces/IChartGroupType.ts +3 -0
- package/src/column_format/interfaces/IChartShelfType.ts +3 -0
- package/src/column_format/interfaces/IChartTableType.ts +3 -0
- package/src/column_format/interfaces/IColumnFormatReturnType.ts +4 -0
- package/src/column_format/interfaces/IColumnFormatSettings.ts +11 -0
- package/src/column_format/interfaces/IFormatStringType.ts +3 -0
- package/src/column_format/interfaces/index.ts +7 -0
- package/src/columns/interfaces/IColumnAggregate.ts +7 -0
- package/src/columns/interfaces/IColumnDateGroupSettings.ts +7 -0
- package/src/columns/interfaces/IColumnScale.ts +5 -0
- package/src/dates/adapters/dateToHms.ts +15 -0
- package/src/dates/adapters/dateToMdyDate.ts +16 -0
- package/src/dates/adapters/dateToMonthYear.ts +15 -0
- package/src/dates/adapters/dateToQuarterYear.ts +16 -0
- package/src/dates/adapters/dateToWeekYear.ts +16 -0
- package/src/dates/adapters/dateToYear.ts +14 -0
- package/src/dates/adapters/index.ts +11 -0
- package/src/dates/adapters/mdyDateToDate.ts +1 -1
- package/src/dates/adapters/monthYearToDate.ts +1 -1
- package/src/dates/adapters/quarterYearToDate.ts +1 -1
- package/src/dates/adapters/weekYearToDate.ts +1 -1
- package/src/dates/adapters/yearToDate.ts +1 -1
- package/src/dates/helpers/getDateByDateFormat.ts +1 -1
- package/src/dates/helpers/getDatePickerPickLevel.ts +12 -0
- package/src/dates/helpers/getFormattedDateByFormat.ts +29 -0
- package/src/dates/helpers/includeDateTokens.ts +26 -0
- package/src/dates/helpers/index.ts +4 -0
- package/src/dates/index.ts +1 -0
- package/src/filters/helpers/common/getFiltersByDatasetsColumns.ts +35 -0
- package/src/filters/helpers/common/index.ts +1 -0
- package/src/filters/helpers/common/resolveFilterConditions.ts +4 -4
- package/src/filters/interfaces/common/IFSParamsToGetFilter.ts +2 -2
- package/src/general/array/addPropertyToArrayOfObjects.ts +32 -0
- package/src/general/array/index.ts +1 -0
- package/src/general/string/index.ts +3 -1
- package/src/general/string/padLeadingZeros.ts +7 -0
- package/src/globalization/interfaces/style_themes/II18nStyleThemesTheme.ts +1 -0
- package/src/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.ts +3 -3
- package/src/globalization/labels/style_themes/I18N_STYLE_THEMES.ts +1 -0
- package/src/globalization/service/i18nextBuilder.ts +10 -0
- package/src/index.ts +1 -0
- package/src/interfaces/format/IFormatDefaultFormat.ts +5 -0
- package/src/interfaces/format/IFormatOutputFormat.Interface.ts +3 -5
- package/test/general/array/addPropertyToArrayOfObjects.test.js +96 -0
- package/test/tokens/isTokenLabel.test.js +130 -0
- package/tsconfig.doc.json +4 -0
- package/tsconfig.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './dateToHms';
|
|
2
|
+
export * from './dateToMdyDate';
|
|
3
|
+
export * from './dateToMonthYear';
|
|
4
|
+
export * from './dateToQuarterYear';
|
|
5
|
+
export * from './dateToWeekYear';
|
|
6
|
+
export * from './dateToYear';
|
|
7
|
+
export * from './mdyDateToDate';
|
|
8
|
+
export * from './monthYearToDate';
|
|
9
|
+
export * from './quarterYearToDate';
|
|
10
|
+
export * from './weekYearToDate';
|
|
11
|
+
export * from './yearToDate';
|
|
@@ -9,7 +9,7 @@ import { validateDate } from "../helpers/validateDate";
|
|
|
9
9
|
* @param time Flag to parse the object date to milliseconds.
|
|
10
10
|
* @returns The date object or the date in milliseconds
|
|
11
11
|
*/
|
|
12
|
-
export function mdyDateToDate (date: string, time = false) {
|
|
12
|
+
export function mdyDateToDate (date: string, time = false): string | Date | number {
|
|
13
13
|
if (isEmpty(date) || isTokenLabel(date)) return date;
|
|
14
14
|
|
|
15
15
|
if (validateDate(date, DATE_FORMAT.DAY)) {
|
|
@@ -10,7 +10,7 @@ import { validateDate } from "../helpers/validateDate";
|
|
|
10
10
|
* @param time Flag to parse the object date to milliseconds.
|
|
11
11
|
* @returns The date object or the date in milliseconds
|
|
12
12
|
*/
|
|
13
|
-
export function monthYearToDate(monthYearDate: string, time = false) {
|
|
13
|
+
export function monthYearToDate(monthYearDate: string, time = false): string | Date | number {
|
|
14
14
|
if (isEmpty(monthYearDate) || isTokenLabel(monthYearDate)) return monthYearDate;
|
|
15
15
|
|
|
16
16
|
if (validateDate(monthYearDate, DATE_FORMAT.MONTH)) {
|
|
@@ -10,7 +10,7 @@ import { validateDate } from "../helpers/validateDate";
|
|
|
10
10
|
* @param time Flag to parse the object date to milliseconds.
|
|
11
11
|
* @returns The date object or the date in milliseconds
|
|
12
12
|
*/
|
|
13
|
-
export function quarterYearToDate (quarterYearDate: string, time = false) {
|
|
13
|
+
export function quarterYearToDate (quarterYearDate: string, time = false): string | Date | number {
|
|
14
14
|
if (isEmpty(quarterYearDate) || isTokenLabel(quarterYearDate)) return quarterYearDate;
|
|
15
15
|
|
|
16
16
|
if (validateDate(quarterYearDate, DATE_FORMAT.QUARTER)) {
|
|
@@ -10,7 +10,7 @@ import { validateDate } from "../helpers/validateDate";
|
|
|
10
10
|
* @param time Flag to parse the object date to milliseconds.
|
|
11
11
|
* @returns The date object or the date in milliseconds
|
|
12
12
|
*/
|
|
13
|
-
export function weekYearToDate(weekYear: string, time = false) {
|
|
13
|
+
export function weekYearToDate(weekYear: string, time = false): string | Date | number {
|
|
14
14
|
if (isEmpty(weekYear) || isTokenLabel(weekYear)) return weekYear;
|
|
15
15
|
|
|
16
16
|
if (validateDate(weekYear, DATE_FORMAT.WEEK)) {
|
|
@@ -10,7 +10,7 @@ import { validateDate } from "../helpers/validateDate";
|
|
|
10
10
|
* @param time Flag to parse the object date to milliseconds.
|
|
11
11
|
* @returns The date object or the date in milliseconds
|
|
12
12
|
*/
|
|
13
|
-
export function yearToDate(yearDate: string, time = false) {
|
|
13
|
+
export function yearToDate(yearDate: string, time = false): string | Date | number {
|
|
14
14
|
if (isEmpty(yearDate) || isTokenLabel(yearDate)) return yearDate;
|
|
15
15
|
|
|
16
16
|
if (validateDate(yearDate, DATE_FORMAT.YEAR)) {
|
|
@@ -13,7 +13,7 @@ import { mdyDateToDate } from "../adapters/mdyDateToDate";
|
|
|
13
13
|
* @param time flag to convert the formatted date to miliseconds
|
|
14
14
|
* @returns a Date object, milisecond time or the same value if date format does not match.
|
|
15
15
|
*/
|
|
16
|
-
export function getDateByDateFormat(date: string, format: IDateFormat, time = false) {
|
|
16
|
+
export function getDateByDateFormat(date: string, format: IDateFormat, time = false): string | Date | number {
|
|
17
17
|
switch (format) {
|
|
18
18
|
case DATE_FORMAT.YEAR:
|
|
19
19
|
return yearToDate(date, time);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DATE_FORMAT } from "../constants/DATE_FORMAT";
|
|
2
|
+
import { IDateFormat } from "../interfaces/IDateFormat";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Gets the pick level number related to the Date picker element
|
|
6
|
+
* @param {IDateFormat} format The date format
|
|
7
|
+
* @returns {number} A number of the pick level setting
|
|
8
|
+
*/
|
|
9
|
+
export function getDatePickerPickLevel(format: IDateFormat): 0 | 1 | 2 {
|
|
10
|
+
return format === DATE_FORMAT.YEAR ? 2 :
|
|
11
|
+
format === DATE_FORMAT.MONTH ? 1 : 0;
|
|
12
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { dateToMdyDate } from "../adapters/dateToMdyDate";
|
|
2
|
+
import { dateToMonthYear } from "../adapters/dateToMonthYear";
|
|
3
|
+
import { dateToQuarterYear } from "../adapters/dateToQuarterYear";
|
|
4
|
+
import { dateToWeekYear } from "../adapters/dateToWeekYear";
|
|
5
|
+
import { dateToYear } from "../adapters/dateToYear";
|
|
6
|
+
import { DATE_FORMAT } from "../constants/DATE_FORMAT";
|
|
7
|
+
import { IDateFormat } from "../interfaces/IDateFormat";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A Date object, string or millisecond number are gotten in order to convert it in an formatted string date
|
|
11
|
+
* @param date String with a formatted date
|
|
12
|
+
* @param format The date format
|
|
13
|
+
* @returns a formmatted date or the same value if format does not match
|
|
14
|
+
*/
|
|
15
|
+
export function getFormattedDateByFormat(date: string | Date | number, format: IDateFormat): string | Date | number {
|
|
16
|
+
if (format === DATE_FORMAT.QUARTER) {
|
|
17
|
+
return dateToQuarterYear(date);
|
|
18
|
+
} else if (format === DATE_FORMAT.MONTH) {
|
|
19
|
+
return dateToMonthYear(date);
|
|
20
|
+
} else if (format === DATE_FORMAT.YEAR) {
|
|
21
|
+
return dateToYear(date);
|
|
22
|
+
} else if (format === DATE_FORMAT.WEEK) {
|
|
23
|
+
return dateToWeekYear(date);
|
|
24
|
+
} else if (format === DATE_FORMAT.DAY) {
|
|
25
|
+
return dateToMdyDate(date);
|
|
26
|
+
} else {
|
|
27
|
+
return date;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { isEmpty } from "../../general/mix/isEmpty";
|
|
2
|
+
import { isTokenLabel } from "../../tokens/isTokenLabel";
|
|
3
|
+
import { IDateFormat } from "../interfaces/IDateFormat";
|
|
4
|
+
import { getSeparatorByDateFormat } from "./getSeparatorByDateFormat";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Determines if the given date has tokens. The date is splitted depending on date format.
|
|
8
|
+
* Undefined date is returning false.
|
|
9
|
+
* @param date The string of the date. It may contain tokens.
|
|
10
|
+
* @param format The date format
|
|
11
|
+
* @returns true: include tokens; false: otherwise
|
|
12
|
+
*/
|
|
13
|
+
export function includeDateTokens(date: string, format: IDateFormat) {
|
|
14
|
+
let hasTokens = false;
|
|
15
|
+
if (!isEmpty(date)) {
|
|
16
|
+
if (isTokenLabel(date)) hasTokens = true;
|
|
17
|
+
else {
|
|
18
|
+
const separator = getSeparatorByDateFormat(format);
|
|
19
|
+
if (separator != null) {
|
|
20
|
+
const tokens = date.split(separator);
|
|
21
|
+
hasTokens = tokens.some(token => isTokenLabel(token));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return hasTokens;
|
|
26
|
+
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
export * from './getDateByDateFormat';
|
|
1
2
|
export * from './getDateFormatByProperty';
|
|
2
3
|
export * from './getDateFormatRegularExpressionInArray';
|
|
4
|
+
export * from './getDatePickerPickLevel';
|
|
5
|
+
export * from './getFormattedDateByFormat';
|
|
3
6
|
export * from './getSeparatorByDateFormat';
|
|
7
|
+
export * from './includeDateTokens';
|
|
4
8
|
export * from './getWeek';
|
|
5
9
|
export * from './validateDate';
|
|
6
10
|
export * from './validateDateByDateFormat';
|
package/src/dates/index.ts
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { isEmpty } from "../../../general/mix/isEmpty";
|
|
2
|
+
import { IDataset } from "../../../qrvey/interfaces/IDataset";
|
|
3
|
+
import { IFUData } from "../../interfaces/ui/IFUData";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Filtering the filters by the columns of datasets.
|
|
7
|
+
* Module specially for CLS.
|
|
8
|
+
* @param data the filter data
|
|
9
|
+
* @param datasets the collection of datasets and their columns
|
|
10
|
+
* @returns A new filter data with the filtered filters by columns
|
|
11
|
+
*/
|
|
12
|
+
export function getFiltersByDatasetsColumns(data: IFUData, datasets: IDataset[] = []): IFUData {
|
|
13
|
+
if (isEmpty(data) || isEmpty(data.scopes)) return;
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
...data,
|
|
17
|
+
scopes: data.scopes.map(scope => ({
|
|
18
|
+
...scope,
|
|
19
|
+
datasets: scope.datasets.map(filterDataset => {
|
|
20
|
+
const dataset = datasets.find(data => data.qrveyid === filterDataset.qrveyid);
|
|
21
|
+
if (!isEmpty(dataset)) {
|
|
22
|
+
return {
|
|
23
|
+
...filterDataset,
|
|
24
|
+
filters: filterDataset.filters.map(filter => {
|
|
25
|
+
const column = (dataset.options || []).find(cInfo => cInfo.id === filter.column.id && cInfo.qrveyid === filter.column.qrveyid);
|
|
26
|
+
if (!isEmpty(column)) {
|
|
27
|
+
return { ...filter };
|
|
28
|
+
}
|
|
29
|
+
}).filter(Boolean)
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}).filter(dataset => !isEmpty(dataset) && dataset.filters.length > 0)
|
|
33
|
+
})).filter(scope => !isEmpty(scope) && scope.datasets.length > 0)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -7,6 +7,7 @@ export * from './getFilterColumnLabel';
|
|
|
7
7
|
export * from './getFilterid';
|
|
8
8
|
export * from './getFilterLabel';
|
|
9
9
|
export * from './getFiltersByAggregateColumn';
|
|
10
|
+
export * from './getFiltersByDatasetsColumns';
|
|
10
11
|
export * from './getFiltersByParams';
|
|
11
12
|
export * from './getFiltersByScopes';
|
|
12
13
|
export * from './getFiltersByScopesIds';
|
|
@@ -17,8 +17,8 @@ export function resolveFilterConditions(filter: IFSFilter, params: IFSParamsToGe
|
|
|
17
17
|
(!_hasProperty(params, 'panelid') || (letPassUndefinedProperties && filter.extras.panelid == null) || (letPassUndefinedParams && isEmpty(params.panelid)) || params.panelid === filter.extras.panelid) &&
|
|
18
18
|
(!_hasProperty(params, 'property') || (letPassUndefinedProperties && filter.property == null) || (letPassUndefinedParams && isEmpty(params.property)) || params.property === filter.property) &&
|
|
19
19
|
(!_hasProperty(params, 'validator') || (letPassUndefinedProperties && filter.validator == null) || (letPassUndefinedParams && isEmpty(params.validator)) || params.validator === filter.validator) &&
|
|
20
|
-
(!_hasProperty(params, 'column') || (letPassUndefinedProperties && filter.column == null) || (letPassUndefinedParams && isEmpty(params.column)) || (params.column?.id === filter.column.id &&
|
|
21
|
-
params.column?.qrveyid === filter.column.qrveyid &&
|
|
22
|
-
params.column?.linkid === filter.column.linkid &&
|
|
23
|
-
params.column?.aggregate === filter.column.aggregate));
|
|
20
|
+
(!_hasProperty(params, 'column') || (letPassUndefinedProperties && filter.column == null) || (letPassUndefinedParams && isEmpty(params.column)) || ((letPassUndefinedParams && isEmpty(params.column?.id) || params.column?.id === filter.column.id) &&
|
|
21
|
+
(letPassUndefinedParams && isEmpty(params.column?.qrveyid) || params.column?.qrveyid === filter.column.qrveyid) &&
|
|
22
|
+
(letPassUndefinedParams && isEmpty(params.column?.linkid) || params.column?.linkid === filter.column.linkid) &&
|
|
23
|
+
(letPassUndefinedParams && isEmpty(params.column?.aggregate) || params.column?.aggregate === filter.column.aggregate)));
|
|
24
24
|
}
|
|
@@ -9,7 +9,7 @@ import { IFSParamsToGetFilterEnableds } from "./IFSParamsToGetFilterEnableds";
|
|
|
9
9
|
* Structure for filter properties
|
|
10
10
|
*/
|
|
11
11
|
export interface IFSParamsToGetFilter {
|
|
12
|
-
column?: IFSColumn
|
|
12
|
+
column?: Partial<IFSColumn>;
|
|
13
13
|
dateSection?: IFDateSection;
|
|
14
14
|
enableds?: IFSParamsToGetFilterEnableds;
|
|
15
15
|
linkid?: string;
|
|
@@ -19,4 +19,4 @@ export interface IFSParamsToGetFilter {
|
|
|
19
19
|
scope?: IFScope;
|
|
20
20
|
scopeid?: string;
|
|
21
21
|
validator?: IFValidator;
|
|
22
|
-
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { isEmpty } from '../mix/isEmpty';
|
|
2
|
+
import { isObject } from '../object/isObject';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* It takes an array of objects, adds a property to each object, and returns the new array.
|
|
6
|
+
* @param {Object} info - Information needed to add property to the array of objects.
|
|
7
|
+
* @param {Array} info.array - The array of objects you want to add a property to.
|
|
8
|
+
* @param {string} info.property - The property you want to add to the object.
|
|
9
|
+
* @param {any} info.value - - The value to be added to the array of objects.
|
|
10
|
+
* ----------------------------------------------------------------------------------------------
|
|
11
|
+
* @example <caption>Example usage of addPropertyToArrayOfObjects.</caption>
|
|
12
|
+
* addPropertyToArrayOfObjects({
|
|
13
|
+
* array: [{ name: "John", lastName: "Doe" }, { name: "Chris", lastName: "Musk" }],
|
|
14
|
+
* property: "lastName",
|
|
15
|
+
* value: 'Peck'
|
|
16
|
+
* });
|
|
17
|
+
* @returns the new array created.
|
|
18
|
+
*/
|
|
19
|
+
export function addPropertyToArrayOfObjects(obj: AddPropertyToArrayOfObjectsParams): any[] {
|
|
20
|
+
if (isEmpty(obj) || !isObject(obj)) return [];
|
|
21
|
+
const { array, property, value } = obj;
|
|
22
|
+
if (Array.isArray(array)) {
|
|
23
|
+
if (isEmpty(array) || isEmpty(property)) return array;
|
|
24
|
+
return array.map((element) => ({ ...element, [property]: value }));
|
|
25
|
+
}
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
type AddPropertyToArrayOfObjectsParams = {
|
|
29
|
+
array: any[];
|
|
30
|
+
property: string;
|
|
31
|
+
value: any;
|
|
32
|
+
};
|
|
@@ -191,9 +191,9 @@ export const I18N_CHART_BUILDER_STYLE_OPTIONS: Pick<II18nChartBuilder, StyleOpti
|
|
|
191
191
|
align: 'Align',
|
|
192
192
|
align_all_columns: 'All Columns',
|
|
193
193
|
align_default: 'Default',
|
|
194
|
-
align_left: '
|
|
195
|
-
align_right: '
|
|
196
|
-
align_center: '
|
|
194
|
+
align_left: 'Left',
|
|
195
|
+
align_right: 'Right',
|
|
196
|
+
align_center: 'Center',
|
|
197
197
|
typeface: 'Typeface',
|
|
198
198
|
weight: 'Weight',
|
|
199
199
|
weight_bold: 'Bold',
|
|
@@ -42,6 +42,7 @@ export const I18N_STYLE_THEMES: II18nStyleThemes = {
|
|
|
42
42
|
qrvey_theme: 'Qrvey Theme',
|
|
43
43
|
restore_to_default: 'Restore to Default',
|
|
44
44
|
save_theme: 'Save Theme',
|
|
45
|
+
show_header: 'Show Header',
|
|
45
46
|
show_title: 'Show Title',
|
|
46
47
|
table_header_styles: 'Table Header Styles',
|
|
47
48
|
text_styles: 'Text Styles',
|
|
@@ -35,7 +35,17 @@ export class I18nServiceBuilder {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
/**
|
|
39
|
+
* This class allows to use the translation service of the i18next library
|
|
40
|
+
*/
|
|
38
41
|
export abstract class I18nService {
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* This method by means of the key searches in the configuration object, replaces the values received by means of the options parameter and returns the translated text. Ex: <b>translate('the_value_is {{number}}',{number: 1});</b>
|
|
45
|
+
* @param key String used as key
|
|
46
|
+
* @param options Object of type II18nServiceTranslateOption that contains the dynamic parameters to replace
|
|
47
|
+
* @returns The translated text Ex: <b>The value is: 1</b>
|
|
48
|
+
*/
|
|
39
49
|
abstract translate(key: string, options?: II18nServiceTranslateOption): string;
|
|
40
50
|
}
|
|
41
51
|
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { IFormatCurrency } from "./IFormatCurrency.Interface";
|
|
2
|
+
import { IFormatDefaultFormat } from "./IFormatDefaultFormat";
|
|
2
3
|
|
|
3
|
-
export interface IFormatOutputFormat {
|
|
4
|
-
format: string;
|
|
5
|
-
type: string;
|
|
6
|
-
decimals?: number;
|
|
4
|
+
export interface IFormatOutputFormat extends IFormatDefaultFormat {
|
|
7
5
|
currency?: IFormatCurrency;
|
|
8
6
|
backup_currency?: IFormatCurrency;
|
|
9
|
-
originalFormat?:
|
|
7
|
+
originalFormat?: IFormatOutputFormat;
|
|
10
8
|
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
const { addPropertyToArrayOfObjects } = require('../../../dist/cjs');
|
|
2
|
+
|
|
3
|
+
describe('Testing undefined argument', function () {
|
|
4
|
+
test('no argument passed', function () {
|
|
5
|
+
const validation = addPropertyToArrayOfObjects();
|
|
6
|
+
expect(validation).toEqual([]);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
test('Undefined argument', function () {
|
|
10
|
+
const validation = addPropertyToArrayOfObjects(undefined);
|
|
11
|
+
expect(validation).toEqual([]);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test('Null argument', function () {
|
|
15
|
+
const validation = addPropertyToArrayOfObjects(null);
|
|
16
|
+
expect(validation).toEqual([]);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
describe('Testing no-object argument', function () {
|
|
21
|
+
const scenarios1 = 1;
|
|
22
|
+
const scenarios2 = false;
|
|
23
|
+
const scenarios4 = 'Hello World';
|
|
24
|
+
const scenarios5 = ['Hello', 'World'];
|
|
25
|
+
|
|
26
|
+
test('Numeric variable', function () {
|
|
27
|
+
const validation = addPropertyToArrayOfObjects(scenarios1);
|
|
28
|
+
expect(validation).toEqual([]);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('Boolean variable', function () {
|
|
32
|
+
const validation = addPropertyToArrayOfObjects(scenarios2);
|
|
33
|
+
expect(validation).toEqual([]);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('String variable', function () {
|
|
37
|
+
const validation = addPropertyToArrayOfObjects(scenarios4);
|
|
38
|
+
expect(validation).toEqual([]);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('Array variable', function () {
|
|
42
|
+
const validation = addPropertyToArrayOfObjects(scenarios5);
|
|
43
|
+
expect(validation).toEqual([]);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
describe('Testing invalid object arguments', function () {
|
|
48
|
+
const scenarios1 = { array: undefined, property: 'lastName', value: 'Doe' };
|
|
49
|
+
const scenarios2 = { array: [{ name: 'Lebron', lastName: 'James' }], property: undefined, value: 'Doe' };
|
|
50
|
+
|
|
51
|
+
test('Empty Array', function () {
|
|
52
|
+
const validation = addPropertyToArrayOfObjects(scenarios1);
|
|
53
|
+
expect(validation).toEqual([]);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('Empty Property', function () {
|
|
57
|
+
const validation = addPropertyToArrayOfObjects(scenarios2);
|
|
58
|
+
expect(validation).toEqual(scenarios2.array);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
describe('Regular scenarios', function () {
|
|
63
|
+
const commonArray = [
|
|
64
|
+
{ name: 'John', lastName: 'Doe' },
|
|
65
|
+
{ name: 'Chris', lastName: 'Musk' },
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
const scenarios1 = { array: commonArray, property: 'name', value: 'Daniel' };
|
|
69
|
+
const scenarios2 = { array: commonArray, property: 'nationality', value: 'Colombian' };
|
|
70
|
+
const scenarios3 = { array: [{ name: 'Lebron', lastName: 'James' }], property: 'lastName', value: undefined };
|
|
71
|
+
|
|
72
|
+
const expectedScenario1 = [
|
|
73
|
+
{ name: 'Daniel', lastName: 'Doe' },
|
|
74
|
+
{ name: 'Daniel', lastName: 'Musk' },
|
|
75
|
+
];
|
|
76
|
+
const expectedScenario2 = [
|
|
77
|
+
{ name: 'John', lastName: 'Doe', nationality: 'Colombian' },
|
|
78
|
+
{ name: 'Chris', lastName: 'Musk', nationality: 'Colombian' },
|
|
79
|
+
];
|
|
80
|
+
const expectedScenario3 = [{ name: 'Lebron', lastName: undefined }];
|
|
81
|
+
|
|
82
|
+
test('Scenario #1', function () {
|
|
83
|
+
const validation = addPropertyToArrayOfObjects(scenarios1);
|
|
84
|
+
expect(validation).toEqual(expectedScenario1);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test('Scenario #2', function () {
|
|
88
|
+
const validation = addPropertyToArrayOfObjects(scenarios2);
|
|
89
|
+
expect(validation).toEqual(expectedScenario2);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
test('Scenario #3', function () {
|
|
93
|
+
const validation = addPropertyToArrayOfObjects(scenarios3);
|
|
94
|
+
expect(validation).toEqual(expectedScenario3);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
@@ -1,3 +1,133 @@
|
|
|
1
|
+
// import { isTokenLabel } from '../../src/tokens/isTokenLabel';
|
|
2
|
+
|
|
3
|
+
// describe('Testing undefined argument', function () {
|
|
4
|
+
// test('no argument passed', function () {
|
|
5
|
+
// const validation: boolean = isTokenLabel();
|
|
6
|
+
// expect(validation).toBeFalsy();
|
|
7
|
+
// });
|
|
8
|
+
|
|
9
|
+
// test('Undefined argument', function () {
|
|
10
|
+
// const validation: boolean = isTokenLabel(undefined);
|
|
11
|
+
// expect(validation).toBeFalsy();
|
|
12
|
+
// });
|
|
13
|
+
|
|
14
|
+
// test('Null argument', function () {
|
|
15
|
+
// const validation: boolean = isTokenLabel(null);
|
|
16
|
+
// expect(validation).toBeFalsy();
|
|
17
|
+
// });
|
|
18
|
+
// });
|
|
19
|
+
|
|
20
|
+
// describe('Testing no-string arguments', function () {
|
|
21
|
+
// const variable1: any = 1;
|
|
22
|
+
// const variable2: any = false;
|
|
23
|
+
// const variable3: any = new Date();
|
|
24
|
+
// const variable4: any = { const1: 'Hello', const2: 'World'};
|
|
25
|
+
// const variable5: any = ['Hello', 'World'];
|
|
26
|
+
|
|
27
|
+
// test('Numeric variable', function () {
|
|
28
|
+
// const validation: boolean = isTokenLabel(variable1);
|
|
29
|
+
// expect(validation).toBeFalsy();
|
|
30
|
+
// });
|
|
31
|
+
|
|
32
|
+
// test('Boolean variable', function () {
|
|
33
|
+
// const validation: boolean = isTokenLabel(variable2);
|
|
34
|
+
// expect(validation).toBeFalsy();
|
|
35
|
+
// });
|
|
36
|
+
|
|
37
|
+
// test('Date object variable', function () {
|
|
38
|
+
// const validation: boolean = isTokenLabel(variable3);
|
|
39
|
+
// expect(validation).toBeFalsy();
|
|
40
|
+
// });
|
|
41
|
+
|
|
42
|
+
// test('Object variable', function () {
|
|
43
|
+
// const validation: boolean = isTokenLabel(variable4);
|
|
44
|
+
// expect(validation).toBeFalsy();
|
|
45
|
+
// });
|
|
46
|
+
|
|
47
|
+
// test('Array variable', function () {
|
|
48
|
+
// const validation: boolean = isTokenLabel(variable5);
|
|
49
|
+
// expect(validation).toBeFalsy();
|
|
50
|
+
// });
|
|
51
|
+
// });
|
|
52
|
+
|
|
53
|
+
// describe('Testing invalid string argument', function () {
|
|
54
|
+
// const variable1: string = '';
|
|
55
|
+
// const variable2: string = 'Hello World';
|
|
56
|
+
// const variable3: string = '{}';
|
|
57
|
+
// const variable4: string = '{{}}';
|
|
58
|
+
// const variable5: string = '{{ }}';
|
|
59
|
+
// const variable6: string = '{{ Hello }}';
|
|
60
|
+
// const variable7: string = '{{Hello}';
|
|
61
|
+
// const variable8: string = '{{Hello}}{{World}}';
|
|
62
|
+
// const variable9: string = '{Hello}';
|
|
63
|
+
|
|
64
|
+
// test('Empty string', function () {
|
|
65
|
+
// const validation: boolean = isTokenLabel(variable1);
|
|
66
|
+
// expect(validation).toBeFalsy();
|
|
67
|
+
// });
|
|
68
|
+
|
|
69
|
+
// test('Non-empty and regular string', function () {
|
|
70
|
+
// const validation: boolean = isTokenLabel(variable2);
|
|
71
|
+
// expect(validation).toBeFalsy();
|
|
72
|
+
// });
|
|
73
|
+
|
|
74
|
+
// test('Single curly brackets and empty label', function () {
|
|
75
|
+
// const validation: boolean = isTokenLabel(variable3);
|
|
76
|
+
// expect(validation).toBeFalsy();
|
|
77
|
+
// });
|
|
78
|
+
|
|
79
|
+
// test('Double curly brackets and empty label', function () {
|
|
80
|
+
// const validation: boolean = isTokenLabel(variable4);
|
|
81
|
+
// expect(validation).toBeFalsy();
|
|
82
|
+
// });
|
|
83
|
+
|
|
84
|
+
// test('Double curly brackets and space between them', function () {
|
|
85
|
+
// const validation: boolean = isTokenLabel(variable5);
|
|
86
|
+
// expect(validation).toBeFalsy();
|
|
87
|
+
// });
|
|
88
|
+
|
|
89
|
+
// test('Double curly brackets and non-empty label with space between them', function () {
|
|
90
|
+
// const validation: boolean = isTokenLabel(variable6);
|
|
91
|
+
// expect(validation).toBeFalsy();
|
|
92
|
+
// });
|
|
93
|
+
|
|
94
|
+
// test('Double left and single right curly brackets and non-empty label', function () {
|
|
95
|
+
// const validation: boolean = isTokenLabel(variable7);
|
|
96
|
+
// expect(validation).toBeFalsy();
|
|
97
|
+
// });
|
|
98
|
+
|
|
99
|
+
// test('Two data tokens in a single string', function () {
|
|
100
|
+
// const validation: boolean = isTokenLabel(variable8);
|
|
101
|
+
// expect(validation).toBeFalsy();
|
|
102
|
+
// });
|
|
103
|
+
|
|
104
|
+
// test('Single curly brackets and non-empty label', function () {
|
|
105
|
+
// const validation: boolean = isTokenLabel(variable9);
|
|
106
|
+
// expect(validation).toBeFalsy();
|
|
107
|
+
// });
|
|
108
|
+
// });
|
|
109
|
+
|
|
110
|
+
// describe('Regular scenarios', function () {
|
|
111
|
+
// const variable1: string = '{{NOW}}';
|
|
112
|
+
// const variable2: string = '{{LAST_YEAR_END}}';
|
|
113
|
+
// const variable3: string = '{{data.marathonparatooltips-cambiodesorting.FECHA.avg}}';
|
|
114
|
+
|
|
115
|
+
// test('Scenario #1', function () {
|
|
116
|
+
// const validation: boolean = isTokenLabel(variable1);
|
|
117
|
+
// expect(validation).toBeTruthy();
|
|
118
|
+
// });
|
|
119
|
+
|
|
120
|
+
// test('Scenario #2', function () {
|
|
121
|
+
// const validation: boolean = isTokenLabel(variable2);
|
|
122
|
+
// expect(validation).toBeTruthy();
|
|
123
|
+
// });
|
|
124
|
+
|
|
125
|
+
// test('Scenario #3', function () {
|
|
126
|
+
// const validation: boolean = isTokenLabel(variable3);
|
|
127
|
+
// expect(validation).toBeTruthy();
|
|
128
|
+
// });
|
|
129
|
+
// });
|
|
130
|
+
|
|
1
131
|
const { isTokenLabel } = require("../../dist/cjs");
|
|
2
132
|
|
|
3
133
|
describe('Testing undefined argument', function () {
|
package/tsconfig.json
CHANGED