Registry / data / my-easy-fp

my-easy-fp

JSON →
library0.23.0jsnpmunverified

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.

npm install my-easy-fp
INSTALL
IMPORT
SIG · MY-EASY-FP
M
my-easy-fp
datajavascriptv0.23.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

chunk
import { chunk } from 'my-easy-fp';
const { chunk } = require('my-easy-fp');
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.
isComplexEmpty
import { isComplexEmpty } from 'my-easy-fp';
import isComplexEmpty from 'my-easy-fp';
my-easy-fp exclusively uses named exports; there is no default export from the main package.
sleep
import { sleep } from 'my-easy-fp';
import * as myfp from 'my-easy-fp'; myfp.sleep();
For optimal tree-shaking and bundle size, import only the specific functions you need.

Demonstrates basic usage of `my-easy-fp` utilities for array manipulation, comprehensive empty/null/undefined checks, asynchronous delays, and random number generation.

import { chunk, sleep, isComplexEmpty, populate, getRandomRangeInt } from 'my-easy-fp'; async function main() { console.log('--- Array Utilities ---'); const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; const chunked = chunk(numbers, 3); console.log('Chunked array:', chunked); // [[1,2,3], [4,5,6], [7,8,9], [10]] const populated = populate(5); console.log('Populated array (0-based):', populated); // [0, 1, 2, 3, 4] const populatedOneBased = populate(3, true); console.log('Populated array (1-based):', populatedOneBased); // [1, 2, 3] console.log('\n--- Empty Checks ---'); console.log('Is null complex empty?', isComplexEmpty(null)); // true console.log('Is empty string complex empty?', isComplexEmpty('')); // true console.log('Is [] complex empty?', isComplexEmpty([])); // true console.log('Is {} complex empty?', isComplexEmpty({})); // true console.log('Is 0 complex empty?', isComplexEmpty(0)); // true (due to isNaN check) console.log('Is "hello" complex empty?', isComplexEmpty('hello')); // false console.log('\n--- Async Utility ---'); console.log('Starting sleep for 1 second...'); await sleep(1000); console.log('...Finished sleeping.'); console.log('\n--- Misc Utility ---'); const randomNumber = getRandomRangeInt(1, 100); console.log('Random integer between 1 and 100:', randomNumber); } main().catch(console.error);
Debug
Known issues
breakingAs 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.
fix
Pin to exact versions in `package.json` or carefully review changelogs before updating `my-easy-fp`.
affects: >=0.1.0
gotchaThe 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.
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.
affects: >=0.1.0
gotchaThe 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.
fix
Only use named imports for specific functions: `import { functionName } from 'my-easy-fp';`
affects: >=0.1.0
gotcha`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.
fix
Ensure your Node.js environment is at version 20 or greater. Update Node.js if necessary using `nvm` or your preferred package manager.
affects: <0.23.0
Errors
Common errors & fixes
TypeError: (0, _my_easy_fp__WEBPACK_IMPORTED_MODULE_0__.someFunction) is not a function
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.
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.
ReferenceError: chunk is not defined
The `chunk` function (or any other function) was used without being imported first.
fix
Add `import { chunk } from 'my-easy-fp';` (or the respective function) at the top of your file where it's being used.
TS2305: Module '"my-easy-fp"' has no exported member 'default'.
You attempted to import `my-easy-fp` using a default import syntax, but the library only provides named exports.
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.
Upgrade
Version history
0.23.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
my-easy-fp — npm install my-easy-fp · libregistry