UNPKG

@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 858 B
{"version":3,"file":"index.cjs","sources":[""],"sourcesContent":["export type TIsNonEmptyArrArgs = Parameters<typeof isNonEmptyArr>;\r\n\r\nexport type TIsNonEmptyArrReturn = ReturnType<typeof isNonEmptyArr>;\r\n\r\n/**\r\n * Check if an object is non-empty array\r\n * @template T\r\n * @param {unknown} arr\r\n * @returns {arr is Array<T>}\r\n * @example\r\n * // How to check if an array is valid (non-empty)?\r\n * const myArr = [ 1, 2, 3 ];\r\n * console.log(isNonEmptyArr(myArr)); // => true\r\n * const myObj = \"string\";\r\n * console.log(isNonEmptyArr(myObj)); // => false\r\n */\r\nexport const isNonEmptyArr = <T>(arr: unknown): arr is T[] => {\r\n return Array.isArray(arr) && arr.length > 0;\r\n};\r\n"],"names":["isNonEmptyArr","arr","Array","isArray","length"],"mappings":";;;;;;;;;;;;GAgBO,MAAMA,cAAoBC,KACxBC,MAAMC,QAAQF,MAAQA,IAAIG,OAAS"}