@ztimson/utils 0.21.6 → 0.22.1

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/string.d.ts CHANGED
@@ -26,6 +26,7 @@ export declare function formatPhoneNumber(number: string): string;
26
26
  * @param {string} str - Value that will be injected to parent
27
27
  * @param {number} index - Position to inject string at
28
28
  * @returns {string} - New string
29
+ * @deprecated use `strSplice()`
29
30
  */
30
31
  export declare function insertAt(target: string, str: string, index: number): String;
31
32
  /**
@@ -83,6 +84,16 @@ export declare function randomString(length: number, pool?: string): string;
83
84
  * @return {string} generated string
84
85
  */
85
86
  export declare function randomStringBuilder(length: number, letters?: boolean, numbers?: boolean, symbols?: boolean): string;
87
+ /**
88
+ * Splice a string together (Similar to Array.splice)
89
+ *
90
+ * @param {string} str String that will be modified
91
+ * @param {number} start Start index of splice
92
+ * @param {number} deleteCount Number of characters to remove in splice
93
+ * @param {string} insert Insert new string into splice
94
+ * @return {string} Returned spliced string
95
+ */
96
+ export declare function strSplice(str: string, start: number, deleteCount: number, insert?: string): string;
86
97
  /**
87
98
  * Find all substrings that match a given pattern.
88
99
  *
@@ -111,6 +122,7 @@ export type ParsedUrl = {
111
122
  *
112
123
  * @param {string} url URL string that will be parsed
113
124
  * @returns {RegExpExecArray} Parts of URL
125
+ * @deprecated Use built-in URL object: `new URL('...')`;
114
126
  */
115
127
  export declare function parseUrl(url: string): ParsedUrl;
116
128
  /**
package/dist/time.d.ts CHANGED
@@ -6,12 +6,13 @@
6
6
  */
7
7
  export declare function adjustedInterval(cb: Function, ms: number): () => void;
8
8
  /**
9
- * Return date formated highest to lowest: YYYY-MM-DD H:mm AM
9
+ * Format date
10
10
  *
11
11
  * @param {Date | number | string} date Date or timestamp to convert to string
12
+ * @param {string} format How date string will be formatted, default: `YYYY-MM-DD H:mm A`
12
13
  * @return {string} Formated date
13
14
  */
14
- export declare function formatDate(date: Date | number | string): string;
15
+ export declare function formatDate(date: Date | number | string, format?: string): string;
15
16
  /**
16
17
  * Use in conjunction with `await` to pause an async script
17
18
  *
package/dist/types.d.ts CHANGED
@@ -15,4 +15,4 @@
15
15
  *
16
16
  * @return {Array<keyof T>} Available keys
17
17
  */
18
- export declare function tyoeKeys<T extends object>(): Array<keyof T>;
18
+ export declare function typeKeys<T extends object>(): Array<keyof T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ztimson/utils",
3
- "version": "0.21.6",
3
+ "version": "0.22.1",
4
4
  "description": "Utility library",
5
5
  "author": "Zak Timson",
6
6
  "license": "MIT",