{"id":11375,"library":"my-easy-fp","title":"my-easy-fp Utility Functions","description":"my-easy-fp is a JavaScript and TypeScript utility library providing a collection of focused, single-purpose functions for common programming tasks. It covers categories such as boolean logic, array manipulation (e.g., `chunk`, `populate`, `last`), comprehensive empty/null/undefined checks, miscellaneous helpers like `getRandomRange`, and an asynchronous `sleep` function. The library also ships with several custom TypeScript utility types to enhance type safety. Currently at version `0.23.0`, `my-easy-fp` is actively developed under a `0.x` versioning scheme, indicating that its API is subject to change as it approaches a stable 1.0 release. It is designed to be compatible with both browser and Node.js environments (requiring Node.js >=20), offering a lightweight alternative to larger utility frameworks. Its key differentiators include built-in TypeScript support and a modular design, making it suitable for projects needing specific utilities without extensive bundle size.","status":"active","version":"0.23.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/imjuni/my-easy-fp","tags":["javascript","typescript"],"install":[{"cmd":"npm install my-easy-fp","lang":"bash","label":"npm"},{"cmd":"yarn add my-easy-fp","lang":"bash","label":"yarn"},{"cmd":"pnpm add my-easy-fp","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The library is primarily designed for ESM usage. While CJS might work in some bundler setups, direct CommonJS require is not officially supported and may lead to issues.","wrong":"const { chunk } = require('my-easy-fp');","symbol":"chunk","correct":"import { chunk } from 'my-easy-fp';"},{"note":"my-easy-fp exclusively uses named exports; there is no default export from the main package.","wrong":"import isComplexEmpty from 'my-easy-fp';","symbol":"isComplexEmpty","correct":"import { isComplexEmpty } from 'my-easy-fp';"},{"note":"For optimal tree-shaking and bundle size, import only the specific functions you need.","wrong":"import * as myfp from 'my-easy-fp'; myfp.sleep();","symbol":"sleep","correct":"import { sleep } from 'my-easy-fp';"}],"quickstart":{"code":"import { chunk, sleep, isComplexEmpty, populate, getRandomRangeInt } from 'my-easy-fp';\n\nasync function main() {\n  console.log('--- Array Utilities ---');\n  const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];\n  const chunked = chunk(numbers, 3);\n  console.log('Chunked array:', chunked); // [[1,2,3], [4,5,6], [7,8,9], [10]]\n\n  const populated = populate(5);\n  console.log('Populated array (0-based):', populated); // [0, 1, 2, 3, 4]\n  const populatedOneBased = populate(3, true);\n  console.log('Populated array (1-based):', populatedOneBased); // [1, 2, 3]\n\n  console.log('\\n--- Empty Checks ---');\n  console.log('Is null complex empty?', isComplexEmpty(null)); // true\n  console.log('Is empty string complex empty?', isComplexEmpty('')); // true\n  console.log('Is [] complex empty?', isComplexEmpty([])); // true\n  console.log('Is {} complex empty?', isComplexEmpty({})); // true\n  console.log('Is 0 complex empty?', isComplexEmpty(0)); // true (due to isNaN check)\n  console.log('Is \"hello\" complex empty?', isComplexEmpty('hello')); // false\n\n  console.log('\\n--- Async Utility ---');\n  console.log('Starting sleep for 1 second...');\n  await sleep(1000);\n  console.log('...Finished sleeping.');\n\n  console.log('\\n--- Misc Utility ---');\n  const randomNumber = getRandomRangeInt(1, 100);\n  console.log('Random integer between 1 and 100:', randomNumber);\n}\n\nmain().catch(console.error);","lang":"typescript","description":"Demonstrates basic usage of `my-easy-fp` utilities for array manipulation, comprehensive empty/null/undefined checks, asynchronous delays, and random number generation."},"warnings":[{"fix":"Pin to exact versions in `package.json` or carefully review changelogs before updating `my-easy-fp`.","message":"As a `0.x.y` version package, `my-easy-fp`'s API is considered unstable and subject to breaking changes without adhering to semantic versioning until a 1.0 release. Always review changelogs when upgrading.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Always use `import { ... } from 'my-easy-fp';` syntax. Ensure your project is configured for ESM, potentially by setting `\"type\": \"module\"` in `package.json` or using a bundler like Webpack/Rollup that handles ESM compilation.","message":"The package targets modern Node.js environments and assumes ESM for module imports. Direct `require()` statements for CommonJS might not work as expected or could lead to compatibility issues in certain build setups.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Only use named imports for specific functions: `import { functionName } from 'my-easy-fp';`","message":"The library strictly uses named exports. Attempting to import a default export (e.g., `import MyEasyFp from 'my-easy-fp'`) will result in an error, as no default export is provided.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Ensure your Node.js environment is at version 20 or greater. Update Node.js if necessary using `nvm` or your preferred package manager.","message":"`my-easy-fp` explicitly requires Node.js version `20` or higher. Running the package on older Node.js versions may lead to runtime errors or unexpected behavior due to reliance on newer language features or APIs.","severity":"gotcha","affected_versions":"<0.23.0"}],"env_vars":null,"search_vec":"'0':83 '0.23.0':73 '1.0':100 '20':116 'activ':79 'also':58 'altern':120 'api':90 'approach':97 'array':38 'asynchron':53 'boolean':36 'browser':110 'built':130 'built-in':129 'bundl':148 'categori':33 'chang':94 'check':46 'chunk':41 'collect':20 'common':28 'compat':107 'comprehens':44 'cover':32 'current':70 'custom':62 'design':104,137 'develop':80 'differenti':127 'e.g':40 'easi':3,9,76 'empty/null/undefined':45 'enhanc':67 'environ':113 'extens':147 'focus':22 'fp':4,10,77 'framework':124 'function':6,26,55 'getrandomrang':50 'helper':48 'includ':128 'indic':87 'javascript':13,150 'key':126 'larger':122 'last':43 'librari':17,57 'lightweight':119 'like':49 'logic':37 'make':138 'manipul':39 'miscellan':47 'modular':136 'my-easy-fp':1,7,74 'need':143 'node.js':112,115 'offer':117 'popul':42 'program':29 'project':142 'provid':18 'purpos':25 'releas':101 'requir':114 'safeti':69 'scheme':86 'sever':61 'ship':59 'singl':24 'single-purpos':23 'size':149 'sleep':54 'specif':144 'stabl':99 'subject':92 'suitabl':140 'support':133 'task':30 'type':65,68 'typescript':15,63,132,151 'util':5,16,64,123,145 'version':72,85 'without':146 'x':84","created_at":"2026-04-19T13:37:39.696182+00:00","updated_at":"2026-04-19T13:37:39.696182+00:00","problems":[{"fix":"Ensure you are using named imports `import { someFunction } from 'my-easy-fp';` and that your bundler/project configuration correctly handles ESM. Verify the function `someFunction` is indeed exported by `my-easy-fp` and is spelled correctly.","cause":"This error often occurs in bundled environments (like Webpack or Vite) when there's a mismatch in how modules are imported or when a CommonJS `require()` is used in an ESM context.","error":"TypeError: (0, _my_easy_fp__WEBPACK_IMPORTED_MODULE_0__.someFunction) is not a function"},{"fix":"Add `import { chunk } from 'my-easy-fp';` (or the respective function) at the top of your file where it's being used.","cause":"The `chunk` function (or any other function) was used without being imported first.","error":"ReferenceError: chunk is not defined"},{"fix":"Change your import statement from `import MyEasyFp from 'my-easy-fp';` to `import { functionName } from 'my-easy-fp';` for the specific functions you intend to use.","cause":"You attempted to import `my-easy-fp` using a default import syntax, but the library only provides named exports.","error":"TS2305: Module '\"my-easy-fp\"' has no exported member 'default'."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/imjuni/my-easy-fp","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/my-easy-fp","openapi_spec":null,"status_page":null,"smithery":null,"categories":["data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-18","install_tag":null}}