This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const memoize = (f) => | |
function(...args) { | |
f.memoize = f.memoize || {} | |
return args in f.memoize | |
? f.memoize[args] | |
: (f.memoize[args] = f.apply(this, args)) | |
} | |
export default memoize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { clarity } from "clarity-js"; | |
import { isNil, isEmpty } from "ramda"; | |
const isNilorEmpty = val => isNil(val) || isEmpty(val); | |
/** | |
* Initializes Clarity tracking with the provided Clarity project Id, unique user identifier, and custom tags. | |
* @param {string} clarityId - The Clarity project Id. This parameter is required. | |
* @param {string} [uniqueId=""] - The unique identifier for the user. | |
* @param {Object.<string, string>} [customTags={}] - Custom tags to be set for Clarity. Each key-value pair represents a custom tag and its value. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function debounce(func, delay) { | |
let timeoutId; | |
return function () { | |
const context = this; | |
const args = arguments; | |
clearTimeout(timeoutId); | |
timeoutId = setTimeout(() => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* React cusotm hook to disable inspect | |
*/ | |
export const useDisableInspect = () => { | |
useEffect(() => { | |
const disableRightClick = (e) => { | |
e.preventDefault(); | |
}; | |
const handleKeyDown = (e) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const expiryDate = new Date(pm.environment.get('tokenExpiryDate')); | |
const currDate = new Date(Date.now()); | |
const isTokenExpired = (isNaN(expiryDate) || expiryDate) < currDate; | |
if(isTokenExpired){ | |
pm.sendRequest({ | |
url: pm.globals.get("oAuthUrl"), | |
method: 'POST', | |
header: { | |
'Authorization': pm.globals.get("basicAuth"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react'; | |
import { isEmpty, isNil } from 'ramda'; | |
/** | |
* Custom hook to handle state as an object in functional components similar to local state management in class based components. | |
** Returns a stateful value and a function to update it. | |
* @param {object} initialStateObj | |
* @returns { [{},React.Dispatch<React.SetStateAction<{}>>]} | |
*/ | |
const useStateObj = (initialStateObj = {}) => { |