@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 • 907 B
Source Map (JSON)
{"version":3,"file":"index.mjs","sources":[""],"sourcesContent":["export type TIsIterableArgs = Parameters<typeof isIterable>;\r\n\r\nexport type TIsIterableReturn = ReturnType<typeof isIterable>;\r\n\r\n/**\r\n * Check if an object is iterable\r\n * @param obj{any}\r\n * @returns {boolean}\r\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols\r\n * @example\r\n * // How to check for iterability?\r\n * const myDivs = document.querySelectAll(\"div\");\r\n * const isCanBeIterated = isIterable(myDivs);\r\n * console.log(isCanBeIterated); // => true\r\n */\r\nexport const isIterable = (obj: any): boolean => {\r\n return obj !== null && typeof (obj as { [Symbol.iterator]?: unknown; })[Symbol.iterator] === \"function\";\r\n};\r\n"],"names":["isIterable","obj","Symbol","iterator"],"mappings":";;;;;;;;;;;AAeO,MAAMA,WAAcC,KAClBA,MAAQ,aAAgBA,IAAyCC,OAAOC,YAAc"}