{"id":19050489,"url":"https://github.com/blakek/curry","last_synced_at":"2025-10-16T12:32:59.810Z","repository":{"id":38253093,"uuid":"269191911","full_name":"blakek/curry","owner":"blakek","description":"🍛 Simple curry functions","archived":false,"fork":false,"pushed_at":"2023-01-06T07:50:00.000Z","size":1708,"stargazers_count":2,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-18T09:34:20.580Z","etag":null,"topics":["curry","currying","functional","functional-programming","javascript","typescript","utility"],"latest_commit_sha":null,"homepage":"","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/blakek.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}},"created_at":"2020-06-03T20:50:35.000Z","updated_at":"2021-10-21T12:28:53.000Z","dependencies_parsed_at":"2023-02-05T16:01:34.011Z","dependency_job_id":null,"html_url":"https://github.com/blakek/curry","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blakek%2Fcurry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blakek%2Fcurry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blakek%2Fcurry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blakek%2Fcurry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blakek","download_url":"https://codeload.github.com/blakek/curry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250541863,"owners_count":21447593,"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":["curry","currying","functional","functional-programming","javascript","typescript","utility"],"created_at":"2024-11-08T23:15:06.487Z","updated_at":"2025-10-16T12:32:59.757Z","avatar_url":"https://github.com/blakek.png","language":"TypeScript","readme":"# curry\n\n\u003e 🍛 Simple curry functions\n\nA simple helper to wrap a function and gradually accept (i.e. partially apply)\narguments.\n\nThis package is technically a helper partial application, but `curry` is much\neasier to remember and a nicer package function name than `partiallyApply`.\n\n## Install\n\nUsing [Yarn]:\n\n```bash\n$ yarn add @blakek/curry\n```\n\n…or using [npm]:\n\n```bash\n$ npm i --save @blakek/curry\n```\n\n## Usage\n\n```js\nimport { curry, curryRight } from '@blakek/curry';\n\n// Simple curry usage\nconst multiply = (a, b) =\u003e a * b;\nconst timesTwo = curry(multiply)(2);\ntimesTwo(5); //» 10\n\n// Specify number of arguments\nconst sum = (...args) =\u003e args.reduce((a, b) =\u003e a + b, 0);\nconst topFiveTotal = curry(sum, 5);\ntopFiveTotal(1, 5, 6)(6)(7); //» 25\n\n// Reverse arguments\nconst prop = (object, key) =\u003e object[key];\nconst getName = curryRight(prop)('name');\ngetName({ name: 'John Smith', age: 42 }); //» 'John Smith'\n```\n\n### TypeScript\n\nThe types of many functions are inferred. However, some functions, such as\nvariadic functions, need an explicit type:\n\n```ts\nconst add = (...args: number[]) =\u003e args.reduce((a, b) =\u003e a + b, 0);\n\nconst addFourItems = curry(add, 4) as VariadicCurry\u003c\n  // argument types\n  [number, number, number, number],\n  // return type\n  number\n\u003e;\n\n// Includes helpers for functions accepting \u003c=5 args\nconst addTwo = curry(add, 2) as Curry2\u003cnumber, number, number\u003e;\n```\n\n## API\n\n### `curry`\n\n```ts\ncurry(fn: Function, arity?: number): any;\n```\n\nReturns functions that take in the arguments of a function until all have been\nprovided.\n\n### `curryRight`\n\n```ts\ncurryRight(fn: Function, arity?: number): any;\n```\n\nSame as `curry`, but reverses all arguments once the limit has been provided.\nProvided for the common use-case of needing to supply context-specific arguments\nbefore providing the first arguments.\n\nFor example:\n\n```js\nimport { curryRight } from '@blakek/curry';\n\nconst users = [\n  { username: 'blakek' },\n  { username: 'gsandf' },\n  { username: 'google' }\n];\n\nconst prop = (object, key) =\u003e object[key];\nconst getUsername = curryRight(prop)('username');\nusers.map(getUsername); //» [ 'blakek', 'gsandf', 'google' ]\n```\n\n## Contributing\n\n[Node.js] and [Yarn] are required to work with this project.\n\nTo install all dependencies, run:\n\n```bash\nyarn\n```\n\n### Useful Commands\n\n|                     |                                                 |\n| ------------------- | ----------------------------------------------- |\n| `yarn build`        | Builds the project to `./dist`                  |\n| `yarn format`       | Format the source following the Prettier styles |\n| `yarn test`         | Run project tests                               |\n| `yarn test --watch` | Run project tests, watching for file changes    |\n\n## License\n\nMIT\n\n[node.js]: https://nodejs.org/\n[npm]: https://npmjs.com/\n[yarn]: https://yarnpkg.com/en/docs/\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblakek%2Fcurry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblakek%2Fcurry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblakek%2Fcurry/lists"}