@ztimson/utils 0.25.17 → 0.25.19

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/misc.d.ts CHANGED
@@ -1,4 +1,11 @@
1
1
  import { PathEvent } from './path-events.ts';
2
+ /**
3
+ * Escape any regex special characters to avoid misinterpretation during search
4
+ *
5
+ * @param {string} value String which should be escaped
6
+ * @return {string} New escaped sequence
7
+ */
8
+ export declare function escapeRegex(value: string): string;
2
9
  /**
3
10
  * Run a stringified function with arguments asynchronously
4
11
  * @param {object} args Map of key/value arguments
@@ -16,12 +23,11 @@ export declare function fn<T>(args: object, fn: string, async?: boolean): T;
16
23
  */
17
24
  export declare function gravatar(email: string, def?: string): string;
18
25
  /**
19
- * Escape any regex special characters to avoid misinterpretation during search
20
- *
21
- * @param {string} value String which should be escaped
22
- * @return {string} New escaped sequence
26
+ * Convert IPv6 to v4 because who uses that, NAT4Life
27
+ * @param {string} ip IPv6 address, e.g. 2001:0db8:85a3:0000:0000:8a2e:0370:7334
28
+ * @returns {string | null} IPv4 address, e.g. 172.16.58.3
23
29
  */
24
- export declare function escapeRegex(value: string): string;
30
+ export declare function ipV6ToV4(ip: string): string | null;
25
31
  /**
26
32
  * Represents a function that listens for events and handles them accordingly.
27
33
  *
@@ -123,6 +123,32 @@ export declare class PathEvent {
123
123
  * @return {string} String representation of Event
124
124
  */
125
125
  static toString(path: string | string[], methods: Method | Method[]): string;
126
+ /**
127
+ * Squash 2 sets of paths & return true if any overlap is found
128
+ *
129
+ * @param has Target must have at least one of these path
130
+ * @return {boolean} Whether there is any overlap
131
+ */
132
+ has(...has: (string | PathEvent)[]): boolean;
133
+ /**
134
+ * Squash 2 sets of paths & return true if the target has all paths
135
+ *
136
+ * @param has Target must have all these paths
137
+ * @return {boolean} Whether there is any overlap
138
+ */
139
+ hasAll(...has: (string | PathEvent)[]): boolean;
140
+ /**
141
+ * Same as `has` but raises an error if there is no overlap
142
+ *
143
+ * @param has Target must have at least one of these path
144
+ */
145
+ hasFatal(...has: (string | PathEvent)[]): void;
146
+ /**
147
+ * Same as `hasAll` but raises an error if the target is missing any paths
148
+ *
149
+ * @param has Target must have all these paths
150
+ */
151
+ hasAllFatal(...has: (string | PathEvent)[]): void;
126
152
  /**
127
153
  * Filter a set of paths based on this event
128
154
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ztimson/utils",
3
- "version": "0.25.17",
3
+ "version": "0.25.19",
4
4
  "description": "Utility library",
5
5
  "author": "Zak Timson",
6
6
  "license": "MIT",