@qrvey/utils 1.15.0-21 → 1.15.0-23
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/dist/cjs/columns/helpers/isNumericalColumn.d.ts +1 -1
- package/dist/cjs/columns/helpers/isNumericalColumn.js +1 -1
- package/dist/cjs/columns/helpers/isStringColumn.d.ts +7 -0
- package/dist/cjs/columns/helpers/isStringColumn.js +19 -0
- package/dist/cjs/dates/relative/RelativeStatementAdapter.js +2 -1
- package/dist/columns/helpers/isNumericalColumn.d.ts +1 -1
- package/dist/columns/helpers/isNumericalColumn.js +1 -1
- package/dist/columns/helpers/isStringColumn.d.ts +7 -0
- package/dist/columns/helpers/isStringColumn.js +15 -0
- package/dist/dates/relative/RelativeStatementAdapter.js +2 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IColumn } from "../interfaces/IColumn";
|
|
2
2
|
/**
|
|
3
3
|
* Validates if the given column is numerical type
|
|
4
|
-
* @param
|
|
4
|
+
* @param column the column info
|
|
5
5
|
* @returns true: the column is numerical type
|
|
6
6
|
*/
|
|
7
7
|
export declare const isNumericalColumn: (column: IColumn) => boolean;
|
|
@@ -8,7 +8,7 @@ const COLUMN_1 = require("../constants/COLUMN");
|
|
|
8
8
|
const NUMERICAL_COLUMNS_1 = require("../constants/NUMERICAL_COLUMNS");
|
|
9
9
|
/**
|
|
10
10
|
* Validates if the given column is numerical type
|
|
11
|
-
* @param
|
|
11
|
+
* @param column the column info
|
|
12
12
|
* @returns true: the column is numerical type
|
|
13
13
|
*/
|
|
14
14
|
const isNumericalColumn = (column) => !(0, isEmpty_1.isEmpty)(column) &&
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isStringColumn = void 0;
|
|
4
|
+
const FORMULA_1 = require("../../formulas/constants/FORMULA");
|
|
5
|
+
const isEmpty_1 = require("../../general/mix/isEmpty");
|
|
6
|
+
const isObject_1 = require("../../general/object/isObject");
|
|
7
|
+
const COLUMN_1 = require("../constants/COLUMN");
|
|
8
|
+
/**
|
|
9
|
+
* Validates if the given column is text type
|
|
10
|
+
* @param column the column info
|
|
11
|
+
* @returns true: the column is numerical type
|
|
12
|
+
*/
|
|
13
|
+
const isStringColumn = (column) => !(0, isEmpty_1.isEmpty)(column) &&
|
|
14
|
+
(0, isObject_1.isObject)(column) &&
|
|
15
|
+
([COLUMN_1.COLUMN.TEXT_LABEL, COLUMN_1.COLUMN.LONGTEXT, COLUMN_1.COLUMN.TEXT_FORMULA].includes(column.type) ||
|
|
16
|
+
(column.type === COLUMN_1.COLUMN.FORMULA && column.formulaType === FORMULA_1.FORMULA.TEXT) ||
|
|
17
|
+
(column.type === COLUMN_1.COLUMN.AGGREGATED_FORMULA &&
|
|
18
|
+
column.formulaType === FORMULA_1.FORMULA.TEXT));
|
|
19
|
+
exports.isStringColumn = isStringColumn;
|
|
@@ -9,6 +9,7 @@ const getStatementCase_1 = require("./helpers/getStatementCase");
|
|
|
9
9
|
const DATE_GROUPING_PROPERTY_1 = require("../constants/DATE_GROUPING_PROPERTY");
|
|
10
10
|
const parseDate_1 = require("./helpers/parseDate");
|
|
11
11
|
const DATE_FORMATS_1 = require("./constants/DATE_FORMATS");
|
|
12
|
+
const general_1 = require("../../general");
|
|
12
13
|
class RelativeStatementAdapter {
|
|
13
14
|
constructor(statement, now = new Date()) {
|
|
14
15
|
this.statement =
|
|
@@ -22,7 +23,7 @@ class RelativeStatementAdapter {
|
|
|
22
23
|
return this.get("unit");
|
|
23
24
|
}
|
|
24
25
|
get anchor() {
|
|
25
|
-
return this.get("anchor");
|
|
26
|
+
return (0, general_1.isEmpty)(this.get("anchor")) ? undefined : this.get("anchor");
|
|
26
27
|
}
|
|
27
28
|
get number() {
|
|
28
29
|
return this.get("number");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IColumn } from "../interfaces/IColumn";
|
|
2
2
|
/**
|
|
3
3
|
* Validates if the given column is numerical type
|
|
4
|
-
* @param
|
|
4
|
+
* @param column the column info
|
|
5
5
|
* @returns true: the column is numerical type
|
|
6
6
|
*/
|
|
7
7
|
export declare const isNumericalColumn: (column: IColumn) => boolean;
|
|
@@ -5,7 +5,7 @@ import { COLUMN } from "../constants/COLUMN";
|
|
|
5
5
|
import { NUMERICAL_COLUMNS } from "../constants/NUMERICAL_COLUMNS";
|
|
6
6
|
/**
|
|
7
7
|
* Validates if the given column is numerical type
|
|
8
|
-
* @param
|
|
8
|
+
* @param column the column info
|
|
9
9
|
* @returns true: the column is numerical type
|
|
10
10
|
*/
|
|
11
11
|
export const isNumericalColumn = (column) => !isEmpty(column) &&
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FORMULA } from "../../formulas/constants/FORMULA";
|
|
2
|
+
import { isEmpty } from "../../general/mix/isEmpty";
|
|
3
|
+
import { isObject } from "../../general/object/isObject";
|
|
4
|
+
import { COLUMN } from "../constants/COLUMN";
|
|
5
|
+
/**
|
|
6
|
+
* Validates if the given column is text type
|
|
7
|
+
* @param column the column info
|
|
8
|
+
* @returns true: the column is numerical type
|
|
9
|
+
*/
|
|
10
|
+
export const isStringColumn = (column) => !isEmpty(column) &&
|
|
11
|
+
isObject(column) &&
|
|
12
|
+
([COLUMN.TEXT_LABEL, COLUMN.LONGTEXT, COLUMN.TEXT_FORMULA].includes(column.type) ||
|
|
13
|
+
(column.type === COLUMN.FORMULA && column.formulaType === FORMULA.TEXT) ||
|
|
14
|
+
(column.type === COLUMN.AGGREGATED_FORMULA &&
|
|
15
|
+
column.formulaType === FORMULA.TEXT));
|
|
@@ -6,6 +6,7 @@ import { getStatementCase } from "./helpers/getStatementCase";
|
|
|
6
6
|
import { DATE_GROUPING_PROPERTY } from "../constants/DATE_GROUPING_PROPERTY";
|
|
7
7
|
import { parseDate } from "./helpers/parseDate";
|
|
8
8
|
import { DATETIME_FORMAT } from "./constants/DATE_FORMATS";
|
|
9
|
+
import { isEmpty } from "../../general";
|
|
9
10
|
export class RelativeStatementAdapter {
|
|
10
11
|
constructor(statement, now = new Date()) {
|
|
11
12
|
this.statement =
|
|
@@ -19,7 +20,7 @@ export class RelativeStatementAdapter {
|
|
|
19
20
|
return this.get("unit");
|
|
20
21
|
}
|
|
21
22
|
get anchor() {
|
|
22
|
-
return this.get("anchor");
|
|
23
|
+
return isEmpty(this.get("anchor")) ? undefined : this.get("anchor");
|
|
23
24
|
}
|
|
24
25
|
get number() {
|
|
25
26
|
return this.get("number");
|