{"id":15492123,"url":"https://github.com/imjuni/my-easy-fp","last_synced_at":"2026-01-08T13:38:45.903Z","repository":{"id":45471749,"uuid":"253149785","full_name":"imjuni/my-easy-fp","owner":"imjuni","description":null,"archived":false,"fork":false,"pushed_at":"2024-01-07T05:31:02.000Z","size":1083,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-19T10:27:02.462Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imjuni.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-05T03:43:51.000Z","updated_at":"2023-03-17T12:23:59.000Z","dependencies_parsed_at":"2024-06-19T00:26:55.897Z","dependency_job_id":"a4a140be-8813-492a-b249-9a79268b73bd","html_url":"https://github.com/imjuni/my-easy-fp","commit_stats":{"total_commits":29,"total_committers":1,"mean_commits":29.0,"dds":0.0,"last_synced_commit":"c9fa85dda6f515ef3b5b2aaeb76982944146a3b8"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imjuni%2Fmy-easy-fp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imjuni%2Fmy-easy-fp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imjuni%2Fmy-easy-fp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imjuni%2Fmy-easy-fp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imjuni","download_url":"https://codeload.github.com/imjuni/my-easy-fp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246386656,"owners_count":20768860,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T07:58:55.071Z","updated_at":"2026-01-08T13:38:45.863Z","avatar_url":"https://github.com/imjuni.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple functional programming utility \u0026 programming helper tools\n\n[![Download Status](https://img.shields.io/npm/dw/my-easy-fp.svg)](https://npmcharts.com/compare/my-easy-fp?minimal=true) [![Github Star](https://img.shields.io/github/stars/imjuni/my-easy-fp.svg?style=popout)](https://github.com/imjuni/my-easy-fp) [![Github Issues](https://img.shields.io/github/issues-raw/imjuni/my-easy-fp.svg)](https://github.com/imjuni/my-easy-fp/issues) [![NPM version](https://img.shields.io/npm/v/my-easy-fp.svg)](https://www.npmjs.com/package/my-easy-fp) [![License](https://img.shields.io/npm/l/my-easy-fp.svg)](https://github.com/imjuni/my-easy-fp/blob/master/LICENSE)\n\nSimple utility functions that can use browser, node.\n\n## Function list\n\n### boolean\n\n| name    | description                    |\n| ------- | ------------------------------ |\n| isFalse | If argument false, return true |\n| isTrue  | If argument true, return true  |\n| invert  | return inverted boolean value  |\n\n### array\n\n| name     | description                                                                       |\n| -------- | --------------------------------------------------------------------------------- |\n| populate | populate array zero base, if you pass second argument true that populate one base |\n| chunk    | array split given size                                                            |\n| last     | pick last element from array                                                      |\n| first    | pick first element from array                                                     |\n| toArray  | make array given argument                                                         |\n| settify  | make it set and convert it back to array                                          |\n\n### empty\n\n| name              | description                                                                                           |\n| ----------------- | ----------------------------------------------------------------------------------------------------- |\n| isUndefined       | if argument undefiend, return true                                                                    |\n| isNotUndefined    | if argument not undefined, return true                                                                |\n| isNull            | if argument null, return true                                                                         |\n| isNotNull         | if argument not null, return true                                                                     |\n| isNotEmpty        | if argument not null and undefined, return true                                                       |\n| isEmpty           | if argument null or undefined, return true                                                            |\n| isComplexEmpty    | if argument not undefined and null, do additional test isNaN, empty string, empty array, empty object |\n| isNotComplexEmpty | return inverted value isComplexEmpty                                                                  |\n\n### misc\n\n| name              | description                                           |\n| ----------------- | ----------------------------------------------------- |\n| typedkey          | same work Object.keys, but typed key in Recoed        |\n| getRandomRange    | return random value in min and max                    |\n| getRandomRangeInt | return random integer value in min and max            |\n| isError           | if argument is Error return Error or return undefined |\n\n### sleep\n\n| name  | description             |\n| ----- | ----------------------- |\n| sleep | sleep given millisecond |\n\n### Custom Utility Types\n\n| name               | description                            |\n| ------------------ | -------------------------------------- |\n| TResolvePromise    | get type resolved promise              |\n| TResolveArray      | get type resolve array                 |\n| TNullablePick      | convert specific field to nullable     |\n| TNonNullableObject | object type each field to non nullable |\n| TNonNullablePick   | convert specific field to non nullable |\n\n## False \u0026 True checker\n\nWhy need this utility?\n\n```ts\nimport { isFalse } from 'my-easy-fp';\n\nconst iamboolean = false;\n\n// this line easily miss in refactoring or changing\nif (!iamboolean) {\n  console.log('I am execute false-case');\n}\n\n// more than better!\nif (isFalse(iamboolean)) {\n  console.log('I am execute false-case');\n}\n```\n\n## Empty checker\n\nWhy need this utility?\n\n```ts\nconst iamempty?: string | null = undefined;\n\n// this line some boring task\nif (iamempty === undefined || iamempty === null || iamempty !== '') {\n  console.log('i am empty');\n}\n\n// more than better!\nif (isComplexEmpty(iamempty)) {\n  console.log('i am empty');\n}\n```\n\nYou need only `undefined` and `null` check, use double equal operator.\n\n```ts\nconst iamempty?: string | null = undefined;\n\n// Recently ESLint allow double equal for null check\n// see https://eslint.org/docs/latest/rules/eqeqeq#allow-null\nif (iamempty == null) {\n  console.log('i am empty');\n}\n```\n\n## Sleep\n\nWhy need this utility?\n\n```ts\nconst ms = 1000;\n\n// this line some boring task\nawait new Promise((resolve) =\u003e setTimeout(() =\u003e resolve(), ms));\n\n// more than better!\nawait sleep(ms);\n```\n\n## Array\n\npopulate, chunk utility here.\n\n```ts\n// seq is [0,1,2,3,4,5,6,7,8,9]\nconst seq = populate(10);\n\n// seq is [1,2,3,4,5,6,7,8,9,10]\nconst seq = populate(10, true);\n\n// chunked is [[1,2],[3,4],[5,6],[7]]\nconst chunked = chunk([1, 2, 3, 4, 5, 6, 7], 2);\n\n// settify is [ 1, 2, 3, 4 ]\nconst settified = settify([1, 1, 2, 3, 2, 3, 4]);\n\n// zeroIndex is 1\nconst zeroIndex = atOrThrow([1, 2, 3], 0);\n```\n\n## Type Helper\n\nresolve promise, array. But you can use [type-fest](https://github.com/sindresorhus/type-fest) or [ts-essentials](https://github.com/ts-essentials/ts-essentials). Recommand use type-fest and tsessentials.\n\n```ts\n// you can get string | Buffer type\ntype TResolvedPromiseType = TResolvePromise\u003cReturnType\u003ctypeof fs.promises.readFile\u003e\u003e;\n\n// you can get number type\ntype TResolvedArrayType = TResolveArray\u003cnumber[]\u003e;\n\ninterface IStudent {\n  name: string;\n  major: string;\n  grade: number;\n}\n\n// you can get { name?: string; major?: string; grade: number; }\n// converted Omit\u003cIStudent, 'name' | 'major'\u003e \u0026 Pick\u003cPartial\u003cIStudent\u003e, 'name' | 'major'\u003e\ntype TCliArgumentStudent = TNullablePick\u003cIStudent, 'name' | 'major'\u003e;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimjuni%2Fmy-easy-fp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimjuni%2Fmy-easy-fp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimjuni%2Fmy-easy-fp/lists"}