@bigbinary/neeto-commons-frontend 2.1.33 → 2.1.35

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/utils.d.ts CHANGED
@@ -290,6 +290,18 @@ export function getQueryParams(options?: qsOptionsType): QueryParamsType;
290
290
  * @endexample
291
291
  */
292
292
  export function joinHyphenCase(...args: string[]): string;
293
+ /**
294
+ *
295
+ * The hyphenize function converts strings that contain underscores, spaces, and
296
+ *
297
+ * camelCase strings into hyphenized strings
298
+ *
299
+ * @example
300
+ *
301
+ * hyphenize("hello_world", ""); // output: "hello-world"
302
+ * @endexample
303
+ */
304
+ export function hyphenize(value: string, fallbackString?: string): string;
293
305
  /**
294
306
  *
295
307
  * The debounce function is used to create a debounced function that delays the
@@ -422,6 +434,18 @@ export function getFromLocalStorage<T extends object>(key: string): T | null;
422
434
  * @endexample
423
435
  */
424
436
  export function setToLocalStorage(key: string, value: any): void;
437
+ /**
438
+ *
439
+ * The removeFromLocalStorage function takes a key as its parameter, and will
440
+ *
441
+ * remove that key from the given Storage object if it exists.
442
+ *
443
+ * @example
444
+ *
445
+ * removeFromLocalStorage("token");
446
+ * @endexample
447
+ */
448
+ export function removeFromLocalStorage(key: string): void;
425
449
  type CurrencyFormatterFunction = (amount: number | string, currency: string, options?: Intl.NumberFormatOptions) => string;
426
450
  /**
427
451
  *
package/utils.js CHANGED
@@ -2625,6 +2625,14 @@ var joinHyphenCase = function joinHyphenCase() {
2625
2625
  }
2626
2626
  return args.join(" ").replace(/\s+/g, "-").toLowerCase();
2627
2627
  };
2628
+ var hyphenize = function hyphenize(value) {
2629
+ var fallbackString = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
2630
+ if (typeof value === "number") return String(value);
2631
+ if (value && typeof value === "string" && value.replace) {
2632
+ return value.replace(/[\s_]/g, "-").replace(/([a-z])([A-Z])/g, "$1-$2").replace(/-+/g, "-").toLowerCase();
2633
+ }
2634
+ return fallbackString;
2635
+ };
2628
2636
  var debounce = function debounce(func) {
2629
2637
  var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 350;
2630
2638
  var timer;
@@ -2648,6 +2656,9 @@ var getFromLocalStorage = function getFromLocalStorage(key) {
2648
2656
  var setToLocalStorage = function setToLocalStorage(key, value) {
2649
2657
  if (isNotNil(value)) localStorage.setItem(key, JSON.stringify(value));else localStorage.removeItem(key);
2650
2658
  };
2659
+ var removeFromLocalStorage = function removeFromLocalStorage(key) {
2660
+ localStorage.removeItem(key);
2661
+ };
2651
2662
 
2652
2663
  dayjs.extend(relativeTime);
2653
2664
  dayjs.extend(updateLocale);
@@ -3265,5 +3276,5 @@ var currencyFormat = {
3265
3276
  } // 1000, "INR", { maximumFractionDigits: 0 } => ₹1,000 INR
3266
3277
  };
3267
3278
 
3268
- export { buildUrl, copyToClipboard, createSubscription, currencyFormat, dateFormat, debounce, getFromLocalStorage, getQueryParams, getSubdomain, hasAllPermissions, hasAnyPermission, hasPermission, joinHyphenCase, resetAuthTokens, setToLocalStorage, simulateApiCall, timeFormat, toLocale, withEventTargetValue };
3279
+ export { buildUrl, copyToClipboard, createSubscription, currencyFormat, dateFormat, debounce, getFromLocalStorage, getQueryParams, getSubdomain, hasAllPermissions, hasAnyPermission, hasPermission, hyphenize, joinHyphenCase, removeFromLocalStorage, resetAuthTokens, setToLocalStorage, simulateApiCall, timeFormat, toLocale, withEventTargetValue };
3269
3280
  //# sourceMappingURL=utils.js.map