UNPKG

@techmely/utils

Version:

Collection of helpful JavaScript / TypeScript utils

28 lines (22 loc) 482 B
'use strict'; /*! * @techmely/utils * Copyright(c) 2021-2024 Techmely <techmely.creation@gmail.com> * MIT Licensed */ // src/isServer.ts function isServer() { return typeof window === "undefined"; } // src/isSlowConnection.ts function isSlowConnection() { if (isServer()) { return; } const cn = navigator.connection; if (cn && (cn.saveData || /2g/.test(cn.effectiveType))) { return true; } return false; } exports.isSlowConnection = isSlowConnection;