@inrixia/helpers 1.23.3 → 2.0.0

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.
Files changed (72) hide show
  1. package/conv.d.ts +28 -0
  2. package/conv.d.ts.map +1 -0
  3. package/conv.js +42 -0
  4. package/conv.js.map +1 -0
  5. package/{elastic/index.d.ts → elastic.d.ts} +15 -14
  6. package/elastic.d.ts.map +1 -0
  7. package/{elastic/index.js → elastic.js} +24 -31
  8. package/elastic.js.map +1 -0
  9. package/{geo/index.d.ts → geo.d.ts} +5 -6
  10. package/geo.d.ts.map +1 -0
  11. package/geo.js +32 -0
  12. package/geo.js.map +1 -0
  13. package/index.d.ts +9 -7
  14. package/index.d.ts.map +1 -1
  15. package/index.js +9 -29
  16. package/index.js.map +1 -1
  17. package/{logic/index.d.ts → logic.d.ts} +2 -2
  18. package/logic.d.ts.map +1 -0
  19. package/{logic/index.js → logic.js} +16 -18
  20. package/logic.js.map +1 -0
  21. package/{math/index.d.ts → math.d.ts} +2 -2
  22. package/math.d.ts.map +1 -0
  23. package/{math/index.js → math.js} +6 -13
  24. package/math.js.map +1 -0
  25. package/{object/index.d.ts → object.d.ts} +42 -44
  26. package/object.d.ts.map +1 -0
  27. package/{object/index.js → object.js} +77 -111
  28. package/object.js.map +1 -0
  29. package/package.json +13 -8
  30. package/{react/index.d.ts → react.d.ts} +1 -1
  31. package/react.d.ts.map +1 -0
  32. package/{react/index.js → react.js} +2 -6
  33. package/react.js.map +1 -0
  34. package/test/matchers.d.ts +15 -0
  35. package/test/matchers.d.ts.map +1 -0
  36. package/test/matchers.js +66 -0
  37. package/test/matchers.js.map +1 -0
  38. package/test.d.ts +15 -0
  39. package/test.d.ts.map +1 -0
  40. package/test.js +5 -0
  41. package/test.js.map +1 -0
  42. package/ts/math.js +1 -2
  43. package/ts/numRange.d.ts.map +1 -1
  44. package/ts/numRange.js +1 -2
  45. package/{ts/index.d.ts → ts.d.ts} +11 -3
  46. package/ts.d.ts.map +1 -0
  47. package/ts.js +6 -0
  48. package/ts.js.map +1 -0
  49. package/conv/index.d.ts +0 -28
  50. package/conv/index.d.ts.map +0 -1
  51. package/conv/index.js +0 -48
  52. package/conv/index.js.map +0 -1
  53. package/elastic/index.d.ts.map +0 -1
  54. package/elastic/index.js.map +0 -1
  55. package/geo/index.d.ts.map +0 -1
  56. package/geo/index.js +0 -39
  57. package/geo/index.js.map +0 -1
  58. package/jest/index.d.ts +0 -24
  59. package/jest/index.d.ts.map +0 -1
  60. package/jest/index.js +0 -47
  61. package/jest/index.js.map +0 -1
  62. package/logic/index.d.ts.map +0 -1
  63. package/logic/index.js.map +0 -1
  64. package/math/index.d.ts.map +0 -1
  65. package/math/index.js.map +0 -1
  66. package/object/index.d.ts.map +0 -1
  67. package/object/index.js.map +0 -1
  68. package/react/index.d.ts.map +0 -1
  69. package/react/index.js.map +0 -1
  70. package/ts/index.d.ts.map +0 -1
  71. package/ts/index.js +0 -11
  72. package/ts/index.js.map +0 -1
@@ -1,16 +1,17 @@
1
+ import { UnknownRecord } from "./ts.js";
1
2
  export declare const isDuplicate: (key: unknown) => boolean;
2
3
  /**
3
4
  * Simple object check.
4
5
  * @param item
5
6
  * @returns {boolean}
6
7
  */
7
- export declare const isObject: (item: unknown) => boolean;
8
+ export declare const isObject: (item: unknown) => item is UnknownRecord;
8
9
  /**
9
10
  * Deep merge objects into target. Without modifying target.
10
11
  * @param target
11
12
  * @param source
12
13
  */
13
- export declare const deepMerge: <T extends S, S extends Record<string, any> = Partial<T>>(target: T, source: S) => T & S;
14
+ export declare const deepMerge: <T extends S, S extends UnknownRecord = Partial<T>>(target: T, source: S) => T & S;
14
15
  export declare type Types = {
15
16
  [key: string]: string | string[] | Types | Types[];
16
17
  };
@@ -21,35 +22,35 @@ export declare type TypeCompareResult = boolean | {
21
22
  };
22
23
  /**
23
24
  * Take in a target `object` and a `types` object with identical keys but values as array of types those keys should be.
24
- * @param {object} target Object
25
- * @param {object} types Object identical to `target` but values are types
26
- * @returns {{ location: string, expected: string, got: object }|boolean} `object` if the types dont match. `True` if they do.
25
+ * @param target Object
26
+ * @param types Object identical to `target` but values are types
27
+ * @returns `object` if the types dont match. `True` if they do.
27
28
  */
28
- export declare const deepTypeCompare: (target: Record<string, any>, types: Types, location?: string) => TypeCompareResult;
29
+ export declare const deepTypeCompare: (target: UnknownRecord, types: Types, location?: string) => TypeCompareResult;
29
30
  /**
30
31
  * Helper function for `deepTypeCompare` to compare a item to a type or set of types.
31
- * @param {string|Array<string>} expectedTypes Expected type/types
32
- * @param {unknown} receivedValue Object given
33
- * @param {string} location Location of `got` given
32
+ * @param expectedTypes Expected type/types
33
+ * @param receivedValue Object given
34
+ * @param location Location of `got` given
34
35
  */
35
- export declare const compareTwo: (expectedTypes: string | Array<string>, receivedValue: unknown, location: string) => TypeCompareResult;
36
+ export declare const compareTwo: (expectedTypes: string | string[], receivedValue: unknown, location: string) => TypeCompareResult;
36
37
  /**
37
38
  * Returns the type of `item` respecting `Array`, `null` and `undefined` unlike typeof.
38
- * @param {unknown} item
39
- * @returns {string} Type of item
39
+ * @param item
40
+ * @returns Type of item
40
41
  */
41
42
  export declare const type: (item: unknown) => string;
42
43
  /**
43
44
  * Breaks `array` into smaller chunks based on `chunkSize`
44
- * @param {Array} array Array to break up.
45
- * @param {number} chunkSize Maximum size of array chunks.
45
+ * @param array Array to break up.
46
+ * @param chunkSize Maximum size of array chunks.
46
47
  *
47
- * @returns {Array<Array>} Array containing array chunks.
48
+ * @returns Array containing array chunks.
48
49
  */
49
50
  export declare const chunkArray: <T extends string | unknown[]>(array: T, chunkSize: number) => T[];
50
51
  /**
51
52
  * stringifies and then parses a object to convert it to a JSON supported object.
52
- * @param {Object} obj Object to convert.
53
+ * @param obj Object to convert.
53
54
  * @example
54
55
  * const obj = {
55
56
  * a: 1,
@@ -59,35 +60,32 @@ export declare const chunkArray: <T extends string | unknown[]>(array: T, chunkS
59
60
  * const b = JSON.parse(JSON.stringify(obj))
60
61
  * console.log(a == b) -> true
61
62
  */
62
- export declare const objectify: (obj: Record<string, unknown>) => Record<string, unknown>;
63
+ export declare const objectify: (obj: UnknownRecord) => UnknownRecord;
63
64
  /**
64
65
  * Logs a inspected object to console
65
- * @param {*} obj Object to inspect
66
- * @param {boolean} options Show hidden properties of object
67
- * @param {number} options Depth to inspect object
68
- * @param {boolean} options Color resulting output
69
- * @returns {void}
66
+ * @param obj Object to inspect
67
+ * @param options.showHidden Show hidden properties of object
68
+ * @param options.depth Depth to inspect object
69
+ * @param options.color Color resulting output
70
70
  */
71
71
  export declare const lObj: (obj: unknown, showHidden?: boolean | undefined, depth?: number | undefined, color?: boolean | undefined) => void;
72
72
  /**
73
73
  * Inspects a object
74
- * @param {*} obj Object to inspect
75
- * @param {boolean} showHidden Show hidden properties of object
76
- * @param {number} depth Depth to inspect object
77
- * @param {boolean} color Color resulting output
78
- * @returns {string}
74
+ * @param obj Object to inspect
75
+ * @param options.showHidden Show hidden properties of object
76
+ * @param options.depth Depth to inspect object
77
+ * @param options.color Color resulting output
79
78
  */
80
79
  export declare const iObj: (obj: unknown, showHidden?: boolean | undefined, depth?: number | undefined, color?: boolean | undefined) => string;
81
80
  /**
82
81
  * Single line inspect object.
83
- * @param {*} obj Object to inspect
84
- * @param {boolean} showHidden Show hidden properties of object
85
- * @param {number} depth Depth to inspect object
86
- * @param {boolean} color Color resulting output
87
- * @returns {string} Inspected object in a single line, spaces aligned
82
+ * @param obj Object to inspect
83
+ * @param options.showHidden Show hidden properties of object
84
+ * @param options.depth Depth to inspect object
85
+ * @param options.color Color resulting output
88
86
  */
89
87
  export declare const sliObj: (obj: unknown, showHidden?: boolean | undefined, depth?: number | undefined, color?: boolean | undefined) => string;
90
- declare type UnknownFunction = (...args: any[]) => Promise<unknown>;
88
+ declare type AsyncFunction = (...args: unknown[]) => Promise<unknown>;
91
89
  declare type ErrorHandler = (err: Error) => Promise<void>;
92
90
  /**
93
91
  * Recursively runs `func` and handles errors with `errorHandler` until `func` successfully finishes.
@@ -95,15 +93,15 @@ declare type ErrorHandler = (err: Error) => Promise<void>;
95
93
  * @param errorHandler Function to execute when a error occours
96
94
  * @returns Return value of `func` on success
97
95
  */
98
- export declare const loopError: <F extends UnknownFunction>(func: F, errorHandler?: ErrorHandler) => ReturnType<F>;
96
+ export declare const loopError: <F extends AsyncFunction>(func: F, errorHandler?: ErrorHandler) => ReturnType<F>;
99
97
  /**
100
- * @param {Array<number>} array
101
- * @returns {string} string containing ranges of numbers.
98
+ * @param array
99
+ * @returns string containing ranges of numbers.
102
100
  * @example
103
101
  * const range = toRange([1, 2, 3, 12, 6,7, 5, 27, 28, 29, 40, 41, 25, 42, 12])
104
102
  * // range = "1-3 & 5-7 & 12 & 25 & 27-29 & 40-42"
105
103
  */
106
- export declare const toRange: (array: Array<number>) => string;
104
+ export declare const toRange: (array: number[]) => string;
107
105
  /**
108
106
  * Returns the `property` requested from `obj`
109
107
  * @param obj
@@ -118,14 +116,14 @@ export declare const toRange: (array: Array<number>) => string;
118
116
  * const wantedProperty = "a.child"
119
117
  * console.log(deepGet(object, wantedProperty)) // -> "Hello World"
120
118
  */
121
- export declare const deepGet: <T = unknown>(obj: Record<string, unknown>, property: string, delimiter?: string) => T | undefined;
119
+ export declare const deepGet: <T = unknown>(obj: UnknownRecord, property: string, delimiter?: string) => T | undefined;
122
120
  declare type ContentTemplate = {
123
121
  [key: string]: string | ContentTemplate;
124
122
  };
125
123
  /**
126
124
  * Replaces values in a given `templatestring` with contentKeys from a given `contentKeys` object.
127
- * @param {object} contentKeys Object containing key value pairs of contentKeys to fill template string with
128
- * @param {string} templatestring string containing templates to fill
125
+ * @param contentKeys Object containing key value pairs of contentKeys to fill template string with
126
+ * @param templatestring string containing templates to fill
129
127
  * @example
130
128
  * const contentKeys = {
131
129
  * "title": "This is a title",
@@ -143,7 +141,7 @@ export declare const fillTemplate: (contentKeys: ContentTemplate, templatestring
143
141
  * @example process.env["some_subproperty"] = "hello"
144
142
  * returns { some: { subProperty: "hello" } }
145
143
  */
146
- export declare const getEnv: () => Record<string, any>;
144
+ export declare const getEnv: () => UnknownRecord;
147
145
  declare type RecursiveUpdateOptions = {
148
146
  setUndefined?: boolean;
149
147
  setDefined?: boolean;
@@ -155,14 +153,14 @@ declare type RecursiveUpdateOptions = {
155
153
  * @param options.setUndefined Defaults to `true` Set properties that are undefined on `targetObject`.
156
154
  * @param options.setDefined Defaults to `false`. Overwrite properties that are not undefined on `targetObject`.
157
155
  */
158
- export declare const recursiveUpdate: (targetObject: Record<string, any>, newObject: Record<string, any>, options?: RecursiveUpdateOptions) => void;
156
+ export declare const recursiveUpdate: (targetObject: UnknownRecord, newObject: UnknownRecord, options?: RecursiveUpdateOptions) => void;
159
157
  /**
160
158
  * Set the types of a given `object` based on the types of an identical `types` object. Usful in conjunction with `getEnv` to convert a object only containing strings/objects to actual types.
161
159
  */
162
- export declare const rebuildTypes: <O extends Record<string, any>, T extends O>(object: O, types: T) => void;
160
+ export declare const rebuildTypes: (object: UnknownRecord, types: UnknownRecord) => void;
163
161
  /**
164
162
  * Fetch process.env[envName] or throw if its undefined
165
163
  */
166
164
  export declare const envOrThrow: (envName: string) => string;
167
165
  export {};
168
- //# sourceMappingURL=index.d.ts.map
166
+ //# sourceMappingURL=object.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../src/object.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAMxC,eAAO,MAAM,WAAW,QAAS,OAAO,KAAG,OAI1C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,QAAQ,SAAU,OAAO,0BAAkG,CAAC;AAEzI;;;;GAIG;AACH,eAAO,MAAM,SAAS,oFAWrB,CAAC;AAEF,oBAAY,KAAK,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,KAAK,GAAG,KAAK,EAAE,CAAA;CAAE,CAAC;AAC3E,o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AE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,eAAe,CAAA;CAAE,CAAC;AAEnE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY,gBAAiB,eAAe,kBAAkB,MAAM,sBAAgB,MAMhG,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,MAAM,QAAO,aA8BzB,CAAC;AAEF,aAAK,sBAAsB,GAAG;IAAE,YAAY,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAE/E;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,iBACb,aAAa,aAChB,aAAa,YACf,sBAAsB,KAC7B,IAQF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,WAAY,aAAa,SAAS,aAAa,KAAG,IAkB1E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,YAAa,MAAM,KAAG,MAI5C,CAAC"}
@@ -1,44 +1,35 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.envOrThrow = exports.rebuildTypes = exports.recursiveUpdate = exports.getEnv = exports.fillTemplate = exports.deepGet = exports.toRange = exports.loopError = exports.sliObj = exports.iObj = exports.lObj = exports.objectify = exports.chunkArray = exports.type = exports.compareTwo = exports.deepTypeCompare = exports.deepMerge = exports.isObject = exports.isDuplicate = void 0;
7
- const util_1 = __importDefault(require("util"));
1
+ import util from "util";
8
2
  /**
9
3
  * Checks if `key` has been seen before.
10
4
  */
11
5
  const hash = new Map();
12
- const isDuplicate = (key) => {
6
+ export const isDuplicate = (key) => {
13
7
  if (!hash.has(key))
14
8
  hash.set(key, true);
15
9
  else
16
10
  return true;
17
11
  return false;
18
12
  };
19
- exports.isDuplicate = isDuplicate;
20
13
  /**
21
14
  * Simple object check.
22
15
  * @param item
23
16
  * @returns {boolean}
24
17
  */
25
- const isObject = (item) => item !== undefined && typeof item === "object" && !Array.isArray(item);
26
- exports.isObject = isObject;
18
+ export const isObject = (item) => item !== undefined && typeof item === "object" && !Array.isArray(item);
27
19
  /**
28
20
  * Deep merge objects into target. Without modifying target.
29
21
  * @param target
30
22
  * @param source
31
23
  */
32
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
- const deepMerge = (target, source) => {
24
+ export const deepMerge = (target, source) => {
34
25
  const output = Object.assign({}, target);
35
- if ((0, exports.isObject)(target) && (0, exports.isObject)(source)) {
26
+ if (isObject(target) && isObject(source)) {
36
27
  Object.keys(source).forEach((key) => {
37
- if ((0, exports.isObject)(source[key])) {
28
+ if (isObject(source[key])) {
38
29
  if (!(key in target))
39
30
  Object.assign(output, { [key]: source[key] });
40
31
  else
41
- output[key] = (0, exports.deepMerge)(target[key], source[key]);
32
+ output[key] = deepMerge(target[key], source[key]);
42
33
  }
43
34
  else
44
35
  Object.assign(output, { [key]: source[key] });
@@ -46,40 +37,39 @@ const deepMerge = (target, source) => {
46
37
  }
47
38
  return output;
48
39
  };
49
- exports.deepMerge = deepMerge;
50
40
  /**
51
41
  * Take in a target `object` and a `types` object with identical keys but values as array of types those keys should be.
52
- * @param {object} target Object
53
- * @param {object} types Object identical to `target` but values are types
54
- * @returns {{ location: string, expected: string, got: object }|boolean} `object` if the types dont match. `True` if they do.
42
+ * @param target Object
43
+ * @param types Object identical to `target` but values are types
44
+ * @returns `object` if the types dont match. `True` if they do.
55
45
  */
56
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
57
- const deepTypeCompare = (target, types, location = "target") => {
58
- if (!((0, exports.isObject)(target) && (0, exports.isObject)(types)))
59
- return { location, expectedType: "object", received: `${target}:${(0, exports.type)(target)}` };
46
+ export const deepTypeCompare = (target, types, location = "target") => {
47
+ if (!(isObject(target) && isObject(types)))
48
+ return { location, expectedType: "object", received: `${target}:${type(target)}` };
60
49
  for (const key in target) {
61
- if ((0, exports.isObject)(target[key])) {
50
+ const targetValue = target[key];
51
+ if (isObject(targetValue)) {
62
52
  // If target.property is a object then check its child properties
63
- const same = (0, exports.deepTypeCompare)(target[key], types[key], `${location}.${key}`);
53
+ const same = deepTypeCompare(targetValue, types[key], `${location}.${key}`);
64
54
  if (same !== true)
65
55
  return same;
66
56
  }
67
57
  else {
68
- if (Array.isArray(target[key]) && Array.isArray(types[key])) {
58
+ if (Array.isArray(targetValue) && Array.isArray(types[key])) {
69
59
  // target.property and types.property are arrays
70
60
  // Check each item in target.property against types.property[0]
71
61
  const childCheckType = types[key];
72
- for (const targetItem of target[key]) {
73
- const targetType = (0, exports.type)(targetItem);
62
+ for (const targetItem of targetValue) {
63
+ const targetType = type(targetItem);
74
64
  // If the array entry is a object then check it
75
65
  if (targetType === "object")
76
- return (0, exports.deepTypeCompare)(targetItem, childCheckType, `${location}.${key}`);
66
+ return deepTypeCompare(targetItem, childCheckType, `${location}.${key}`);
77
67
  else
78
- return (0, exports.compareTwo)(childCheckType, targetItem, `${location}.${key}`);
68
+ return compareTwo(childCheckType, targetItem, `${location}.${key}`);
79
69
  }
80
70
  }
81
71
  else {
82
- const same = (0, exports.compareTwo)(types[key], target[key], `${location}.${key}`);
72
+ const same = compareTwo(types[key], target[key], `${location}.${key}`);
83
73
  if (same !== true)
84
74
  return same;
85
75
  }
@@ -87,30 +77,28 @@ const deepTypeCompare = (target, types, location = "target") => {
87
77
  }
88
78
  return true;
89
79
  };
90
- exports.deepTypeCompare = deepTypeCompare;
91
80
  /**
92
81
  * Helper function for `deepTypeCompare` to compare a item to a type or set of types.
93
- * @param {string|Array<string>} expectedTypes Expected type/types
94
- * @param {unknown} receivedValue Object given
95
- * @param {string} location Location of `got` given
82
+ * @param expectedTypes Expected type/types
83
+ * @param receivedValue Object given
84
+ * @param location Location of `got` given
96
85
  */
97
- const compareTwo = (expectedTypes, receivedValue, location) => {
86
+ export const compareTwo = (expectedTypes, receivedValue, location) => {
98
87
  if (!Array.isArray(expectedTypes))
99
88
  expectedTypes = [expectedTypes];
100
- const gotType = (0, exports.type)(receivedValue);
89
+ const gotType = type(receivedValue);
101
90
  for (const expectedType of expectedTypes) {
102
91
  if (gotType !== expectedType)
103
92
  return { location, expectedType, received: `${receivedValue}:${gotType}` };
104
93
  }
105
94
  return true;
106
95
  };
107
- exports.compareTwo = compareTwo;
108
96
  /**
109
97
  * Returns the type of `item` respecting `Array`, `null` and `undefined` unlike typeof.
110
- * @param {unknown} item
111
- * @returns {string} Type of item
98
+ * @param item
99
+ * @returns Type of item
112
100
  */
113
- const type = (item) => {
101
+ export const type = (item) => {
114
102
  if (Array.isArray(item))
115
103
  return "array";
116
104
  if (item === null)
@@ -119,15 +107,14 @@ const type = (item) => {
119
107
  return "undefined";
120
108
  return typeof item;
121
109
  };
122
- exports.type = type;
123
110
  /**
124
111
  * Breaks `array` into smaller chunks based on `chunkSize`
125
- * @param {Array} array Array to break up.
126
- * @param {number} chunkSize Maximum size of array chunks.
112
+ * @param array Array to break up.
113
+ * @param chunkSize Maximum size of array chunks.
127
114
  *
128
- * @returns {Array<Array>} Array containing array chunks.
115
+ * @returns Array containing array chunks.
129
116
  */
130
- const chunkArray = (array, chunkSize) => {
117
+ export const chunkArray = (array, chunkSize) => {
131
118
  if (array.length < chunkSize)
132
119
  return [array];
133
120
  let i, j;
@@ -136,10 +123,9 @@ const chunkArray = (array, chunkSize) => {
136
123
  returnArray.push(array.slice(i, i + chunkSize));
137
124
  return returnArray;
138
125
  };
139
- exports.chunkArray = chunkArray;
140
126
  /**
141
127
  * stringifies and then parses a object to convert it to a JSON supported object.
142
- * @param {Object} obj Object to convert.
128
+ * @param obj Object to convert.
143
129
  * @example
144
130
  * const obj = {
145
131
  * a: 1,
@@ -149,70 +135,62 @@ exports.chunkArray = chunkArray;
149
135
  * const b = JSON.parse(JSON.stringify(obj))
150
136
  * console.log(a == b) -> true
151
137
  */
152
- const objectify = (obj) => JSON.parse(JSON.stringify(obj));
153
- exports.objectify = objectify;
138
+ export const objectify = (obj) => JSON.parse(JSON.stringify(obj));
154
139
  /**
155
140
  * Logs a inspected object to console
156
- * @param {*} obj Object to inspect
157
- * @param {boolean} options Show hidden properties of object
158
- * @param {number} options Depth to inspect object
159
- * @param {boolean} options Color resulting output
160
- * @returns {void}
141
+ * @param obj Object to inspect
142
+ * @param options.showHidden Show hidden properties of object
143
+ * @param options.depth Depth to inspect object
144
+ * @param options.color Color resulting output
161
145
  */
162
- const lObj = (obj, ...options) => console.log((0, exports.iObj)(obj, ...options));
163
- exports.lObj = lObj;
146
+ export const lObj = (obj, ...options) => console.log(iObj(obj, ...options));
164
147
  /**
165
148
  * Inspects a object
166
- * @param {*} obj Object to inspect
167
- * @param {boolean} showHidden Show hidden properties of object
168
- * @param {number} depth Depth to inspect object
169
- * @param {boolean} color Color resulting output
170
- * @returns {string}
149
+ * @param obj Object to inspect
150
+ * @param options.showHidden Show hidden properties of object
151
+ * @param options.depth Depth to inspect object
152
+ * @param options.color Color resulting output
171
153
  */
172
- const iObj = (obj, ...options) => {
154
+ export const iObj = (obj, ...options) => {
173
155
  if (options[0] === undefined || options[0] === null)
174
156
  options[0] = false;
175
157
  if (options[1] === undefined || options[1] === null)
176
158
  options[1] = 5;
177
159
  if (options[2] === undefined || options[2] === null)
178
160
  options[2] = true;
179
- return util_1.default.inspect(obj, ...options);
161
+ return util.inspect(obj, ...options);
180
162
  };
181
- exports.iObj = iObj;
182
163
  /**
183
164
  * Single line inspect object.
184
- * @param {*} obj Object to inspect
185
- * @param {boolean} showHidden Show hidden properties of object
186
- * @param {number} depth Depth to inspect object
187
- * @param {boolean} color Color resulting output
188
- * @returns {string} Inspected object in a single line, spaces aligned
165
+ * @param obj Object to inspect
166
+ * @param options.showHidden Show hidden properties of object
167
+ * @param options.depth Depth to inspect object
168
+ * @param options.color Color resulting output
189
169
  */
190
- const sliObj = (obj, ...options) => (0, exports.iObj)(obj, ...options)
170
+ export const sliObj = (obj, ...options) => iObj(obj, ...options)
191
171
  .replace(/\r?\n/g, " ")
192
172
  .replace(/ +/g, " ");
193
- exports.sliObj = sliObj;
194
173
  /**
195
174
  * Recursively runs `func` and handles errors with `errorHandler` until `func` successfully finishes.
196
175
  * @param func Function to execute
197
176
  * @param errorHandler Function to execute when a error occours
198
177
  * @returns Return value of `func` on success
199
178
  */
200
- const loopError = (func, errorHandler = (err) => new Promise((_res, r) => r(err))) => new Promise((resolve) => {
179
+ export const loopError = (func, errorHandler = (err) => new Promise((_res, r) => r(err))) => new Promise((resolve) => {
201
180
  func()
202
181
  .then(resolve)
203
182
  .catch(async (err) => {
204
- errorHandler(err).then(() => resolve((0, exports.loopError)(func, errorHandler)));
183
+ errorHandler(err).then(() => resolve(loopError(func, errorHandler)));
205
184
  });
206
185
  });
207
- exports.loopError = loopError;
208
186
  /**
209
- * @param {Array<number>} array
210
- * @returns {string} string containing ranges of numbers.
187
+ * @param array
188
+ * @returns string containing ranges of numbers.
211
189
  * @example
212
190
  * const range = toRange([1, 2, 3, 12, 6,7, 5, 27, 28, 29, 40, 41, 25, 42, 12])
213
191
  * // range = "1-3 & 5-7 & 12 & 25 & 27-29 & 40-42"
214
192
  */
215
- const toRange = (array) => {
193
+ export const toRange = (array) => {
216
194
  array = array
217
195
  .filter((a, pos) => array.indexOf(a) === pos)
218
196
  .sort((a, b) => a - b)
@@ -230,7 +208,6 @@ const toRange = (array) => {
230
208
  }
231
209
  return sum;
232
210
  };
233
- exports.toRange = toRange;
234
211
  /**
235
212
  * Returns the `property` requested from `obj`
236
213
  * @param obj
@@ -245,17 +222,16 @@ exports.toRange = toRange;
245
222
  * const wantedProperty = "a.child"
246
223
  * console.log(deepGet(object, wantedProperty)) // -> "Hello World"
247
224
  */
248
- const deepGet = (obj, property, delimiter = ".") => {
225
+ export const deepGet = (obj, property, delimiter = ".") => {
249
226
  const arr = property.split(delimiter);
250
227
  while (arr.length && (obj = obj[arr.shift()]))
251
228
  ;
252
229
  return obj;
253
230
  };
254
- exports.deepGet = deepGet;
255
231
  /**
256
232
  * Replaces values in a given `templatestring` with contentKeys from a given `contentKeys` object.
257
- * @param {object} contentKeys Object containing key value pairs of contentKeys to fill template string with
258
- * @param {string} templatestring string containing templates to fill
233
+ * @param contentKeys Object containing key value pairs of contentKeys to fill template string with
234
+ * @param templatestring string containing templates to fill
259
235
  * @example
260
236
  * const contentKeys = {
261
237
  * "title": "This is a title",
@@ -267,26 +243,22 @@ exports.deepGet = deepGet;
267
243
  *
268
244
  * fillTemplate(contentKeys, template) // => Wow! This is a title... Here is some info: This is some info!"
269
245
  */
270
- const fillTemplate = (contentKeys, templatestring, parent = "") => {
246
+ export const fillTemplate = (contentKeys, templatestring, parent = "") => {
271
247
  for (const key in contentKeys) {
272
- if ((0, exports.isObject)(contentKeys[key]))
273
- templatestring = (0, exports.fillTemplate)(contentKeys[key], templatestring, `${parent}${key}.`);
248
+ if (isObject(contentKeys[key]))
249
+ templatestring = fillTemplate(contentKeys[key], templatestring, `${parent}${key}.`);
274
250
  else
275
251
  templatestring = templatestring.replace(new RegExp(`{${parent}${key}}`, "g"), contentKeys[key]);
276
252
  }
277
253
  return templatestring;
278
254
  };
279
- exports.fillTemplate = fillTemplate;
280
255
  /**
281
256
  * Converts process.env variables into a object
282
257
  * @example process.env["some_subproperty"] = "hello"
283
258
  * returns { some: { subProperty: "hello" } }
284
259
  */
285
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
286
- const getEnv = () => {
287
- var _a;
260
+ export const getEnv = () => {
288
261
  // Define our return object env variables are applied to.
289
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
290
262
  const envObject = {};
291
263
  // Iterate over env keys
292
264
  for (const envKey in process.env) {
@@ -300,7 +272,7 @@ const getEnv = () => {
300
272
  // For every key except the last...
301
273
  for (let i = 0; i < keys.length - 1; i++) {
302
274
  // Set the key on the objRef to a empty object if its undefined.
303
- if (!(0, exports.isObject)(objRef)) {
275
+ if (!isObject(objRef)) {
304
276
  // If objRef is not a object. Use the parent object to set it to a object containing itself as _.
305
277
  if (pObjRef !== undefined)
306
278
  objRef = pObjRef[0][pObjRef[1]] = { _: objRef };
@@ -308,18 +280,17 @@ const getEnv = () => {
308
280
  }
309
281
  else {
310
282
  pObjRef = [objRef, keys[i]];
311
- objRef = objRef[_a = keys[i]] ?? (objRef[_a] = {});
283
+ objRef = (objRef[keys[i]] ??= {});
312
284
  }
313
285
  }
314
286
  // Set the last key to equal the original value
315
287
  // If objRef is not a object. Use the parent object to set it to a object containing itself as _.
316
- if (!(0, exports.isObject)(objRef) && pObjRef !== undefined)
288
+ if (!isObject(objRef) && pObjRef !== undefined)
317
289
  objRef = pObjRef[0][pObjRef[1]] = { _: objRef };
318
290
  objRef[keys[keys.length - 1]] = process.env[envKey];
319
291
  }
320
292
  return envObject;
321
293
  };
322
- exports.getEnv = getEnv;
323
294
  /**
324
295
  * Recursively update properties of a object with another.
325
296
  * @param targetObject Object to update.
@@ -327,27 +298,24 @@ exports.getEnv = getEnv;
327
298
  * @param options.setUndefined Defaults to `true` Set properties that are undefined on `targetObject`.
328
299
  * @param options.setDefined Defaults to `false`. Overwrite properties that are not undefined on `targetObject`.
329
300
  */
330
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
331
- const recursiveUpdate = (targetObject, newObject, options = { setUndefined: true, setDefined: false }) => {
332
- if (!(0, exports.isObject)(targetObject))
301
+ export const recursiveUpdate = (targetObject, newObject, options = { setUndefined: true, setDefined: false }) => {
302
+ if (!isObject(targetObject))
333
303
  throw new Error("targetObject is not an object!");
334
- if (!(0, exports.isObject)(newObject))
304
+ if (!isObject(newObject))
335
305
  throw new Error("newObject is not an object!");
336
306
  for (const key in newObject) {
337
- if ((0, exports.isObject)(targetObject[key]) && (0, exports.isObject)(newObject[key]))
338
- (0, exports.recursiveUpdate)(targetObject[key], newObject[key], options);
307
+ if (isObject(targetObject[key]) && isObject(newObject[key]))
308
+ recursiveUpdate(targetObject[key], newObject[key], options);
339
309
  else if (options.setUndefined && targetObject[key] === undefined)
340
310
  targetObject[key] = newObject[key];
341
311
  else if (options.setDefined && targetObject[key] !== undefined)
342
312
  targetObject[key] = newObject[key];
343
313
  }
344
314
  };
345
- exports.recursiveUpdate = recursiveUpdate;
346
315
  /**
347
316
  * Set the types of a given `object` based on the types of an identical `types` object. Usful in conjunction with `getEnv` to convert a object only containing strings/objects to actual types.
348
317
  */
349
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
350
- const rebuildTypes = (object, types) => {
318
+ export const rebuildTypes = (object, types) => {
351
319
  for (const key in object) {
352
320
  if (types[key] === undefined)
353
321
  continue;
@@ -356,26 +324,24 @@ const rebuildTypes = (object, types) => {
356
324
  object[key] = +object[key];
357
325
  break;
358
326
  case "string":
359
- object[key] = object[key].toString();
327
+ object[key] = String(object[key]);
360
328
  break;
361
329
  case "boolean":
362
330
  object[key] = object[key] === true || object[key] === "true";
363
331
  break;
364
332
  default:
365
- (0, exports.rebuildTypes)(object[key], types[key]);
333
+ rebuildTypes(object[key], types[key]);
366
334
  break;
367
335
  }
368
336
  }
369
337
  };
370
- exports.rebuildTypes = rebuildTypes;
371
338
  /**
372
339
  * Fetch process.env[envName] or throw if its undefined
373
340
  */
374
- const envOrThrow = (envName) => {
341
+ export const envOrThrow = (envName) => {
375
342
  const envValue = process.env[envName];
376
343
  if (envValue === undefined)
377
344
  throw new Error(`Enviroment variable "${envName}" is undefined!`);
378
345
  return envValue;
379
346
  };
380
- exports.envOrThrow = envOrThrow;
381
- //# sourceMappingURL=index.js.map
347
+ //# sourceMappingURL=object.js.map
package/object.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.js","sourceRoot":"","sources":["../src/object.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB;;GAEG;AACH,MAAM,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;AACvB,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAY,EAAW,EAAE;IACpD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,IAAI,CAAC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