1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-06-30 05:41:41 +02:00
market/src/@utils/index.ts

17 lines
433 B
TypeScript
Raw Normal View History

2020-05-07 08:03:30 +02:00
// Boolean value that will be true if we are inside a browser, false otherwise
export const isBrowser = typeof window !== 'undefined'
export function sleep(ms: number): Promise<void> {
return new Promise((resolve) => {
setTimeout(resolve, ms)
})
2020-05-13 19:34:47 +02:00
}
2021-06-09 11:45:36 +02:00
export function removeItemFromArray<T>(arr: Array<T>, value: T): Array<T> {
const index = arr.indexOf(value)
if (index > -1) {
arr.splice(index, 1)
}
return arr
}