@web3r/flowerkit
Version:
Tree-shakable JavaScript and TypeScript utility library for frontend/browser apps: DOM, events, arrays, objects, strings, date, JSON, and network helpers (ESM/CJS, SSR-friendly).
1 lines • 803 B
Source Map (JSON)
{"version":3,"file":"index.mjs","sources":[""],"sourcesContent":["export type TIsObjPromiseArgs = Parameters<typeof isObjPromise>;\r\n\r\nexport type TIsObjPromiseReturn = ReturnType<typeof isObjPromise>;\r\n\r\n/**\r\n * Checks if an object is promise\r\n * @param obj{*} source object\r\n * @returns {boolean}\r\n * @example\r\n * // How to check if an object is promise?\r\n * const obj = new Promise(() => {});\r\n * const isPromise = isObjPromise(obj);\r\n * console.log(isPromise); // => true\r\n */\r\nexport const isObjPromise = (obj: unknown): obj is Promise<unknown> => {\r\n return !!obj && typeof obj === \"object\" && typeof (obj as any).then === \"function\";\r\n};\r\n"],"names":["isObjPromise","obj","then"],"mappings":";;;;;;;;;;AAcO,MAAMA,aAAgBC,OAClBA,YAAcA,MAAQ,iBAAoBA,IAAYC,OAAS"}