@trackunit/shared-utils 0.0.4 → 0.0.5

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/package.json CHANGED
@@ -1,17 +1,12 @@
1
1
  {
2
2
  "name": "@trackunit/shared-utils",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
7
7
  "node": ">=18.x"
8
8
  },
9
- "dependencies": {
10
- "@sentry/react": "7.57.0",
11
- "crossfilter2": "1.5.4",
12
- "moment": "2.29.4"
13
- },
9
+ "dependencies": {},
14
10
  "module": "./index.esm.js",
15
- "main": "./index.cjs.js",
16
- "peerDependencies": {}
11
+ "main": "./index.cjs.js"
17
12
  }
@@ -5,6 +5,7 @@ export declare enum HoursAndMinutesFormat {
5
5
  HOURS_MIN = "HOURS_MIN",
6
6
  HOURS_LONG = "HOURS_LONG"
7
7
  }
8
+ export type HoursAndMinutesFormatType = `${HoursAndMinutesFormat}`;
8
9
  export declare enum DateTimeFormat {
9
10
  DATE = "L",
10
11
  DATE_LONG = "LL",
@@ -17,3 +18,4 @@ export declare enum DateTimeFormat {
17
18
  YEAR_MONTH_DAY = "yyyy-MM-DD",
18
19
  MONTH_DAY = "MMM, Do"
19
20
  }
21
+ export type DateTimeFormatType = `${DateTimeFormat}`;
@@ -2,15 +2,6 @@
2
2
  export declare function toggle<T>(array: T[] | null | undefined, value: T | null | undefined): T[];
3
3
  /** Ensure the argument is an array, if not, create array with that element in it */
4
4
  export declare function ensureArray<T>(arrayish: T | T[]): T[];
5
- /**
6
- * Returns the first item in an array, and logs a warning if there are more than one item in the array.
7
- *
8
- * @param array The array to get the first item from
9
- * @param location The location from where this function is called
10
- * @returns The first item in the array
11
- * @example getFirstItemAndLogIfMore([1, 2, 3], "getFirstItemAndLogIfMore") // 1
12
- */
13
- export declare const getFirstItemAndLogIfMore: <T>(array?: T[] | null | undefined, location?: string) => T | undefined;
14
5
  /**
15
6
  * Returns a new array with the items from the previous array and the new array, but only if the item's key is unique.
16
7
  *
package/src/filter.d.ts CHANGED
@@ -19,7 +19,3 @@ export declare function filterByMultiple<T>(array: T[] | null | undefined, props
19
19
  * The terms can match the same property multiple times
20
20
  */
21
21
  export declare const fuzzySearch: <T>(elementsToFilter: T[], filterableProps: (element: T) => string[], searchTerm: string) => T[];
22
- /**
23
- * Filter an array of items based on a search term.
24
- */
25
- export declare const Search: <T>(elementsToSearch: T[], searchableProps: (element: T) => string[], searchTerm: string) => T[];
package/src/index.d.ts CHANGED
@@ -1,13 +1,10 @@
1
1
  export * from "./DateTimeFormat";
2
2
  export * from "./DateUtils";
3
3
  export * from "./GeoJsonUtils";
4
- export * from "./TimePeriod";
5
4
  export * from "./UnitOfMeasurementConverter";
6
5
  export * from "./addressUtils";
7
6
  export * from "./arrayUtils";
8
- export * from "./chameleonUtils";
9
7
  export * from "./constants";
10
- export * from "./dimensionHelpers";
11
8
  export * from "./doNothing";
12
9
  export * from "./enumUtils";
13
10
  export * from "./exhaustiveCheck";
@@ -21,5 +18,4 @@ export * from "./pathUtils";
21
18
  export * from "./pictureUtils/pictureUtils";
22
19
  export * from "./sorting/sorting";
23
20
  export * from "./stringUtils";
24
- export * from "./timePeriodConverter/timePeriodConverter";
25
21
  export * from "./typeUtils";
@@ -27,4 +27,4 @@ export declare const titleCase: (s: string) => string;
27
27
  * @example removeLeftPadding("00000000-0000-0000-0000-000000000001") // 1
28
28
  * @example removeLeftPadding("00000000-0000-0000-0000-000000000010") // 10
29
29
  */
30
- export declare const removeLeftPadding: (id: string) => number;
30
+ export declare const removeLeftPadding: (id: string | null | undefined) => number;
@@ -1,12 +0,0 @@
1
- export declare enum TimePeriod {
2
- THIS_WEEK = "THIS_WEEK",
3
- LAST_WEEK = "LAST_WEEK",
4
- THIS_MONTH = "THIS_MONTH",
5
- LAST_MONTH = "LAST_MONTH"
6
- }
7
- export declare enum DayPeriod {
8
- LAST_24_HOURS = "LAST_24_HOURS",
9
- LAST_7_DAYS = "LAST_7_DAYS",
10
- LAST_30_DAYS = "LAST_30_DAYS",
11
- LIFETIME = "LIFETIME"
12
- }
@@ -1,4 +0,0 @@
1
- export interface IChameleonAware {
2
- /** Hardcode an anchor to be used by chameleon */
3
- chameleonId?: string;
4
- }
@@ -1,11 +0,0 @@
1
- import crossfilter from "crossfilter2";
2
- /**
3
- * Gets the filtered record values where the value is over 0
4
- *
5
- * @param dimension the record dimension
6
- */
7
- export declare const getDimensionValues: <RecordType, TValue extends crossfilter.NaturallyOrderedValue>(dimension: crossfilter.Dimension<RecordType, TValue>) => crossfilter.Grouping<crossfilter.NaturallyOrderedValue, crossfilter.NaturallyOrderedValue>[];
8
- /**
9
- * This value is used to group null or undefined values
10
- */
11
- export declare const UNKNOWN_VALUE = "Unknown";
@@ -1,34 +0,0 @@
1
- import { TimePeriod } from "../TimePeriod";
2
- /**
3
- * Converts a time period to a list of daily intervals
4
- *
5
- * @param period The time period to convert
6
- * @returns {Array<{ from: Date; to: Date }>} A list of daily intervals
7
- * @example toDailyIntervals(TimePeriod.THIS_MONTH) // [{ from: "2021-05-01T00:00:00.000Z", to: "2021-05-31T23:59:59.999Z" }]
8
- */
9
- export declare function toDailyIntervals(period: TimePeriod): {
10
- from: Date;
11
- to: Date;
12
- }[];
13
- /**
14
- * Converts a time period to an interval
15
- *
16
- * @param period The time period to convert
17
- * @returns {{ from: Date; to: Date }} An interval
18
- * @example toInterval(TimePeriod.THIS_MONTH) // { from: "2021-05-01T00:00:00.000Z", to: "2021-05-31T23:59:59.999Z" }
19
- */
20
- export declare function toInterval(period: TimePeriod): {
21
- from: Date;
22
- to: Date;
23
- };
24
- /**
25
- * Converts a time period to a list of months
26
- *
27
- * @param period The time period to convert
28
- * @returns {Array<{ year: number; month: number }>} A list of months
29
- * @example toMonths(TimePeriod.THIS_MONTH) // [{ year: 2021, month: 5 }]
30
- */
31
- export declare function toDates(period: TimePeriod): {
32
- from: string;
33
- to: string;
34
- };