@cripty2001/utils 0.0.243 → 0.0.244

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/index.d.ts CHANGED
@@ -44,7 +44,7 @@ export declare function getRandomOtp(length?: number, char?: boolean): string;
44
44
  * @param ms The number of milliseconds to sleep
45
45
  */
46
46
  export declare function sleep(ms: number): Promise<void>;
47
- export declare function parseHash(fields: string[]): URLSearchParams;
47
+ export declare function parseHash(fields: string[], deleteFields?: boolean): URLSearchParams;
48
48
  /**
49
49
  * Start an infinite loop executing an async callback spaced by at least the given interval.
50
50
  * The loop ignores errors (the next execution is not affected), but an optional error callback can be provided to handle them.
package/dist/index.js CHANGED
@@ -96,7 +96,7 @@ function getRandomOtp(length = 6, char = false) {
96
96
  function sleep(ms) {
97
97
  return new Promise((resolve) => setTimeout(resolve, ms));
98
98
  }
99
- function parseHash(fields) {
99
+ function parseHash(fields, deleteFields = false) {
100
100
  // Checking empty hash
101
101
  if (window.location.hash === "")
102
102
  return new URLSearchParams();
@@ -107,7 +107,9 @@ function parseHash(fields) {
107
107
  for (const field of fields) {
108
108
  if (data.has(field)) {
109
109
  toReturn.set(field, data.get(field));
110
- data.delete(field);
110
+ if (deleteFields) {
111
+ data.delete(field);
112
+ }
111
113
  }
112
114
  }
113
115
  // Reencoding hash without extracted fields
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cripty2001/utils",
3
- "version": "0.0.243",
3
+ "version": "0.0.244",
4
4
  "description": "Internal Set of utils. If you need them use them, otherwise go to the next package ;)",
5
5
  "homepage": "https://github.com/cripty2001/utils#readme",
6
6
  "bugs": {