{"id":13515354,"url":"https://github.com/selfrefactor/rambdax","last_synced_at":"2025-04-14T08:54:14.045Z","repository":{"id":40275343,"uuid":"87567927","full_name":"selfrefactor/rambdax","owner":"selfrefactor","description":"Extended version of Rambda ","archived":false,"fork":false,"pushed_at":"2025-04-01T14:31:29.000Z","size":5421,"stargazers_count":221,"open_issues_count":0,"forks_count":26,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-07T01:07:59.080Z","etag":null,"topics":["functional-programming","lodash","rambda","ramda","utils"],"latest_commit_sha":null,"homepage":"https://selfrefactor.github.io/rambdax","language":"JavaScript","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/selfrefactor.png","metadata":{"files":{"readme":".github/README.md","changelog":"CHANGELOG.md","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":"2017-04-07T16:54:26.000Z","updated_at":"2025-04-01T14:31:34.000Z","dependencies_parsed_at":"2024-05-03T12:25:15.518Z","dependency_job_id":"e28d33b8-77e8-4e4f-a72f-6a021b94db95","html_url":"https://github.com/selfrefactor/rambdax","commit_stats":{"total_commits":1025,"total_committers":20,"mean_commits":51.25,"dds":"0.030243902439024417","last_synced_commit":"d4ef6d78a39a6491223b9de79cd67308d4b9ccd6"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfrefactor%2Frambdax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfrefactor%2Frambdax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfrefactor%2Frambdax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selfrefactor%2Frambdax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/selfrefactor","download_url":"https://codeload.github.com/selfrefactor/rambdax/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248852109,"owners_count":21171839,"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":["functional-programming","lodash","rambda","ramda","utils"],"created_at":"2024-08-01T05:01:09.982Z","updated_at":"2025-04-14T08:54:14.007Z","avatar_url":"https://github.com/selfrefactor.png","language":"JavaScript","readme":"# Rambda\n\n`Rambda` is smaller and faster alternative to the popular functional programming library **Ramda**. - [Documentation](https://selfrefactor.github.io/rambda/#/)\n\n[![CircleCI](https://circleci.com/gh/selfrefactor/rambda/tree/master.svg?style=svg)](https://circleci.com/gh/selfrefactor/rambda/tree/master)\n[![codecov](https://codecov.io/gh/selfrefactor/rambda/branch/master/graph/badge.svg)](https://codecov.io/gh/selfrefactor/rambda)\n![Commit activity](https://img.shields.io/github/commit-activity/y/selfrefactor/rambda)\n![All contributors](https://img.shields.io/github/contributors/selfrefactor/rambda)\n![Library size](https://img.shields.io/bundlephobia/minzip/rambda)\n[![install size](https://packagephobia.com/badge?p=rambda)](https://packagephobia.com/result?p=rambda)\n[![nest badge](https://nest.land/badge.svg)](https://nest.land/package/rambda)\n[![PR's Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](https://github.com/selfrefactor/rambda/pulls)\n\n## ❯ Example use\n\n```javascript\nimport { compose, map, filter } from 'rambda'\n\nconst result = compose(\n  map(x =\u003e x * 2),\n  filter(x =\u003e x \u003e 2)\n)([1, 2, 3, 4])\n// =\u003e [6, 8]\n```\n\nYou can test this example in \u003ca href=\"https://rambda.now.sh?const%20result%20%3D%20R.compose(%0A%20%20R.map(x%20%3D%3E%20x%20*%202)%2C%0A%20%20R.filter(x%20%3D%3E%20x%20%3E%202)%0A)(%5B1%2C%202%2C%203%2C%204%5D)%0A%0A%2F%2F%20%3D%3E%20%5B6%2C%208%5D\"\u003eRambda's REPL\u003c/a\u003e\n\n* [Differences between Rambda and Ramda](#differences-between-rambda-and-ramda)\n* [API](#api)\n* [Changelog](#-changelog)\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#-example-use)\n\n## ❯ Rambda's advantages\n\n### TypeScript included\n\nTypeScript definitions are included in the library, in comparison to **Ramda**, where you need to additionally install `@types/ramda`.\n\nStill, you need to be aware that functional programming features in `TypeScript` are in development, which means that using **R.compose/R.pipe** can be problematic.\n\nImportant - Rambda version `7.1.0`(or higher) requires TypeScript version `4.3.3`(or higher).\n\n### Understandable source code due to little usage of internals\n\n`Ramda` uses a lot of internals, which hides a lot of logic. Reading the full source code of a method can be challenging.\n\n### Better VSCode experience\n\nIf the project is written in Javascript, then `go to source definition` action will lead you to actual implementation of the method.\n\n### Immutable TS definitions\n\nYou can use immutable version of Rambda definitions, which is linted with ESLint `functional/prefer-readonly-type` plugin.\n\n```\nimport {add} from 'rambda/immutable'\n```\n\n### Deno support\n\nLatest version of **Ramba** available for `Deno` users is 3 years old. This is not the case with **Rambda** as most of recent releases are available for `Deno` users.\n\nAlso, `Rambda` provides you with included TS definitions:\n\n```\n// Deno extension(https://marketplace.visualstudio.com/items?itemName=denoland.vscode-deno)\n// is installed and initialized\nimport * as R from \"https://deno.land/x/rambda/mod.ts\";\nimport * as Ramda from \"https://deno.land/x/ramda/mod.ts\";\n\nR.add(1)('foo') // =\u003e will trigger warning in VSCode as it should\nRamda.add(1)('foo') // =\u003e will not trigger warning in VSCode\n```\n\n### Dot notation for `R.path`, `R.paths`, `R.assocPath` and `R.lensPath`\n\nStandard usage of `R.path` is `R.path(['a', 'b'], {a: {b: 1} })`.\n\nIn **Rambda** you have the choice to use dot notation(which is arguably more readable):\n\n```\nR.path('a.b', {a: {b: 1} })\n```\n\n### Comma notation for `R.pick` and `R.omit`\n\nSimilar to dot notation, but the separator is comma(`,`) instead of dot(`.`).\n\n```\nR.pick('a,b', {a: 1 , b: 2, c: 3} })\n// No space allowed between properties\n```\n\n### Speed\n\n**Rambda** is generally more performant than `Ramda` as the [benchmarks](#-benchmarks) can prove that.\n\n### Support\n\nOne of the main issues with `Ramda` is the slow process of releasing new versions. This is not the case with **Rambda** as releases are made on regular basis.\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#-rambdas-advantages)\n\n## ❯ Missing Ramda methods\n\n\u003cdetails\u003e\n\u003csummary\u003e\n  Click to see the full list of 46 Ramda methods not implemented in Rambda and their status.\n\u003c/summary\u003e\n\n- construct - Using classes is not very functional programming oriented.\n- constructN - same as above\n- into - no support for transducer as it is overly complex to implement, understand and read.\n- invert - overly complicated and limited use case\n- invertObj\n- invoker\n- keysIn - we shouldn't encourage extending object with `.prototype` \n- lift\n- liftN\n- mapAccum - `Ramda` example doesn't looks convincing\n- mapAccumRight\n- memoizeWith - hard to imagine its usage in context of `R.pipe`/`R.compose`\n- mergeDeepWith - limited use case\n- mergeDeepWithKey\n- mergeWithKey\n- nAry - hard to argument about and hard to create meaningful TypeScript definitions\n- nthArg - limited use case\n- o - enough TypeScript issues with `R.pipe`/`R.compose` to add more composition methods\n- otherwise - naming is confusing\n- pair - `left-pad` types of debacles happens partially because of such methods that should not be hidden, bur rather part of your code base even if they need to exist.\n- partialRight - I dislike `R.partial`, so I don't want to add more methods that are based on it\n- pipeWith\n- project - naming is confusing, but also limited use case\n- promap\n- reduceRight - I find `right/left` methods confusing so I added them only where it makes sense.\n- reduceWhile - functions with 4 inputs - I think that even 3 is too much\n- reduced\n- remove - nice name but it is too generic. Also, `Rambdax` has such method and there it works very differently\n- scan - hard to explain\n- sequence\n- splitWhenever\n- symmetricDifferenceWith\n- andThen\n- toPairsIn\n- transduce - currently is out of focus\n- traverse - same as above\n- unary\n- uncurryN\n- unfold - similar to `R.scan` and I find that it doesn't help with readability\n- unionWith - why it has its usage, I want to limit number of methods that accept more than 2 arguments\n- until\n- useWith - hard to explain\n- valuesIn\n- xprod - limited use case\n- thunkify\n- __ - placeholder method allows user to further customize the method call. While, it seems useful initially, the price is too high in terms of complexity for TypeScript definitions. If it is not easy exressable in TypeScript, it is not worth it as **Rambda** is a TypeScript first library.\n\nThe following methods are not going to be added(reason for exclusion is provided as a comment):\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#-missing-ramda-methods)\n  \n## ❯ Install\n\n- **yarn add rambda**\n\n- For UMD usage either use `./dist/rambda.umd.js` or the following CDN link:\n\n```\nhttps://unpkg.com/rambda@CURRENT_VERSION/dist/rambda.umd.js\n```\n\n- with deno\n\n```\nimport {add} from \"https://deno.land/x/rambda/mod.ts\";\n```\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#-install)\n\n## Differences between Rambda and Ramda\n\n- Rambda's **type** detects async functions and unresolved `Promises`. The returned values are `'Async'` and `'Promise'`.\n\n- Rambda's **type** handles *NaN* input, in which case it returns `NaN`.\n\n- Rambda's **forEach** can iterate over objects not only arrays.\n\n- Rambda's **map**, **filter**, **partition** when they iterate over objects, they pass property and input object as predicate's argument.\n\n- Rambda's **filter** returns empty array with bad input(`null` or `undefined`), while Ramda throws.\n\n- Ramda's **clamp** work with strings, while Rambda's method work only with numbers.\n\n- Ramda's **indexOf/lastIndexOf** work with strings and lists, while Rambda's method work only with lists as iterable input.\n\n- Error handling, when wrong inputs are provided, may not be the same. This difference will be better documented once all brute force tests are completed.\n\n- TypeScript definitions between `rambda` and `@types/ramda` may vary.\n\n\u003e If you need more **Ramda** methods in **Rambda**, you may either submit a `PR` or check the extended version of **Rambda** - [Rambdax](https://github.com/selfrefactor/rambdax). In case of the former, you may want to consult with [Rambda contribution guidelines.](CONTRIBUTING.md)\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#-differences-between-rambda-and-ramda)\n\n## ❯ Benchmarks\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\nClick to expand all benchmark results\n\nThere are methods which are benchmarked only with `Ramda` and `Rambda`(i.e. no `Lodash`).\n\nNote that some of these methods, are called with and without curring. This is done in order to give more detailed performance feedback.\n\nThe benchmarks results are produced from latest versions of *Rambda*, *Lodash*(4.17.21) and *Ramda*(0.30.1).\n\n\u003c/summary\u003e\n\nmethod | Rambda | Ramda | Lodash\n--- |--- | --- | ---\n *add* | 🚀 Fastest | 21.52% slower | 82.15% slower\n *adjust* | 8.48% slower | 🚀 Fastest | 🔳\n *all* | 🚀 Fastest | 7.18% slower | 🔳\n *allPass* | 🚀 Fastest | 88.25% slower | 🔳\n *allPass* | 🚀 Fastest | 98.56% slower | 🔳\n *and* | 🚀 Fastest | 89.09% slower | 🔳\n *any* | 🚀 Fastest | 92.87% slower | 45.82% slower\n *anyPass* | 🚀 Fastest | 98.25% slower | 🔳\n *append* | 🚀 Fastest | 2.07% slower | 🔳\n *applySpec* | 🚀 Fastest | 80.43% slower | 🔳\n *assoc* | 72.32% slower | 60.08% slower | 🚀 Fastest\n *clone* | 🚀 Fastest | 91.86% slower | 86.48% slower\n *compose* | 6.07% slower | 16.89% slower | 🚀 Fastest\n *converge* | 78.63% slower | 🚀 Fastest | 🔳\n *curry* | 🚀 Fastest | 28.86% slower | 🔳\n *curryN* | 🚀 Fastest | 41.05% slower | 🔳\n *defaultTo* | 🚀 Fastest | 48.91% slower | 🔳\n *drop* | 🚀 Fastest | 82.35% slower | 🔳\n *dropLast* | 🚀 Fastest | 86.74% slower | 🔳\n *equals* | 58.37% slower | 96.73% slower | 🚀 Fastest\n *filter* | 6.7% slower | 72.03% slower | 🚀 Fastest\n *find* | 🚀 Fastest | 85.14% slower | 42.65% slower\n *findIndex* | 🚀 Fastest | 86.48% slower | 72.27% slower\n *flatten* | 🚀 Fastest | 85.68% slower | 3.57% slower\n *ifElse* | 🚀 Fastest | 58.56% slower | 🔳\n *includes* | 🚀 Fastest | 81.64% slower | 🔳\n *indexOf* | 🚀 Fastest | 80.17% slower | 🔳\n *indexOf* | 🚀 Fastest | 82.2% slower | 🔳\n *init* | 🚀 Fastest | 92.24% slower | 13.3% slower\n *is* | 🚀 Fastest | 57.69% slower | 🔳\n *isEmpty* | 🚀 Fastest | 97.14% slower | 54.99% slower\n *last* | 🚀 Fastest | 93.43% slower | 5.28% slower\n *lastIndexOf* | 🚀 Fastest | 85.19% slower | 🔳\n *map* | 🚀 Fastest | 86.6% slower | 11.73% slower\n *match* | 🚀 Fastest | 44.83% slower | 🔳\n *merge* | 🚀 Fastest | 12.21% slower | 55.76% slower\n *none* | 🚀 Fastest | 96.48% slower | 🔳\n *objOf* | 🚀 Fastest | 38.05% slower | 🔳\n *omit* | 🚀 Fastest | 69.95% slower | 97.34% slower\n *over* | 🚀 Fastest | 56.23% slower | 🔳\n *path* | 37.81% slower | 77.81% slower | 🚀 Fastest\n *pick* | 🚀 Fastest | 19.07% slower | 80.2% slower\n *pipe* | 🚀 Fastest | 0.11% slower | 🔳\n *prop* | 🚀 Fastest | 87.95% slower | 🔳\n *propEq* | 🚀 Fastest | 91.92% slower | 🔳\n *range* | 🚀 Fastest | 61.8% slower | 57.44% slower\n *reduce* | 60.48% slower | 77.1% slower | 🚀 Fastest\n *repeat* | 48.57% slower | 68.98% slower | 🚀 Fastest\n *replace* | 33.45% slower | 33.99% slower | 🚀 Fastest\n *set* | 🚀 Fastest | 50.35% slower | 🔳\n *sort* | 🚀 Fastest | 40.23% slower | 🔳\n *sortBy* | 🚀 Fastest | 25.29% slower | 56.88% slower\n *split* | 🚀 Fastest | 55.37% slower | 17.64% slower\n *splitEvery* | 🚀 Fastest | 71.98% slower | 🔳\n *take* | 🚀 Fastest | 91.96% slower | 4.72% slower\n *takeLast* | 🚀 Fastest | 93.39% slower | 19.22% slower\n *test* | 🚀 Fastest | 82.34% slower | 🔳\n *type* | 🚀 Fastest | 48.6% slower | 🔳\n *uniq* | 🚀 Fastest | 84.9% slower | 🔳\n *uniqBy* | 51.93% slower | 🚀 Fastest | 🔳\n *uniqWith* | 8.29% slower | 🚀 Fastest | 🔳\n *uniqWith* | 14.23% slower | 🚀 Fastest | 🔳\n *update* | 🚀 Fastest | 52.35% slower | 🔳\n *view* | 🚀 Fastest | 76.15% slower | 🔳\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#-benchmarks)\n\n## ❯ Used by\n\n- [ESLint plugin Mocha](https://www.npmjs.com/package/eslint-plugin-mocha)\n\n- [WatermelonDB](https://github.com/Nozbe/WatermelonDB)\n\n- [Walmart Canada](https://www.walmart.ca) reported by [w-b-dev](https://github.com/w-b-dev) \n\n- [VSCode Slack integration](https://github.com/verydanny/vcslack)\n\n- [Webpack PostCSS](https://github.com/sectsect/webpack-postcss)\n\n- [MobX-State-Tree decorators](https://github.com/farwayer/mst-decorators)\n\n- [Rewrite of the Betaflight configurator](https://github.com/freshollie/fresh-configurator)\n\n- [MineFlayer plugin](https://github.com/G07cha/MineflayerArmorManager)\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#-used-by)\n\n## API\n\n### add\n\nIt adds `a` and `b`.\n\n\u003e :boom: It doesn't work with strings, as the inputs are parsed to numbers before calculation.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.add(2%2C%203)%20%2F%2F%20%3D%3E%20%205\"\u003eTry this \u003cstrong\u003eR.add\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#add)\n\n### addIndex\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.addIndex(R.map)((val%2C%20idx)%20%3D%3E%20val%20%2B%20idx%20%2B%201%2C%20%5B1%2C%202%2C%203%5D)%0A%2F%2F%20%3D%3E%20%5B2%2C%204%2C%206%5D\"\u003eTry this \u003cstrong\u003eR.addIndex\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#addIndex)\n\n### addIndexRight\n\nSame as `R.addIndex`, but it will passed indexes are decreasing, instead of increasing.\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#addIndexRight)\n\n### adjust\n\n```typescript\n\nadjust\u003cT\u003e(index: number, replaceFn: (x: T) =\u003e T, list: T[]): T[]\n```\n\nIt replaces `index` in array `list` with the result of `replaceFn(list[i])`.\n\n```javascript\nconst result = R.adjust(\n  0,\n  a =\u003e a + 1,\n  [0, 100]\n) // =\u003e [1, 100]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.adjust(%0A%20%200%2C%0A%20%20a%20%3D%3E%20a%20%2B%201%2C%0A%20%20%5B0%2C%20100%5D%0A)%20%2F%2F%20%3D%3E%20%5B1%2C%20100%5D\"\u003eTry this \u003cstrong\u003eR.adjust\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nadjust\u003cT\u003e(index: number, replaceFn: (x: T) =\u003e T, list: T[]): T[];\nadjust\u003cT\u003e(index: number, replaceFn: (x: T) =\u003e T): (list: T[]) =\u003e T[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.adjust\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { cloneList } from './_internals/cloneList.js'\nimport { curry } from './curry.js'\n\nfunction adjustFn(\n  index, replaceFn, list\n){\n  const actualIndex = index \u003c 0 ? list.length + index : index\n  if (index \u003e= list.length || actualIndex \u003c 0) return list\n\n  const clone = cloneList(list)\n  clone[ actualIndex ] = replaceFn(clone[ actualIndex ])\n\n  return clone\n}\n\nexport const adjust = curry(adjustFn)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { add } from './add.js'\nimport { adjust } from './adjust.js'\nimport { pipe } from './pipe.js'\n\nconst list = [ 0, 1, 2 ]\nconst expected = [ 0, 11, 2 ]\n\ntest('happy', () =\u003e {})\n\ntest('happy', () =\u003e {\n  expect(adjust(\n    1, add(10), list\n  )).toEqual(expected)\n})\n\ntest('with curring type 1 1 1', () =\u003e {\n  expect(adjust(1)(add(10))(list)).toEqual(expected)\n})\n\ntest('with curring type 1 2', () =\u003e {\n  expect(adjust(1)(add(10), list)).toEqual(expected)\n})\n\ntest('with curring type 2 1', () =\u003e {\n  expect(adjust(1, add(10))(list)).toEqual(expected)\n})\n\ntest('with negative index', () =\u003e {\n  expect(adjust(\n    -2, add(10), list\n  )).toEqual(expected)\n})\n\ntest('when index is out of bounds', () =\u003e {\n  const list = [ 0, 1, 2, 3 ]\n  expect(adjust(\n    4, add(1), list\n  )).toEqual(list)\n  expect(adjust(\n    -5, add(1), list\n  )).toEqual(list)\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#adjust)\n\n### all\n\n```typescript\n\nall\u003cT\u003e(predicate: (x: T) =\u003e boolean, list: T[]): boolean\n```\n\nIt returns `true`, if all members of array `list` returns `true`, when applied as argument to `predicate` function.\n\n```javascript\nconst list = [ 0, 1, 2, 3, 4 ]\nconst predicate = x =\u003e x \u003e -1\n\nconst result = R.all(predicate, list)\n// =\u003e true\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B%200%2C%201%2C%202%2C%203%2C%204%20%5D%0Aconst%20predicate%20%3D%20x%20%3D%3E%20x%20%3E%20-1%0A%0Aconst%20result%20%3D%20R.all(predicate%2C%20list)%0A%2F%2F%20%3D%3E%20true\"\u003eTry this \u003cstrong\u003eR.all\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nall\u003cT\u003e(predicate: (x: T) =\u003e boolean, list: T[]): boolean;\nall\u003cT\u003e(predicate: (x: T) =\u003e boolean): (list: T[]) =\u003e boolean;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.all\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function all(predicate, list){\n  if (arguments.length === 1) return _list =\u003e all(predicate, _list)\n\n  for (let i = 0; i \u003c list.length; i++){\n    if (!predicate(list[ i ])) return false\n  }\n\n  return true\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { all } from './all.js'\n\nconst list = [ 0, 1, 2, 3, 4 ]\n\ntest('when true', () =\u003e {\n  const fn = x =\u003e x \u003e -1\n\n  expect(all(fn)(list)).toBeTrue()\n})\n\ntest('when false', () =\u003e {\n  const fn = x =\u003e x \u003e 2\n\n  expect(all(fn, list)).toBeFalse()\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {all} from 'rambda'\n\ndescribe('all', () =\u003e {\n  it('happy', () =\u003e {\n    const result = all(\n      x =\u003e {\n        x // $ExpectType number\n        return x \u003e 0\n      },\n      [1, 2, 3]\n    )\n    result // $ExpectType boolean\n  })\n  it('curried needs a type', () =\u003e {\n    const result = all\u003cnumber\u003e(x =\u003e {\n      x // $ExpectType number\n      return x \u003e 0\n    })([1, 2, 3])\n    result // $ExpectType boolean\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#all)\n\n### allPass\n\n```typescript\n\nallPass\u003cT\u003e(predicates: ((x: T) =\u003e boolean)[]): (input: T) =\u003e boolean\n```\n\nIt returns `true`, if all functions of `predicates` return `true`, when `input` is their argument.\n\n```javascript\nconst input = {\n  a : 1,\n  b : 2,\n}\nconst predicates = [\n  x =\u003e x.a === 1,\n  x =\u003e x.b === 2,\n]\nconst result = R.allPass(predicates)(input) // =\u003e true\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20input%20%3D%20%7B%0A%20%20a%20%3A%201%2C%0A%20%20b%20%3A%202%2C%0A%7D%0Aconst%20predicates%20%3D%20%5B%0A%20%20x%20%3D%3E%20x.a%20%3D%3D%3D%201%2C%0A%20%20x%20%3D%3E%20x.b%20%3D%3D%3D%202%2C%0A%5D%0Aconst%20result%20%3D%20R.allPass(predicates)(input)%20%2F%2F%20%3D%3E%20true\"\u003eTry this \u003cstrong\u003eR.allPass\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nallPass\u003cT\u003e(predicates: ((x: T) =\u003e boolean)[]): (input: T) =\u003e boolean;\nallPass\u003cT\u003e(predicates: ((...inputs: T[]) =\u003e boolean)[]): (...inputs: T[]) =\u003e boolean;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.allPass\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function allPass(predicates){\n  return (...input) =\u003e {\n    let counter = 0\n    while (counter \u003c predicates.length){\n      if (!predicates[ counter ](...input)){\n        return false\n      }\n      counter++\n    }\n\n    return true\n  }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { allPass } from './allPass.js'\n\ntest('happy', () =\u003e {\n  const rules = [ x =\u003e typeof x === 'number', x =\u003e x \u003e 10, x =\u003e x * 7 \u003c 100 ]\n\n  expect(allPass(rules)(11)).toBeTrue()\n\n  expect(allPass(rules)(undefined)).toBeFalse()\n})\n\ntest('when returns true', () =\u003e {\n  const conditionArr = [ val =\u003e val.a === 1, val =\u003e val.b === 2 ]\n\n  expect(allPass(conditionArr)({\n    a : 1,\n    b : 2,\n  })).toBeTrue()\n})\n\ntest('when returns false', () =\u003e {\n  const conditionArr = [ val =\u003e val.a === 1, val =\u003e val.b === 3 ]\n\n  expect(allPass(conditionArr)({\n    a : 1,\n    b : 2,\n  })).toBeFalse()\n})\n\ntest('works with multiple inputs', () =\u003e {\n  const fn = function (\n    w, x, y, z\n  ){\n    return w + x === y + z\n  }\n  expect(allPass([ fn ])(\n    3, 3, 3, 3\n  )).toBeTrue()\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {allPass, filter} from 'rambda'\n\ndescribe('allPass', () =\u003e {\n  it('happy', () =\u003e {\n    const x = allPass\u003cnumber\u003e([\n      y =\u003e {\n        y // $ExpectType number\n        return typeof y === 'number'\n      },\n      y =\u003e {\n        return y \u003e 0\n      },\n    ])(11)\n\n    x // $ExpectType boolean\n  })\n  it('issue #642', () =\u003e {\n    const isGreater = (num: number) =\u003e num \u003e 5\n    const pred = allPass([isGreater])\n    const xs = [0, 1, 2, 3]\n\n    const filtered1 = filter(pred)(xs)\n    filtered1 // $ExpectType number[]\n    const filtered2 = xs.filter(pred)\n    filtered2 // $ExpectType number[]\n  })\n  it('issue #604', () =\u003e {\n    const plusEq = function(w: number, x: number, y: number, z: number) {\n      return w + x === y + z\n    }\n    const result = allPass([plusEq])(3, 3, 3, 3)\n\n    result // $ExpectType boolean\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#allPass)\n\n### always\n\nIt returns function that always returns `x`.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20fn%20%3D%20R.always(7)%0A%0Aconst%20result%20%3D%20fn()%0A%2F%2F%20%3D%3E%207\"\u003eTry this \u003cstrong\u003eR.always\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#always)\n\n### and\n\nLogical AND\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?R.and(true%2C%20true)%3B%20%2F%2F%20%3D%3E%20true%0AR.and(false%2C%20true)%3B%20%2F%2F%20%3D%3E%20false%0Aconst%20result%20%3D%20R.and(true%2C%20'foo')%3B%20%2F%2F%20%3D%3E%20'foo'\"\u003eTry this \u003cstrong\u003eR.and\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#and)\n\n### any\n\n```typescript\n\nany\u003cT\u003e(predicate: (x: T) =\u003e boolean, list: T[]): boolean\n```\n\nIt returns `true`, if at least one member of `list` returns true, when passed to a `predicate` function.\n\n```javascript\nconst list = [1, 2, 3]\nconst predicate = x =\u003e x * x \u003e 8\nR.any(fn, list)\n// =\u003e true\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B1%2C%202%2C%203%5D%0Aconst%20predicate%20%3D%20x%20%3D%3E%20x%20*%20x%20%3E%208%0Aconst%20result%20%3D%20R.any(fn%2C%20list)%0A%2F%2F%20%3D%3E%20true\"\u003eTry this \u003cstrong\u003eR.any\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nany\u003cT\u003e(predicate: (x: T) =\u003e boolean, list: T[]): boolean;\nany\u003cT\u003e(predicate: (x: T) =\u003e boolean): (list: T[]) =\u003e boolean;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.any\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function any(predicate, list){\n  if (arguments.length === 1) return _list =\u003e any(predicate, _list)\n\n  let counter = 0\n  while (counter \u003c list.length){\n    if (predicate(list[ counter ], counter)){\n      return true\n    }\n    counter++\n  }\n\n  return false\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { any } from './any.js'\n\nconst list = [ 1, 2, 3 ]\n\ntest('happy', () =\u003e {\n  expect(any(x =\u003e x \u003c 0, list)).toBeFalse()\n})\n\ntest('with curry', () =\u003e {\n  expect(any(x =\u003e x \u003e 2)(list)).toBeTrue()\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {any} from 'rambda'\n\ndescribe('R.any', () =\u003e {\n  it('happy', () =\u003e {\n    const result = any(\n      x =\u003e {\n        x // $ExpectType number\n        return x \u003e 2\n      },\n      [1, 2, 3]\n    )\n    result // $ExpectType boolean\n  })\n\n  it('when curried needs a type', () =\u003e {\n    const result = any\u003cnumber\u003e(x =\u003e {\n      x // $ExpectType number\n      return x \u003e 2\n    })([1, 2, 3])\n    result // $ExpectType boolean\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#any)\n\n### anyPass\n\n```typescript\n\nanyPass\u003cT\u003e(predicates: ((x: T) =\u003e boolean)[]): (input: T) =\u003e boolean\n```\n\nIt accepts list of `predicates` and returns a function. This function with its `input` will return `true`, if any of `predicates` returns `true` for this `input`.\n\n```javascript\nconst isBig = x =\u003e x \u003e 20\nconst isOdd = x =\u003e x % 2 === 1\nconst input = 11\n\nconst fn = R.anyPass(\n  [isBig, isOdd]\n)\n\nconst result = fn(input) \n// =\u003e true\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20isBig%20%3D%20x%20%3D%3E%20x%20%3E%2020%0Aconst%20isOdd%20%3D%20x%20%3D%3E%20x%20%25%202%20%3D%3D%3D%201%0Aconst%20input%20%3D%2011%0A%0Aconst%20fn%20%3D%20R.anyPass(%0A%20%20%5BisBig%2C%20isOdd%5D%0A)%0A%0Aconst%20result%20%3D%20fn(input)%20%0A%2F%2F%20%3D%3E%20true\"\u003eTry this \u003cstrong\u003eR.anyPass\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nanyPass\u003cT\u003e(predicates: ((x: T) =\u003e boolean)[]): (input: T) =\u003e boolean;\nanyPass\u003cT\u003e(predicates: ((...inputs: T[]) =\u003e boolean)[]): (...inputs: T[]) =\u003e boolean;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.anyPass\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function anyPass(predicates){\n  return (...input) =\u003e {\n    let counter = 0\n    while (counter \u003c predicates.length){\n      if (predicates[ counter ](...input)){\n        return true\n      }\n      counter++\n    }\n\n    return false\n  }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { anyPass } from './anyPass.js'\n\ntest('happy', () =\u003e {\n  const rules = [ x =\u003e typeof x === 'string', x =\u003e x \u003e 10 ]\n  const predicate = anyPass(rules)\n  expect(predicate('foo')).toBeTrue()\n  expect(predicate(6)).toBeFalse()\n})\n\ntest('happy', () =\u003e {\n  const rules = [ x =\u003e typeof x === 'string', x =\u003e x \u003e 10 ]\n\n  expect(anyPass(rules)(11)).toBeTrue()\n  expect(anyPass(rules)(undefined)).toBeFalse()\n})\n\nconst obj = {\n  a : 1,\n  b : 2,\n}\n\ntest('when returns true', () =\u003e {\n  const conditionArr = [ val =\u003e val.a === 1, val =\u003e val.a === 2 ]\n\n  expect(anyPass(conditionArr)(obj)).toBeTrue()\n})\n\ntest('when returns false + curry', () =\u003e {\n  const conditionArr = [ val =\u003e val.a === 2, val =\u003e val.b === 3 ]\n\n  expect(anyPass(conditionArr)(obj)).toBeFalse()\n})\n\ntest('with empty predicates list', () =\u003e {\n  expect(anyPass([])(3)).toBeFalse()\n})\n\ntest('works with multiple inputs', () =\u003e {\n  const fn = function (\n    w, x, y, z\n  ){\n    console.log(\n      w, x, y, z\n    )\n\n    return w + x === y + z\n  }\n  expect(anyPass([ fn ])(\n    3, 3, 3, 3\n  )).toBeTrue()\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {anyPass, filter} from 'rambda'\n\ndescribe('anyPass', () =\u003e {\n  it('happy', () =\u003e {\n    const x = anyPass\u003cnumber\u003e([\n      y =\u003e {\n        y // $ExpectType number\n        return typeof y === 'number'\n      },\n      y =\u003e {\n        return y \u003e 0\n      },\n    ])(11)\n\n    x // $ExpectType boolean\n  })\n  it('issue #604', () =\u003e {\n    const plusEq = function(w: number, x: number, y: number, z: number) {\n      return w + x === y + z\n    }\n    const result = anyPass([plusEq])(3, 3, 3, 3)\n\n    result // $ExpectType boolean\n  })\n  it('issue #642', () =\u003e {\n    const isGreater = (num: number) =\u003e num \u003e 5\n    const pred = anyPass([isGreater])\n    const xs = [0, 1, 2, 3]\n\n    const filtered1 = filter(pred)(xs)\n    filtered1 // $ExpectType number[]\n    const filtered2 = xs.filter(pred)\n    filtered2 // $ExpectType number[]\n  })\n  it('functions as a type guard', () =\u003e {\n    const isString = (x: unknown): x is string =\u003e typeof x === 'string'\n    const isNumber = (x: unknown): x is number =\u003e typeof x === 'number'\n    const isBoolean = (x: unknown): x is boolean =\u003e typeof x === 'boolean'\n\n    const isStringNumberOrBoolean = anyPass([isString, isNumber, isBoolean])\n\n    isStringNumberOrBoolean // $ExpectType (input: unknown) =\u003e boolean\n\n    const aValue: unknown = 1\n\n    if (isStringNumberOrBoolean(aValue)) {\n      aValue // $ExpectType unknown\n    }\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#anyPass)\n\n### ap\n\n```typescript\n\nap\u003cT, U\u003e(fns: Array\u003c(a: T) =\u003e U\u003e[], vs: T[]): U[]\n```\n\nIt takes a list of functions and a list of values. Then it returns a list of values obtained by applying each function to each value.\n\n```javascript\nconst result = R.ap(\n  [\n    x =\u003e x + 1,\n    x =\u003e x + 2,\n  ],\n  [1, 2, 3]\n)\n// =\u003e [2, 3, 4, 3, 4, 5]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.ap(%0A%20%20%5B%0A%20%20%20%20x%20%3D%3E%20x%20%2B%201%2C%0A%20%20%20%20x%20%3D%3E%20x%20%2B%202%2C%0A%20%20%5D%2C%0A%20%20%5B1%2C%202%2C%203%5D%0A)%0A%2F%2F%20%3D%3E%20%5B2%2C%203%2C%204%2C%203%2C%204%2C%205%5D\"\u003eTry this \u003cstrong\u003eR.ap\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nap\u003cT, U\u003e(fns: Array\u003c(a: T) =\u003e U\u003e[], vs: T[]): U[];\nap\u003cT, U\u003e(fns: Array\u003c(a: T) =\u003e U\u003e): (vs: T[]) =\u003e U[];\nap\u003cR, A, B\u003e(fn: (r: R, a: A) =\u003e B, fn1: (r: R) =\u003e A): (r: R) =\u003e B;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.ap\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function ap(functions, input){\n  if (arguments.length === 1){\n    return _inputs =\u003e ap(functions, _inputs)\n  }\n\n  return functions.reduce((acc, fn) =\u003e [ ...acc, ...input.map(fn) ], [])\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { ap } from './ap.js'\n\nfunction mult2(x){\n  return x * 2\n}\nfunction plus3(x){\n  return x + 3\n}\n\ntest('happy', () =\u003e {\n  expect(ap([ mult2, plus3 ], [ 1, 2, 3 ])).toEqual([ 2, 4, 6, 4, 5, 6 ])\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#ap)\n\n### aperture\n\n```typescript\n\naperture\u003cN extends number, T\u003e(n: N, list: T[]): Array\u003cTuple\u003cT, N\u003e\u003e | []\n```\n\nIt returns a new list, composed of consecutive `n`-tuples from a `list`.\n\n```javascript\nconst result = R.aperture(2, [1, 2, 3, 4])\n// =\u003e [[1, 2], [2, 3], [3, 4]]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.aperture(2%2C%20%5B1%2C%202%2C%203%2C%204%5D)%0A%2F%2F%20%3D%3E%20%5B%5B1%2C%202%5D%2C%20%5B2%2C%203%5D%2C%20%5B3%2C%204%5D%5D\"\u003eTry this \u003cstrong\u003eR.aperture\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\naperture\u003cN extends number, T\u003e(n: N, list: T[]): Array\u003cTuple\u003cT, N\u003e\u003e | [];\naperture\u003cN extends number\u003e(n: N): \u003cT\u003e(list: T[]) =\u003e Array\u003cTuple\u003cT, N\u003e\u003e | [];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.aperture\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function aperture(step, list){\n  if (arguments.length === 1){\n    return _list =\u003e aperture(step, _list)\n  }\n  if (step \u003e list.length) return []\n  let idx = 0\n  const limit = list.length - (step - 1)\n  const acc = new Array(limit)\n  while (idx \u003c limit){\n    acc[ idx ] = list.slice(idx, idx + step)\n    idx += 1\n  }\n\n  return acc\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { aperture } from './aperture.js'\n\nconst list = [ 1, 2, 3, 4, 5, 6, 7 ]\n\ntest('happy', () =\u003e {\n  expect(aperture(1, list)).toEqual([ [ 1 ], [ 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ] ])\n  expect(aperture(2, list)).toEqual([\n    [ 1, 2 ],\n    [ 2, 3 ],\n    [ 3, 4 ],\n    [ 4, 5 ],\n    [ 5, 6 ],\n    [ 6, 7 ],\n  ])\n  expect(aperture(3, list)).toEqual([\n    [ 1, 2, 3 ],\n    [ 2, 3, 4 ],\n    [ 3, 4, 5 ],\n    [ 4, 5, 6 ],\n    [ 5, 6, 7 ],\n  ])\n  expect(aperture(8, list)).toEqual([])\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#aperture)\n\n### append\n\n```typescript\n\nappend\u003cT\u003e(xToAppend: T, iterable: T[]): T[]\n```\n\nIt adds element `x` at the end of `iterable`.\n\n```javascript\nconst x = 'foo'\n\nconst result = R.append(x, ['bar', 'baz'])\n// =\u003e ['bar', 'baz', 'foo']\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20x%20%3D%20'foo'%0A%0Aconst%20result%20%3D%20R.append(x%2C%20%5B'bar'%2C%20'baz'%5D)%0A%2F%2F%20%3D%3E%20%5B'bar'%2C%20'baz'%2C%20'foo'%5D\"\u003eTry this \u003cstrong\u003eR.append\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nappend\u003cT\u003e(xToAppend: T, iterable: T[]): T[];\nappend\u003cT, U\u003e(xToAppend: T, iterable: IsFirstSubtypeOfSecond\u003cT, U\u003e[]) : U[];\nappend\u003cT\u003e(xToAppend: T): \u003cU\u003e(iterable: IsFirstSubtypeOfSecond\u003cT, U\u003e[]) =\u003e U[];\nappend\u003cT\u003e(xToAppend: T): (iterable: T[]) =\u003e T[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.append\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { cloneList } from './_internals/cloneList.js'\n\nexport function append(x, input){\n  if (arguments.length === 1) return _input =\u003e append(x, _input)\n\n  if (typeof input === 'string') return input.split('').concat(x)\n\n  const clone = cloneList(input)\n  clone.push(x)\n\n  return clone\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { append } from './append.js'\n\ntest('happy', () =\u003e {\n  expect(append('tests', [ 'write', 'more' ])).toEqual([\n    'write',\n    'more',\n    'tests',\n  ])\n})\n\ntest('append to empty array', () =\u003e {\n  expect(append('tests')([])).toEqual([ 'tests' ])\n})\n\ntest('with strings', () =\u003e {\n  expect(append('o', 'fo')).toEqual([ 'f', 'o', 'o' ])\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {append, prepend} from 'rambda'\n\nconst listOfNumbers = [1, 2, 3]\nconst listOfNumbersAndStrings = [1, 'b', 3]\n\ndescribe('R.append/R.prepend', () =\u003e {\n  describe(\"with the same primitive type as the array's elements\", () =\u003e {\n    it('uncurried', () =\u003e {\n      // @ts-expect-error\n      append('d', listOfNumbers)\n      // @ts-expect-error\n      prepend('d', listOfNumbers)\n      append(4, listOfNumbers) // $ExpectType number[]\n      prepend(4, listOfNumbers) // $ExpectType number[]\n    })\n\n    it('curried', () =\u003e {\n      // @ts-expect-error\n      append('d')(listOfNumbers)\n      append(4)(listOfNumbers) // $ExpectType number[]\n      prepend(4)(listOfNumbers) // $ExpectType number[]\n    })\n  })\n\n  describe(\"with a subtype of the array's elements\", () =\u003e {\n    it('uncurried', () =\u003e {\n      // @ts-expect-error\n      append(true, listOfNumbersAndStrings)\n      append(4, listOfNumbersAndStrings) // $ExpectType (string | number)[]\n      prepend(4, listOfNumbersAndStrings) // $ExpectType (string | number)[]\n    })\n\n    it('curried', () =\u003e {\n      // @ts-expect-error\n      append(true)(listOfNumbersAndStrings)\n      append(4)(listOfNumbersAndStrings) // $ExpectType (string | number)[]\n      prepend(4)(listOfNumbersAndStrings) // $ExpectType (string | number)[]\n    })\n  })\n\n  describe(\"expanding the type of the array's elements\", () =\u003e {\n    it('uncurried', () =\u003e {\n      // @ts-expect-error\n      append('d', listOfNumbers)\n      append\u003cstring | number\u003e('d', listOfNumbers) // $ExpectType (string | number)[]\n      prepend\u003cstring | number\u003e('d', listOfNumbers) // $ExpectType (string | number)[]\n    })\n\n    it('curried', () =\u003e {\n      // @ts-expect-error\n      append('d')(listOfNumbers)\n      const appendD = append('d')\n      appendD\u003cstring | number\u003e(listOfNumbers) // $ExpectType (string | number)[]\n      const prependD = prepend('d')\n      prependD\u003cstring | number\u003e(listOfNumbers) // $ExpectType (string | number)[]\n    })\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#append)\n\n### apply\n\n```typescript\n\napply\u003cT = any\u003e(fn: (...args: any[]) =\u003e T, args: any[]): T\n```\n\nIt applies function `fn` to the list of arguments. \n\nThis is useful for creating a fixed-arity function from a variadic function. `fn` should be a bound function if context is significant.\n\n```javascript\nconst result = R.apply(Math.max, [42, -Infinity, 1337])\n// =\u003e 1337\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.apply(Math.max%2C%20%5B42%2C%20-Infinity%2C%201337%5D)%0A%2F%2F%20%3D%3E%201337\"\u003eTry this \u003cstrong\u003eR.apply\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\napply\u003cT = any\u003e(fn: (...args: any[]) =\u003e T, args: any[]): T;\napply\u003cT = any\u003e(fn: (...args: any[]) =\u003e T): (args: any[]) =\u003e T;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.apply\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function apply(fn, args){\n  if (arguments.length === 1){\n    return _args =\u003e apply(fn, _args)\n  }\n\n  return fn.apply(this, args)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { apply } from './apply.js'\nimport { bind } from './bind.js'\nimport { identity } from './identity.js'\n\ntest('happy', () =\u003e {\n  expect(apply(identity, [ 1, 2, 3 ])).toBe(1)\n})\n\ntest('applies function to argument list', () =\u003e {\n  expect(apply(Math.max, [ 1, 2, 3, -99, 42, 6, 7 ])).toBe(42)\n})\n\ntest('provides no way to specify context', () =\u003e {\n  const obj = {\n    method (){\n      return this === obj\n    },\n  }\n  expect(apply(obj.method, [])).toBeFalse()\n  expect(apply(bind(obj.method, obj), [])).toBeTrue()\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {apply, identity} from 'rambda'\n\ndescribe('R.apply', () =\u003e {\n  it('happy', () =\u003e {\n    const result = apply\u003cnumber\u003e(identity, [1, 2, 3])\n\n    result // $ExpectType number\n  })\n  it('curried', () =\u003e {\n    const fn = apply\u003cnumber\u003e(identity)\n    const result = fn([1, 2, 3])\n\n    result // $ExpectType number\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#apply)\n\n### applySpec\n\n```typescript\n\napplySpec\u003cSpec extends Record\u003cstring, AnyFunction\u003e\u003e(\n  spec: Spec\n): (\n  ...args: Parameters\u003cValueOfRecord\u003cSpec\u003e\u003e\n) =\u003e { [Key in keyof Spec]: ReturnType\u003cSpec[Key]\u003e }\n```\n\n\u003e :boom: The currying in this function works best with functions with 4 arguments or less. (arity of 4)\n\n```javascript\nconst fn = R.applySpec({\n  sum: R.add,\n  nested: { mul: R.multiply }\n})\nconst result = fn(2, 4) \n// =\u003e { sum: 6, nested: { mul: 8 } }\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20fn%20%3D%20R.applySpec(%7B%0A%20%20sum%3A%20R.add%2C%0A%20%20nested%3A%20%7B%20mul%3A%20R.multiply%20%7D%0A%7D)%0Aconst%20result%20%3D%20fn(2%2C%204)%20%0A%2F%2F%20%3D%3E%20%7B%20sum%3A%206%2C%20nested%3A%20%7B%20mul%3A%208%20%7D%20%7D\"\u003eTry this \u003cstrong\u003eR.applySpec\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\napplySpec\u003cSpec extends Record\u003cstring, AnyFunction\u003e\u003e(\n  spec: Spec\n): (\n  ...args: Parameters\u003cValueOfRecord\u003cSpec\u003e\u003e\n) =\u003e { [Key in keyof Spec]: ReturnType\u003cSpec[Key]\u003e };\napplySpec\u003cT\u003e(spec: any): (...args: unknown[]) =\u003e T;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.applySpec\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { isArray } from './_internals/isArray.js'\n\n// recursively traverse the given spec object to find the highest arity function\nexport function __findHighestArity(spec, max = 0){\n  for (const key in spec){\n    if (spec.hasOwnProperty(key) === false || key === 'constructor') continue\n\n    if (typeof spec[ key ] === 'object'){\n      max = Math.max(max, __findHighestArity(spec[ key ]))\n    }\n\n    if (typeof spec[ key ] === 'function'){\n      max = Math.max(max, spec[ key ].length)\n    }\n  }\n\n  return max\n}\n\nfunction __filterUndefined(){\n  const defined = []\n  let i = 0\n  const l = arguments.length\n  while (i \u003c l){\n    if (typeof arguments[ i ] === 'undefined') break\n    defined[ i ] = arguments[ i ]\n    i++\n  }\n\n  return defined\n}\n\nfunction __applySpecWithArity(\n  spec, arity, cache\n){\n  const remaining = arity - cache.length\n\n  if (remaining === 1)\n    return x =\u003e\n      __applySpecWithArity(\n        spec, arity, __filterUndefined(...cache, x)\n      )\n  if (remaining === 2)\n    return (x, y) =\u003e\n      __applySpecWithArity(\n        spec, arity, __filterUndefined(\n          ...cache, x, y\n        )\n      )\n  if (remaining === 3)\n    return (\n      x, y, z\n    ) =\u003e\n      __applySpecWithArity(\n        spec, arity, __filterUndefined(\n          ...cache, x, y, z\n        )\n      )\n  if (remaining === 4)\n    return (\n      x, y, z, a\n    ) =\u003e\n      __applySpecWithArity(\n        spec,\n        arity,\n        __filterUndefined(\n          ...cache, x, y, z, a\n        )\n      )\n  if (remaining \u003e 4)\n    return (...args) =\u003e\n      __applySpecWithArity(\n        spec, arity, __filterUndefined(...cache, ...args)\n      )\n\n  // handle spec as Array\n  if (isArray(spec)){\n    const ret = []\n    let i = 0\n    const l = spec.length\n    for (; i \u003c l; i++){\n      // handle recursive spec inside array\n      if (typeof spec[ i ] === 'object' || isArray(spec[ i ])){\n        ret[ i ] = __applySpecWithArity(\n          spec[ i ], arity, cache\n        )\n      }\n      // apply spec to the key\n      if (typeof spec[ i ] === 'function'){\n        ret[ i ] = spec[ i ](...cache)\n      }\n    }\n\n    return ret\n  }\n\n  // handle spec as Object\n  const ret = {}\n  // apply callbacks to each property in the spec object\n  for (const key in spec){\n    if (spec.hasOwnProperty(key) === false || key === 'constructor') continue\n\n    // apply the spec recursively\n    if (typeof spec[ key ] === 'object'){\n      ret[ key ] = __applySpecWithArity(\n        spec[ key ], arity, cache\n      )\n      continue\n    }\n\n    // apply spec to the key\n    if (typeof spec[ key ] === 'function'){\n      ret[ key ] = spec[ key ](...cache)\n    }\n  }\n\n  return ret\n}\n\nexport function applySpec(spec, ...args){\n  // get the highest arity spec function, cache the result and pass to __applySpecWithArity\n  const arity = __findHighestArity(spec)\n\n  if (arity === 0){\n    return () =\u003e ({})\n  }\n  const toReturn = __applySpecWithArity(\n    spec, arity, args\n  )\n\n  return toReturn\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { applySpec as applySpecRamda, nAry } from 'ramda'\n\nimport {\n  add,\n  always,\n  compose,\n  dec,\n  inc,\n  map,\n  path,\n  prop,\n  T,\n} from '../rambda.js'\nimport { applySpec } from './applySpec.js'\n\ntest('different than Ramda when bad spec', () =\u003e {\n  const result = applySpec({ sum : { a : 1 } })(1, 2)\n  const ramdaResult = applySpecRamda({ sum : { a : 1 } })(1, 2)\n  expect(result).toEqual({})\n  expect(ramdaResult).toEqual({ sum : { a : {} } })\n})\n\ntest('works with empty spec', () =\u003e {\n  expect(applySpec({})()).toEqual({})\n  expect(applySpec([])(1, 2)).toEqual({})\n  expect(applySpec(null)(1, 2)).toEqual({})\n})\n\ntest('works with unary functions', () =\u003e {\n  const result = applySpec({\n    v : inc,\n    u : dec,\n  })(1)\n  const expected = {\n    v : 2,\n    u : 0,\n  }\n  expect(result).toEqual(expected)\n})\n\ntest('works with binary functions', () =\u003e {\n  const result = applySpec({ sum : add })(1, 2)\n  expect(result).toEqual({ sum : 3 })\n})\n\ntest('works with nested specs', () =\u003e {\n  const result = applySpec({\n    unnested : always(0),\n    nested   : { sum : add },\n  })(1, 2)\n  const expected = {\n    unnested : 0,\n    nested   : { sum : 3 },\n  }\n  expect(result).toEqual(expected)\n})\n\ntest('works with arrays of nested specs', () =\u003e {\n  const result = applySpec({\n    unnested : always(0),\n    nested   : [ { sum : add } ],\n  })(1, 2)\n\n  expect(result).toEqual({\n    unnested : 0,\n    nested   : [ { sum : 3 } ],\n  })\n})\n\ntest('works with arrays of spec objects', () =\u003e {\n  const result = applySpec([ { sum : add } ])(1, 2)\n\n  expect(result).toEqual([ { sum : 3 } ])\n})\n\ntest('works with arrays of functions', () =\u003e {\n  const result = applySpec([ map(prop('a')), map(prop('b')) ])([\n    {\n      a : 'a1',\n      b : 'b1',\n    },\n    {\n      a : 'a2',\n      b : 'b2',\n    },\n  ])\n  const expected = [\n    [ 'a1', 'a2' ],\n    [ 'b1', 'b2' ],\n  ]\n  expect(result).toEqual(expected)\n})\n\ntest('works with a spec defining a map key', () =\u003e {\n  expect(applySpec({ map : prop('a') })({ a : 1 })).toEqual({ map : 1 })\n})\n\ntest('cannot retains the highest arity', () =\u003e {\n  const f = applySpec({\n    f1 : nAry(2, T),\n    f2 : nAry(5, T),\n  })\n  const fRamda = applySpecRamda({\n    f1 : nAry(2, T),\n    f2 : nAry(5, T),\n  })\n  expect(f).toHaveLength(0)\n  expect(fRamda).toHaveLength(5)\n})\n\ntest('returns a curried function', () =\u003e {\n  expect(applySpec({ sum : add })(1)(2)).toEqual({ sum : 3 })\n})\n\n// Additional tests\n// ============================================\ntest('arity', () =\u003e {\n  const spec = {\n    one   : x1 =\u003e x1,\n    two   : (x1, x2) =\u003e x1 + x2,\n    three : (\n      x1, x2, x3\n    ) =\u003e x1 + x2 + x3,\n  }\n  expect(applySpec(\n    spec, 1, 2, 3\n  )).toEqual({\n    one   : 1,\n    two   : 3,\n    three : 6,\n  })\n})\n\ntest('arity over 5 arguments', () =\u003e {\n  const spec = {\n    one   : x1 =\u003e x1,\n    two   : (x1, x2) =\u003e x1 + x2,\n    three : (\n      x1, x2, x3\n    ) =\u003e x1 + x2 + x3,\n    four : (\n      x1, x2, x3, x4\n    ) =\u003e x1 + x2 + x3 + x4,\n    five : (\n      x1, x2, x3, x4, x5\n    ) =\u003e x1 + x2 + x3 + x4 + x5,\n  }\n  expect(applySpec(\n    spec, 1, 2, 3, 4, 5\n  )).toEqual({\n    one   : 1,\n    two   : 3,\n    three : 6,\n    four  : 10,\n    five  : 15,\n  })\n})\n\ntest('curried', () =\u003e {\n  const spec = {\n    one   : x1 =\u003e x1,\n    two   : (x1, x2) =\u003e x1 + x2,\n    three : (\n      x1, x2, x3\n    ) =\u003e x1 + x2 + x3,\n  }\n  expect(applySpec(spec)(1)(2)(3)).toEqual({\n    one   : 1,\n    two   : 3,\n    three : 6,\n  })\n})\n\ntest('curried over 5 arguments', () =\u003e {\n  const spec = {\n    one   : x1 =\u003e x1,\n    two   : (x1, x2) =\u003e x1 + x2,\n    three : (\n      x1, x2, x3\n    ) =\u003e x1 + x2 + x3,\n    four : (\n      x1, x2, x3, x4\n    ) =\u003e x1 + x2 + x3 + x4,\n    five : (\n      x1, x2, x3, x4, x5\n    ) =\u003e x1 + x2 + x3 + x4 + x5,\n  }\n  expect(applySpec(spec)(1)(2)(3)(4)(5)).toEqual({\n    one   : 1,\n    two   : 3,\n    three : 6,\n    four  : 10,\n    five  : 15,\n  })\n})\n\ntest('undefined property', () =\u003e {\n  const spec = { prop : path([ 'property', 'doesnt', 'exist' ]) }\n  expect(applySpec(spec, {})).toEqual({ prop : undefined })\n})\n\ntest('restructure json object', () =\u003e {\n  const spec = {\n    id          : path('user.id'),\n    name        : path('user.firstname'),\n    profile     : path('user.profile'),\n    doesntExist : path('user.profile.doesntExist'),\n    info        : { views : compose(inc, prop('views')) },\n    type        : always('playa'),\n  }\n\n  const data = {\n    user : {\n      id        : 1337,\n      firstname : 'john',\n      lastname  : 'shaft',\n      profile   : 'shaft69',\n    },\n    views : 42,\n  }\n\n  expect(applySpec(spec, data)).toEqual({\n    id          : 1337,\n    name        : 'john',\n    profile     : 'shaft69',\n    doesntExist : undefined,\n    info        : { views : 43 },\n    type        : 'playa',\n  })\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {multiply, applySpec, inc, dec, add} from 'rambda'\n\ndescribe('applySpec', () =\u003e {\n  it('ramda 1', () =\u003e {\n    const result = applySpec({\n      v: inc,\n      u: dec,\n    })(1)\n    result // $ExpectType { v: number; u: number; }\n  })\n  it('ramda 1', () =\u003e {\n    interface Output {\n      sum: number,\n      multiplied: number,\n    }\n    const result = applySpec\u003cOutput\u003e({\n      sum: add,\n      multiplied: multiply,\n    })(1, 2)\n\n    result // $ExpectType Output\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#applySpec)\n\n### applyTo\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.applyTo(%0A%20%201%2C%0A%20%20x%20%3D%3E%20x%20%2B%201%0A)%0A%2F%2F%20%3D%3E%202\"\u003eTry this \u003cstrong\u003eR.applyTo\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#applyTo)\n\n### ascend\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.sort(%0A%20%20R.ascend(x%20%3D%3E%20x)%2C%0A%20%20%5B2%2C%201%5D%0A)%0A%2F%2F%20%3D%3E%20%5B1%2C%202%5D\"\u003eTry this \u003cstrong\u003eR.ascend\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#ascend)\n\n### assoc\n\nIt makes a shallow clone of `obj` with setting or overriding the property `prop` with `newValue`.\n\n\u003e :boom: This copies and flattens prototype properties\nonto the new object as well. All non-primitive properties are copied by\nreference.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.assoc('c'%2C%203%2C%20%7Ba%3A%201%2C%20b%3A%202%7D)%0A%2F%2F%20%3D%3E%20%7Ba%3A%201%2C%20b%3A%202%2C%20c%3A%203%7D\"\u003eTry this \u003cstrong\u003eR.assoc\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#assoc)\n\n### assocPath\n\n```typescript\n\nassocPath\u003cOutput\u003e(path: Path, newValue: any, obj: object): Output\n```\n\nIt makes a shallow clone of `obj` with setting or overriding with `newValue` the property found with `path`.\n\n```javascript\nconst path = 'b.c'\nconst newValue = 2\nconst obj = { a: 1 }\n\nR.assocPath(path, newValue, Record\u003cstring, unknown\u003e)\n// =\u003e { a : 1, b : { c : 2 }}\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20path%20%3D%20'b.c'%0Aconst%20newValue%20%3D%202%0Aconst%20obj%20%3D%20%7B%20a%3A%201%20%7D%0A%0Aconst%20result%20%3D%20R.assocPath(path%2C%20newValue%2C%20Record%3Cstring%2C%20unknown%3E)%0A%2F%2F%20%3D%3E%20%7B%20a%20%3A%201%2C%20b%20%3A%20%7B%20c%20%3A%202%20%7D%7D\"\u003eTry this \u003cstrong\u003eR.assocPath\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nassocPath\u003cOutput\u003e(path: Path, newValue: any, obj: object): Output;\nassocPath\u003cOutput\u003e(path: Path, newValue: any): (obj: object) =\u003e Output;\nassocPath\u003cOutput\u003e(path: Path): (newValue: any) =\u003e (obj: object) =\u003e Output;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.assocPath\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { cloneList } from './_internals/cloneList.js'\nimport { createPath } from './_internals/createPath.js'\nimport { isArray } from './_internals/isArray.js'\nimport { isIndexInteger } from './_internals/isInteger.js'\nimport { assocFn } from './assoc.js'\nimport { curry } from './curry.js'\n\nexport function assocPathFn(\n  path, newValue, input\n){\n  const pathArrValue = createPath(path)\n  if (pathArrValue.length === 0) return newValue\n\n  const index = pathArrValue[ 0 ]\n  if (pathArrValue.length \u003e 1){\n    const condition =\n      typeof input !== 'object' ||\n      input === null ||\n      !input.hasOwnProperty(index)\n\n    const nextInput = condition ?\n      isIndexInteger(pathArrValue[ 1 ]) ?\n        [] :\n        {} :\n      input[ index ]\n\n    newValue = assocPathFn(\n      Array.prototype.slice.call(pathArrValue, 1),\n      newValue,\n      nextInput\n    )\n  }\n\n  if (isIndexInteger(index) \u0026\u0026 isArray(input)){\n    const arr = cloneList(input)\n    arr[ index ] = newValue\n\n    return arr\n  }\n\n  return assocFn(\n    index, newValue, input\n  )\n}\n\nexport const assocPath = curry(assocPathFn)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { assocPathFn } from './assocPath.js'\n\ntest.only('happy', () =\u003e {\n  const path = 'a.c.1'\n  const input = {\n    a : {\n      b : 1,\n      c : [ 1, 2 ],\n    },\n  }\n  assocPathFn(\n    path, 3, input\n  )\n  expect(input).toEqual({\n    a : {\n      b : 1,\n      c : [ 1, 2 ],\n    },\n  })\n})\n\ntest('string can be used as path input', () =\u003e {\n  const testObj = {\n    a : [ { b : 1 }, { b : 2 } ],\n    d : 3,\n  }\n  const result1 = assocPathFn(\n    [ 'a', 0, 'b' ], 10, testObj\n  )\n  const result2 = assocPathFn(\n    'a.0.b', 10, testObj\n  )\n\n  const expected = {\n    a : [ { b : 10 }, { b : 2 } ],\n    d : 3,\n  }\n  expect(result1).toEqual(expected)\n  expect(result2).toEqual(expected)\n})\n\ntest('difference with ramda - doesn\\'t overwrite primitive values with keys in the path', () =\u003e {\n  const obj = { a : 'str' }\n  const result = assocPath(\n    [ 'a', 'b' ], 42, obj\n  )\n\n  expect(result).toEqual({\n    a : {\n      0 : 's',\n      1 : 't',\n      2 : 'r',\n      b : 42,\n    },\n  })\n})\n\ntest('bug', () =\u003e {\n  /*\n    https://github.com/selfrefactor/rambda/issues/524\n  */\n  const state = {}\n\n  const withDateLike = assocPath(\n    [ 'outerProp', '2020-03-10' ],\n    { prop : 2 },\n    state\n  )\n  const withNumber = assocPath(\n    [ 'outerProp', '5' ], { prop : 2 }, state\n  )\n\n  const withDateLikeExpected = { outerProp : { '2020-03-10' : { prop : 2 } } }\n  const withNumberExpected = { outerProp : { 5 : { prop : 2 } } }\n  expect(withDateLike).toEqual(withDateLikeExpected)\n  expect(withNumber).toEqual(withNumberExpected)\n})\n\ntest('adds a key to an empty object', () =\u003e {\n  expect(assocPath(\n    [ 'a' ], 1, {}\n  )).toEqual({ a : 1 })\n})\n\ntest('adds a key to a non-empty object', () =\u003e {\n  expect(assocPath(\n    'b', 2, { a : 1 }\n  )).toEqual({\n    a : 1,\n    b : 2,\n  })\n})\n\ntest('adds a nested key to a non-empty object', () =\u003e {\n  expect(assocPath(\n    'b.c', 2, { a : 1 }\n  )).toEqual({\n    a : 1,\n    b : { c : 2 },\n  })\n})\n\ntest('adds a nested key to a nested non-empty object - curry case 1', () =\u003e {\n  expect(assocPath('b.d',\n    3)({\n    a : 1,\n    b : { c : 2 },\n  })).toEqual({\n    a : 1,\n    b : {\n      c : 2,\n      d : 3,\n    },\n  })\n})\n\ntest('adds a key to a non-empty object - curry case 1', () =\u003e {\n  expect(assocPath('b', 2)({ a : 1 })).toEqual({\n    a : 1,\n    b : 2,\n  })\n})\n\ntest('adds a nested key to a non-empty object - curry case 1', () =\u003e {\n  expect(assocPath('b.c', 2)({ a : 1 })).toEqual({\n    a : 1,\n    b : { c : 2 },\n  })\n})\n\ntest('adds a key to a non-empty object - curry case 2', () =\u003e {\n  expect(assocPath('b')(2, { a : 1 })).toEqual({\n    a : 1,\n    b : 2,\n  })\n})\n\ntest('adds a key to a non-empty object - curry case 3', () =\u003e {\n  const result = assocPath('b')(2)({ a : 1 })\n\n  expect(result).toEqual({\n    a : 1,\n    b : 2,\n  })\n})\n\ntest('changes an existing key', () =\u003e {\n  expect(assocPath(\n    'a', 2, { a : 1 }\n  )).toEqual({ a : 2 })\n})\n\ntest('undefined is considered an empty object', () =\u003e {\n  expect(assocPath(\n    'a', 1, undefined\n  )).toEqual({ a : 1 })\n})\n\ntest('null is considered an empty object', () =\u003e {\n  expect(assocPath(\n    'a', 1, null\n  )).toEqual({ a : 1 })\n})\n\ntest('value can be null', () =\u003e {\n  expect(assocPath(\n    'a', null, null\n  )).toEqual({ a : null })\n})\n\ntest('value can be undefined', () =\u003e {\n  expect(assocPath(\n    'a', undefined, null\n  )).toEqual({ a : undefined })\n})\n\ntest('assignment is shallow', () =\u003e {\n  expect(assocPath(\n    'a', { b : 2 }, { a : { c : 3 } }\n  )).toEqual({ a : { b : 2 } })\n})\n\ntest('empty array as path', () =\u003e {\n  const result = assocPath(\n    [], 3, {\n      a : 1,\n      b : 2,\n    }\n  )\n  expect(result).toBe(3)\n})\n\ntest('happy', () =\u003e {\n  const expected = { foo : { bar : { baz : 42 } } }\n  const result = assocPath(\n    [ 'foo', 'bar', 'baz' ], 42, { foo : null }\n  )\n  expect(result).toEqual(expected)\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {assocPath} from 'rambda'\n\ninterface Output {\n  a: number,\n  foo: {bar: number},\n}\n\ndescribe('R.assocPath - user must explicitly set type of output', () =\u003e {\n  it('with array as path input', () =\u003e {\n    const result = assocPath\u003cOutput\u003e(['foo', 'bar'], 2, {a: 1})\n\n    result // $ExpectType Output\n  })\n  it('with string as path input', () =\u003e {\n    const result = assocPath\u003cOutput\u003e('foo.bar', 2, {a: 1})\n\n    result // $ExpectType Output\n  })\n})\n\ndescribe('R.assocPath - curried', () =\u003e {\n  it('with array as path input', () =\u003e {\n    const result = assocPath\u003cOutput\u003e(['foo', 'bar'], 2)({a: 1})\n\n    result // $ExpectType Output\n  })\n  it('with string as path input', () =\u003e {\n    const result = assocPath\u003cOutput\u003e('foo.bar', 2)({a: 1})\n\n    result // $ExpectType Output\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#assocPath)\n\n### binary\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.binary(%0A%20%20(a%2C%20b%2C%20c)%20%3D%3E%20a%20%2B%20b%20%2B%20c%2C%0A)(1%2C%202%2C%203%2C%204)%0A%2F%2F%20%3D%3E%203\"\u003eTry this \u003cstrong\u003eR.binary\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#binary)\n\n### bind\n\n```typescript\n\nbind\u003cF extends AnyFunction, T\u003e(fn: F, thisObj: T): (...args: Parameters\u003cF\u003e) =\u003e ReturnType\u003cF\u003e\n```\n\nCreates a function that is bound to a context.\n\n\u003e :boom: R.bind does not provide the additional argument-binding capabilities of `Function.prototype.bind`.\n\n```javascript\nconst log = R.bind(console.log, console)\nconst result = R.pipe(\n  R.assoc('a', 2), \n  R.tap(log), \n  R.assoc('a', 3)\n)({a: 1}); \n// =\u003e result - `{a: 3}`\n// =\u003e console log - `{a: 2}`\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20log%20%3D%20R.bind(console.log%2C%20console)%0Aconst%20result%20%3D%20R.pipe(%0A%20%20R.assoc('a'%2C%202)%2C%20%0A%20%20R.tap(log)%2C%20%0A%20%20R.assoc('a'%2C%203)%0A)(%7Ba%3A%201%7D)%3B%20%0A%2F%2F%20%3D%3E%20result%20-%20%60%7Ba%3A%203%7D%60%0A%2F%2F%20%3D%3E%20console%20log%20-%20%60%7Ba%3A%202%7D%60\"\u003eTry this \u003cstrong\u003eR.bind\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nbind\u003cF extends AnyFunction, T\u003e(fn: F, thisObj: T): (...args: Parameters\u003cF\u003e) =\u003e ReturnType\u003cF\u003e;\nbind\u003cF extends AnyFunction, T\u003e(fn: F): (thisObj: T) =\u003e (...args: Parameters\u003cF\u003e) =\u003e ReturnType\u003cF\u003e;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.bind\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { curryN } from './curryN.js'\n\nexport function bind(fn, thisObj){\n  if (arguments.length === 1){\n    return _thisObj =\u003e bind(fn, _thisObj)\n  }\n\n  return curryN(fn.length, (...args) =\u003e fn.apply(thisObj, args))\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { bind } from './bind.js'\n\nfunction Foo(x){\n  this.x = x\n}\nfunction add(x){\n  return this.x + x\n}\nfunction Bar(x, y){\n  this.x = x\n  this.y = y\n}\nBar.prototype = new Foo()\nBar.prototype.getX = function (){\n  return 'prototype getX'\n}\n\ntest('returns a function', () =\u003e {\n  expect(typeof bind(add)(Foo)).toBe('function')\n})\n\ntest('returns a function bound to the specified context object', () =\u003e {\n  const f = new Foo(12)\n  function isFoo(){\n    return this instanceof Foo\n  }\n  const isFooBound = bind(isFoo, f)\n  expect(isFoo()).toBeFalse()\n  expect(isFooBound()).toBeTrue()\n})\n\ntest('works with built-in types', () =\u003e {\n  const abc = bind(String.prototype.toLowerCase, 'ABCDEFG')\n  expect(typeof abc).toBe('function')\n  expect(abc()).toBe('abcdefg')\n})\n\ntest('works with user-defined types', () =\u003e {\n  const f = new Foo(12)\n  function getX(){\n    return this.x\n  }\n  const getXFooBound = bind(getX, f)\n  expect(getXFooBound()).toBe(12)\n})\n\ntest('works with plain objects', () =\u003e {\n  const pojso = { x : 100 }\n  function incThis(){\n    return this.x + 1\n  }\n  const incPojso = bind(incThis, pojso)\n  expect(typeof incPojso).toBe('function')\n  expect(incPojso()).toBe(101)\n})\n\ntest('does not interfere with existing object methods', () =\u003e {\n  const b = new Bar('a', 'b')\n  function getX(){\n    return this.x\n  }\n  const getXBarBound = bind(getX, b)\n  expect(b.getX()).toBe('prototype getX')\n  expect(getXBarBound()).toBe('a')\n})\n\ntest('preserves arity', () =\u003e {\n  const f0 = function (){\n    return 0\n  }\n  const f1 = function (a){\n    return a\n  }\n  const f2 = function (a, b){\n    return a + b\n  }\n  const f3 = function (\n    a, b, c\n  ){\n    return a + b + c\n  }\n\n  expect(bind(f0, {})).toHaveLength(0)\n  expect(bind(f1, {})).toHaveLength(1)\n  expect(bind(f2, {})).toHaveLength(2)\n  expect(bind(f3, {})).toHaveLength(3)\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {bind} from 'rambda'\n\nclass Foo {}\nfunction isFoo\u003cT = any\u003e(this: T): boolean {\n  return this instanceof Foo\n}\n\ndescribe('R.bind', () =\u003e {\n  it('happy', () =\u003e {\n    const foo = new Foo()\n    const result = bind(isFoo, foo)()\n\n    result // $ExpectType boolean\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#bind)\n\n### both\n\n```typescript\n\nboth(pred1: Pred, pred2: Pred): Pred\n```\n\nIt returns a function with `input` argument. \n\nThis function will return `true`, if both `firstCondition` and `secondCondition` return `true` when `input` is passed as their argument.\n\n```javascript\nconst firstCondition = x =\u003e x \u003e 10\nconst secondCondition = x =\u003e x \u003c 20\nconst fn = R.both(firstCondition, secondCondition)\n\nconst result = [fn(15), fn(30)]\n// =\u003e [true, false]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20firstCondition%20%3D%20x%20%3D%3E%20x%20%3E%2010%0Aconst%20secondCondition%20%3D%20x%20%3D%3E%20x%20%3C%2020%0Aconst%20fn%20%3D%20R.both(firstCondition%2C%20secondCondition)%0A%0Aconst%20result%20%3D%20%5Bfn(15)%2C%20fn(30)%5D%0A%2F%2F%20%3D%3E%20%5Btrue%2C%20false%5D\"\u003eTry this \u003cstrong\u003eR.both\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nboth(pred1: Pred, pred2: Pred): Pred;\nboth\u003cT\u003e(pred1: Predicate\u003cT\u003e, pred2: Predicate\u003cT\u003e): Predicate\u003cT\u003e;\nboth\u003cT\u003e(pred1: Predicate\u003cT\u003e): (pred2: Predicate\u003cT\u003e) =\u003e Predicate\u003cT\u003e;\nboth(pred1: Pred): (pred2: Pred) =\u003e Pred;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.both\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function both(f, g){\n  if (arguments.length === 1) return _g =\u003e both(f, _g)\n\n  return (...input) =\u003e f(...input) \u0026\u0026 g(...input)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { both } from './both.js'\n\nconst firstFn = val =\u003e val \u003e 0\nconst secondFn = val =\u003e val \u003c 10\n\ntest('with curry', () =\u003e {\n  expect(both(firstFn)(secondFn)(17)).toBeFalse()\n})\n\ntest('without curry', () =\u003e {\n  expect(both(firstFn, secondFn)(7)).toBeTrue()\n})\n\ntest('with multiple inputs', () =\u003e {\n  const between = function (\n    a, b, c\n  ){\n    return a \u003c b \u0026\u0026 b \u003c c\n  }\n  const total20 = function (\n    a, b, c\n  ){\n    return a + b + c === 20\n  }\n  const fn = both(between, total20)\n  expect(fn(\n    5, 7, 8\n  )).toBeTrue()\n})\n\ntest('skip evaluation of the second expression', () =\u003e {\n  let effect = 'not evaluated'\n  const F = function (){\n    return false\n  }\n  const Z = function (){\n    effect = 'Z got evaluated'\n  }\n  both(F, Z)()\n\n  expect(effect).toBe('not evaluated')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {both} from 'rambda'\n\ndescribe('R.both', () =\u003e {\n  it('with passed type', () =\u003e {\n    const fn = both\u003cnumber\u003e(\n      x =\u003e x \u003e 1,\n      x =\u003e x % 2 === 0\n    )\n    fn // $ExpectType Predicate\u003cnumber\u003e\n    const result = fn(2) // $ExpectType boolean\n    result // $ExpectType boolean\n  })\n  it('with passed type - curried', () =\u003e {\n    const fn = both\u003cnumber\u003e(x =\u003e x \u003e 1)(x =\u003e x % 2 === 0)\n    fn // $ExpectType Predicate\u003cnumber\u003e\n    const result = fn(2)\n    result // $ExpectType boolean\n  })\n  it('no type passed', () =\u003e {\n    const fn = both(\n      x =\u003e {\n        x // $ExpectType any\n        return x \u003e 1\n      },\n      x =\u003e {\n        x // $ExpectType any\n        return x % 2 === 0\n      }\n    )\n    const result = fn(2)\n    result // $ExpectType boolean\n  })\n  it('no type passed - curried', () =\u003e {\n    const fn = both((x: number) =\u003e {\n      x // $ExpectType number\n      return x \u003e 1\n    })((x: number) =\u003e {\n      x // $ExpectType number\n      return x % 2 === 0\n    })\n    const result = fn(2)\n    result // $ExpectType boolean\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#both)\n\n### call\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.call(%0A%20%20(a%2C%20b)%20%3D%3E%20a%20%2B%20b%2C%0A%20%201%2C%0A%20%202%0A)%0A%2F%2F%20%3D%3E%203\"\u003eTry this \u003cstrong\u003eR.call\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#call)\n\n### chain\n\n```typescript\n\nchain\u003cT, U\u003e(fn: (n: T) =\u003e U[], list: T[]): U[]\n```\n\nThe method is also known as `flatMap`.\n\n```javascript\nconst duplicate = n =\u003e [ n, n ]\nconst list = [ 1, 2, 3 ]\n\nconst result = chain(duplicate, list)\n// =\u003e [ 1, 1, 2, 2, 3, 3 ]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20duplicate%20%3D%20n%20%3D%3E%20%5B%20n%2C%20n%20%5D%0Aconst%20list%20%3D%20%5B%201%2C%202%2C%203%20%5D%0A%0Aconst%20result%20%3D%20chain(duplicate%2C%20list)%0A%2F%2F%20%3D%3E%20%5B%201%2C%201%2C%202%2C%202%2C%203%2C%203%20%5D\"\u003eTry this \u003cstrong\u003eR.chain\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nchain\u003cT, U\u003e(fn: (n: T) =\u003e U[], list: T[]): U[];\nchain\u003cT, U\u003e(fn: (n: T) =\u003e U[]): (list: T[]) =\u003e U[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.chain\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function chain(fn, list){\n  if (arguments.length === 1){\n    return _list =\u003e chain(fn, _list)\n  }\n\n  return [].concat(...list.map(fn))\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { chain as chainRamda } from 'ramda'\n\nimport { chain } from './chain.js'\n\nconst duplicate = n =\u003e [ n, n ]\n\ntest('happy', () =\u003e {\n  const fn = x =\u003e [ x * 2 ]\n  const list = [ 1, 2, 3 ]\n\n  const result = chain(fn, list)\n\n  expect(result).toEqual([ 2, 4, 6 ])\n})\n\ntest('maps then flattens one level', () =\u003e {\n  expect(chain(duplicate, [ 1, 2, 3 ])).toEqual([ 1, 1, 2, 2, 3, 3 ])\n})\n\ntest('maps then flattens one level - curry', () =\u003e {\n  expect(chain(duplicate)([ 1, 2, 3 ])).toEqual([ 1, 1, 2, 2, 3, 3 ])\n})\n\ntest('flattens only one level', () =\u003e {\n  const nest = n =\u003e [ [ n ] ]\n  expect(chain(nest, [ 1, 2, 3 ])).toEqual([ [ 1 ], [ 2 ], [ 3 ] ])\n})\n\ntest('can compose', () =\u003e {\n  function dec(x){\n    return [ x - 1 ]\n  }\n  function times2(x){\n    return [ x * 2 ]\n  }\n\n  const mdouble = chain(times2)\n  const mdec = chain(dec)\n  expect(mdec(mdouble([ 10, 20, 30 ]))).toEqual([ 19, 39, 59 ])\n})\n\ntest('@types/ramda broken test', () =\u003e {\n  const score = {\n    maths   : 90,\n    physics : 80,\n  }\n\n  const calculateTotal = score =\u003e {\n    const { maths, physics } = score\n\n    return maths + physics\n  }\n\n  const assocTotalToScore = (total, score) =\u003e ({\n    ...score,\n    total,\n  })\n\n  const calculateAndAssocTotalToScore = chainRamda(assocTotalToScore,\n    calculateTotal)\n  expect(() =\u003e\n    calculateAndAssocTotalToScore(score)).toThrowErrorMatchingInlineSnapshot('\"fn(...) is not a function\"')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {chain} from 'rambda'\n\nconst list = [1, 2, 3]\nconst fn = (x: number) =\u003e [`${x}`, `${x}`]\n\ndescribe('R.chain', () =\u003e {\n  it('without passing type', () =\u003e {\n    const result = chain(fn, list)\n    result // $ExpectType string[]\n\n    const curriedResult = chain(fn)(list)\n    curriedResult // $ExpectType string[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#chain)\n\n### clamp\n\nRestrict a number `input` to be within `min` and `max` limits.\n\nIf `input` is bigger than `max`, then the result is `max`.\n\nIf `input` is smaller than `min`, then the result is `min`.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5B%0A%20%20R.clamp(0%2C%2010%2C%205)%2C%20%0A%20%20R.clamp(0%2C%2010%2C%20-1)%2C%0A%20%20R.clamp(0%2C%2010%2C%2011)%0A%5D%0A%2F%2F%20%3D%3E%20%5B5%2C%200%2C%2010%5D\"\u003eTry this \u003cstrong\u003eR.clamp\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#clamp)\n\n### clone\n\nIt creates a deep copy of the `input`, which may contain (nested) Arrays and Objects, Numbers, Strings, Booleans and Dates.\n\n\u003e :boom: It doesn't work with very specific types, such as MongoDB's ObjectId.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20objects%20%3D%20%5B%7Ba%3A%201%7D%2C%20%7Bb%3A%202%7D%5D%3B%0Aconst%20objectsClone%20%3D%20R.clone(objects)%3B%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.equals(objects%2C%20objectsClone)%2C%0A%20%20R.equals(objects%5B0%5D%2C%20objectsClone%5B0%5D)%2C%0A%5D%20%2F%2F%20%3D%3E%20%5B%20true%2C%20true%20%5D\"\u003eTry this \u003cstrong\u003eR.clone\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#clone)\n\n### collectBy\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.collectBy(%0A%20%20x%20%3D%3E%20x%20%25%202%2C%0A%20%20%5B1%2C%202%2C%203%2C%204%5D%0A)%0A%2F%2F%20%3D%3E%20%5B%5B2%2C%204%5D%2C%20%5B1%2C%203%5D%5D\"\u003eTry this \u003cstrong\u003eR.collectBy\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#collectBy)\n\n### comparator\n\nIt returns a comparator function that can be used in `sort` method.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.sort(%0A%20%20R.comparator((a%2C%20b)%20%3D%3E%20a.x%20%3C%20b.x)%2C%0A%20%20%5B%7Bx%3A%202%7D%2C%20%7Bx%3A%201%7D%5D%0A)%0A%2F%2F%20%3D%3E%20%5B%7Bx%3A%201%7D%2C%20%7Bx%3A%202%7D%5D\"\u003eTry this \u003cstrong\u003eR.comparator\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#comparator)\n\n### complement\n\nIt returns `inverted` version of `origin` function that accept `input` as argument.\n\nThe return value of `inverted` is the negative boolean value of `origin(input)`.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20origin%20%3D%20x%20%3D%3E%20x%20%3E%205%0Aconst%20inverted%20%3D%20complement(origin)%0A%0Aconst%20result%20%3D%20%5B%0A%20%20origin(7)%2C%0A%20%20inverted(7)%0A%5D%20%3D%3E%20%5B%20true%2C%20false%20%5D\"\u003eTry this \u003cstrong\u003eR.complement\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#complement)\n\n### compose\n\nIt performs right-to-left function composition.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.compose(%0A%20%20R.map(x%20%3D%3E%20x%20*%202)%2C%0A%20%20R.filter(x%20%3D%3E%20x%20%3E%202)%0A)(%5B1%2C%202%2C%203%2C%204%5D)%0A%0A%2F%2F%20%3D%3E%20%5B6%2C%208%5D\"\u003eTry this \u003cstrong\u003eR.compose\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#compose)\n\n### composeWith\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.composeWith(%0A%20%20(fn%2C%20intermediateResult)%20%3D%3E%20fn(intermediateResult)%2C%0A%20%20%5B%0A%20%20%20%20R.map(x%20%3D%3E%20x%20%2B%201)%2C%0A%20%20%20%20R.map(x%20%3D%3E%20x%20*%202)%2C%0A%20%20%5D%0A)(%5B1%2C%202%2C%203%5D)%0A%2F%2F%20%3D%3E%20%5B3%2C%205%2C%207%5D\"\u003eTry this \u003cstrong\u003eR.composeWith\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#composeWith)\n\n### concat\n\nIt returns a new string or array, which is the result of merging `x` and `y`.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?R.concat(%5B1%2C%202%5D)(%5B3%2C%204%5D)%20%2F%2F%20%3D%3E%20%5B1%2C%202%2C%203%2C%204%5D%0Aconst%20result%20%3D%20R.concat('foo'%2C%20'bar')%20%2F%2F%20%3D%3E%20'foobar'\"\u003eTry this \u003cstrong\u003eR.concat\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#concat)\n\n### cond\n\nIt takes list with `conditions` and returns a new function `fn` that expects `input` as argument. \n\nThis function will start evaluating the `conditions` in order to find the first winner(order of conditions matter). \n\nThe winner is this condition, which left side returns `true` when `input` is its argument. Then the evaluation of the right side of the winner will be the final result.\n\nIf no winner is found, then `fn` returns `undefined`.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20fn%20%3D%20R.cond(%5B%0A%20%20%5B%20x%20%3D%3E%20x%20%3E%2025%2C%20R.always('more%20than%2025')%20%5D%2C%0A%20%20%5B%20x%20%3D%3E%20x%20%3E%2015%2C%20R.always('more%20than%2015')%20%5D%2C%0A%20%20%5B%20R.T%2C%20x%20%3D%3E%20%60%24%7Bx%7D%20is%20nothing%20special%60%20%5D%2C%0A%5D)%0A%0Aconst%20result%20%3D%20%5B%0A%20%20fn(30)%2C%0A%20%20fn(20)%2C%0A%20%20fn(10)%2C%0A%5D%20%0A%2F%2F%20%3D%3E%20%5B'more%20than%2025'%2C%20'more%20than%2015'%2C%20'10%20is%20nothing%20special'%5D\"\u003eTry this \u003cstrong\u003eR.cond\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#cond)\n\n### converge\n\nAccepts a converging function and a list of branching functions and returns a new function. When invoked, this new function is applied to some arguments, each branching function is applied to those same arguments. The results of each branching function are passed as arguments to the converging function to produce the return value.\n\n\u003e :boom: Explanation is taken from `Ramda` documentation\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.converge(R.multiply)(%5B%20R.add(1)%2C%20R.add(3)%20%5D)(2)%0A%2F%2F%20%3D%3E%2015\"\u003eTry this \u003cstrong\u003eR.converge\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#converge)\n\n### count\n\nIt counts how many times `predicate` function returns `true`, when supplied with iteration of `list`.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B%7Ba%3A%201%7D%2C%201%2C%20%7Ba%3A2%7D%5D%0Aconst%20result%20%3D%20R.count(x%20%3D%3E%20x.a%20!%3D%3D%20undefined%2C%20list)%0A%2F%2F%20%3D%3E%202\"\u003eTry this \u003cstrong\u003eR.count\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#count)\n\n### countBy\n\n```typescript\n\ncountBy\u003cT extends unknown\u003e(transformFn: (x: T) =\u003e any, list: T[]): Record\u003cstring, number\u003e\n```\n\nIt counts elements in a list after each instance of the input list is passed through `transformFn` function.\n\n```javascript\nconst list = [ 'a', 'A', 'b', 'B', 'c', 'C' ]\n\nconst result = countBy(R.toLower, list)\nconst expected = { a: 2, b: 2, c: 2 }\n// =\u003e `result` is equal to `expected`\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B%20'a'%2C%20'A'%2C%20'b'%2C%20'B'%2C%20'c'%2C%20'C'%20%5D%0A%0Aconst%20result%20%3D%20countBy(R.toLower%2C%20list)%0Aconst%20expected%20%3D%20%7B%20a%3A%202%2C%20b%3A%202%2C%20c%3A%202%20%7D%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60\"\u003eTry this \u003cstrong\u003eR.countBy\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\ncountBy\u003cT extends unknown\u003e(transformFn: (x: T) =\u003e any, list: T[]): Record\u003cstring, number\u003e;\ncountBy\u003cT extends unknown\u003e(transformFn: (x: T) =\u003e any): (list: T[]) =\u003e Record\u003cstring, number\u003e;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.countBy\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function countBy(fn, list){\n  if (arguments.length === 1){\n    return _list =\u003e countBy(fn, _list)\n  }\n  const willReturn = {}\n\n  list.forEach(item =\u003e {\n    const key = fn(item)\n    if (!willReturn[ key ]){\n      willReturn[ key ] = 1\n    } else {\n      willReturn[ key ]++\n    }\n  })\n\n  return willReturn\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { countBy } from './countBy.js'\n\nconst list = [ 'a', 'A', 'b', 'B', 'c', 'C' ]\n\ntest('happy', () =\u003e {\n  const result = countBy(x =\u003e x.toLowerCase(), list)\n  expect(result).toEqual({\n    a : 2,\n    b : 2,\n    c : 2,\n  })\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {countBy} from 'rambda'\n\nconst transformFn = (x: string) =\u003e x.toLowerCase()\nconst list = ['a', 'A', 'b', 'B', 'c', 'C']\n\ndescribe('R.countBy', () =\u003e {\n  it('happy', () =\u003e {\n    const result = countBy(transformFn, list)\n\n    result // $ExpectType Record\u003cstring, number\u003e\n  })\n  it('curried', () =\u003e {\n    const result = countBy(transformFn)(list)\n\n    result // $ExpectType Record\u003cstring, number\u003e\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#countBy)\n\n### curry\n\nIt expects a function as input and returns its curried version.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20fn%20%3D%20(a%2C%20b%2C%20c)%20%3D%3E%20a%20%2B%20b%20%2B%20c%0Aconst%20curried%20%3D%20R.curry(fn)%0Aconst%20sum%20%3D%20curried(1%2C2)%0A%0Aconst%20result%20%3D%20sum(3)%20%2F%2F%20%3D%3E%206\"\u003eTry this \u003cstrong\u003eR.curry\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#curry)\n\n### curryN\n\nIt returns a curried equivalent of the provided function, with the specified arity.\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#curryN)\n\n### dec\n\nIt decrements a number.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.dec(2)%20%2F%2F%20%3D%3E%201\"\u003eTry this \u003cstrong\u003eR.dec\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#dec)\n\n### defaultTo\n\n```typescript\n\ndefaultTo\u003cT\u003e(defaultValue: T, input: T | null | undefined): T\n```\n\nIt returns `defaultValue`, if all of `inputArguments` are `undefined`, `null` or `NaN`.\n\nElse, it returns the first truthy `inputArguments` instance(from left to right).\n\n\u003e :boom: Rambda's **defaultTo** accept indefinite number of arguments when non curried, i.e. `R.defaultTo(2, foo, bar, baz)`.\n\n```javascript\nR.defaultTo('foo', 'bar') // =\u003e 'bar'\nR.defaultTo('foo', undefined) // =\u003e 'foo'\n\n// Important - emtpy string is not falsy value(same as Ramda)\nR.defaultTo('foo', '') // =\u003e 'foo'\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?R.defaultTo('foo'%2C%20'bar')%20%2F%2F%20%3D%3E%20'bar'%0AR.defaultTo('foo'%2C%20undefined)%20%2F%2F%20%3D%3E%20'foo'%0A%0A%2F%2F%20Important%20-%20emtpy%20string%20is%20not%20falsy%20value(same%20as%20Ramda)%0Aconst%20result%20%3D%20R.defaultTo('foo'%2C%20'')%20%2F%2F%20%3D%3E%20'foo'\"\u003eTry this \u003cstrong\u003eR.defaultTo\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\ndefaultTo\u003cT\u003e(defaultValue: T, input: T | null | undefined): T;\ndefaultTo\u003cT\u003e(defaultValue: T): (input: T | null | undefined) =\u003e T;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.defaultTo\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nfunction isFalsy(input){\n  return (\n    input === undefined || input === null || Number.isNaN(input) === true\n  )\n}\n\nexport function defaultTo(defaultArgument, input){\n  if (arguments.length === 1){\n    return _input =\u003e defaultTo(defaultArgument, _input)\n  }\n\n  return isFalsy(input) ? defaultArgument : input\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { defaultTo } from './defaultTo.js'\n\ntest('with undefined', () =\u003e {\n  expect(defaultTo('foo')(undefined)).toBe('foo')\n})\n\ntest('with null', () =\u003e {\n  expect(defaultTo('foo')(null)).toBe('foo')\n})\n\ntest('with NaN', () =\u003e {\n  expect(defaultTo('foo')(NaN)).toBe('foo')\n})\n\ntest('with empty string', () =\u003e {\n  expect(defaultTo('foo', '')).toBe('')\n})\n\ntest('with false', () =\u003e {\n  expect(defaultTo('foo', false)).toBeFalse()\n})\n\ntest('when inputArgument passes initial check', () =\u003e {\n  expect(defaultTo('foo', 'bar')).toBe('bar')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {defaultTo} from 'rambda'\n\ndescribe('R.defaultTo with Ramda spec', () =\u003e {\n  it('happy', () =\u003e {\n    const result = defaultTo('foo', '')\n    result // $ExpectType \"\" | \"foo\"\n  })\n  it('with explicit type', () =\u003e {\n    const result = defaultTo\u003cstring\u003e('foo', null)\n    result // $ExpectType string\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#defaultTo)\n\n### descend\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?R.sort(%0A%20%20R.descend(x%20%3D%3E%20x)%2C%0A%20%20%5B1%2C%202%5D%0Aconst%20result%20%3D%20)%0A%2F%2F%20%3D%3E%20%5B2%2C%201%5D\"\u003eTry this \u003cstrong\u003eR.descend\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#descend)\n\n### difference\n\n```typescript\n\ndifference\u003cT\u003e(a: T[], b: T[]): T[]\n```\n\nIt returns the uniq set of all elements in the first list `a` not contained in the second list `b`.\n\n`R.equals` is used to determine equality.\n\n```javascript\nconst a = [ 1, 2, 3, 4 ]\nconst b = [ 3, 4, 5, 6 ]\n\nconst result = R.difference(a, b)\n// =\u003e [ 1, 2 ]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20a%20%3D%20%5B%201%2C%202%2C%203%2C%204%20%5D%0Aconst%20b%20%3D%20%5B%203%2C%204%2C%205%2C%206%20%5D%0A%0Aconst%20result%20%3D%20R.difference(a%2C%20b)%0A%2F%2F%20%3D%3E%20%5B%201%2C%202%20%5D\"\u003eTry this \u003cstrong\u003eR.difference\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\ndifference\u003cT\u003e(a: T[], b: T[]): T[];\ndifference\u003cT\u003e(a: T[]): (b: T[]) =\u003e T[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.difference\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { includes } from './includes.js'\nimport { uniq } from './uniq.js'\n\nexport function difference(a, b){\n  if (arguments.length === 1) return _b =\u003e difference(a, _b)\n\n  return uniq(a).filter(aInstance =\u003e !includes(aInstance, b))\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { difference as differenceRamda } from 'ramda'\n\nimport { difference } from './difference.js'\n\ntest('difference', () =\u003e {\n  const a = [ 1, 2, 3, 4 ]\n  const b = [ 3, 4, 5, 6 ]\n  expect(difference(a)(b)).toEqual([ 1, 2 ])\n\n  expect(difference([], [])).toEqual([])\n})\n\ntest('difference with objects', () =\u003e {\n  const a = [ { id : 1 }, { id : 2 }, { id : 3 }, { id : 4 } ]\n  const b = [ { id : 3 }, { id : 4 }, { id : 5 }, { id : 6 } ]\n  expect(difference(a, b)).toEqual([ { id : 1 }, { id : 2 } ])\n})\n\ntest('no duplicates in first list', () =\u003e {\n  const M2 = [ 1, 2, 3, 4, 1, 2, 3, 4 ]\n  const N2 = [ 3, 3, 4, 4, 5, 5, 6, 6 ]\n  expect(difference(M2, N2)).toEqual([ 1, 2 ])\n})\n\ntest('should use R.equals', () =\u003e {\n  expect(difference([ 1 ], [ 1 ])).toHaveLength(0)\n  expect(differenceRamda([ NaN ], [ NaN ])).toHaveLength(0)\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {difference} from 'rambda'\n\nconst list1 = [1, 2, 3]\nconst list2 = [1, 2, 4]\n\ndescribe('R.difference', () =\u003e {\n  it('happy', () =\u003e {\n    const result = difference(list1, list2)\n\n    result // $ExpectType number[]\n  })\n  it('curried', () =\u003e {\n    const result = difference(list1)(list2)\n\n    result // $ExpectType number[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#difference)\n\n### differenceWith\n\n```typescript\n\ndifferenceWith\u003cT1, T2\u003e(\n  pred: (a: T1, b: T2) =\u003e boolean,\n  list1: T1[],\n  list2: T2[],\n): T1[]\n```\n\n```javascript\nconst result = R.differenceWith(\n  (a, b) =\u003e a.x === b.x,\n  [{x: 1}, {x: 2}],\n  [{x: 1}, {x: 3}]\n)\n// =\u003e [{x: 2}]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.differenceWith(%0A%20%20(a%2C%20b)%20%3D%3E%20a.x%20%3D%3D%3D%20b.x%2C%0A%20%20%5B%7Bx%3A%201%7D%2C%20%7Bx%3A%202%7D%5D%2C%0A%20%20%5B%7Bx%3A%201%7D%2C%20%7Bx%3A%203%7D%5D%0A)%0A%2F%2F%20%3D%3E%20%5B%7Bx%3A%202%7D%5D\"\u003eTry this \u003cstrong\u003eR.differenceWith\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\ndifferenceWith\u003cT1, T2\u003e(\n  pred: (a: T1, b: T2) =\u003e boolean,\n  list1: T1[],\n  list2: T2[],\n): T1[];\ndifferenceWith\u003cT1, T2\u003e(\n  pred: (a: T1, b: T2) =\u003e boolean,\n): (list1: T1[], list2: T2[]) =\u003e T1[];\ndifferenceWith\u003cT1, T2\u003e(\n  pred: (a: T1, b: T2) =\u003e boolean,\n  list1: T1[],\n): (list2: T2[]) =\u003e T1[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.differenceWith\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { curry } from './curry.js'\nimport { _indexOf } from './equals.js'\n\nexport function differenceWithFn(\n  fn, a, b\n){\n  const willReturn = []\n  const [ first, second ] = a.length \u003e b.length ? [ a, b ] : [ b, a ]\n\n  first.forEach(item =\u003e {\n    const hasItem = second.some(secondItem =\u003e fn(item, secondItem))\n    if (!hasItem \u0026\u0026 _indexOf(item, willReturn) === -1){\n      willReturn.push(item)\n    }\n  })\n\n  return willReturn\n}\n\nexport const differenceWith = curry(differenceWithFn)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { differenceWith } from './differenceWith.js'\n\ntest('happy', () =\u003e {\n  const foo = [ { a : 1 }, { a : 2 }, { a : 3 } ]\n  const bar = [ { a : 3 }, { a : 4 } ]\n  const fn = function (r, s){\n    return r.a === s.a\n  }\n  const result = differenceWith(\n    fn, foo, bar\n  )\n  expect(result).toEqual([ { a : 1 }, { a : 2 } ])\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#differenceWith)\n\n### dissoc\n\nIt returns a new object that does not contain property `prop`.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.dissoc('b'%2C%20%7Ba%3A%201%2C%20b%3A%202%2C%20c%3A%203%7D)%0A%2F%2F%20%3D%3E%20%7Ba%3A%201%2C%20c%3A%203%7D\"\u003eTry this \u003cstrong\u003eR.dissoc\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#dissoc)\n\n### dissocPath\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.dissocPath(%5B'a'%2C%20'b'%5D%2C%20%7Ba%3A%20%7Bb%3A%201%2C%20c%3A%202%7D%7D)%0A%2F%2F%20%3D%3E%20%7Ba%3A%20%7Bc%3A%202%7D%7D\"\u003eTry this \u003cstrong\u003eR.dissocPath\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#dissocPath)\n\n### divide\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.divide(71%2C%20100)%20%2F%2F%20%3D%3E%200.71\"\u003eTry this \u003cstrong\u003eR.divide\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#divide)\n\n### drop\n\n```typescript\n\ndrop\u003cT\u003e(howMany: number, input: T[]): T[]\n```\n\nIt returns `howMany` items dropped from beginning of list or string `input`.\n\n```javascript\nR.drop(2, ['foo', 'bar', 'baz']) // =\u003e ['baz']\nR.drop(2, 'foobar')  // =\u003e 'obar'\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?R.drop(2%2C%20%5B'foo'%2C%20'bar'%2C%20'baz'%5D)%20%2F%2F%20%3D%3E%20%5B'baz'%5D%0Aconst%20result%20%3D%20R.drop(2%2C%20'foobar')%20%20%2F%2F%20%3D%3E%20'obar'\"\u003eTry this \u003cstrong\u003eR.drop\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\ndrop\u003cT\u003e(howMany: number, input: T[]): T[];\ndrop(howMany: number, input: string): string;\ndrop\u003cT\u003e(howMany: number): {\n  \u003cT\u003e(input: T[]): T[];\n  (input: string): string;\n};\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.drop\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function drop(howManyToDrop, listOrString){\n  if (arguments.length === 1) return _list =\u003e drop(howManyToDrop, _list)\n\n  return listOrString.slice(howManyToDrop \u003e 0 ? howManyToDrop : 0)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport assert from 'assert'\n\nimport { drop } from './drop.js'\n\ntest('with array', () =\u003e {\n  expect(drop(2)([ 'foo', 'bar', 'baz' ])).toEqual([ 'baz' ])\n  expect(drop(3, [ 'foo', 'bar', 'baz' ])).toEqual([])\n  expect(drop(4, [ 'foo', 'bar', 'baz' ])).toEqual([])\n})\n\ntest('with string', () =\u003e {\n  expect(drop(3, 'rambda')).toBe('bda')\n})\n\ntest('with non-positive count', () =\u003e {\n  expect(drop(0, [ 1, 2, 3 ])).toEqual([ 1, 2, 3 ])\n  expect(drop(-1, [ 1, 2, 3 ])).toEqual([ 1, 2, 3 ])\n  expect(drop(-Infinity, [ 1, 2, 3 ])).toEqual([ 1, 2, 3 ])\n})\n\ntest('should return copy', () =\u003e {\n  const xs = [ 1, 2, 3 ]\n\n  assert.notStrictEqual(drop(0, xs), xs)\n  assert.notStrictEqual(drop(-1, xs), xs)\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {drop} from 'rambda'\n\nconst list = [1, 2, 3, 4]\nconst str = 'foobar'\nconst howMany = 2\n\ndescribe('R.drop - array', () =\u003e {\n  it('happy', () =\u003e {\n    const result = drop(howMany, list)\n    result // $ExpectType number[]\n  })\n  it('curried', () =\u003e {\n    const result = drop(howMany)(list)\n    result // $ExpectType number[]\n  })\n})\n\ndescribe('R.drop - string', () =\u003e {\n  it('happy', () =\u003e {\n    const result = drop(howMany, str)\n    result // $ExpectType string\n  })\n  it('curried', () =\u003e {\n    const result = drop(howMany)(str)\n    result // $ExpectType string\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#drop)\n\n### dropLast\n\n```typescript\n\ndropLast\u003cT\u003e(howMany: number, input: T[]): T[]\n```\n\nIt returns `howMany` items dropped from the end of list or string `input`.\n\n```javascript\nR.dropLast(2, ['foo', 'bar', 'baz']) // =\u003e ['foo']\nR.dropLast(2, 'foobar')  // =\u003e 'foob'\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?R.dropLast(2%2C%20%5B'foo'%2C%20'bar'%2C%20'baz'%5D)%20%2F%2F%20%3D%3E%20%5B'foo'%5D%0Aconst%20result%20%3D%20R.dropLast(2%2C%20'foobar')%20%20%2F%2F%20%3D%3E%20'foob'\"\u003eTry this \u003cstrong\u003eR.dropLast\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\ndropLast\u003cT\u003e(howMany: number, input: T[]): T[];\ndropLast(howMany: number, input: string): string;\ndropLast\u003cT\u003e(howMany: number): {\n  \u003cT\u003e(input: T[]): T[];\n  (input: string): string;\n};\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.dropLast\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function dropLast(howManyToDrop, listOrString){\n  if (arguments.length === 1){\n    return _listOrString =\u003e dropLast(howManyToDrop, _listOrString)\n  }\n\n  return howManyToDrop \u003e 0 ?\n    listOrString.slice(0, -howManyToDrop) :\n    listOrString.slice()\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport assert from 'assert'\n\nimport { dropLast } from './dropLast.js'\n\ntest('with array', () =\u003e {\n  expect(dropLast(2)([ 'foo', 'bar', 'baz' ])).toEqual([ 'foo' ])\n  expect(dropLast(3, [ 'foo', 'bar', 'baz' ])).toEqual([])\n  expect(dropLast(4, [ 'foo', 'bar', 'baz' ])).toEqual([])\n})\n\ntest('with string', () =\u003e {\n  expect(dropLast(3, 'rambda')).toBe('ram')\n})\n\ntest('with non-positive count', () =\u003e {\n  expect(dropLast(0, [ 1, 2, 3 ])).toEqual([ 1, 2, 3 ])\n  expect(dropLast(-1, [ 1, 2, 3 ])).toEqual([ 1, 2, 3 ])\n  expect(dropLast(-Infinity, [ 1, 2, 3 ])).toEqual([ 1, 2, 3 ])\n})\n\ntest('should return copy', () =\u003e {\n  const xs = [ 1, 2, 3 ]\n\n  assert.notStrictEqual(dropLast(0, xs), xs)\n  assert.notStrictEqual(dropLast(-1, xs), xs)\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {dropLast} from 'rambda'\n\nconst list = [1, 2, 3, 4]\nconst str = 'foobar'\nconst howMany = 2\n\ndescribe('R.dropLast - array', () =\u003e {\n  it('happy', () =\u003e {\n    const result = dropLast(howMany, list)\n    result // $ExpectType number[]\n  })\n  it('curried', () =\u003e {\n    const result = dropLast(howMany)(list)\n    result // $ExpectType number[]\n  })\n})\n\ndescribe('R.dropLast - string', () =\u003e {\n  it('happy', () =\u003e {\n    const result = dropLast(howMany, str)\n    result // $ExpectType string\n  })\n  it('curried', () =\u003e {\n    const result = dropLast(howMany)(str)\n    result // $ExpectType string\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#dropLast)\n\n### dropLastWhile\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B1%2C%202%2C%203%2C%204%2C%205%5D%3B%0Aconst%20predicate%20%3D%20x%20%3D%3E%20x%20%3E%3D%203%0A%0Aconst%20result%20%3D%20dropLastWhile(predicate%2C%20list)%3B%0A%2F%2F%20%3D%3E%20%5B1%2C%202%5D\"\u003eTry this \u003cstrong\u003eR.dropLastWhile\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#dropLastWhile)\n\n### dropRepeats\n\n```typescript\n\ndropRepeats\u003cT\u003e(list: T[]): T[]\n```\n\nIt removes any successive duplicates according to `R.equals`.\n\n```javascript\nconst result = R.dropRepeats([\n  1, \n  1, \n  {a: 1}, \n  {a:1}, \n  1\n])\n// =\u003e [1, {a: 1}, 1]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.dropRepeats(%5B%0A%20%201%2C%20%0A%20%201%2C%20%0A%20%20%7Ba%3A%201%7D%2C%20%0A%20%20%7Ba%3A1%7D%2C%20%0A%20%201%0A%5D)%0A%2F%2F%20%3D%3E%20%5B1%2C%20%7Ba%3A%201%7D%2C%201%5D\"\u003eTry this \u003cstrong\u003eR.dropRepeats\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\ndropRepeats\u003cT\u003e(list: T[]): T[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.dropRepeats\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { isArray } from './_internals/isArray.js'\nimport { equals } from './equals.js'\n\nexport function dropRepeats(list){\n  if (!isArray(list)){\n    throw new Error(`${ list } is not a list`)\n  }\n\n  const toReturn = []\n\n  list.reduce((prev, current) =\u003e {\n    if (!equals(prev, current)){\n      toReturn.push(current)\n    }\n\n    return current\n  }, undefined)\n\n  return toReturn\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { dropRepeats as dropRepeatsRamda } from 'ramda'\n\nimport { compareCombinations } from './_internals/testUtils.js'\nimport { add } from './add.js'\nimport { dropRepeats } from './dropRepeats.js'\n\nconst list = [ 1, 2, 2, 2, 3, 4, 4, 5, 5, 3, 2, 2, { a : 1 }, { a : 1 } ]\nconst listClean = [ 1, 2, 3, 4, 5, 3, 2, { a : 1 } ]\n\ntest('happy', () =\u003e {\n  const result = dropRepeats(list)\n  expect(result).toEqual(listClean)\n})\n\nconst possibleLists = [\n  [ add(1), async () =\u003e {}, [ 1 ], [ 1 ], [ 2 ], [ 2 ] ],\n  [ add(1), add(1), add(2) ],\n  [],\n  1,\n  /foo/g,\n  Promise.resolve(1),\n]\n\ndescribe('brute force', () =\u003e {\n  compareCombinations({\n    firstInput : possibleLists,\n    callback   : errorsCounters =\u003e {\n      expect(errorsCounters).toMatchInlineSnapshot(`\n        {\n          \"ERRORS_MESSAGE_MISMATCH\": 0,\n          \"ERRORS_TYPE_MISMATCH\": 0,\n          \"RESULTS_MISMATCH\": 1,\n          \"SHOULD_NOT_THROW\": 3,\n          \"SHOULD_THROW\": 0,\n          \"TOTAL_TESTS\": 6,\n        }\n      `)\n    },\n    fn      : dropRepeats,\n    fnRamda : dropRepeatsRamda,\n  })\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {dropRepeats} from 'rambda'\n\ndescribe('R.dropRepeats', () =\u003e {\n  it('happy', () =\u003e {\n    const result = dropRepeats([1, 2, 2, 3])\n\n    result // $ExpectType number[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#dropRepeats)\n\n### dropRepeatsBy\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.dropRepeatsBy(%0A%20%20Math.abs%2C%0A%20%20%5B1%2C%20-1%2C%202%2C%203%2C%20-3%5D%0A)%0A%2F%2F%20%3D%3E%20%5B1%2C%202%2C%203%5D\"\u003eTry this \u003cstrong\u003eR.dropRepeatsBy\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#dropRepeatsBy)\n\n### dropRepeatsWith\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B%7Ba%3A1%2Cb%3A2%7D%2C%20%7Ba%3A1%2Cb%3A3%7D%2C%20%7Ba%3A2%2C%20b%3A4%7D%5D%0Aconst%20result%20%3D%20R.dropRepeatsWith(R.prop('a')%2C%20list)%0A%0A%2F%2F%20%3D%3E%20%5B%7Ba%3A1%2Cb%3A2%7D%2C%20%7Ba%3A2%2C%20b%3A4%7D%5D\"\u003eTry this \u003cstrong\u003eR.dropRepeatsWith\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#dropRepeatsWith)\n\n### dropWhile\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B1%2C%202%2C%203%2C%204%5D%0Aconst%20predicate%20%3D%20x%20%3D%3E%20x%20%3C%203%0Aconst%20result%20%3D%20R.dropWhile(predicate%2C%20list)%0A%2F%2F%20%3D%3E%20%5B3%2C%204%5D\"\u003eTry this \u003cstrong\u003eR.dropWhile\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#dropWhile)\n\n### either\n\n```typescript\n\neither(firstPredicate: Pred, secondPredicate: Pred): Pred\n```\n\nIt returns a new `predicate` function from `firstPredicate` and `secondPredicate` inputs.\n\nThis `predicate` function will return `true`, if any of the two input predicates return `true`.\n\n```javascript\nconst firstPredicate = x =\u003e x \u003e 10\nconst secondPredicate = x =\u003e x % 2 === 0\nconst predicate = R.either(firstPredicate, secondPredicate)\n\nconst result = [\n  predicate(15),\n  predicate(8),\n  predicate(7),\n]\n// =\u003e [true, true, false]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20firstPredicate%20%3D%20x%20%3D%3E%20x%20%3E%2010%0Aconst%20secondPredicate%20%3D%20x%20%3D%3E%20x%20%25%202%20%3D%3D%3D%200%0Aconst%20predicate%20%3D%20R.either(firstPredicate%2C%20secondPredicate)%0A%0Aconst%20result%20%3D%20%5B%0A%20%20predicate(15)%2C%0A%20%20predicate(8)%2C%0A%20%20predicate(7)%2C%0A%5D%0A%2F%2F%20%3D%3E%20%5Btrue%2C%20true%2C%20false%5D\"\u003eTry this \u003cstrong\u003eR.either\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\neither(firstPredicate: Pred, secondPredicate: Pred): Pred;\neither\u003cT\u003e(firstPredicate: Predicate\u003cT\u003e, secondPredicate: Predicate\u003cT\u003e): Predicate\u003cT\u003e;\neither\u003cT\u003e(firstPredicate: Predicate\u003cT\u003e): (secondPredicate: Predicate\u003cT\u003e) =\u003e Predicate\u003cT\u003e;\neither(firstPredicate: Pred): (secondPredicate: Pred) =\u003e Pred;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.either\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function either(firstPredicate, secondPredicate){\n  if (arguments.length === 1){\n    return _secondPredicate =\u003e either(firstPredicate, _secondPredicate)\n  }\n\n  return (...input) =\u003e\n    Boolean(firstPredicate(...input) || secondPredicate(...input))\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { either } from './either.js'\n\ntest('with multiple inputs', () =\u003e {\n  const between = function (\n    a, b, c\n  ){\n    return a \u003c b \u0026\u0026 b \u003c c\n  }\n  const total20 = function (\n    a, b, c\n  ){\n    return a + b + c === 20\n  }\n  const fn = either(between, total20)\n  expect(fn(\n    7, 8, 5\n  )).toBeTrue()\n})\n\ntest('skip evaluation of the second expression', () =\u003e {\n  let effect = 'not evaluated'\n  const F = function (){\n    return true\n  }\n  const Z = function (){\n    effect = 'Z got evaluated'\n  }\n  either(F, Z)()\n\n  expect(effect).toBe('not evaluated')\n})\n\ntest('case 1', () =\u003e {\n  const firstFn = val =\u003e val \u003e 0\n  const secondFn = val =\u003e val * 5 \u003e 10\n\n  expect(either(firstFn, secondFn)(1)).toBeTrue()\n})\n\ntest('case 2', () =\u003e {\n  const firstFn = val =\u003e val \u003e 0\n  const secondFn = val =\u003e val === -10\n  const fn = either(firstFn)(secondFn)\n\n  expect(fn(-10)).toBeTrue()\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {either} from 'rambda'\n\ndescribe('R.either', () =\u003e {\n  it('with passed type', () =\u003e {\n    const fn = either\u003cnumber\u003e(\n      x =\u003e x \u003e 1,\n      x =\u003e x % 2 === 0\n    )\n    fn // $ExpectType Predicate\u003cnumber\u003e\n    const result = fn(2) // $ExpectType boolean\n    result // $ExpectType boolean\n  })\n  it('with passed type - curried', () =\u003e {\n    const fn = either\u003cnumber\u003e(x =\u003e x \u003e 1)(x =\u003e x % 2 === 0)\n    fn // $ExpectType Predicate\u003cnumber\u003e\n    const result = fn(2)\n    result // $ExpectType boolean\n  })\n  it('no type passed', () =\u003e {\n    const fn = either(\n      x =\u003e {\n        x // $ExpectType any\n        return x \u003e 1\n      },\n      x =\u003e {\n        x // $ExpectType any\n        return x % 2 === 0\n      }\n    )\n    const result = fn(2)\n    result // $ExpectType boolean\n  })\n  it('no type passed - curried', () =\u003e {\n    const fn = either((x: number) =\u003e {\n      x // $ExpectType number\n      return x \u003e 1\n    })((x: number) =\u003e {\n      x // $ExpectType number\n      return x % 2 === 0\n    })\n    const result = fn(2)\n    result // $ExpectType boolean\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#either)\n\n### empty\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5BR.empty(%5B1%2C2%2C3%5D)%2C%20R.empty('foo')%2C%20R.empty(%7Bx%3A%201%2C%20y%3A%202%7D)%5D%0A%2F%2F%20%3D%3E%20%5B%5B%5D%2C%20''%2C%20%7B%7D%5D\"\u003eTry this \u003cstrong\u003eR.empty\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#empty)\n\n### endsWith\n\n```typescript\n\nendsWith\u003cT extends string\u003e(question: T, str: string): boolean\n```\n\nWhen iterable is a string, then it behaves as `String.prototype.endsWith`.\nWhen iterable is a list, then it uses R.equals to determine if the target list ends in the same way as the given target.\n\n```javascript\nconst str = 'foo-bar'\nconst list = [{a:1}, {a:2}, {a:3}]\n\nconst result = [\n  R.endsWith('bar', str),\n  R.endsWith([{a:1}, {a:2}], list)\n]\n// =\u003e [true, true]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20str%20%3D%20'foo-bar'%0Aconst%20list%20%3D%20%5B%7Ba%3A1%7D%2C%20%7Ba%3A2%7D%2C%20%7Ba%3A3%7D%5D%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.endsWith('bar'%2C%20str)%2C%0A%20%20R.endsWith(%5B%7Ba%3A1%7D%2C%20%7Ba%3A2%7D%5D%2C%20list)%0A%5D%0A%2F%2F%20%3D%3E%20%5Btrue%2C%20true%5D\"\u003eTry this \u003cstrong\u003eR.endsWith\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nendsWith\u003cT extends string\u003e(question: T, str: string): boolean;\nendsWith\u003cT extends string\u003e(question: T): (str: string) =\u003e boolean;\nendsWith\u003cT\u003e(question: T[], list: T[]): boolean;\nendsWith\u003cT\u003e(question: T[]): (list: T[]) =\u003e boolean;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.endsWith\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { isArray } from './_internals/isArray.js'\nimport { equals } from './equals.js'\n\nexport function endsWith(target, iterable){\n  if (arguments.length === 1) return _iterable =\u003e endsWith(target, _iterable)\n\n  if (typeof iterable === 'string'){\n    return iterable.endsWith(target)\n  }\n  if (!isArray(target)) return false\n\n  const diff = iterable.length - target.length\n  let correct = true\n  const filtered = target.filter((x, index) =\u003e {\n    if (!correct) return false\n    const result = equals(x, iterable[ index + diff ])\n    if (!result) correct = false\n\n    return result\n  })\n\n  return filtered.length === target.length\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { endsWith as endsWithRamda } from 'ramda'\n\nimport { compareCombinations } from './_internals/testUtils.js'\nimport { endsWith } from './endsWith.js'\n\ntest('with string', () =\u003e {\n  expect(endsWith('bar', 'foo-bar')).toBeTrue()\n  expect(endsWith('baz')('foo-bar')).toBeFalse()\n})\n\ntest('use R.equals with array', () =\u003e {\n  const list = [ { a : 1 }, { a : 2 }, { a : 3 } ]\n  expect(endsWith({ a : 3 }, list)).toBeFalse(),\n  expect(endsWith([ { a : 3 } ], list)).toBeTrue()\n  expect(endsWith([ { a : 2 }, { a : 3 } ], list)).toBeTrue()\n  expect(endsWith(list, list)).toBeTrue()\n  expect(endsWith([ { a : 1 } ], list)).toBeFalse()\n})\n\nexport const possibleTargets = [\n  NaN,\n  [ NaN ],\n  /foo/,\n  [ /foo/ ],\n  Promise.resolve(1),\n  [ Promise.resolve(1) ],\n  Error('foo'),\n  [ Error('foo') ],\n]\n\nexport const possibleIterables = [\n  [ Promise.resolve(1), Promise.resolve(2) ],\n  [ /foo/, /bar/ ],\n  [ NaN ],\n  [ Error('foo'), Error('bar') ],\n]\n\ndescribe('brute force', () =\u003e {\n  compareCombinations({\n    fn          : endsWith,\n    fnRamda     : endsWithRamda,\n    firstInput  : possibleTargets,\n    secondInput : possibleIterables,\n    callback    : errorsCounters =\u003e {\n      expect(errorsCounters).toMatchInlineSnapshot(`\n        {\n          \"ERRORS_MESSAGE_MISMATCH\": 0,\n          \"ERRORS_TYPE_MISMATCH\": 0,\n          \"RESULTS_MISMATCH\": 0,\n          \"SHOULD_NOT_THROW\": 0,\n          \"SHOULD_THROW\": 0,\n          \"TOTAL_TESTS\": 32,\n        }\n      `)\n    },\n  })\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {endsWith} from 'rambda'\n\ndescribe('R.endsWith - array', () =\u003e {\n  const target = [{a: 2}]\n  const input = [{a: 1}, {a: 2}]\n  it('happy', () =\u003e {\n    const result = endsWith(target, input)\n    result // $ExpectType boolean\n  })\n  it('curried', () =\u003e {\n    const result = endsWith(target)(input)\n    result // $ExpectType boolean\n  })\n})\n\ndescribe('R.endsWith - string', () =\u003e {\n  const target = 'bar'\n  const input = 'foo bar'\n  it('happy', () =\u003e {\n    const result = endsWith(target, input)\n    result // $ExpectType boolean\n  })\n  it('curried', () =\u003e {\n    const result = endsWith(target)(input)\n    result // $ExpectType boolean\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#endsWith)\n\n### eqBy\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.eqBy(Math.abs%2C%205%2C%20-5)%0A%2F%2F%20%3D%3E%20true\"\u003eTry this \u003cstrong\u003eR.eqBy\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#eqBy)\n\n### eqProps\n\nIt returns `true` if property `prop` in `obj1` is equal to property `prop` in `obj2` according to `R.equals`.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20obj1%20%3D%20%7Ba%3A%201%2C%20b%3A2%7D%0Aconst%20obj2%20%3D%20%7Ba%3A%201%2C%20b%3A3%7D%0Aconst%20result%20%3D%20R.eqProps('a'%2C%20obj1%2C%20obj2)%0A%2F%2F%20%3D%3E%20true\"\u003eTry this \u003cstrong\u003eR.eqProps\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#eqProps)\n\n### equals\n\n```typescript\n\nequals\u003cT\u003e(x: T, y: T): boolean\n```\n\nIt deeply compares `x` and `y` and returns `true` if they are equal.\n\n\u003e :boom: It doesn't handle cyclical data structures and functions\n\n```javascript\nR.equals(\n  [1, {a:2}, [{b: 3}]],\n  [1, {a:2}, [{b: 3}]]\n) // =\u003e true\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?R.equals(%0A%20%20%5B1%2C%20%7Ba%3A2%7D%2C%20%5B%7Bb%3A%203%7D%5D%5D%2C%0A%20%20%5B1%2C%20%7Ba%3A2%7D%2C%20%5B%7Bb%3A%203%7D%5D%5D%0Aconst%20result%20%3D%20)%20%2F%2F%20%3D%3E%20true\"\u003eTry this \u003cstrong\u003eR.equals\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nequals\u003cT\u003e(x: T, y: T): boolean;\nequals\u003cT\u003e(x: T): (y: T) =\u003e boolean;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.equals\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { isArray } from './_internals/isArray.js'\nimport { type } from './type.js'\n\nexport function _lastIndexOf(valueToFind, list){\n  if (!isArray(list))\n    throw new Error(`Cannot read property 'indexOf' of ${ list }`)\n\n  const typeOfValue = type(valueToFind)\n  if (![ 'Array', 'NaN', 'Object', 'RegExp' ].includes(typeOfValue))\n    return list.lastIndexOf(valueToFind)\n\n  const { length } = list\n  let index = length\n  let foundIndex = -1\n\n  while (--index \u003e -1 \u0026\u0026 foundIndex === -1)\n    if (equals(list[ index ], valueToFind))\n      foundIndex = index\n\n  return foundIndex\n}\n\nexport function _indexOf(valueToFind, list){\n  if (!isArray(list))\n    throw new Error(`Cannot read property 'indexOf' of ${ list }`)\n\n  const typeOfValue = type(valueToFind)\n  if (![ 'Array', 'NaN', 'Object', 'RegExp' ].includes(typeOfValue))\n    return list.indexOf(valueToFind)\n\n  let index = -1\n  let foundIndex = -1\n  const { length } = list\n\n  while (++index \u003c length \u0026\u0026 foundIndex === -1)\n    if (equals(list[ index ], valueToFind))\n      foundIndex = index\n\n  return foundIndex\n}\n\nfunction _arrayFromIterator(iter){\n  const list = []\n  let next\n  while (!(next = iter.next()).done)\n    list.push(next.value)\n\n  return list\n}\n\nfunction _compareSets(a, b){\n  if (a.size !== b.size)\n    return false\n\n  const aList = _arrayFromIterator(a.values())\n  const bList = _arrayFromIterator(b.values())\n\n  const filtered = aList.filter(aInstance =\u003e _indexOf(aInstance, bList) === -1)\n\n  return filtered.length === 0\n}\n\nfunction compareErrors(a, b){\n  if (a.message !== b.message) return false\n  if (a.toString !== b.toString) return false\n\n  return a.toString() === b.toString()\n}\n\nfunction parseDate(maybeDate){\n  if (!maybeDate.toDateString) return [ false ]\n\n  return [ true, maybeDate.getTime() ]\n}\n\nfunction parseRegex(maybeRegex){\n  if (maybeRegex.constructor !== RegExp) return [ false ]\n\n  return [ true, maybeRegex.toString() ]\n}\n\nexport function equals(a, b){\n  if (arguments.length === 1) return _b =\u003e equals(a, _b)\n\n  if (Object.is(a, b)) return true\n\n  const aType = type(a)\n\n  if (aType !== type(b)) return false\n  if (aType === 'Function')\n    return a.name === undefined ? false : a.name === b.name\n\n  if ([ 'NaN', 'Null', 'Undefined' ].includes(aType)) return true\n\n  if ([ 'BigInt', 'Number' ].includes(aType)){\n    if (Object.is(-0, a) !== Object.is(-0, b)) return false\n\n    return a.toString() === b.toString()\n  }\n\n  if ([ 'Boolean', 'String' ].includes(aType))\n    return a.toString() === b.toString()\n\n  if (aType === 'Array'){\n    const aClone = Array.from(a)\n    const bClone = Array.from(b)\n\n    if (aClone.toString() !== bClone.toString())\n      return false\n\n    let loopArrayFlag = true\n    aClone.forEach((aCloneInstance, aCloneIndex) =\u003e {\n      if (loopArrayFlag)\n        if (\n          aCloneInstance !== bClone[ aCloneIndex ] \u0026\u0026\n          !equals(aCloneInstance, bClone[ aCloneIndex ])\n        )\n          loopArrayFlag = false\n\n    })\n\n    return loopArrayFlag\n  }\n\n  const aRegex = parseRegex(a)\n  const bRegex = parseRegex(b)\n\n  if (aRegex[ 0 ])\n    return bRegex[ 0 ] ? aRegex[ 1 ] === bRegex[ 1 ] : false\n  else if (bRegex[ 0 ]) return false\n\n  const aDate = parseDate(a)\n  const bDate = parseDate(b)\n\n  if (aDate[ 0 ])\n    return bDate[ 0 ] ? aDate[ 1 ] === bDate[ 1 ] : false\n  else if (bDate[ 0 ]) return false\n\n  if (a instanceof Error){\n    if (!(b instanceof Error)) return false\n\n    return compareErrors(a, b)\n  }\n\n  if (aType === 'Set')\n    return _compareSets(a, b)\n\n  if (aType === 'Object'){\n    const aKeys = Object.keys(a)\n\n    if (aKeys.length !== Object.keys(b).length)\n      return false\n\n    let loopObjectFlag = true\n    aKeys.forEach(aKeyInstance =\u003e {\n      if (loopObjectFlag){\n        const aValue = a[ aKeyInstance ]\n        const bValue = b[ aKeyInstance ]\n\n        if (aValue !== bValue \u0026\u0026 !equals(aValue, bValue))\n          loopObjectFlag = false\n\n      }\n    })\n\n    return loopObjectFlag\n  }\n\n  return false\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { equals as equalsRamda } from 'ramda'\n\nimport { compareCombinations } from './_internals/testUtils.js'\nimport { variousTypes } from './benchmarks/_utils.js'\nimport { equals } from './equals.js'\n\ntest('compare functions', () =\u003e {\n  function foo(){}\n  function bar(){}\n  const baz = () =\u003e {}\n\n  const expectTrue = equals(foo, foo)\n  const expectFalseFirst = equals(foo, bar)\n  const expectFalseSecond = equals(foo, baz)\n\n  expect(expectTrue).toBeTrue()\n  expect(expectFalseFirst).toBeFalse()\n  expect(expectFalseSecond).toBeFalse()\n})\n\ntest('with array of objects', () =\u003e {\n  const list1 = [ { a : 1 }, [ { b : 2 } ] ]\n  const list2 = [ { a : 1 }, [ { b : 2 } ] ]\n  const list3 = [ { a : 1 }, [ { b : 3 } ] ]\n\n  expect(equals(list1, list2)).toBeTrue()\n  expect(equals(list1, list3)).toBeFalse()\n})\n\ntest('with regex', () =\u003e {\n  expect(equals(/s/, /s/)).toBeTrue()\n  expect(equals(/s/, /d/)).toBeFalse()\n  expect(equals(/a/gi, /a/gi)).toBeTrue()\n  expect(equals(/a/gim, /a/gim)).toBeTrue()\n  expect(equals(/a/gi, /a/i)).toBeFalse()\n})\n\ntest('not a number', () =\u003e {\n  expect(equals([ NaN ], [ NaN ])).toBeTrue()\n})\n\ntest('new number', () =\u003e {\n  expect(equals(new Number(0), new Number(0))).toBeTrue()\n  expect(equals(new Number(0), new Number(1))).toBeFalse()\n  expect(equals(new Number(1), new Number(0))).toBeFalse()\n})\n\ntest('new string', () =\u003e {\n  expect(equals(new String(''), new String(''))).toBeTrue()\n  expect(equals(new String(''), new String('x'))).toBeFalse()\n  expect(equals(new String('x'), new String(''))).toBeFalse()\n  expect(equals(new String('foo'), new String('foo'))).toBeTrue()\n  expect(equals(new String('foo'), new String('bar'))).toBeFalse()\n  expect(equals(new String('bar'), new String('foo'))).toBeFalse()\n})\n\ntest('new Boolean', () =\u003e {\n  expect(equals(new Boolean(true), new Boolean(true))).toBeTrue()\n  expect(equals(new Boolean(false), new Boolean(false))).toBeTrue()\n  expect(equals(new Boolean(true), new Boolean(false))).toBeFalse()\n  expect(equals(new Boolean(false), new Boolean(true))).toBeFalse()\n})\n\ntest('new Error', () =\u003e {\n  expect(equals(new Error('XXX'), {})).toBeFalse()\n  expect(equals(new Error('XXX'), new TypeError('XXX'))).toBeFalse()\n  expect(equals(new Error('XXX'), new Error('YYY'))).toBeFalse()\n  expect(equals(new Error('XXX'), new Error('XXX'))).toBeTrue()\n  expect(equals(new Error('XXX'), new TypeError('YYY'))).toBeFalse()\n  expect(equals(new Error('XXX'), new Error('XXX'))).toBeTrue()\n})\n\ntest('with dates', () =\u003e {\n  expect(equals(new Date(0), new Date(0))).toBeTrue()\n  expect(equals(new Date(1), new Date(1))).toBeTrue()\n  expect(equals(new Date(0), new Date(1))).toBeFalse()\n  expect(equals(new Date(1), new Date(0))).toBeFalse()\n  expect(equals(new Date(0), {})).toBeFalse()\n  expect(equals({}, new Date(0))).toBeFalse()\n})\n\ntest('ramda spec', () =\u003e {\n  expect(equals({}, {})).toBeTrue()\n\n  expect(equals({\n    a : 1,\n    b : 2,\n  },\n  {\n    a : 1,\n    b : 2,\n  })).toBeTrue()\n\n  expect(equals({\n    a : 2,\n    b : 3,\n  },\n  {\n    a : 2,\n    b : 3,\n  })).toBeTrue()\n\n  expect(equals({\n    a : 2,\n    b : 3,\n  },\n  {\n    a : 3,\n    b : 3,\n  })).toBeFalse()\n\n  expect(equals({\n    a : 2,\n    b : 3,\n    c : 1,\n  },\n  {\n    a : 2,\n    b : 3,\n  })).toBeFalse()\n})\n\ntest('works with boolean tuple', () =\u003e {\n  expect(equals([ true, false ], [ true, false ])).toBeTrue()\n  expect(equals([ true, false ], [ true, true ])).toBeFalse()\n})\n\ntest('works with equal objects within array', () =\u003e {\n  const objFirst = {\n    a : {\n      b : 1,\n      c : 2,\n      d : [ 1 ],\n    },\n  }\n  const objSecond = {\n    a : {\n      b : 1,\n      c : 2,\n      d : [ 1 ],\n    },\n  }\n\n  const x = [ 1, 2, objFirst, null, '', [] ]\n  const y = [ 1, 2, objSecond, null, '', [] ]\n  expect(equals(x, y)).toBeTrue()\n})\n\ntest('works with different objects within array', () =\u003e {\n  const objFirst = { a : { b : 1 } }\n  const objSecond = { a : { b : 2 } }\n\n  const x = [ 1, 2, objFirst, null, '', [] ]\n  const y = [ 1, 2, objSecond, null, '', [] ]\n  expect(equals(x, y)).toBeFalse()\n})\n\ntest('works with undefined as second argument', () =\u003e {\n  expect(equals(1, undefined)).toBeFalse()\n\n  expect(equals(undefined, undefined)).toBeTrue()\n})\n\ntest('compare sets', () =\u003e {\n  const toCompareDifferent = new Set([ { a : 1 }, { a : 2 } ])\n  const toCompareSame = new Set([ { a : 1 }, { a : 2 }, { a : 1 } ])\n  const testSet = new Set([ { a : 1 }, { a : 2 }, { a : 1 } ])\n  expect(equals(toCompareSame, testSet)).toBeTruthy()\n  expect(equals(toCompareDifferent, testSet)).toBeFalsy()\n  expect(equalsRamda(toCompareSame, testSet)).toBeTruthy()\n  expect(equalsRamda(toCompareDifferent, testSet)).toBeFalsy()\n})\n\ntest('compare simple sets', () =\u003e {\n  const testSet = new Set([ '2', '3', '3', '2', '1' ])\n  expect(equals(new Set([ '3', '2', '1' ]), testSet)).toBeTruthy()\n  expect(equals(new Set([ '3', '2', '0' ]), testSet)).toBeFalsy()\n})\n\ntest('various examples', () =\u003e {\n  expect(equals([ 1, 2, 3 ])([ 1, 2, 3 ])).toBeTrue()\n\n  expect(equals([ 1, 2, 3 ], [ 1, 2 ])).toBeFalse()\n\n  expect(equals(1, 1)).toBeTrue()\n\n  expect(equals(1, '1')).toBeFalse()\n\n  expect(equals({}, {})).toBeTrue()\n\n  expect(equals({\n    a : 1,\n    b : 2,\n  },\n  {\n    a : 1,\n    b : 2,\n  })).toBeTrue()\n\n  expect(equals({\n    a : 1,\n    b : 2,\n  },\n  {\n    a : 1,\n    b : 1,\n  })).toBeFalse()\n\n  expect(equals({\n    a : 1,\n    b : false,\n  },\n  {\n    a : 1,\n    b : 1,\n  })).toBeFalse()\n\n  expect(equals({\n    a : 1,\n    b : 2,\n  },\n  {\n    a : 1,\n    b : 2,\n    c : 3,\n  })).toBeFalse()\n\n  expect(equals({\n    x : {\n      a : 1,\n      b : 2,\n    },\n  },\n  {\n    x : {\n      a : 1,\n      b : 2,\n      c : 3,\n    },\n  })).toBeFalse()\n\n  expect(equals({\n    a : 1,\n    b : 2,\n  },\n  {\n    a : 1,\n    b : 3,\n  })).toBeFalse()\n\n  expect(equals({ a : { b : { c : 1 } } }, { a : { b : { c : 1 } } })).toBeTrue()\n\n  expect(equals({ a : { b : { c : 1 } } }, { a : { b : { c : 2 } } })).toBeFalse()\n\n  expect(equals({ a : {} }, { a : {} })).toBeTrue()\n\n  expect(equals('', '')).toBeTrue()\n\n  expect(equals('foo', 'foo')).toBeTrue()\n\n  expect(equals('foo', 'bar')).toBeFalse()\n\n  expect(equals(0, false)).toBeFalse()\n\n  expect(equals(/\\s/g, null)).toBeFalse()\n\n  expect(equals(null, null)).toBeTrue()\n\n  expect(equals(false)(null)).toBeFalse()\n})\n\ntest('with custom functions', () =\u003e {\n  function foo(){\n    return 1\n  }\n  foo.prototype.toString = () =\u003e ''\n  const result = equals(foo, foo)\n\n  expect(result).toBeTrue()\n})\n\ntest('with classes', () =\u003e {\n  class Foo{}\n  const foo = new Foo()\n  const result = equals(foo, foo)\n\n  expect(result).toBeTrue()\n})\n\ntest('with negative zero', () =\u003e {\n  expect(equals(-0, -0)).toBeTrue()\n  expect(equals(-0, 0)).toBeFalse()\n  expect(equals(0, 0)).toBeTrue()\n  expect(equals(-0, 1)).toBeFalse()\n})\n\ntest('with big int', () =\u003e {\n  const a = BigInt(9007199254740991)\n  const b = BigInt(9007199254740991)\n  const c = BigInt(7007199254740991)\n  expect(equals(a, b)).toBeTrue()\n  expect(equals(a, c)).toBeFalse()\n})\n\ndescribe('brute force', () =\u003e {\n  compareCombinations({\n    callback : errorsCounters =\u003e {\n      expect(errorsCounters).toMatchInlineSnapshot(`\n{\n  \"ERRORS_MESSAGE_MISMATCH\": 0,\n  \"ERRORS_TYPE_MISMATCH\": 0,\n  \"RESULTS_MISMATCH\": 0,\n  \"SHOULD_NOT_THROW\": 0,\n  \"SHOULD_THROW\": 0,\n  \"TOTAL_TESTS\": 289,\n}\n`)\n    },\n    firstInput  : variousTypes,\n    fn          : equals,\n    fnRamda     : equalsRamda,\n    secondInput : variousTypes,\n  })\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {equals} from 'rambda'\n\ndescribe('R.equals', () =\u003e {\n  it('happy', () =\u003e {\n    const result = equals(4, 1)\n    result // $ExpectType boolean\n  })\n  it('with object', () =\u003e {\n    const foo = {a: 1}\n    const bar = {a: 2}\n    const result = equals(foo, bar)\n    result // $ExpectType boolean\n  })\n  it('curried', () =\u003e {\n    const result = equals(4)(1)\n\n    result // $ExpectType boolean\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#equals)\n\n### evolve\n\n```typescript\n\nevolve\u003cT, U\u003e(rules: ((x: T) =\u003e U)[], list: T[]): U[]\n```\n\nIt takes object or array of functions as set of rules. These `rules` are applied to the `iterable` input to produce the result.\n\n\u003e :boom: Error handling of this method differs between Ramda and Rambda. Ramda for some wrong inputs returns result and for other - it returns one of the inputs. Rambda simply throws when inputs are not correct. Full details for this mismatch are listed in `source/_snapshots/evolve.spec.js.snap` file.\n\n```javascript\nconst rules = {\n  foo : add(1),\n  bar : add(-1),\n}\nconst input = {\n  a   : 1,\n  foo : 2,\n  bar : 3,\n}\nconst result = evolve(rules, input)\nconst expected = {\n  a   : 1,\n  foo : 3,\n  bar : 2,\n})\n// =\u003e `result` is equal to `expected`\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20rules%20%3D%20%7B%0A%20%20foo%20%3A%20add(1)%2C%0A%20%20bar%20%3A%20add(-1)%2C%0A%7D%0Aconst%20input%20%3D%20%7B%0A%20%20a%20%20%20%3A%201%2C%0A%20%20foo%20%3A%202%2C%0A%20%20bar%20%3A%203%2C%0A%7D%0Aconst%20result%20%3D%20evolve(rules%2C%20input)%0Aconst%20expected%20%3D%20%7B%0A%20%20a%20%20%20%3A%201%2C%0A%20%20foo%20%3A%203%2C%0A%20%20bar%20%3A%202%2C%0A%7D)%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60\"\u003eTry this \u003cstrong\u003eR.evolve\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nevolve\u003cT, U\u003e(rules: ((x: T) =\u003e U)[], list: T[]): U[];\nevolve\u003cT, U\u003e(rules: ((x: T) =\u003e U)[]) : (list: T[]) =\u003e U[];\nevolve\u003cE extends Evolver, V extends Evolvable\u003cE\u003e\u003e(rules: E, obj: V): Evolve\u003cV, E\u003e;\nevolve\u003cE extends Evolver\u003e(rules: E): \u003cV extends Evolvable\u003cE\u003e\u003e(obj: V) =\u003e Evolve\u003cV, E\u003e;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.evolve\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { isArray } from './_internals/isArray.js'\nimport { mapArray, mapObject } from './map.js'\nimport { type } from './type.js'\n\nexport function evolveArray(rules, list){\n  return mapArray(\n    (x, i) =\u003e {\n      if (type(rules[ i ]) === 'Function'){\n        return rules[ i ](x)\n      }\n\n      return x\n    },\n    list,\n    true\n  )\n}\n\nexport function evolveObject(rules, iterable){\n  return mapObject((x, prop) =\u003e {\n    if (type(x) === 'Object'){\n      const typeRule = type(rules[ prop ])\n      if (typeRule === 'Function'){\n        return rules[ prop ](x)\n      }\n      if (typeRule === 'Object'){\n        return evolve(rules[ prop ], x)\n      }\n\n      return x\n    }\n    if (type(rules[ prop ]) === 'Function'){\n      return rules[ prop ](x)\n    }\n\n    return x\n  }, iterable)\n}\n\nexport function evolve(rules, iterable){\n  if (arguments.length === 1){\n    return _iterable =\u003e evolve(rules, _iterable)\n  }\n  const rulesType = type(rules)\n  const iterableType = type(iterable)\n\n  if (iterableType !== rulesType){\n    throw new Error('iterableType !== rulesType')\n  }\n\n  if (![ 'Object', 'Array' ].includes(rulesType)){\n    throw new Error(`'iterable' and 'rules' are from wrong type ${ rulesType }`)\n  }\n\n  if (iterableType === 'Object'){\n    return evolveObject(rules, iterable)\n  }\n\n  return evolveArray(rules, iterable)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { evolve as evolveRamda } from 'ramda'\n\nimport { add } from '../rambda.js'\nimport { compareCombinations, compareToRamda } from './_internals/testUtils.js'\nimport { evolve } from './evolve.js'\n\ntest('happy', () =\u003e {\n  const rules = {\n    foo    : add(1),\n    nested : { bar : x =\u003e Object.keys(x).length },\n  }\n  const input = {\n    a      : 1,\n    foo    : 2,\n    nested : { bar : { z : 3 } },\n  }\n  const result = evolve(rules, input)\n  expect(result).toEqual({\n    a      : 1,\n    foo    : 3,\n    nested : { bar : 1 },\n  })\n})\n\ntest('nested rule is wrong', () =\u003e {\n  const rules = {\n    foo    : add(1),\n    nested : { bar : 10 },\n  }\n  const input = {\n    a      : 1,\n    foo    : 2,\n    nested : { bar : { z : 3 } },\n  }\n  const result = evolve(rules)(input)\n  expect(result).toEqual({\n    a      : 1,\n    foo    : 3,\n    nested : { bar : { z : 3 } },\n  })\n})\n\ntest('is recursive', () =\u003e {\n  const rules = {\n    nested : {\n      second : add(-1),\n      third  : add(1),\n    },\n  }\n  const object = {\n    first  : 1,\n    nested : {\n      second : 2,\n      third  : 3,\n    },\n  }\n  const expected = {\n    first  : 1,\n    nested : {\n      second : 1,\n      third  : 4,\n    },\n  }\n  const result = evolve(rules, object)\n  expect(result).toEqual(expected)\n})\n\ntest('ignores primitive values', () =\u003e {\n  const rules = {\n    n : 2,\n    m : 'foo',\n  }\n  const object = {\n    n : 0,\n    m : 1,\n  }\n  const expected = {\n    n : 0,\n    m : 1,\n  }\n  const result = evolve(rules, object)\n  expect(result).toEqual(expected)\n})\n\ntest('with array', () =\u003e {\n  const rules = [ add(1), add(-1) ]\n  const list = [ 100, 1400 ]\n  const expected = [ 101, 1399 ]\n  const result = evolve(rules, list)\n  expect(result).toEqual(expected)\n})\n\nconst rulesObject = { a : add(1) }\nconst rulesList = [ add(1) ]\nconst possibleIterables = [ null, undefined, '', 42, [], [ 1 ], { a : 1 } ]\nconst possibleRules = [ ...possibleIterables, rulesList, rulesObject ]\n\ndescribe('brute force', () =\u003e {\n  compareCombinations({\n    firstInput : possibleRules,\n    callback   : errorsCounters =\u003e {\n      expect(errorsCounters).toMatchInlineSnapshot(`\n        {\n          \"ERRORS_MESSAGE_MISMATCH\": 0,\n          \"ERRORS_TYPE_MISMATCH\": 4,\n          \"RESULTS_MISMATCH\": 0,\n          \"SHOULD_NOT_THROW\": 51,\n          \"SHOULD_THROW\": 0,\n          \"TOTAL_TESTS\": 63,\n        }\n      `)\n    },\n    secondInput : possibleIterables,\n    fn          : evolve,\n    fnRamda     : evolveRamda,\n  })\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {evolve, add} from 'rambda'\n\ndescribe('R.evolve', () =\u003e {\n  it('happy', () =\u003e {\n    const input = {\n      foo: 2,\n      nested: {\n        a: 1,\n        bar: 3,\n      },\n    }\n    const rules = {\n      foo: add(1),\n      nested: {\n        a: add(-1),\n        bar: add(1),\n      },\n    }\n    const result = evolve(rules, input)\n    const curriedResult = evolve(rules)(input)\n\n    result.nested.a // $ExpectType number\n    curriedResult.nested.a // $ExpectType number\n    result.nested.bar // $ExpectType number\n    result.foo // $ExpectType number\n  })\n  it('with array', () =\u003e {\n    const rules = [String, String]\n    const input = [100, 1400]\n    const result = evolve(rules, input)\n    const curriedResult = evolve(rules)(input)\n    result // $ExpectType string[]\n    curriedResult // $ExpectType string[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#evolve)\n\n### F\n\n```typescript\n\nF(): boolean\n```\n\n```javascript\nF() // =\u003e false\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20F()%20%2F%2F%20%3D%3E%20false\"\u003eTry this \u003cstrong\u003eR.F\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nF(): boolean;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.F\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function F(){\n  return false\n}\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#F)\n\n### filter\n\n```typescript\n\nfilter\u003cT\u003e(predicate: Predicate\u003cT\u003e): (input: T[]) =\u003e T[]\n```\n\nIt filters list or object `input` using a `predicate` function.\n\n```javascript\nconst list = [3, 4, 3, 2]\nconst listPredicate = x =\u003e x \u003e 2\n\nconst object = {abc: 'fo', xyz: 'bar', baz: 'foo'}\nconst objectPredicate = (x, prop) =\u003e x.length + prop.length \u003e 5\n\nconst result = [\n  R.filter(listPredicate, list),\n  R.filter(objectPredicate, object)\n]\n// =\u003e [ [3, 4], { xyz: 'bar', baz: 'foo'} ]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B3%2C%204%2C%203%2C%202%5D%0Aconst%20listPredicate%20%3D%20x%20%3D%3E%20x%20%3E%202%0A%0Aconst%20object%20%3D%20%7Babc%3A%20'fo'%2C%20xyz%3A%20'bar'%2C%20baz%3A%20'foo'%7D%0Aconst%20objectPredicate%20%3D%20(x%2C%20prop)%20%3D%3E%20x.length%20%2B%20prop.length%20%3E%205%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.filter(listPredicate%2C%20list)%2C%0A%20%20R.filter(objectPredicate%2C%20object)%0A%5D%0A%2F%2F%20%3D%3E%20%5B%20%5B3%2C%204%5D%2C%20%7B%20xyz%3A%20'bar'%2C%20baz%3A%20'foo'%7D%20%5D\"\u003eTry this \u003cstrong\u003eR.filter\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nfilter\u003cT\u003e(predicate: Predicate\u003cT\u003e): (input: T[]) =\u003e T[];\nfilter\u003cT\u003e(predicate: Predicate\u003cT\u003e, input: T[]): T[];\nfilter\u003cT, U\u003e(predicate: ObjectPredicate\u003cT\u003e): (x: Dictionary\u003cT\u003e) =\u003e Dictionary\u003cT\u003e;\nfilter\u003cT\u003e(predicate: ObjectPredicate\u003cT\u003e, x: Dictionary\u003cT\u003e): Dictionary\u003cT\u003e;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.filter\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { isArray } from './_internals/isArray.js'\n\nexport function filterObject(predicate, obj){\n  const willReturn = {}\n\n  for (const prop in obj){\n    if (predicate(\n      obj[ prop ], prop, obj\n    )){\n      willReturn[ prop ] = obj[ prop ]\n    }\n  }\n\n  return willReturn\n}\n\nexport function filterArray(\n  predicate, list, indexed = false\n){\n  let index = 0\n  const len = list.length\n  const willReturn = []\n\n  while (index \u003c len){\n    const predicateResult = indexed ?\n      predicate(list[ index ], index) :\n      predicate(list[ index ])\n    if (predicateResult){\n      willReturn.push(list[ index ])\n    }\n\n    index++\n  }\n\n  return willReturn\n}\n\nexport function filter(predicate, iterable){\n  if (arguments.length === 1)\n    return _iterable =\u003e filter(predicate, _iterable)\n  if (!iterable){\n    throw new Error('Incorrect iterable input')\n  }\n\n  if (isArray(iterable)) return filterArray(\n    predicate, iterable, false\n  )\n\n  return filterObject(predicate, iterable)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { filter as filterRamda } from 'ramda'\n\nimport { filter } from './filter.js'\nimport { T } from './T.js'\n\nconst sampleObject = {\n  a : 1,\n  b : 2,\n  c : 3,\n  d : 4,\n}\n\ntest('happy', () =\u003e {\n  const isEven = n =\u003e n % 2 === 0\n\n  expect(filter(isEven, [ 1, 2, 3, 4 ])).toEqual([ 2, 4 ])\n  expect(filter(isEven, {\n    a : 1,\n    b : 2,\n    d : 3,\n  })).toEqual({ b : 2 })\n})\n\ntest('predicate when input is object', () =\u003e {\n  const obj = {\n    a : 1,\n    b : 2,\n  }\n  const predicate = (\n    val, prop, inputObject\n  ) =\u003e {\n    expect(inputObject).toEqual(obj)\n    expect(typeof prop).toBe('string')\n\n    return val \u003c 2\n  }\n  expect(filter(predicate, obj)).toEqual({ a : 1 })\n})\n\ntest('with object', () =\u003e {\n  const isEven = n =\u003e n % 2 === 0\n  const result = filter(isEven, sampleObject)\n  const expectedResult = {\n    b : 2,\n    d : 4,\n  }\n\n  expect(result).toEqual(expectedResult)\n})\n\ntest('bad inputs difference between Ramda and Rambda', () =\u003e {\n  expect(() =\u003e filter(T, null)).toThrowWithMessage(Error,\n    'Incorrect iterable input')\n  expect(() =\u003e filter(T)(undefined)).toThrowWithMessage(Error,\n    'Incorrect iterable input')\n  expect(() =\u003e filterRamda(T, null)).toThrowWithMessage(TypeError,\n    'Cannot read properties of null (reading \\'fantasy-land/filter\\')')\n  expect(() =\u003e filterRamda(T, undefined)).toThrowWithMessage(TypeError,\n    'Cannot read properties of undefined (reading \\'fantasy-land/filter\\')')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {filter} from 'rambda'\n\nconst list = [1, 2, 3]\nconst obj = {a: 1, b: 2}\n\ndescribe('R.filter with array', () =\u003e {\n  it('happy', () =\u003e {\n    const result = filter\u003cnumber\u003e(x =\u003e {\n      x // $ExpectType number\n      return x \u003e 1\n    }, list)\n    result // $ExpectType number[]\n  })\n  it('curried', () =\u003e {\n    const result = filter\u003cnumber\u003e(x =\u003e {\n      x // $ExpectType number\n      return x \u003e 1\n    })(list)\n    result // $ExpectType number[]\n  })\n})\n\ndescribe('R.filter with objects', () =\u003e {\n  it('happy', () =\u003e {\n    const result = filter\u003cnumber\u003e((val, prop, origin) =\u003e {\n      val // $ExpectType number\n      prop // $ExpectType string\n      origin // $ExpectType Dictionary\u003cnumber\u003e\n\n      return val \u003e 1\n    }, obj)\n    result // $ExpectType Dictionary\u003cnumber\u003e\n  })\n  it('curried version requires second dummy type', () =\u003e {\n    const result = filter\u003cnumber, any\u003e((val, prop, origin) =\u003e {\n      val // $ExpectType number\n      prop // $ExpectType string\n      origin // $ExpectType Dictionary\u003cnumber\u003e\n\n      return val \u003e 1\n    })(obj)\n    result // $ExpectType Dictionary\u003cnumber\u003e\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#filter)\n\n### find\n\n```typescript\n\nfind\u003cT\u003e(predicate: (x: T) =\u003e boolean, list: T[]): T | undefined\n```\n\nIt returns the first element of `list` that satisfy the `predicate`.\n\nIf there is no such element, it returns `undefined`.\n\n```javascript\nconst predicate = x =\u003e R.type(x.foo) === 'Number'\nconst list = [{foo: 'bar'}, {foo: 1}]\n\nconst result = R.find(predicate, list)\n// =\u003e {foo: 1}\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20predicate%20%3D%20x%20%3D%3E%20R.type(x.foo)%20%3D%3D%3D%20'Number'%0Aconst%20list%20%3D%20%5B%7Bfoo%3A%20'bar'%7D%2C%20%7Bfoo%3A%201%7D%5D%0A%0Aconst%20result%20%3D%20R.find(predicate%2C%20list)%0A%2F%2F%20%3D%3E%20%7Bfoo%3A%201%7D\"\u003eTry this \u003cstrong\u003eR.find\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nfind\u003cT\u003e(predicate: (x: T) =\u003e boolean, list: T[]): T | undefined;\nfind\u003cT\u003e(predicate: (x: T) =\u003e boolean): (list: T[]) =\u003e T | undefined;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.find\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function find(predicate, list){\n  if (arguments.length === 1) return _list =\u003e find(predicate, _list)\n\n  let index = 0\n  const len = list.length\n\n  while (index \u003c len){\n    const x = list[ index ]\n    if (predicate(x)){\n      return x\n    }\n\n    index++\n  }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { find } from './find.js'\nimport { propEq } from './propEq.js'\n\nconst list = [ { a : 1 }, { a : 2 }, { a : 3 } ]\n\ntest('happy', () =\u003e {\n  const fn = propEq(2, 'a')\n  expect(find(fn, list)).toEqual({ a : 2 })\n})\n\ntest('with curry', () =\u003e {\n  const fn = propEq(4, 'a')\n  expect(find(fn)(list)).toBeUndefined()\n})\n\ntest('with empty list', () =\u003e {\n  expect(find(() =\u003e true, [])).toBeUndefined()\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {find} from 'rambda'\n\nconst list = [1, 2, 3]\n\ndescribe('R.find', () =\u003e {\n  it('happy', () =\u003e {\n    const predicate = (x: number) =\u003e x \u003e 2\n    const result = find(predicate, list)\n    result // $ExpectType number | undefined\n  })\n  it('curried', () =\u003e {\n    const predicate = (x: number) =\u003e x \u003e 2\n    const result = find(predicate)(list)\n    result // $ExpectType number | undefined\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#find)\n\n### findIndex\n\n```typescript\n\nfindIndex\u003cT\u003e(predicate: (x: T) =\u003e boolean, list: T[]): number\n```\n\nIt returns the index of the first element of `list` satisfying the `predicate` function.\n\nIf there is no such element, then `-1` is returned.\n\n```javascript\nconst predicate = x =\u003e R.type(x.foo) === 'Number'\nconst list = [{foo: 'bar'}, {foo: 1}]\n\nconst result = R.findIndex(predicate, list)\n// =\u003e 1\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20predicate%20%3D%20x%20%3D%3E%20R.type(x.foo)%20%3D%3D%3D%20'Number'%0Aconst%20list%20%3D%20%5B%7Bfoo%3A%20'bar'%7D%2C%20%7Bfoo%3A%201%7D%5D%0A%0Aconst%20result%20%3D%20R.findIndex(predicate%2C%20list)%0A%2F%2F%20%3D%3E%201\"\u003eTry this \u003cstrong\u003eR.findIndex\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nfindIndex\u003cT\u003e(predicate: (x: T) =\u003e boolean, list: T[]): number;\nfindIndex\u003cT\u003e(predicate: (x: T) =\u003e boolean): (list: T[]) =\u003e number;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.findIndex\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function findIndex(predicate, list){\n  if (arguments.length === 1) return _list =\u003e findIndex(predicate, _list)\n\n  const len = list.length\n  let index = -1\n\n  while (++index \u003c len){\n    if (predicate(list[ index ])){\n      return index\n    }\n  }\n\n  return -1\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { findIndex } from './findIndex.js'\nimport { propEq } from './propEq.js'\n\nconst list = [ { a : 1 }, { a : 2 }, { a : 3 } ]\n\ntest('happy', () =\u003e {\n  expect(findIndex(propEq(2, 'a'), list)).toBe(1)\n  expect(findIndex(propEq(1, 'a'))(list)).toBe(0)\n  expect(findIndex(propEq(4, 'a'))(list)).toBe(-1)\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {findIndex} from 'rambda'\n\nconst list = [1, 2, 3]\n\ndescribe('R.findIndex', () =\u003e {\n  it('happy', () =\u003e {\n    const predicate = (x: number) =\u003e x \u003e 2\n    const result = findIndex(predicate, list)\n    result // $ExpectType number\n  })\n  it('curried', () =\u003e {\n    const predicate = (x: number) =\u003e x \u003e 2\n    const result = findIndex(predicate)(list)\n    result // $ExpectType number\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#findIndex)\n\n### findLast\n\n```typescript\n\nfindLast\u003cT\u003e(fn: (x: T) =\u003e boolean, list: T[]): T | undefined\n```\n\nIt returns the last element of `list` satisfying the `predicate` function.\n\nIf there is no such element, then `undefined` is returned.\n\n```javascript\nconst predicate = x =\u003e R.type(x.foo) === 'Number'\nconst list = [{foo: 0}, {foo: 1}]\n\nconst result = R.findLast(predicate, list)\n// =\u003e {foo: 1}\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20predicate%20%3D%20x%20%3D%3E%20R.type(x.foo)%20%3D%3D%3D%20'Number'%0Aconst%20list%20%3D%20%5B%7Bfoo%3A%200%7D%2C%20%7Bfoo%3A%201%7D%5D%0A%0Aconst%20result%20%3D%20R.findLast(predicate%2C%20list)%0A%2F%2F%20%3D%3E%20%7Bfoo%3A%201%7D\"\u003eTry this \u003cstrong\u003eR.findLast\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nfindLast\u003cT\u003e(fn: (x: T) =\u003e boolean, list: T[]): T | undefined;\nfindLast\u003cT\u003e(fn: (x: T) =\u003e boolean): (list: T[]) =\u003e T | undefined;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.findLast\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function findLast(predicate, list){\n  if (arguments.length === 1) return _list =\u003e findLast(predicate, _list)\n\n  let index = list.length\n\n  while (--index \u003e= 0){\n    if (predicate(list[ index ])){\n      return list[ index ]\n    }\n  }\n\n  return undefined\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { findLast } from './findLast.js'\n\ntest('happy', () =\u003e {\n  const result = findLast(x =\u003e x \u003e 1, [ 1, 1, 1, 2, 3, 4, 1 ])\n  expect(result).toBe(4)\n\n  expect(findLast(x =\u003e x === 0, [ 0, 1, 1, 2, 3, 4, 1 ])).toBe(0)\n})\n\ntest('with curry', () =\u003e {\n  expect(findLast(x =\u003e x \u003e 1)([ 1, 1, 1, 2, 3, 4, 1 ])).toBe(4)\n})\n\nconst obj1 = { x : 100 }\nconst obj2 = { x : 200 }\nconst a = [ 11, 10, 9, 'cow', obj1, 8, 7, 100, 200, 300, obj2, 4, 3, 2, 1, 0 ]\nconst even = function (x){\n  return x % 2 === 0\n}\nconst gt100 = function (x){\n  return x \u003e 100\n}\nconst isStr = function (x){\n  return typeof x === 'string'\n}\nconst xGt100 = function (o){\n  return o \u0026\u0026 o.x \u003e 100\n}\n\ntest('ramda 1', () =\u003e {\n  expect(findLast(even, a)).toBe(0)\n  expect(findLast(gt100, a)).toBe(300)\n  expect(findLast(isStr, a)).toBe('cow')\n  expect(findLast(xGt100, a)).toEqual(obj2)\n})\n\ntest('ramda 2', () =\u003e {\n  expect(findLast(even, [ 'zing' ])).toBeUndefined()\n})\n\ntest('ramda 3', () =\u003e {\n  expect(findLast(even, [ 2, 3, 5 ])).toBe(2)\n})\n\ntest('ramda 4', () =\u003e {\n  expect(findLast(even, [])).toBeUndefined()\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {findLast} from 'rambda'\n\nconst list = [1, 2, 3]\n\ndescribe('R.findLast', () =\u003e {\n  it('happy', () =\u003e {\n    const predicate = (x: number) =\u003e x \u003e 2\n    const result = findLast(predicate, list)\n    result // $ExpectType number | undefined\n  })\n  it('curried', () =\u003e {\n    const predicate = (x: number) =\u003e x \u003e 2\n    const result = findLast(predicate)(list)\n    result // $ExpectType number | undefined\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#findLast)\n\n### findLastIndex\n\n```typescript\n\nfindLastIndex\u003cT\u003e(predicate: (x: T) =\u003e boolean, list: T[]): number\n```\n\nIt returns the index of the last element of `list` satisfying the `predicate` function.\n\nIf there is no such element, then `-1` is returned.\n\n```javascript\nconst predicate = x =\u003e R.type(x.foo) === 'Number'\nconst list = [{foo: 0}, {foo: 1}]\n\nconst result = R.findLastIndex(predicate, list)\n// =\u003e 1\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20predicate%20%3D%20x%20%3D%3E%20R.type(x.foo)%20%3D%3D%3D%20'Number'%0Aconst%20list%20%3D%20%5B%7Bfoo%3A%200%7D%2C%20%7Bfoo%3A%201%7D%5D%0A%0Aconst%20result%20%3D%20R.findLastIndex(predicate%2C%20list)%0A%2F%2F%20%3D%3E%201\"\u003eTry this \u003cstrong\u003eR.findLastIndex\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nfindLastIndex\u003cT\u003e(predicate: (x: T) =\u003e boolean, list: T[]): number;\nfindLastIndex\u003cT\u003e(predicate: (x: T) =\u003e boolean): (list: T[]) =\u003e number;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.findLastIndex\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function findLastIndex(fn, list){\n  if (arguments.length === 1) return _list =\u003e findLastIndex(fn, _list)\n\n  let index = list.length\n\n  while (--index \u003e= 0){\n    if (fn(list[ index ])){\n      return index\n    }\n  }\n\n  return -1\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { findLastIndex } from './findLastIndex.js'\n\ntest('happy', () =\u003e {\n  const result = findLastIndex(x =\u003e x \u003e 1, [ 1, 1, 1, 2, 3, 4, 1 ])\n\n  expect(result).toBe(5)\n\n  expect(findLastIndex(x =\u003e x === 0, [ 0, 1, 1, 2, 3, 4, 1 ])).toBe(0)\n})\n\ntest('with curry', () =\u003e {\n  expect(findLastIndex(x =\u003e x \u003e 1)([ 1, 1, 1, 2, 3, 4, 1 ])).toBe(5)\n})\n\nconst obj1 = { x : 100 }\nconst obj2 = { x : 200 }\nconst a = [ 11, 10, 9, 'cow', obj1, 8, 7, 100, 200, 300, obj2, 4, 3, 2, 1, 0 ]\nconst even = function (x){\n  return x % 2 === 0\n}\nconst gt100 = function (x){\n  return x \u003e 100\n}\nconst isStr = function (x){\n  return typeof x === 'string'\n}\nconst xGt100 = function (o){\n  return o \u0026\u0026 o.x \u003e 100\n}\n\ntest('ramda 1', () =\u003e {\n  expect(findLastIndex(even, a)).toBe(15)\n  expect(findLastIndex(gt100, a)).toBe(9)\n  expect(findLastIndex(isStr, a)).toBe(3)\n  expect(findLastIndex(xGt100, a)).toBe(10)\n})\n\ntest('ramda 2', () =\u003e {\n  expect(findLastIndex(even, [ 'zing' ])).toBe(-1)\n})\n\ntest('ramda 3', () =\u003e {\n  expect(findLastIndex(even, [ 2, 3, 5 ])).toBe(0)\n})\n\ntest('ramda 4', () =\u003e {\n  expect(findLastIndex(even, [])).toBe(-1)\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {findLastIndex} from 'rambda'\n\nconst list = [1, 2, 3]\n\ndescribe('R.findLastIndex', () =\u003e {\n  it('happy', () =\u003e {\n    const predicate = (x: number) =\u003e x \u003e 2\n    const result = findLastIndex(predicate, list)\n    result // $ExpectType number\n  })\n  it('curried', () =\u003e {\n    const predicate = (x: number) =\u003e x \u003e 2\n    const result = findLastIndex(predicate)(list)\n    result // $ExpectType number\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#findLastIndex)\n\n### flatten\n\n```typescript\n\nflatten\u003cT\u003e(list: any[]): T[]\n```\n\nIt deeply flattens an array.\n\n```javascript\nconst result = R.flatten([\n  1, \n  2, \n  [3, 30, [300]], \n  [4]\n])\n// =\u003e [ 1, 2, 3, 30, 300, 4 ]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.flatten(%5B%0A%20%201%2C%20%0A%20%202%2C%20%0A%20%20%5B3%2C%2030%2C%20%5B300%5D%5D%2C%20%0A%20%20%5B4%5D%0A%5D)%0A%2F%2F%20%3D%3E%20%5B%201%2C%202%2C%203%2C%2030%2C%20300%2C%204%20%5D\"\u003eTry this \u003cstrong\u003eR.flatten\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nflatten\u003cT\u003e(list: any[]): T[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.flatten\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { isArray } from './_internals/isArray.js'\n\nexport function flatten(list, input){\n  const willReturn = input === undefined ? [] : input\n\n  for (let i = 0; i \u003c list.length; i++){\n    if (isArray(list[ i ])){\n      flatten(list[ i ], willReturn)\n    } else {\n      willReturn.push(list[ i ])\n    }\n  }\n\n  return willReturn\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { flatten } from './flatten.js'\n\ntest('happy', () =\u003e {\n  expect(flatten([ 1, 2, 3, [ [ [ [ [ 4 ] ] ] ] ] ])).toEqual([ 1, 2, 3, 4 ])\n\n  expect(flatten([ 1, [ 2, [ [ 3 ] ] ], [ 4 ] ])).toEqual([ 1, 2, 3, 4 ])\n\n  expect(flatten([ 1, [ 2, [ [ [ 3 ] ] ] ], [ 4 ] ])).toEqual([ 1, 2, 3, 4 ])\n\n  expect(flatten([ 1, 2, [ 3, 4 ], 5, [ 6, [ 7, 8, [ 9, [ 10, 11 ], 12 ] ] ] ])).toEqual([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ])\n})\n\ntest('readme example', () =\u003e {\n  const result = flatten([ 1, 2, [ 3, 30, [ 300 ] ], [ 4 ] ])\n  expect(result).toEqual([ 1, 2, 3, 30, 300, 4 ])\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {flatten} from 'rambda'\n\ndescribe('flatten', () =\u003e {\n  it('happy', () =\u003e {\n    const result = flatten\u003cnumber\u003e([1, 2, [3, [4]]])\n    result // $ExpectType number[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#flatten)\n\n### flip\n\nIt returns function which calls `fn` with exchanged first and second argument.\n\n\u003e :boom: Rambda's **flip** will throw if the arity of the input function is greater or equal to 5.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20subtractFlip%20%3D%20R.flip(R.subtract)%0A%0Aconst%20result%20%3D%20%5B%0A%20%20subtractFlip(1%2C7)%2C%0A%20%20R.subtract(1%2C%206)%0A%5D%20%20%0A%2F%2F%20%3D%3E%20%5B6%2C%20-6%5D\"\u003eTry this \u003cstrong\u003eR.flip\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#flip)\n\n### forEach\n\n```typescript\n\nforEach\u003cT\u003e(fn: Iterator\u003cT, void\u003e, list: T[]): T[]\n```\n\nIt applies `iterable` function over all members of `list` and returns `list`.\n\n\u003e :boom: It works with objects, unlike `Ramda`.\n\n```javascript\nconst sideEffect = {}\nconst result = R.forEach(\n  x =\u003e sideEffect[`foo${x}`] = x\n)([1, 2])\n\nsideEffect // =\u003e {foo1: 1, foo2: 2}\nresult // =\u003e [1, 2]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20sideEffect%20%3D%20%7B%7D%0Aconst%20result%20%3D%20R.forEach(%0A%20%20x%20%3D%3E%20sideEffect%5B%60foo%24%7Bx%7D%60%5D%20%3D%20x%0A)(%5B1%2C%202%5D)%0A%0AsideEffect%20%2F%2F%20%3D%3E%20%7Bfoo1%3A%201%2C%20foo2%3A%202%7D%0Aresult%20%2F%2F%20%3D%3E%20%5B1%2C%202%5D\"\u003eTry this \u003cstrong\u003eR.forEach\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nforEach\u003cT\u003e(fn: Iterator\u003cT, void\u003e, list: T[]): T[];\nforEach\u003cT\u003e(fn: Iterator\u003cT, void\u003e): (list: T[]) =\u003e T[];\nforEach\u003cT\u003e(fn: ObjectIterator\u003cT, void\u003e, list: Dictionary\u003cT\u003e): Dictionary\u003cT\u003e;\nforEach\u003cT, U\u003e(fn: ObjectIterator\u003cT, void\u003e): (list: Dictionary\u003cT\u003e) =\u003e Dictionary\u003cT\u003e;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.forEach\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { isArray } from './_internals/isArray.js'\nimport { forEachObjIndexedFn } from './forEachObjIndexed.js'\n\nexport function forEach(fn, iterable){\n  if (arguments.length === 1) return _list =\u003e forEach(fn, _list)\n  if (iterable === undefined) return\n\n  if (isArray(iterable)){\n    let index = 0\n    const len = iterable.length\n\n    while (index \u003c len){\n      fn(iterable[ index ])\n      index++\n    }\n  } else return forEachObjIndexedFn(fn, iterable)\n\n  return iterable\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { forEach } from './forEach.js'\nimport { type } from './type.js'\n\ntest('happy', () =\u003e {\n  const sideEffect = {}\n  forEach(x =\u003e sideEffect[ `foo${ x }` ] = x + 10)([ 1, 2 ])\n\n  expect(sideEffect).toEqual({\n    foo1 : 11,\n    foo2 : 12,\n  })\n})\n\ntest('iterate over object', () =\u003e {\n  const obj = {\n    a : 1,\n    b : [ 1, 2 ],\n    c : { d : 7 },\n    f : 'foo',\n  }\n  const result = {}\n  const returned = forEach((\n    val, prop, inputObj\n  ) =\u003e {\n    expect(type(inputObj)).toBe('Object')\n    result[ prop ] = `${ prop }-${ type(val) }`\n  })(obj)\n\n  const expected = {\n    a : 'a-Number',\n    b : 'b-Array',\n    c : 'c-Object',\n    f : 'f-String',\n  }\n\n  expect(result).toEqual(expected)\n  expect(returned).toEqual(obj)\n})\n\ntest('with empty list', () =\u003e {\n  const list = []\n  const result = forEach(x =\u003e x * x)(list)\n\n  expect(result).toEqual(list)\n})\n\ntest('with wrong input', () =\u003e {\n  const list = undefined\n  const result = forEach(x =\u003e x * x)(list)\n\n  expect(result).toBeUndefined()\n})\n\ntest('returns the input', () =\u003e {\n  const list = [ 1, 2, 3 ]\n  const result = forEach(x =\u003e x * x)(list)\n\n  expect(result).toEqual(list)\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {forEach} from 'rambda'\n\nconst list = [1, 2, 3]\nconst obj = {a: 1, b: 2}\n\ndescribe('R.forEach with arrays', () =\u003e {\n  it('happy', () =\u003e {\n    const result = forEach(a =\u003e {\n      a // $ExpectType number\n    }, list)\n    result // $ExpectType number[]\n  })\n  it('curried require an explicit typing', () =\u003e {\n    const result = forEach\u003cnumber\u003e(a =\u003e {\n      a // $ExpectType number\n    })(list)\n    result // $ExpectType number[]\n  })\n})\n\ndescribe('R.forEach with objects', () =\u003e {\n  it('happy', () =\u003e {\n    const result = forEach((a, b, c) =\u003e {\n      a // $ExpectType number\n      b // $ExpectType string\n      c // $ExpectType Dictionary\u003cnumber\u003e\n      return `${a}`\n    }, obj)\n    result // $ExpectType Dictionary\u003cnumber\u003e\n  })\n  it('curried require an input typing and a dummy third typing', () =\u003e {\n    // Required in order all typings to work\n    const result = forEach\u003cnumber, any\u003e((a, b, c) =\u003e {\n      a // $ExpectType number\n      b // $ExpectType string\n      c // $ExpectType Dictionary\u003cnumber\u003e\n    })(obj)\n    result // $ExpectType Dictionary\u003cnumber\u003e\n  })\n  it('iterator without property', () =\u003e {\n    const result = forEach(a =\u003e {\n      a // $ExpectType number\n    }, obj)\n    result // $ExpectType Dictionary\u003cnumber\u003e\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#forEach)\n\n### forEachObjIndexed\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#forEachObjIndexed)\n\n### fromPairs\n\nIt transforms a `listOfPairs` to an object.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20listOfPairs%20%3D%20%5B%20%5B%20'a'%2C%201%20%5D%2C%20%5B%20'b'%2C%202%20%5D%2C%20%5B%20'c'%2C%20%5B%203%2C%204%20%5D%20%5D%20%5D%0Aconst%20expected%20%3D%20%7B%0A%20%20a%20%3A%201%2C%0A%20%20b%20%3A%202%2C%0A%20%20c%20%3A%20%5B%203%2C%204%20%5D%2C%0A%7D%0A%0Aconst%20result%20%3D%20R.fromPairs(listOfPairs)%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60\"\u003eTry this \u003cstrong\u003eR.fromPairs\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#fromPairs)\n\n### groupBy\n\nIt splits `list` according to a provided `groupFn` function and returns an object.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B%20'a'%2C%20'b'%2C%20'aa'%2C%20'bb'%20%5D%0Aconst%20groupFn%20%3D%20x%20%3D%3E%20x.length%0A%0Aconst%20result%20%3D%20R.groupBy(groupFn%2C%20list)%0A%2F%2F%20%3D%3E%20%7B%20'1'%3A%20%5B'a'%2C%20'b'%5D%2C%20'2'%3A%20%5B'aa'%2C%20'bb'%5D%20%7D\"\u003eTry this \u003cstrong\u003eR.groupBy\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#groupBy)\n\n### groupWith\n\nIt returns separated version of list or string `input`, where separation is done with equality `compareFn` function.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20compareFn%20%3D%20(x%2C%20y)%20%3D%3E%20x%20%3D%3D%3D%20y%0Aconst%20list%20%3D%20%5B1%2C%202%2C%202%2C%201%2C%201%2C%202%5D%0A%0Aconst%20result%20%3D%20R.groupWith(isConsecutive%2C%20list)%0A%2F%2F%20%3D%3E%20%5B%5B1%5D%2C%20%5B2%2C2%5D%2C%20%5B1%2C1%5D%2C%20%5B2%5D%5D\"\u003eTry this \u003cstrong\u003eR.groupWith\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#groupWith)\n\n### gt\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5BR.gt(2%2C%201)%2C%20R.gt(2%2C%203)%5D%0A%2F%2F%20%3D%3E%20%5Btrue%2C%20false%5D\"\u003eTry this \u003cstrong\u003eR.gt\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#gt)\n\n### gte\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5BR.gte(2%2C%201)%2C%20R.gte(2%2C%202)%2C%20R.gte(2%2C%203)%5D%0A%2F%2F%20%3D%3E%20%5Btrue%2C%20true%2C%20false%5D\"\u003eTry this \u003cstrong\u003eR.gte\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#gte)\n\n### has\n\n```typescript\n\nhas\u003cT\u003e(prop: string, obj: T): boolean\n```\n\nIt returns `true` if `obj` has property `prop`.\n\n```javascript\nconst obj = {a: 1}\n\nconst result = [\n  R.has('a', Record\u003cstring, unknown\u003e),\n  R.has('b', Record\u003cstring, unknown\u003e)\n]\n// =\u003e [true, false]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20obj%20%3D%20%7Ba%3A%201%7D%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.has('a'%2C%20Record%3Cstring%2C%20unknown%3E)%2C%0A%20%20R.has('b'%2C%20Record%3Cstring%2C%20unknown%3E)%0A%5D%0A%2F%2F%20%3D%3E%20%5Btrue%2C%20false%5D\"\u003eTry this \u003cstrong\u003eR.has\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nhas\u003cT\u003e(prop: string, obj: T): boolean;\nhas(prop: string): \u003cT\u003e(obj: T) =\u003e boolean;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.has\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function has(prop, obj){\n  if (arguments.length === 1) return _obj =\u003e has(prop, _obj)\n\n  if (!obj) return false\n\n  return obj.hasOwnProperty(prop)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { has } from './has.js'\n\ntest('happy', () =\u003e {\n  expect(has('a')({ a : 1 })).toBeTrue()\n  expect(has('b', { a : 1 })).toBeFalse()\n})\n\ntest('with non-object', () =\u003e {\n  expect(has('a', undefined)).toBeFalse()\n  expect(has('a', null)).toBeFalse()\n  expect(has('a', true)).toBeFalse()\n  expect(has('a', '')).toBeFalse()\n  expect(has('a', /a/)).toBeFalse()\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {has} from 'rambda'\n\ndescribe('R.has', () =\u003e {\n  it('happy', () =\u003e {\n    const result = has('foo', {a: 1})\n    const curriedResult = has('bar')({a: 1})\n    result // $ExpectType boolean\n    curriedResult // $ExpectType boolean\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#has)\n\n### hasIn\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.hasIn('a'%2C%20%7Ba%3A%201%7D)%0A%2F%2F%20%3D%3E%20true\"\u003eTry this \u003cstrong\u003eR.hasIn\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#hasIn)\n\n### hasPath\n\n```typescript\n\nhasPath\u003cT\u003e(\n  path: string | string[],\n  input: object\n): boolean\n```\n\nIt will return true, if `input` object has truthy `path`(calculated with `R.path`).\n\n```javascript\nconst path = 'a.b'\nconst pathAsArray = ['a', 'b']\nconst obj = {a: {b: []}}\n\nconst result = [\n  R.hasPath(path, Record\u003cstring, unknown\u003e),\n  R.hasPath(pathAsArray, Record\u003cstring, unknown\u003e),\n  R.hasPath('a.c', Record\u003cstring, unknown\u003e),\n]\n// =\u003e [true, true, false]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20path%20%3D%20'a.b'%0Aconst%20pathAsArray%20%3D%20%5B'a'%2C%20'b'%5D%0Aconst%20obj%20%3D%20%7Ba%3A%20%7Bb%3A%20%5B%5D%7D%7D%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.hasPath(path%2C%20Record%3Cstring%2C%20unknown%3E)%2C%0A%20%20R.hasPath(pathAsArray%2C%20Record%3Cstring%2C%20unknown%3E)%2C%0A%20%20R.hasPath('a.c'%2C%20Record%3Cstring%2C%20unknown%3E)%2C%0A%5D%0A%2F%2F%20%3D%3E%20%5Btrue%2C%20true%2C%20false%5D\"\u003eTry this \u003cstrong\u003eR.hasPath\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nhasPath\u003cT\u003e(\n  path: string | string[],\n  input: object\n): boolean;\nhasPath\u003cT\u003e(\n  path: string | string[]\n): (input: object) =\u003e boolean;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.hasPath\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { path } from './path.js'\n\nexport function hasPath(pathInput, obj){\n  if (arguments.length === 1){\n    return objHolder =\u003e hasPath(pathInput, objHolder)\n  }\n\n  return path(pathInput, obj) !== undefined\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { hasPath } from './hasPath.js'\n\ntest('when true', () =\u003e {\n  const path = 'a.b'\n  const obj = { a : { b : [] } }\n\n  const result = hasPath(path)(obj)\n  const expectedResult = true\n\n  expect(result).toEqual(expectedResult)\n})\n\ntest('when false', () =\u003e {\n  const path = 'a.b'\n  const obj = {}\n\n  const result = hasPath(path, obj)\n  const expectedResult = false\n\n  expect(result).toEqual(expectedResult)\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {hasPath} from 'rambda'\n\ndescribe('R.hasPath', () =\u003e {\n  it('string path', () =\u003e {\n    const obj = {a: {b: 1}}\n    const result = hasPath('a.b', obj)\n    const curriedResult = hasPath('a.c')(obj)\n    result // $ExpectType boolean\n    curriedResult // $ExpectType boolean\n  })\n  it('array path', () =\u003e {\n    const obj = {a: {b: 1}}\n    const result = hasPath(['a', 'b'], obj)\n    const curriedResult = hasPath(['a', 'c'])(obj)\n    result // $ExpectType boolean\n    curriedResult // $ExpectType boolean\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#hasPath)\n\n### head\n\n```typescript\n\nhead(str: string): string\n```\n\nIt returns the first element of list or string `input`. It returns `undefined` if array has length of 0.\n\n```javascript\nconst result = [\n  R.head([1, 2, 3]),\n  R.head('foo') \n]\n// =\u003e [1, 'f']\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5B%0A%20%20R.head(%5B1%2C%202%2C%203%5D)%2C%0A%20%20R.head('foo')%20%0A%5D%0A%2F%2F%20%3D%3E%20%5B1%2C%20'f'%5D\"\u003eTry this \u003cstrong\u003eR.head\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nhead(str: string): string;\nhead(str: ''): undefined;\nhead(list: readonly[]): undefined;\nhead\u003cT\u003e(list: never[]): undefined;\nhead\u003cT extends unknown[]\u003e(array: T): FirstArrayElement\u003cT\u003e\nhead\u003cT extends readonly unknown[]\u003e(array: T): FirstArrayElement\u003cT\u003e\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.head\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function head(listOrString){\n  if (typeof listOrString === 'string') return listOrString[ 0 ] || ''\n\n  return listOrString[ 0 ]\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { head } from './head.js'\n\ntest('head', () =\u003e {\n  expect(head([ 'fi', 'fo', 'fum' ])).toBe('fi')\n  expect(head([])).toBeUndefined()\n  expect(head('foo')).toBe('f')\n  expect(head('')).toBe('')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {\n  emptyList,\n  emptyString,\n  mixedList,\n  mixedListConst,\n  numberList,\n  numberListConst,\n  string,\n} from '_internals/typescriptTestUtils'\nimport {head, last} from 'rambda'\n\ndescribe('R.head', () =\u003e {\n  it('string', () =\u003e {\n    head(string) // $ExpectType string\n    last(string) // $ExpectType string\n  })\n  it('empty string', () =\u003e {\n    head(emptyString) // $ExpectType undefined\n    last(emptyString) // $ExpectType undefined\n  })\n  it('array', () =\u003e {\n    head(numberList) // $ExpectType number\n    head(numberListConst) // $ExpectType 1\n\n    last(numberList) // $ExpectType number\n    last(numberListConst) // $ExpectType 3\n  })\n  it('empty array', () =\u003e {\n    const list = [] as const\n    head(emptyList) // $ExpectType undefined\n    head(list) // $ExpectType undefined\n    last(emptyList) // $ExpectType undefined\n    last(list) // $ExpectType undefined\n  })\n\n  it('mixed', () =\u003e {\n    head(mixedList) // $ExpectType string | number\n    head(mixedListConst) // $ExpectType 1\n    last(mixedList) // $ExpectType string | number\n    last(mixedListConst) // $ExpectType \"bar\"\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#head)\n\n### identical\n\nIt returns `true` if its arguments `a` and `b` are identical.\n\nOtherwise, it returns `false`.\n\n\u003e :boom: Values are identical if they reference the same memory. `NaN` is identical to `NaN`; `0` and `-0` are not identical.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20objA%20%3D%20%7Ba%3A%201%7D%3B%0Aconst%20objB%20%3D%20%7Ba%3A%201%7D%3B%0AR.identical(objA%2C%20objA)%3B%20%2F%2F%20%3D%3E%20true%0AR.identical(objA%2C%20objB)%3B%20%2F%2F%20%3D%3E%20false%0AR.identical(1%2C%201)%3B%20%2F%2F%20%3D%3E%20true%0AR.identical(1%2C%20'1')%3B%20%2F%2F%20%3D%3E%20false%0AR.identical(%5B%5D%2C%20%5B%5D)%3B%20%2F%2F%20%3D%3E%20false%0AR.identical(0%2C%20-0)%3B%20%2F%2F%20%3D%3E%20false%0Aconst%20result%20%3D%20R.identical(NaN%2C%20NaN)%3B%20%2F%2F%20%3D%3E%20true\"\u003eTry this \u003cstrong\u003eR.identical\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#identical)\n\n### identity\n\n```typescript\n\nidentity\u003cT\u003e(input: T): T\n```\n\nIt just passes back the supplied `input` argument.\n\n\u003e :boom: Logic\n\n```javascript\nR.identity(7) // =\u003e 7\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.identity(7)%20%2F%2F%20%3D%3E%207\"\u003eTry this \u003cstrong\u003eR.identity\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nidentity\u003cT\u003e(input: T): T;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.identity\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function identity(x){\n  return x\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { identity } from './identity.js'\n\ntest('happy', () =\u003e {\n  expect(identity(7)).toBe(7)\n  expect(identity(true)).toBeTrue()\n  expect(identity({ a : 1 })).toEqual({ a : 1 })\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {identity} from 'rambda'\n\ndescribe('R.identity', () =\u003e {\n  it('happy', () =\u003e {\n    const result = identity(4)\n    result // $ExpectType 4\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#identity)\n\n### ifElse\n\n```typescript\n\nifElse\u003cT, TFiltered extends T, TOnTrueResult, TOnFalseResult\u003e(\n  pred: (a: T) =\u003e a is TFiltered,\n  onTrue: (a: TFiltered) =\u003e TOnTrueResult,\n  onFalse: (a: Exclude\u003cT, TFiltered\u003e) =\u003e TOnFalseResult,\n): (a: T) =\u003e TOnTrueResult | TOnFalseResult\n```\n\nIt expects `condition`, `onTrue` and `onFalse` functions as inputs and it returns a new function with example name of `fn`. \n\nWhen `fn`` is called with `input` argument, it will return either `onTrue(input)` or `onFalse(input)` depending on `condition(input)` evaluation.\n\n```javascript\nconst fn = R.ifElse(\n x =\u003e x\u003e10,\n x =\u003e x*2,\n x =\u003e x*10\n)\n\nconst result = [ fn(8), fn(18) ]\n// =\u003e [80, 36]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20fn%20%3D%20R.ifElse(%0A%20x%20%3D%3E%20x%3E10%2C%0A%20x%20%3D%3E%20x*2%2C%0A%20x%20%3D%3E%20x*10%0A)%0A%0Aconst%20result%20%3D%20%5B%20fn(8)%2C%20fn(18)%20%5D%0A%2F%2F%20%3D%3E%20%5B80%2C%2036%5D\"\u003eTry this \u003cstrong\u003eR.ifElse\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nifElse\u003cT, TFiltered extends T, TOnTrueResult, TOnFalseResult\u003e(\n  pred: (a: T) =\u003e a is TFiltered,\n  onTrue: (a: TFiltered) =\u003e TOnTrueResult,\n  onFalse: (a: Exclude\u003cT, TFiltered\u003e) =\u003e TOnFalseResult,\n): (a: T) =\u003e TOnTrueResult | TOnFalseResult;\nifElse\u003cTArgs extends any[], TOnTrueResult, TOnFalseResult\u003e(fn: (...args: TArgs) =\u003e boolean, onTrue: (...args: TArgs) =\u003e TOnTrueResult, onFalse: (...args: TArgs) =\u003e TOnFalseResult): (...args: TArgs) =\u003e TOnTrueResult | TOnFalseResult;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.ifElse\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { curry } from './curry.js'\n\nfunction ifElseFn(\n  condition, onTrue, onFalse\n){\n  return (...input) =\u003e {\n    const conditionResult =\n      typeof condition === 'boolean' ? condition : condition(...input)\n\n    if (conditionResult === true){\n      return onTrue(...input)\n    }\n\n    return onFalse(...input)\n  }\n}\n\nexport const ifElse = curry(ifElseFn)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { always } from './always.js'\nimport { has } from './has.js'\nimport { identity } from './identity.js'\nimport { ifElse } from './ifElse.js'\nimport { prop } from './prop.js'\n\nconst condition = has('foo')\nconst v = function (a){\n  return typeof a === 'number'\n}\nconst t = function (a){\n  return a + 1\n}\nconst ifFn = x =\u003e prop('foo', x).length\nconst elseFn = () =\u003e false\n\ntest('happy', () =\u003e {\n  const fn = ifElse(condition, ifFn)(elseFn)\n\n  expect(fn({ foo : 'bar' })).toBe(3)\n  expect(fn({ fo : 'bar' })).toBeFalse()\n})\n\ntest('ramda spec', () =\u003e {\n  const ifIsNumber = ifElse(v)\n  expect(ifIsNumber(t, identity)(15)).toBe(16)\n  expect(ifIsNumber(t, identity)('hello')).toBe('hello')\n})\n\ntest('pass all arguments', () =\u003e {\n  const identity = function (a){\n    return a\n  }\n  const v = function (){\n    return true\n  }\n  const onTrue = function (a, b){\n    expect(a).toBe(123)\n    expect(b).toBe('abc')\n  }\n  ifElse(\n    v, onTrue, identity\n  )(123, 'abc')\n})\n\ntest('accept constant as condition', () =\u003e {\n  const fn = ifElse(true)(always(true))(always(false))\n\n  expect(fn()).toBeTrue()\n})\n\ntest('accept constant as condition - case 2', () =\u003e {\n  const fn = ifElse(\n    false, always(true), always(false)\n  )\n\n  expect(fn()).toBeFalse()\n})\n\ntest('curry 1', () =\u003e {\n  const fn = ifElse(condition, ifFn)(elseFn)\n\n  expect(fn({ foo : 'bar' })).toBe(3)\n  expect(fn({ fo : 'bar' })).toBeFalse()\n})\n\ntest('curry 2', () =\u003e {\n  const fn = ifElse(condition)(ifFn)(elseFn)\n\n  expect(fn({ foo : 'bar' })).toBe(3)\n  expect(fn({ fo : 'bar' })).toBeFalse()\n})\n\ntest('simple arity of 1', () =\u003e {\n  const condition = x =\u003e x \u003e 5\n  const onTrue = x =\u003e x + 1\n  const onFalse = x =\u003e x + 10\n  const result = ifElse(\n    condition, onTrue, onFalse\n  )(1)\n  expect(result).toBe(11)\n})\n\ntest('simple arity of 2', () =\u003e {\n  const condition = (x, y) =\u003e x + y \u003e 5\n  const onTrue = (x, y) =\u003e x + y + 1\n  const onFalse = (x, y) =\u003e x + y + 10\n  const result = ifElse(\n    condition, onTrue, onFalse\n  )(1, 10)\n  expect(result).toBe(12)\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {ifElse} from 'rambda'\n\ndescribe('R.ifElse', () =\u003e {\n  it('happy', () =\u003e {\n    const condition = (x: number) =\u003e x \u003e 5\n    const onTrue = (x: number) =\u003e `foo${x}`\n    const onFalse = (x: number) =\u003e `bar${x}`\n    const fn = ifElse(condition, onTrue, onFalse)\n    fn // $ExpectType (x: number) =\u003e string\n    const result = fn(3)\n    result // $ExpectType string\n  })\n  it('arity of 2', () =\u003e {\n    const condition = (x: number, y: string) =\u003e x + y.length \u003e 5\n    const onTrue = (x: number, y: string) =\u003e `foo${x}-${y}`\n    const onFalse = (x: number, y: string) =\u003e `bar${x}-${y}`\n    const fn = ifElse(condition, onTrue, onFalse)\n    fn // $ExpectType (x: number, y: string) =\u003e string\n    const result = fn(3, 'hello')\n    result // $ExpectType string\n  })\n  test('DefinitelyTyped#59291', () =\u003e {\n    const getLengthIfStringElseDouble = ifElse(\n      (a: string | number): a is string =\u003e true,\n      a =\u003e a.length,\n      a =\u003e a * 2\n    )\n\n    getLengthIfStringElseDouble('foo') // $ExpectType number\n    getLengthIfStringElseDouble(3) // $ExpectType number\n    const result = ifElse(\n      (a: {\n        foo?: string,\n        bar: number | string,\n      }): a is {foo: string, bar: string} =\u003e true,\n      (a): [string, string] =\u003e [a.foo, a.bar],\n      (a): [string | undefined, string | number] =\u003e [a.foo, a.bar]\n    )\n    result // $ExpectType (a: { foo?: string | undefined; bar: string | number; }) =\u003e [string, string] | [string | undefined, string | number]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#ifElse)\n\n### inc\n\nIt increments a number.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.inc(1)%20%2F%2F%20%3D%3E%202\"\u003eTry this \u003cstrong\u003eR.inc\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#inc)\n\n### includes\n\n```typescript\n\nincludes\u003cT extends string\u003e(valueToFind: T, input: string): boolean\n```\n\nIf `input` is string, then this method work as native `String.includes`.\n\nIf `input` is array, then `R.equals` is used to define if `valueToFind` belongs to the list.\n\n```javascript\nconst result = [\n  R.includes('oo', 'foo'),\n  R.includes({a: 1}, [{a: 1}])\n]\n// =\u003e [true, true ]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5B%0A%20%20R.includes('oo'%2C%20'foo')%2C%0A%20%20R.includes(%7Ba%3A%201%7D%2C%20%5B%7Ba%3A%201%7D%5D)%0A%5D%0A%2F%2F%20%3D%3E%20%5Btrue%2C%20true%20%5D\"\u003eTry this \u003cstrong\u003eR.includes\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nincludes\u003cT extends string\u003e(valueToFind: T, input: string): boolean;\nincludes\u003cT extends string\u003e(valueToFind: T): (input: string) =\u003e boolean;\nincludes\u003cT\u003e(valueToFind: T, input: T[]): boolean;\nincludes\u003cT\u003e(valueToFind: T): (input: T[]) =\u003e boolean;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.includes\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { isArray } from './_internals/isArray.js'\nimport { _indexOf } from './equals.js'\n\nexport function includes(valueToFind, iterable){\n  if (arguments.length === 1)\n    return _iterable =\u003e includes(valueToFind, _iterable)\n  if (typeof iterable === 'string'){\n    return iterable.includes(valueToFind)\n  }\n  if (!iterable){\n    throw new TypeError(`Cannot read property \\'indexOf\\' of ${ iterable }`)\n  }\n  if (!isArray(iterable)) return false\n\n  return _indexOf(valueToFind, iterable) \u003e -1\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { includes as includesRamda } from 'ramda'\n\nimport { includes } from './includes.js'\n\ntest('with string as iterable', () =\u003e {\n  const str = 'foo bar'\n\n  expect(includes('bar')(str)).toBeTrue()\n  expect(includesRamda('bar')(str)).toBeTrue()\n  expect(includes('never', str)).toBeFalse()\n  expect(includesRamda('never', str)).toBeFalse()\n})\n\ntest('with array as iterable', () =\u003e {\n  const arr = [ 1, 2, 3 ]\n\n  expect(includes(2)(arr)).toBeTrue()\n  expect(includesRamda(2)(arr)).toBeTrue()\n\n  expect(includes(4, arr)).toBeFalse()\n  expect(includesRamda(4, arr)).toBeFalse()\n})\n\ntest('with list of objects as iterable', () =\u003e {\n  const arr = [ { a : 1 }, { b : 2 }, { c : 3 } ]\n\n  expect(includes({ c : 3 }, arr)).toBeTrue()\n  expect(includesRamda({ c : 3 }, arr)).toBeTrue()\n})\n\ntest('with NaN', () =\u003e {\n  const result = includes(NaN, [ NaN ])\n  const ramdaResult = includesRamda(NaN, [ NaN ])\n  expect(result).toBeTrue()\n  expect(ramdaResult).toBeTrue()\n})\n\ntest('with wrong input that does not throw', () =\u003e {\n  const result = includes(1, /foo/g)\n  const ramdaResult = includesRamda(1, /foo/g)\n  expect(result).toBeFalse()\n  expect(ramdaResult).toBeFalse()\n})\n\ntest('throws on wrong input - match ramda behaviour', () =\u003e {\n  expect(() =\u003e includes(2, null)).toThrowWithMessage(TypeError,\n    'Cannot read property \\'indexOf\\' of null')\n  expect(() =\u003e includesRamda(2, null)).toThrowWithMessage(TypeError,\n    'Cannot read properties of null (reading \\'indexOf\\')')\n  expect(() =\u003e includes(2, undefined)).toThrowWithMessage(TypeError,\n    'Cannot read property \\'indexOf\\' of undefined')\n  expect(() =\u003e includesRamda(2, undefined)).toThrowWithMessage(TypeError,\n    'Cannot read properties of undefined (reading \\'indexOf\\')')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {includes} from 'rambda'\n\nconst list = [{a: {b: '1'}}, {a: {c: '2'}}, {a: {b: '3'}}]\n\ndescribe('R.includes', () =\u003e {\n  it('happy', () =\u003e {\n    const result = includes({a: {b: '1'}}, list)\n    result // $ExpectType boolean\n    const result2 = includes('oo', ['f', 'oo'])\n    result2 // $ExpectType boolean\n  })\n  it('with string', () =\u003e {\n    const str = 'foo' as 'foo' | 'bar'\n    const result = includes('oo', str)\n    const curriedResult = includes('oo')(str)\n\n    result // $ExpectType boolean\n    curriedResult // $ExpectType boolean\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#includes)\n\n### indexBy\n\nIt generates object with properties provided by `condition` and values provided by `list` array.\n\nIf `condition` is a function, then all list members are passed through it.\n\nIf `condition` is a string, then all list members are passed through `R.path(condition)`.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B%20%7Bid%3A%2010%7D%2C%20%7Bid%3A%2020%7D%20%5D%0A%0Aconst%20withFunction%20%3D%20R.indexBy(%0A%20%20x%20%3D%3E%20x.id%2C%0A%20%20list%0A)%0Aconst%20withString%20%3D%20R.indexBy(%0A%20%20'id'%2C%0A%20%20list%0A)%0Aconst%20result%20%3D%20%5B%0A%20%20withFunction%2C%20%0A%20%20R.equals(withFunction%2C%20withString)%0A%5D%0A%2F%2F%20%3D%3E%20%5B%20%7B%2010%3A%20%7Bid%3A%2010%7D%2C%2020%3A%20%7Bid%3A%2020%7D%20%7D%2C%20true%20%5D\"\u003eTry this \u003cstrong\u003eR.indexBy\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#indexBy)\n\n### indexOf\n\nIt returns the index of the first element of `list` equals to `valueToFind`.\n\nIf there is no such element, it returns `-1`.\n\n\u003e :boom: It uses `R.equals` for list of objects/arrays or native `indexOf` for any other case.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B0%2C%201%2C%202%2C%203%5D%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.indexOf(2%2C%20list)%2C%0A%20%20R.indexOf(0%2C%20list)%0A%5D%0A%2F%2F%20%3D%3E%20%5B2%2C%20-1%5D\"\u003eTry this \u003cstrong\u003eR.indexOf\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#indexOf)\n\n### init\n\n```typescript\n\ninit\u003cT extends unknown[]\u003e(input: T): T extends readonly [...infer U, any] ? U : [...T]\n```\n\nIt returns all but the last element of list or string `input`.\n\n```javascript\nconst result = [\n  R.init([1, 2, 3]) , \n  R.init('foo')  // =\u003e 'fo'\n]\n// =\u003e [[1, 2], 'fo']\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5B%0A%20%20R.init(%5B1%2C%202%2C%203%5D)%20%2C%20%0A%20%20R.init('foo')%20%20%2F%2F%20%3D%3E%20'fo'%0A%5D%0A%2F%2F%20%3D%3E%20%5B%5B1%2C%202%5D%2C%20'fo'%5D\"\u003eTry this \u003cstrong\u003eR.init\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\ninit\u003cT extends unknown[]\u003e(input: T): T extends readonly [...infer U, any] ? U : [...T];\ninit(input: string): string;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.init\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport baseSlice from './_internals/baseSlice.js'\n\nexport function init(listOrString){\n  if (typeof listOrString === 'string') return listOrString.slice(0, -1)\n\n  return listOrString.length ?\n    baseSlice(\n      listOrString, 0, -1\n    ) :\n    []\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { init } from './init.js'\n\ntest('with array', () =\u003e {\n  expect(init([ 1, 2, 3 ])).toEqual([ 1, 2 ])\n  expect(init([ 1, 2 ])).toEqual([ 1 ])\n  expect(init([ 1 ])).toEqual([])\n  expect(init([])).toEqual([])\n  expect(init([])).toEqual([])\n  expect(init([ 1 ])).toEqual([])\n})\n\ntest('with string', () =\u003e {\n  expect(init('foo')).toBe('fo')\n  expect(init('f')).toBe('')\n  expect(init('')).toBe('')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {init} from 'rambda'\n\ndescribe('R.init', () =\u003e {\n  it('with string', () =\u003e {\n    const result = init('foo')\n\n    result // $ExpectType string\n  })\n  it('with list - one type', () =\u003e {\n    const result = init([1, 2, 3])\n\n    result // $ExpectType number[]\n  })\n  it('with list - mixed types', () =\u003e {\n    const result = init([1, 2, 3, 'foo', 'bar'])\n\n    result // $ExpectType (string | number)[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#init)\n\n### innerJoin\n\nIt returns a new list by applying a `predicate` function to all elements of `list1` and `list2` and keeping only these elements where `predicate` returns `true`.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list1%20%3D%20%5B1%2C%202%2C%203%2C%204%2C%205%5D%0Aconst%20list2%20%3D%20%5B4%2C%205%2C%206%5D%0Aconst%20predicate%20%3D%20(x%2C%20y)%20%3D%3E%20x%20%3E%3D%20y%0Aconst%20result%20%3D%20R.innerJoin(predicate%2C%20list1%2C%20list2)%0A%2F%2F%20%3D%3E%20%5B4%2C%205%5D\"\u003eTry this \u003cstrong\u003eR.innerJoin\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#innerJoin)\n\n### insert\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B'a'%2C%20'b'%2C%20'c'%2C%20'd'%2C%20'e'%5D%3B%0Aconst%20result%20%3D%20R.insert(2%2C%20'x'%2C%20list)%3B%0A%2F%2F%20%3D%3E%20%5B'a'%2C%20'b'%2C%20'x'%2C%20'c'%2C%20'd'%2C%20'e'%5D\"\u003eTry this \u003cstrong\u003eR.insert\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#insert)\n\n### insertAll\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B'a'%2C%20'b'%2C%20'c'%2C%20'd'%2C%20'e'%5D%3B%0Aconst%20result%20%3D%20R.insertAll(2%2C%20%5B'x'%2C%20'y'%2C%20'z'%5D%2C%20list)%3B%0A%2F%2F%20%3D%3E%20%5B'a'%2C%20'b'%2C%20'x'%2C%20'y'%2C%20'z'%2C%20'c'%2C%20'd'%2C%20'e'%5D\"\u003eTry this \u003cstrong\u003eR.insertAll\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#insertAll)\n\n### intersection\n\nIt loops through `listA` and `listB` and returns the intersection of the two according to `R.equals`.\n\n\u003e :boom: There is slight difference between Rambda and Ramda implementation. Ramda.intersection(['a', 'b', 'c'], ['c', 'b']) result is \"[ 'c', 'b' ]\", but Rambda result is \"[ 'b', 'c' ]\".\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20listA%20%3D%20%5B%20%7B%20id%20%3A%201%20%7D%2C%20%7B%20id%20%3A%202%20%7D%2C%20%7B%20id%20%3A%203%20%7D%2C%20%7B%20id%20%3A%204%20%7D%20%5D%0Aconst%20listB%20%3D%20%5B%20%7B%20id%20%3A%203%20%7D%2C%20%7B%20id%20%3A%204%20%7D%2C%20%7B%20id%20%3A%205%20%7D%2C%20%7B%20id%20%3A%206%20%7D%20%5D%0A%0Aconst%20result%20%3D%20R.intersection(listA%2C%20listB)%0A%2F%2F%20%3D%3E%20%5B%7B%20id%20%3A%203%20%7D%2C%20%7B%20id%20%3A%204%20%7D%5D\"\u003eTry this \u003cstrong\u003eR.intersection\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#intersection)\n\n### intersperse\n\nIt adds a `separator` between members of `list`.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B%200%2C%201%2C%202%2C%203%20%5D%0Aconst%20separator%20%3D%20'%7C'%0Aconst%20result%20%3D%20intersperse(separator%2C%20list)%0A%2F%2F%20%3D%3E%20%5B0%2C%20'%7C'%2C%201%2C%20'%7C'%2C%202%2C%20'%7C'%2C%203%5D\"\u003eTry this \u003cstrong\u003eR.intersperse\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#intersperse)\n\n### is\n\nIt returns `true` if `x` is instance of `targetPrototype`.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5B%0A%20%20R.is(String%2C%20'foo')%2C%20%20%0A%20%20R.is(Array%2C%201)%0A%5D%0A%2F%2F%20%3D%3E%20%5Btrue%2C%20false%5D\"\u003eTry this \u003cstrong\u003eR.is\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#is)\n\n### isEmpty\n\n```typescript\n\nisEmpty\u003cT\u003e(x: T): boolean\n```\n\nIt returns `true` if `x` is `empty`.\n\n```javascript\nconst result = [\n  R.isEmpty(''),\n  R.isEmpty({ x : 0 })\n]\n// =\u003e [true, false]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5B%0A%20%20R.isEmpty('')%2C%0A%20%20R.isEmpty(%7B%20x%20%3A%200%20%7D)%0A%5D%0A%2F%2F%20%3D%3E%20%5Btrue%2C%20false%5D\"\u003eTry this \u003cstrong\u003eR.isEmpty\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nisEmpty\u003cT\u003e(x: T): boolean;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.isEmpty\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { type } from './type.js'\n\nexport function isEmpty(input){\n  const inputType = type(input)\n  if ([ 'Undefined', 'NaN', 'Number', 'Null' ].includes(inputType))\n    return false\n  if (!input) return true\n\n  if (inputType === 'Object'){\n    return Object.keys(input).length === 0\n  }\n\n  if (inputType === 'Array'){\n    return input.length === 0\n  }\n\n  return false\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { isEmpty } from './isEmpty.js'\n\ntest('happy', () =\u003e {\n  expect(isEmpty(undefined)).toBeFalse()\n  expect(isEmpty('')).toBeTrue()\n  expect(isEmpty(null)).toBeFalse()\n  expect(isEmpty(' ')).toBeFalse()\n  expect(isEmpty(new RegExp(''))).toBeFalse()\n  expect(isEmpty([])).toBeTrue()\n  expect(isEmpty([ [] ])).toBeFalse()\n  expect(isEmpty({})).toBeTrue()\n  expect(isEmpty({ x : 0 })).toBeFalse()\n  expect(isEmpty(0)).toBeFalse()\n  expect(isEmpty(NaN)).toBeFalse()\n  expect(isEmpty([ '' ])).toBeFalse()\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {isEmpty} from 'rambda'\n\ndescribe('R.isEmpty', () =\u003e {\n  it('happy', () =\u003e {\n    const result = isEmpty('foo')\n    result // $ExpectType boolean\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#isEmpty)\n\n### isNil\n\n```typescript\n\nisNil(x: any): x is null | undefined\n```\n\nIt returns `true` if `x` is either `null` or `undefined`.\n\n```javascript\nconst result = [\n  R.isNil(null),\n  R.isNil(1),\n]\n// =\u003e [true, false]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5B%0A%20%20R.isNil(null)%2C%0A%20%20R.isNil(1)%2C%0A%5D%0A%2F%2F%20%3D%3E%20%5Btrue%2C%20false%5D\"\u003eTry this \u003cstrong\u003eR.isNil\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nisNil(x: any): x is null | undefined;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.isNil\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function isNil(x){\n  return x === undefined || x === null\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { isNil } from './isNil.js'\n\ntest('happy', () =\u003e {\n  expect(isNil(null)).toBeTrue()\n\n  expect(isNil(undefined)).toBeTrue()\n\n  expect(isNil([])).toBeFalse()\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#isNil)\n\n### isNotEmpty\n\n```typescript\n\nisNotEmpty\u003cT\u003e(value: T[]): value is NonEmptyArray\u003cT\u003e\n```\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nisNotEmpty\u003cT\u003e(value: T[]): value is NonEmptyArray\u003cT\u003e;\nisNotEmpty\u003cT\u003e(value: readonly T[]): value is ReadonlyNonEmptyArray\u003cT\u003e;\nisNotEmpty(value: any): boolean;\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#isNotEmpty)\n\n### isNotNil\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5B%0A%20%20R.isNotNil(null)%2C%0A%20%20R.isNotNil(undefined)%2C%0A%20%20R.isNotNil(%5B%5D)%2C%0A%5D%0A%2F%2F%20%3D%3E%20%5Bfalse%2C%20false%2C%20true%5D\"\u003eTry this \u003cstrong\u003eR.isNotNil\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#isNotNil)\n\n### join\n\n```typescript\n\njoin\u003cT\u003e(glue: string, list: T[]): string\n```\n\nIt returns a string of all `list` instances joined with a `glue`.\n\n```javascript\nR.join('-', [1, 2, 3])  // =\u003e '1-2-3'\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.join('-'%2C%20%5B1%2C%202%2C%203%5D)%20%20%2F%2F%20%3D%3E%20'1-2-3'\"\u003eTry this \u003cstrong\u003eR.join\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\njoin\u003cT\u003e(glue: string, list: T[]): string;\njoin\u003cT\u003e(glue: string): (list: T[]) =\u003e string;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.join\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function join(glue, list){\n  if (arguments.length === 1) return _list =\u003e join(glue, _list)\n\n  return list.join(glue)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { join } from './join.js'\n\ntest('curry', () =\u003e {\n  expect(join('|')([ 'foo', 'bar', 'baz' ])).toBe('foo|bar|baz')\n\n  expect(join('|', [ 1, 2, 3 ])).toBe('1|2|3')\n\n  const spacer = join(' ')\n\n  expect(spacer([ 'a', 2, 3.4 ])).toBe('a 2 3.4')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {join} from 'rambda'\n\ndescribe('R.join', () =\u003e {\n  it('happy', () =\u003e {\n    const result = join('|', [1, 2, 3])\n    result // $ExpectType string\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#join)\n\n### juxt\n\n```typescript\n\njuxt\u003cA extends any[], R1\u003e(fns: [(...a: A) =\u003e R1]): (...a: A) =\u003e [R1]\n```\n\nIt applies list of function to a list of inputs.\n\n```javascript\nconst getRange = juxt([ Math.min, Math.max, Math.min ])\nconst result = getRange(\n  3, 4, 9, -3\n)\n// =\u003e [-3, 9, -3]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20getRange%20%3D%20juxt(%5B%20Math.min%2C%20Math.max%2C%20Math.min%20%5D)%0Aconst%20result%20%3D%20getRange(%0A%20%203%2C%204%2C%209%2C%20-3%0A)%0A%2F%2F%20%3D%3E%20%5B-3%2C%209%2C%20-3%5D\"\u003eTry this \u003cstrong\u003eR.juxt\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\njuxt\u003cA extends any[], R1\u003e(fns: [(...a: A) =\u003e R1]): (...a: A) =\u003e [R1];\njuxt\u003cA extends any[], R1, R2\u003e(fns: [(...a: A) =\u003e R1, (...a: A) =\u003e R2]): (...a: A) =\u003e [R1, R2];\njuxt\u003cA extends any[], R1, R2, R3\u003e(fns: [(...a: A) =\u003e R1, (...a: A) =\u003e R2, (...a: A) =\u003e R3]): (...a: A) =\u003e [R1, R2, R3];\njuxt\u003cA extends any[], R1, R2, R3, R4\u003e(fns: [(...a: A) =\u003e R1, (...a: A) =\u003e R2, (...a: A) =\u003e R3, (...a: A) =\u003e R4]): (...a: A) =\u003e [R1, R2, R3, R4];\njuxt\u003cA extends any[], R1, R2, R3, R4, R5\u003e(fns: [(...a: A) =\u003e R1, (...a: A) =\u003e R2, (...a: A) =\u003e R3, (...a: A) =\u003e R4, (...a: A) =\u003e R5]): (...a: A) =\u003e [R1, R2, R3, R4, R5];\njuxt\u003cA extends any[], U\u003e(fns: Array\u003c(...args: A) =\u003e U\u003e): (...args: A) =\u003e U[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.juxt\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function juxt(listOfFunctions){\n  return (...args) =\u003e listOfFunctions.map(fn =\u003e fn(...args))\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { juxt } from './juxt.js'\n\ntest('happy', () =\u003e {\n  const fn = juxt([ Math.min, Math.max, Math.min ])\n  const result = fn(\n    3, 4, 9, -3\n  )\n  expect(result).toEqual([ -3, 9, -3 ])\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {juxt} from 'rambda'\n\ndescribe('R.juxt', () =\u003e {\n  it('happy', () =\u003e {\n    const fn = juxt([Math.min, Math.max])\n    const result = fn(3, 4, 9, -3)\n    result // $ExpectType [number, number]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#juxt)\n\n### keys\n\n```typescript\n\nkeys\u003cT extends object\u003e(x: T): (keyof T \u0026 string)[]\n```\n\nIt applies `Object.keys` over `x` and returns its keys.\n\n```javascript\nR.keys({a:1, b:2})  // =\u003e ['a', 'b']\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.keys(%7Ba%3A1%2C%20b%3A2%7D)%20%20%2F%2F%20%3D%3E%20%5B'a'%2C%20'b'%5D\"\u003eTry this \u003cstrong\u003eR.keys\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nkeys\u003cT extends object\u003e(x: T): (keyof T \u0026 string)[];\nkeys\u003cT\u003e(x: T): string[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.keys\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function keys(x){\n  return Object.keys(x)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { keys } from './keys.js'\n\ntest('happy', () =\u003e {\n  expect(keys({ a : 1 })).toEqual([ 'a' ])\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#keys)\n\n### last\n\n```typescript\n\nlast(str: ''): undefined\n```\n\nIt returns the last element of `input`, as the `input` can be either a string or an array. It returns `undefined` if array has length of 0.\n\n```javascript\nconst result = [\n  R.last([1, 2, 3]),\n  R.last('foo'),\n]\n// =\u003e [3, 'o']\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5B%0A%20%20R.last(%5B1%2C%202%2C%203%5D)%2C%0A%20%20R.last('foo')%2C%0A%5D%0A%2F%2F%20%3D%3E%20%5B3%2C%20'o'%5D\"\u003eTry this \u003cstrong\u003eR.last\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nlast(str: ''): undefined;\nlast(str: string): string;\nlast(list: readonly[]): undefined;\nlast(list: never[]): undefined;\nlast\u003cT extends unknown[]\u003e(array: T): LastArrayElement\u003cT\u003e;\nlast\u003cT extends readonly unknown[]\u003e(array: T): LastArrayElement\u003cT\u003e;\nlast(str: string): string | undefined;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.last\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function last(listOrString){\n  if (typeof listOrString === 'string'){\n    return listOrString[ listOrString.length - 1 ] || ''\n  }\n\n  return listOrString[ listOrString.length - 1 ]\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { last } from './last.js'\n\ntest('with list', () =\u003e {\n  expect(last([ 1, 2, 3 ])).toBe(3)\n  expect(last([])).toBeUndefined()\n})\n\ntest('with string', () =\u003e {\n  expect(last('abc')).toBe('c')\n  expect(last('')).toBe('')\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#last)\n\n### lastIndexOf\n\n```typescript\n\nlastIndexOf\u003cT\u003e(target: T, list: T[]): number\n```\n\nIt returns the last index of `target` in `list` array.\n\n`R.equals` is used to determine equality between `target` and members of `list`.\n\nIf there is no such index, then `-1` is returned.\n\n```javascript\nconst list = [1, 2, 3, 1, 2, 3]\nconst result = [\n  R.lastIndexOf(2, list),\n  R.lastIndexOf(4, list),\n]\n// =\u003e [4, -1]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B1%2C%202%2C%203%2C%201%2C%202%2C%203%5D%0Aconst%20result%20%3D%20%5B%0A%20%20R.lastIndexOf(2%2C%20list)%2C%0A%20%20R.lastIndexOf(4%2C%20list)%2C%0A%5D%0A%2F%2F%20%3D%3E%20%5B4%2C%20-1%5D\"\u003eTry this \u003cstrong\u003eR.lastIndexOf\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nlastIndexOf\u003cT\u003e(target: T, list: T[]): number;\nlastIndexOf\u003cT\u003e(target: T): (list: T[]) =\u003e number;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.lastIndexOf\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { _lastIndexOf } from './equals.js'\n\nexport function lastIndexOf(valueToFind, list){\n  if (arguments.length === 1){\n    return _list =\u003e _lastIndexOf(valueToFind, _list)\n  }\n\n  return _lastIndexOf(valueToFind, list)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { lastIndexOf as lastIndexOfRamda } from 'ramda'\n\nimport { compareCombinations } from './_internals/testUtils.js'\nimport { possibleIterables, possibleTargets } from './indexOf.spec.js'\nimport { lastIndexOf } from './lastIndexOf.js'\n\ntest('with NaN', () =\u003e {\n  expect(lastIndexOf(NaN, [ NaN ])).toBe(0)\n})\n\ntest('will throw with bad input', () =\u003e {\n  expect(lastIndexOfRamda([], true)).toBe(-1)\n  expect(() =\u003e indexOf([], true)).toThrowErrorMatchingInlineSnapshot('\"indexOf is not defined\"')\n})\n\ntest('without list of objects - no R.equals', () =\u003e {\n  expect(lastIndexOf(3, [ 1, 2, 3, 4 ])).toBe(2)\n  expect(lastIndexOf(10)([ 1, 2, 3, 4 ])).toBe(-1)\n})\n\ntest('list of objects uses R.equals', () =\u003e {\n  const listOfObjects = [ { a : 1 }, { b : 2 }, { c : 3 } ]\n  expect(lastIndexOf({ c : 4 }, listOfObjects)).toBe(-1)\n  expect(lastIndexOf({ c : 3 }, listOfObjects)).toBe(2)\n})\n\ntest('list of arrays uses R.equals', () =\u003e {\n  const listOfLists = [ [ 1 ], [ 2, 3 ], [ 2, 3, 4 ], [ 2, 3 ], [ 1 ], [] ]\n  expect(lastIndexOf([], listOfLists)).toBe(5)\n  expect(lastIndexOf([ 1 ], listOfLists)).toBe(4)\n  expect(lastIndexOf([ 2, 3, 4 ], listOfLists)).toBe(2)\n  expect(lastIndexOf([ 2, 3, 5 ], listOfLists)).toBe(-1)\n})\n\ntest('with string as iterable', () =\u003e {\n  expect(() =\u003e lastIndexOf('a', 'abc')).toThrowErrorMatchingInlineSnapshot('\"Cannot read property \\'indexOf\\' of abc\"')\n  expect(lastIndexOfRamda('a', 'abc')).toBe(0)\n})\n\ndescribe('brute force', () =\u003e {\n  compareCombinations({\n    fn          : lastIndexOf,\n    fnRamda     : lastIndexOfRamda,\n    firstInput  : possibleTargets,\n    secondInput : possibleIterables,\n    callback    : errorsCounters =\u003e {\n      expect(errorsCounters).toMatchInlineSnapshot(`\n        {\n          \"ERRORS_MESSAGE_MISMATCH\": 0,\n          \"ERRORS_TYPE_MISMATCH\": 34,\n          \"RESULTS_MISMATCH\": 0,\n          \"SHOULD_NOT_THROW\": 51,\n          \"SHOULD_THROW\": 0,\n          \"TOTAL_TESTS\": 170,\n        }\n      `)\n    },\n  })\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {lastIndexOf} from 'rambda'\n\nconst list = [1, 2, 3]\n\ndescribe('R.lastIndexOf', () =\u003e {\n  it('happy', () =\u003e {\n    const result = lastIndexOf(2, list)\n    result // $ExpectType number\n  })\n  it('curried', () =\u003e {\n    const result = lastIndexOf(2)(list)\n    result // $ExpectType number\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#lastIndexOf)\n\n### length\n\n```typescript\n\nlength\u003cT\u003e(input: T[]): number\n```\n\nIt returns the `length` property of list or string `input`.\n\n```javascript\nconst result = [\n  R.length([1, 2, 3, 4]),\n  R.length('foo'),\n]\n// =\u003e [4, 3]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5B%0A%20%20R.length(%5B1%2C%202%2C%203%2C%204%5D)%2C%0A%20%20R.length('foo')%2C%0A%5D%0A%2F%2F%20%3D%3E%20%5B4%2C%203%5D\"\u003eTry this \u003cstrong\u003eR.length\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nlength\u003cT\u003e(input: T[]): number;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.length\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { isArray } from './_internals/isArray.js'\n\nexport function length(x){\n  if (isArray(x)) return x.length\n  if (typeof x === 'string') return x.length\n\n  return NaN\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { length as lengthRamda } from 'ramda'\n\nimport { length } from './length.js'\n\ntest('happy', () =\u003e {\n  expect(length('foo')).toBe(3)\n  expect(length([ 1, 2, 3 ])).toBe(3)\n  expect(length([])).toBe(0)\n})\n\ntest('with empty string', () =\u003e {\n  expect(length('')).toBe(0)\n})\n\ntest('with bad input returns NaN', () =\u003e {\n  expect(length(0)).toBeNaN()\n  expect(length({})).toBeNaN()\n  expect(length(null)).toBeNaN()\n  expect(length(undefined)).toBeNaN()\n})\n\ntest('with length as property', () =\u003e {\n  const input1 = { length : '123' }\n  const input2 = { length : null }\n  const input3 = { length : '' }\n\n  expect(length(input1)).toBeNaN()\n  expect(lengthRamda(input1)).toBeNaN()\n  expect(length(input2)).toBeNaN()\n  expect(lengthRamda(input2)).toBeNaN()\n  expect(length(input3)).toBeNaN()\n  expect(lengthRamda(input3)).toBeNaN()\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#length)\n\n### lens\n\n```typescript\n\nlens\u003cS, A\u003e(getter: (s: S) =\u003e A, setter: (a: A, s: S) =\u003e S): Lens\u003cS, A\u003e\n```\n\nIt returns a `lens` for the given `getter` and `setter` functions. \n\nThe `getter` **gets** the value of the focus; the `setter` **sets** the value of the focus. \n\nThe setter should not mutate the data structure.\n\n```javascript\nconst xLens = R.lens(R.prop('x'), R.assoc('x'));\n\nR.view(xLens, {x: 1, y: 2}) // =\u003e 1\nR.set(xLens, 4, {x: 1, y: 2}) // =\u003e {x: 4, y: 2}\nR.over(xLens, R.negate, {x: 1, y: 2}) // =\u003e {x: -1, y: 2}\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20xLens%20%3D%20R.lens(R.prop('x')%2C%20R.assoc('x'))%3B%0A%0AR.view(xLens%2C%20%7Bx%3A%201%2C%20y%3A%202%7D)%20%2F%2F%20%3D%3E%201%0AR.set(xLens%2C%204%2C%20%7Bx%3A%201%2C%20y%3A%202%7D)%20%2F%2F%20%3D%3E%20%7Bx%3A%204%2C%20y%3A%202%7D%0Aconst%20result%20%3D%20R.over(xLens%2C%20R.negate%2C%20%7Bx%3A%201%2C%20y%3A%202%7D)%20%2F%2F%20%3D%3E%20%7Bx%3A%20-1%2C%20y%3A%202%7D\"\u003eTry this \u003cstrong\u003eR.lens\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nlens\u003cS, A\u003e(getter: (s: S) =\u003e A, setter: (a: A, s: S) =\u003e S): Lens\u003cS, A\u003e;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.lens\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function lens(getter, setter){\n  return function (functor){\n    return function (target){\n      return functor(getter(target)).map(focus =\u003e setter(focus, target))\n    }\n  }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {lens, assoc, lensProp, view, lensIndex, over, lensPath} from 'rambda'\n\ninterface Input {\n  foo: string,\n}\nconst testObject: Input = {\n  foo: 'Jazz',\n}\n\ndescribe('R.lens', () =\u003e {\n  it('happy', () =\u003e {\n    const fn = lens\u003cInput, string\u003e((x: Input) =\u003e {\n      x.foo // $ExpectType string\n      return x.foo\n    }, assoc('name'))\n    fn // $ExpectType Lens\u003cInput, string\u003e\n  })\n})\n\ndescribe('R.lensProp', () =\u003e {\n  it('happy', () =\u003e {\n    const result = view\u003cInput, string\u003e(lensProp('foo'), testObject)\n    result // $ExpectType string\n  })\n  it('issue 740', () =\u003e {\n    // @ts-expect-error\n    over(lensProp('x'), (n) =\u003e String(n), {x: 1})\n  })\n})\n\ndescribe('R.lensIndex', () =\u003e {\n  const testList: Input[] = [{foo: 'bar'}, {foo: 'baz'}]\n  it('happy', () =\u003e {\n    const result = view\u003cInput[], Input\u003e(lensIndex(0), testList)\n    result // $ExpectType Input\n    result.foo // $ExpectType string\n  })\n})\n\ndescribe('R.lensPath', () =\u003e {\n  const path = lensPath(['bar', 'a'])\n  it('happy', () =\u003e {\n    const result = view\u003cInput, string\u003e(path, testObject)\n    result // $ExpectType string\n  })\n})\n\ndescribe('R.view', () =\u003e {\n  const fooLens = lens\u003cInput, string\u003e((x: Input) =\u003e {\n    return x.foo\n  }, assoc('foo'))\n  it('happt', () =\u003e {\n    const result = view\u003cInput, string\u003e(fooLens, testObject)\n    result // $ExpectType string\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#lens)\n\n### lensIndex\n\n```typescript\n\nlensIndex\u003cA\u003e(n: number): Lens\u003cA[], A\u003e\n```\n\nIt returns a lens that focuses on specified `index`.\n\n```javascript\nconst list = ['a', 'b', 'c']\nconst headLens = R.lensIndex(0)\n\nR.view(headLens, list) // =\u003e 'a'\nR.set(headLens, 'x', list) // =\u003e ['x', 'b', 'c']\nR.over(headLens, R.toUpper, list) // =\u003e ['A', 'b', 'c']\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B'a'%2C%20'b'%2C%20'c'%5D%0Aconst%20headLens%20%3D%20R.lensIndex(0)%0A%0AR.view(headLens%2C%20list)%20%2F%2F%20%3D%3E%20'a'%0AR.set(headLens%2C%20'x'%2C%20list)%20%2F%2F%20%3D%3E%20%5B'x'%2C%20'b'%2C%20'c'%5D%0Aconst%20result%20%3D%20R.over(headLens%2C%20R.toUpper%2C%20list)%20%2F%2F%20%3D%3E%20%5B'A'%2C%20'b'%2C%20'c'%5D\"\u003eTry this \u003cstrong\u003eR.lensIndex\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nlensIndex\u003cA\u003e(n: number): Lens\u003cA[], A\u003e;\nlensIndex\u003cA extends any[], N extends number\u003e(n: N): Lens\u003cA, A[N]\u003e;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.lensIndex\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { lens } from './lens.js'\nimport { nth } from './nth.js'\nimport { update } from './update.js'\n\nexport function lensIndex(index){\n  return lens(nth(index), update(index))\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { compose } from './compose.js'\nimport { keys } from './keys.js'\nimport { lensIndex } from './lensIndex.js'\nimport { over } from './over.js'\nimport { set } from './set.js'\nimport { view } from './view.js'\n\nconst testList = [ { a : 1 }, { b : 2 }, { c : 3 } ]\n\ntest('focuses list element at the specified index', () =\u003e {\n  expect(view(lensIndex(0), testList)).toEqual({ a : 1 })\n})\n\ntest('returns undefined if the specified index does not exist', () =\u003e {\n  expect(view(lensIndex(10), testList)).toBeUndefined()\n})\n\ntest('sets the list value at the specified index', () =\u003e {\n  expect(set(\n    lensIndex(0), 0, testList\n  )).toEqual([ 0, { b : 2 }, { c : 3 } ])\n})\n\ntest('applies function to the value at the specified list index', () =\u003e {\n  expect(over(\n    lensIndex(2), keys, testList\n  )).toEqual([ { a : 1 }, { b : 2 }, [ 'c' ] ])\n})\n\ntest('can be composed', () =\u003e {\n  const nestedList = [ 0, [ 10, 11, 12 ], 1, 2 ]\n  const composedLens = compose(lensIndex(1), lensIndex(0))\n\n  expect(view(composedLens, nestedList)).toBe(10)\n})\n\ntest('set s (get s) === s', () =\u003e {\n  expect(set(\n    lensIndex(0), view(lensIndex(0), testList), testList\n  )).toEqual(testList)\n})\n\ntest('get (set s v) === v', () =\u003e {\n  expect(view(lensIndex(0), set(\n    lensIndex(0), 0, testList\n  ))).toBe(0)\n})\n\ntest('get (set(set s v1) v2) === v2', () =\u003e {\n  expect(view(lensIndex(0),\n    set(\n      lensIndex(0), 11, set(\n        lensIndex(0), 10, testList\n      )\n    ))).toBe(11)\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#lensIndex)\n\n### lensPath\n\nIt returns a lens that focuses on specified `path`.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20lensPath%20%3D%20R.lensPath(%5B'x'%2C%200%2C%20'y'%5D)%0Aconst%20input%20%3D%20%7Bx%3A%20%5B%7By%3A%202%2C%20z%3A%203%7D%2C%20%7By%3A%204%2C%20z%3A%205%7D%5D%7D%0A%0AR.view(lensPath%2C%20input)%20%2F%2F%20%3D%3E%202%0A%0AR.set(lensPath%2C%201%2C%20input)%20%0A%2F%2F%20%3D%3E%20%7Bx%3A%20%5B%7By%3A%201%2C%20z%3A%203%7D%2C%20%7By%3A%204%2C%20z%3A%205%7D%5D%7D%0A%0Aconst%20result%20%3D%20R.over(xHeadYLens%2C%20R.negate%2C%20input)%20%0A%2F%2F%20%3D%3E%20%7Bx%3A%20%5B%7By%3A%20-2%2C%20z%3A%203%7D%2C%20%7By%3A%204%2C%20z%3A%205%7D%5D%7D\"\u003eTry this \u003cstrong\u003eR.lensPath\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#lensPath)\n\n### lensProp\n\n```typescript\n\nlensProp\u003cS, K extends keyof S = keyof S\u003e(prop: K): Lens\u003cS, S[K]\u003e\n```\n\nIt returns a lens that focuses on specified property `prop`.\n\n```javascript\nconst xLens = R.lensProp('x');\nconst input = {x: 1, y: 2}\n\nR.view(xLens, input) // =\u003e 1\n\nR.set(xLens, 4, input) \n// =\u003e {x: 4, y: 2}\n\nR.over(xLens, R.negate, input) \n// =\u003e {x: -1, y: 2}\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20xLens%20%3D%20R.lensProp('x')%3B%0Aconst%20input%20%3D%20%7Bx%3A%201%2C%20y%3A%202%7D%0A%0AR.view(xLens%2C%20input)%20%2F%2F%20%3D%3E%201%0A%0AR.set(xLens%2C%204%2C%20input)%20%0A%2F%2F%20%3D%3E%20%7Bx%3A%204%2C%20y%3A%202%7D%0A%0Aconst%20result%20%3D%20R.over(xLens%2C%20R.negate%2C%20input)%20%0A%2F%2F%20%3D%3E%20%7Bx%3A%20-1%2C%20y%3A%202%7D\"\u003eTry this \u003cstrong\u003eR.lensProp\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nlensProp\u003cS, K extends keyof S = keyof S\u003e(prop: K): Lens\u003cS, S[K]\u003e;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.lensProp\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { assoc } from './assoc.js'\nimport { lens } from './lens.js'\nimport { prop } from './prop.js'\n\nexport function lensProp(key){\n  return lens(prop(key), assoc(key))\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { compose } from './compose.js'\nimport { identity } from './identity.js'\nimport { inc } from './inc.js'\nimport { lensProp } from './lensProp.js'\nimport { over } from './over.js'\nimport { set } from './set.js'\nimport { view } from './view.js'\n\nconst testObj = {\n  a : 1,\n  b : 2,\n  c : 3,\n}\n\ntest('focuses object the specified object property', () =\u003e {\n  expect(view(lensProp('a'), testObj)).toBe(1)\n})\n\ntest('returns undefined if the specified property does not exist', () =\u003e {\n  expect(view(lensProp('X'), testObj)).toBeUndefined()\n})\n\ntest('sets the value of the object property specified', () =\u003e {\n  expect(set(\n    lensProp('a'), 0, testObj\n  )).toEqual({\n    a : 0,\n    b : 2,\n    c : 3,\n  })\n})\n\ntest('adds the property to the object if it doesn\\'t exist', () =\u003e {\n  expect(set(\n    lensProp('d'), 4, testObj\n  )).toEqual({\n    a : 1,\n    b : 2,\n    c : 3,\n    d : 4,\n  })\n})\n\ntest('applies function to the value of the specified object property', () =\u003e {\n  expect(over(\n    lensProp('a'), inc, testObj\n  )).toEqual({\n    a : 2,\n    b : 2,\n    c : 3,\n  })\n})\n\ntest('applies function to undefined and adds the property if it doesn\\'t exist', () =\u003e {\n  expect(over(\n    lensProp('X'), identity, testObj\n  )).toEqual({\n    a : 1,\n    b : 2,\n    c : 3,\n    X : undefined,\n  })\n})\n\ntest('can be composed', () =\u003e {\n  const nestedObj = {\n    a : { b : 1 },\n    c : 2,\n  }\n  const composedLens = compose(lensProp('a'), lensProp('b'))\n\n  expect(view(composedLens, nestedObj)).toBe(1)\n})\n\ntest('set s (get s) === s', () =\u003e {\n  expect(set(\n    lensProp('a'), view(lensProp('a'), testObj), testObj\n  )).toEqual(testObj)\n})\n\ntest('get (set s v) === v', () =\u003e {\n  expect(view(lensProp('a'), set(\n    lensProp('a'), 0, testObj\n  ))).toBe(0)\n})\n\ntest('get (set(set s v1) v2) === v2', () =\u003e {\n  expect(view(lensProp('a'),\n    set(\n      lensProp('a'), 11, set(\n        lensProp('a'), 10, testObj\n      )\n    ))).toBe(11)\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#lensProp)\n\n### lt\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5BR.lt(2%2C%201)%2C%20R.lt(2%2C%203)%5D%0A%2F%2F%20%3D%3E%20%5Bfalse%2C%20true%5D\"\u003eTry this \u003cstrong\u003eR.lt\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#lt)\n\n### lte\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5BR.lte(2%2C%201)%2C%20R.lte(2%2C%202)%2C%20R.lte(2%2C%203)%5D%0A%2F%2F%20%3D%3E%20%5Bfalse%2C%20true%2C%20true%5D\"\u003eTry this \u003cstrong\u003eR.lte\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#lte)\n\n### map\n\n```typescript\n\nmap\u003cT, U\u003e(fn: ObjectIterator\u003cT, U\u003e, iterable: Dictionary\u003cT\u003e): Dictionary\u003cU\u003e\n```\n\nIt returns the result of looping through `iterable` with `fn`.\n\nIt works with both array and object.\n\n\u003e :boom: Unlike Ramda's `map`, here property and input object are passed as arguments to `fn`, when `iterable` is an object.\n\n```javascript\nconst fn = x =\u003e x * 2\nconst fnWhenObject = (val, prop)=\u003e{\n  return `${prop}-${val}`\n}\n\nconst iterable = [1, 2]\nconst obj = {a: 1, b: 2}\n\nconst result = [ \n  R.map(fn, list),\n  R.map(fnWhenObject, Record\u003cstring, unknown\u003e)\n]\n// =\u003e [ [1, 4], {a: 'a-1', b: 'b-2'}]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20fn%20%3D%20x%20%3D%3E%20x%20*%202%0Aconst%20fnWhenObject%20%3D%20(val%2C%20prop)%3D%3E%7B%0A%20%20return%20%60%24%7Bprop%7D-%24%7Bval%7D%60%0A%7D%0A%0Aconst%20iterable%20%3D%20%5B1%2C%202%5D%0Aconst%20obj%20%3D%20%7Ba%3A%201%2C%20b%3A%202%7D%0A%0Aconst%20result%20%3D%20%5B%20%0A%20%20R.map(fn%2C%20list)%2C%0A%20%20R.map(fnWhenObject%2C%20Record%3Cstring%2C%20unknown%3E)%0A%5D%0A%2F%2F%20%3D%3E%20%5B%20%5B1%2C%204%5D%2C%20%7Ba%3A%20'a-1'%2C%20b%3A%20'b-2'%7D%5D\"\u003eTry this \u003cstrong\u003eR.map\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nmap\u003cT, U\u003e(fn: ObjectIterator\u003cT, U\u003e, iterable: Dictionary\u003cT\u003e): Dictionary\u003cU\u003e;\nmap\u003cT, U\u003e(fn: Iterator\u003cT, U\u003e, iterable: T[]): U[];\nmap\u003cT, U\u003e(fn: Iterator\u003cT, U\u003e): (iterable: T[]) =\u003e U[];\nmap\u003cT, U, S\u003e(fn: ObjectIterator\u003cT, U\u003e): (iterable: Dictionary\u003cT\u003e) =\u003e Dictionary\u003cU\u003e;\nmap\u003cT\u003e(fn: Iterator\u003cT, T\u003e): (iterable: T[]) =\u003e T[];\nmap\u003cT\u003e(fn: Iterator\u003cT, T\u003e, iterable: T[]): T[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.map\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { INCORRECT_ITERABLE_INPUT } from './_internals/constants.js'\nimport { isArray } from './_internals/isArray.js'\nimport { keys } from './_internals/keys.js'\n\nexport function mapArray(\n  fn, list, isIndexed = false\n){\n  let index = 0\n  const willReturn = Array(list.length)\n\n  while (index \u003c list.length){\n    willReturn[ index ] = isIndexed ? fn(list[ index ], index) : fn(list[ index ])\n\n    index++\n  }\n\n  return willReturn\n}\n\nexport function mapObject(fn, obj){\n  if (arguments.length === 1){\n    return _obj =\u003e mapObject(fn, _obj)\n  }\n  let index = 0\n  const objKeys = keys(obj)\n  const len = objKeys.length\n  const willReturn = {}\n\n  while (index \u003c len){\n    const key = objKeys[ index ]\n    willReturn[ key ] = fn(\n      obj[ key ], key, obj\n    )\n    index++\n  }\n\n  return willReturn\n}\n\nexport const mapObjIndexed = mapObject\n\nexport function map(fn, iterable){\n  if (arguments.length === 1) return _iterable =\u003e map(fn, _iterable)\n  if (!iterable){\n    throw new Error(INCORRECT_ITERABLE_INPUT)\n  }\n\n  if (isArray(iterable)) return mapArray(fn, iterable)\n\n  return mapObject(fn, iterable)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { map as mapRamda } from 'ramda'\n\nimport { map } from './map.js'\n\nconst double = x =\u003e x * 2\n\ndescribe('with array', () =\u003e {\n  it('happy', () =\u003e {\n    expect(map(double, [ 1, 2, 3 ])).toEqual([ 2, 4, 6 ])\n  })\n\n  it('curried', () =\u003e {\n    expect(map(double)([ 1, 2, 3 ])).toEqual([ 2, 4, 6 ])\n  })\n})\n\ndescribe('with object', () =\u003e {\n  const obj = {\n    a : 1,\n    b : 2,\n  }\n\n  it('happy', () =\u003e {\n    expect(map(double, obj)).toEqual({\n      a : 2,\n      b : 4,\n    })\n  })\n\n  it('property as second and input object as third argument', () =\u003e {\n    const obj = {\n      a : 1,\n      b : 2,\n    }\n    const iterator = (\n      val, prop, inputObject\n    ) =\u003e {\n      expect(prop).toBeString()\n      expect(inputObject).toEqual(obj)\n\n      return val * 2\n    }\n\n    expect(map(iterator)(obj)).toEqual({\n      a : 2,\n      b : 4,\n    })\n  })\n})\n\ntest('bad inputs difference between Ramda and Rambda', () =\u003e {\n  expect(() =\u003e map(double, null)).toThrowErrorMatchingInlineSnapshot('\"Incorrect iterable input\"')\n  expect(() =\u003e map(double)(undefined)).toThrowErrorMatchingInlineSnapshot('\"Incorrect iterable input\"')\n  expect(() =\u003e mapRamda(double, null)).toThrowErrorMatchingInlineSnapshot('\"Cannot read properties of null (reading \\'fantasy-land/map\\')\"')\n  expect(() =\u003e\n    mapRamda(double, undefined)).toThrowErrorMatchingInlineSnapshot('\"Cannot read properties of undefined (reading \\'fantasy-land/map\\')\"')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {map} from 'rambda'\n\ndescribe('R.map with arrays', () =\u003e {\n  it('iterable returns the same type as the input', () =\u003e {\n    const result = map\u003cnumber\u003e(\n      (x: number) =\u003e {\n        x // $ExpectType number\n        return x + 2\n      },\n      [1, 2, 3]\n    )\n    result // $ExpectType number[]\n  })\n  it('iterable returns the same type as the input - curried', () =\u003e {\n    const result = map\u003cnumber\u003e((x: number) =\u003e {\n      x // $ExpectType number\n      return x + 2\n    })([1, 2, 3])\n    result // $ExpectType number[]\n  })\n  it('iterable returns different type as the input', () =\u003e {\n    const result = map\u003cnumber, string\u003e(\n      (x: number) =\u003e {\n        x // $ExpectType number\n        return String(x)\n      },\n      [1, 2, 3]\n    )\n    result // $ExpectType string[]\n  })\n})\n\ndescribe('R.map with objects', () =\u003e {\n  it('iterable with all three arguments - curried', () =\u003e {\n    // It requires dummy third typing argument\n    // in order to identify compared to curry typings for arrays\n    // ============================================\n    const result = map\u003cnumber, string, any\u003e((a, b, c) =\u003e {\n      a // $ExpectType number\n      b // $ExpectType string\n      c // $ExpectType Dictionary\u003cnumber\u003e\n      return `${a}`\n    })({a: 1, b: 2})\n    result // $ExpectType Dictionary\u003cstring\u003e\n  })\n  it('iterable with all three arguments', () =\u003e {\n    const result = map\u003cnumber, string\u003e(\n      (a, b, c) =\u003e {\n        a // $ExpectType number\n        b // $ExpectType string\n        c // $ExpectType Dictionary\u003cnumber\u003e\n        return `${a}`\n      },\n      {a: 1, b: 2}\n    )\n    result // $ExpectType Dictionary\u003cstring\u003e\n  })\n  it('iterable with property argument', () =\u003e {\n    const result = map\u003cnumber, string\u003e(\n      (a, b) =\u003e {\n        a // $ExpectType number\n        b // $ExpectType string\n        return `${a}`\n      },\n      {a: 1, b: 2}\n    )\n    result // $ExpectType Dictionary\u003cstring\u003e\n  })\n  it('iterable with no property argument', () =\u003e {\n    const result = map\u003cnumber, string\u003e(\n      a =\u003e {\n        a // $ExpectType number\n        return `${a}`\n      },\n      {a: 1, b: 2}\n    )\n    result // $ExpectType Dictionary\u003cstring\u003e\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#map)\n\n### mapObjIndexed\n\n```typescript\n\nmapObjIndexed\u003cT\u003e(fn: ObjectIterator\u003cT, T\u003e, iterable: Dictionary\u003cT\u003e): Dictionary\u003cT\u003e\n```\n\nIt works the same way as `R.map` does for objects. It is added as Ramda also has this method.\n\n```javascript\nconst fn = (val, prop) =\u003e {\n  return `${prop}-${val}`\n}\n\nconst obj = {a: 1, b: 2}\n\nconst result = R.map(mapObjIndexed, Record\u003cstring, unknown\u003e)\n// =\u003e {a: 'a-1', b: 'b-2'}\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20fn%20%3D%20(val%2C%20prop)%20%3D%3E%20%7B%0A%20%20return%20%60%24%7Bprop%7D-%24%7Bval%7D%60%0A%7D%0A%0Aconst%20obj%20%3D%20%7Ba%3A%201%2C%20b%3A%202%7D%0A%0Aconst%20result%20%3D%20R.map(mapObjIndexed%2C%20Record%3Cstring%2C%20unknown%3E)%0A%2F%2F%20%3D%3E%20%7Ba%3A%20'a-1'%2C%20b%3A%20'b-2'%7D\"\u003eTry this \u003cstrong\u003eR.mapObjIndexed\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nmapObjIndexed\u003cT\u003e(fn: ObjectIterator\u003cT, T\u003e, iterable: Dictionary\u003cT\u003e): Dictionary\u003cT\u003e;\nmapObjIndexed\u003cT, U\u003e(fn: ObjectIterator\u003cT, U\u003e, iterable: Dictionary\u003cT\u003e): Dictionary\u003cU\u003e;\nmapObjIndexed\u003cT\u003e(fn: ObjectIterator\u003cT, T\u003e): (iterable: Dictionary\u003cT\u003e) =\u003e Dictionary\u003cT\u003e;\nmapObjIndexed\u003cT, U\u003e(fn: ObjectIterator\u003cT, U\u003e): (iterable: Dictionary\u003cT\u003e) =\u003e Dictionary\u003cU\u003e;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {mapObjIndexed} from 'rambda'\n\nconst obj = {a: 1, b: 2, c: 3}\n\ndescribe('R.mapObjIndexed', () =\u003e {\n  it('without type transform', () =\u003e {\n    const result = mapObjIndexed((x, prop, obj) =\u003e {\n      x // $ExpectType number\n      prop // $ExpectType string\n      obj // $ExpectType Dictionary\u003cnumber\u003e\n      return x + 2\n    }, obj)\n    result // $ExpectType Dictionary\u003cnumber\u003e\n  })\n  it('without type transform - curried', () =\u003e {\n    const result = mapObjIndexed\u003cnumber\u003e((x, prop, obj) =\u003e {\n      x // $ExpectType number\n      prop // $ExpectType string\n      obj // $ExpectType Dictionary\u003cnumber\u003e\n      return x + 2\n    })(obj)\n    result // $ExpectType Dictionary\u003cnumber\u003e\n  })\n  it('change of type', () =\u003e {\n    const result = mapObjIndexed((x, prop, obj) =\u003e {\n      x // $ExpectType number\n      prop // $ExpectType string\n      obj // $ExpectType Dictionary\u003cnumber\u003e\n      return String(x + 2)\n    }, obj)\n    result // $ExpectType Dictionary\u003cstring\u003e\n  })\n  it('change of type - curried', () =\u003e {\n    const result = mapObjIndexed\u003cnumber, string\u003e((x, prop, obj) =\u003e {\n      x // $ExpectType number\n      prop // $ExpectType string\n      obj // $ExpectType Dictionary\u003cnumber\u003e\n      return String(x + 2)\n    })(obj)\n    result // $ExpectType Dictionary\u003cstring\u003e\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#mapObjIndexed)\n\n### match\n\n```typescript\n\nmatch(regExpression: RegExp, str: string): string[]\n```\n\nCurried version of `String.prototype.match` which returns empty array, when there is no match.\n\n```javascript\nconst result = [\n  R.match('a', 'foo'),\n  R.match(/([a-z]a)/g, 'bananas')\n]\n// =\u003e [[], ['ba', 'na', 'na']]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5B%0A%20%20R.match('a'%2C%20'foo')%2C%0A%20%20R.match(%2F(%5Ba-z%5Da)%2Fg%2C%20'bananas')%0A%5D%0A%2F%2F%20%3D%3E%20%5B%5B%5D%2C%20%5B'ba'%2C%20'na'%2C%20'na'%5D%5D\"\u003eTry this \u003cstrong\u003eR.match\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nmatch(regExpression: RegExp, str: string): string[];\nmatch(regExpression: RegExp): (str: string) =\u003e string[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.match\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function match(pattern, input){\n  if (arguments.length === 1) return _input =\u003e match(pattern, _input)\n\n  const willReturn = input.match(pattern)\n\n  return willReturn === null ? [] : willReturn\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { equals } from './equals.js'\nimport { match } from './match.js'\n\ntest('happy', () =\u003e {\n  expect(match(/a./g)('foo bar baz')).toEqual([ 'ar', 'az' ])\n})\n\ntest('fallback', () =\u003e {\n  expect(match(/a./g)('foo')).toEqual([])\n})\n\ntest('with string', () =\u003e {\n  expect(match('a', 'foo')).toEqual([])\n  expect(equals(match('o', 'foo'), [ 'o' ])).toBeTrue()\n})\n\ntest('throwing', () =\u003e {\n  expect(() =\u003e {\n    match(/a./g, null)\n  }).toThrowErrorMatchingInlineSnapshot('\"Cannot read properties of null (reading \\'match\\')\"')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {match} from 'rambda'\n\nconst str = 'foo bar'\n\ndescribe('R.match', () =\u003e {\n  it('happy', () =\u003e {\n    const result = match(/foo/, str)\n    result // $ExpectType string[]\n  })\n  it('curried', () =\u003e {\n    const result = match(/foo/)(str)\n    result // $ExpectType string[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#match)\n\n### mathMod\n\n`R.mathMod` behaves like the modulo operator should mathematically, unlike the `%` operator (and by extension, `R.modulo`). So while `-17 % 5` is `-2`, `mathMod(-17, 5)` is `3`.\n\n\u003e :boom: Explanation is taken from `Ramda` documentation site.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5B%0A%20%20R.mathMod(-17%2C%205)%2C%0A%20%20R.mathMod(17%2C%205)%2C%0A%20%20R.mathMod(17%2C%20-5)%2C%20%20%0A%20%20R.mathMod(17%2C%200)%20%20%20%0A%5D%0A%2F%2F%20%3D%3E%20%5B3%2C%202%2C%20NaN%2C%20NaN%5D\"\u003eTry this \u003cstrong\u003eR.mathMod\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#mathMod)\n\n### max\n\nIt returns the greater value between `x` and `y`.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5B%0A%20%20R.max(5%2C%207)%2C%20%20%0A%20%20R.max('bar'%2C%20'foo')%2C%20%20%0A%5D%0A%2F%2F%20%3D%3E%20%5B7%2C%20'foo'%5D\"\u003eTry this \u003cstrong\u003eR.max\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#max)\n\n### maxBy\n\nIt returns the greater value between `x` and `y` according to `compareFn` function.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20compareFn%20%3D%20Math.abs%0A%0Aconst%20result%20%3D%20R.maxBy(compareFn%2C%205%2C%20-7)%20%2F%2F%20%3D%3E%20-7\"\u003eTry this \u003cstrong\u003eR.maxBy\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#maxBy)\n\n### mean\n\n```typescript\n\nmean(list: number[]): number\n```\n\nIt returns the mean value of `list` input.\n\n```javascript\nR.mean([ 2, 7 ])\n// =\u003e 4.5\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.mean(%5B%202%2C%207%20%5D)%0A%2F%2F%20%3D%3E%204.5\"\u003eTry this \u003cstrong\u003eR.mean\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nmean(list: number[]): number;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.mean\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { sum } from './sum.js'\n\nexport function mean(list){\n  return sum(list) / list.length\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { mean } from './mean.js'\n\ntest('happy', () =\u003e {\n  expect(mean([ 2, 7 ])).toBe(4.5)\n})\n\ntest('with NaN', () =\u003e {\n  expect(mean([])).toBeNaN()\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {mean} from 'rambda'\n\ndescribe('R.mean', () =\u003e {\n  it('happy', () =\u003e {\n    const result = mean([1, 2, 3])\n\n    result // $ExpectType number\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#mean)\n\n### median\n\n```typescript\n\nmedian(list: number[]): number\n```\n\nIt returns the median value of `list` input.\n\n```javascript\nR.median([ 7, 2, 10, 9 ]) // =\u003e 8\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.median(%5B%207%2C%202%2C%2010%2C%209%20%5D)%20%2F%2F%20%3D%3E%208\"\u003eTry this \u003cstrong\u003eR.median\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nmedian(list: number[]): number;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.median\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { mean } from './mean.js'\n\nexport function median(list){\n  const len = list.length\n  if (len === 0) return NaN\n  const width = 2 - len % 2\n  const idx = (len - width) / 2\n\n  return mean(Array.prototype.slice\n    .call(list, 0)\n    .sort((a, b) =\u003e {\n      if (a === b) return 0\n\n      return a \u003c b ? -1 : 1\n    })\n    .slice(idx, idx + width))\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { median } from './median.js'\n\ntest('happy', () =\u003e {\n  expect(median([ 2 ])).toBe(2)\n  expect(median([ 7, 2, 10, 2, 9 ])).toBe(7)\n})\n\ntest('with empty array', () =\u003e {\n  expect(median([])).toBeNaN()\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {median} from 'rambda'\n\ndescribe('R.median', () =\u003e {\n  it('happy', () =\u003e {\n    const result = median([1, 2, 3])\n\n    result // $ExpectType number\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#median)\n\n### merge\n\nSame as `R.mergeRight`.\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#merge)\n\n### mergeAll\n\n```typescript\n\nmergeAll\u003cT\u003e(list: object[]): T\n```\n\nIt merges all objects of `list` array sequentially and returns the result.\n\n```javascript\nconst list = [\n  {a: 1},\n  {b: 2},\n  {c: 3}\n]\nconst result = R.mergeAll(list)\nconst expected = {\n  a: 1,\n  b: 2,\n  c: 3\n}\n// =\u003e `result` is equal to `expected`\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B%0A%20%20%7Ba%3A%201%7D%2C%0A%20%20%7Bb%3A%202%7D%2C%0A%20%20%7Bc%3A%203%7D%0A%5D%0Aconst%20result%20%3D%20R.mergeAll(list)%0Aconst%20expected%20%3D%20%7B%0A%20%20a%3A%201%2C%0A%20%20b%3A%202%2C%0A%20%20c%3A%203%0A%7D%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60\"\u003eTry this \u003cstrong\u003eR.mergeAll\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nmergeAll\u003cT\u003e(list: object[]): T;\nmergeAll(list: object[]): object;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.mergeAll\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { map } from './map.js'\nimport { mergeRight } from './mergeRight.js'\n\nexport function mergeAll(arr){\n  let willReturn = {}\n  map(val =\u003e {\n    willReturn = mergeRight(willReturn, val)\n  }, arr)\n\n  return willReturn\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { mergeAll } from './mergeAll.js'\n\ntest('case 1', () =\u003e {\n  const arr = [ { a : 1 }, { b : 2 }, { c : 3 } ]\n  const expectedResult = {\n    a : 1,\n    b : 2,\n    c : 3,\n  }\n  expect(mergeAll(arr)).toEqual(expectedResult)\n})\n\ntest('case 2', () =\u003e {\n  expect(mergeAll([ { foo : 1 }, { bar : 2 }, { baz : 3 } ])).toEqual({\n    foo : 1,\n    bar : 2,\n    baz : 3,\n  })\n})\n\ndescribe('acts as if nil values are simply empty objects', () =\u003e {\n  it('if the first object is nil', () =\u003e {\n    expect(mergeAll([ null, { foo : 1 }, { foo : 2 }, { bar : 2 } ])).toEqual({\n      foo : 2,\n      bar : 2,\n    })\n  })\n\n  it('if the last object is nil', () =\u003e {\n    expect(mergeAll([ { foo : 1 }, { foo : 2 }, { bar : 2 }, undefined ])).toEqual({\n      foo : 2,\n      bar : 2,\n    })\n  })\n\n  it('if an intermediate object is nil', () =\u003e {\n    expect(mergeAll([ { foo : 1 }, { foo : 2 }, null, { bar : 2 } ])).toEqual({\n      foo : 2,\n      bar : 2,\n    })\n  })\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {mergeAll} from 'rambda'\n\ndescribe('R.mergeAll', () =\u003e {\n  it('with passing type', () =\u003e {\n    interface Output {\n      foo: number,\n      bar: number,\n    }\n    const result = mergeAll\u003cOutput\u003e([{foo: 1}, {bar: 2}])\n    result.foo // $ExpectType number\n    result.bar // $ExpectType number\n  })\n\n  it('without passing type', () =\u003e {\n    const result = mergeAll([{foo: 1}, {bar: 2}])\n    result // $ExpectType unknown\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#mergeAll)\n\n### mergeDeepLeft\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.mergeDeepLeft(%0A%20%20%7Ba%3A%20%7Bb%3A%201%7D%7D%2C%0A%20%20%7Ba%3A%20%7Bb%3A%202%2C%20c%3A%203%7D%7D%0A)%0A%2F%2F%20%3D%3E%20%7Ba%3A%20%7Bb%3A%201%2C%20c%3A%203%7D%7D\"\u003eTry this \u003cstrong\u003eR.mergeDeepLeft\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#mergeDeepLeft)\n\n### mergeDeepRight\n\n```typescript\n\nmergeDeepRight\u003cOutput\u003e(target: object, newProps: object): Output\n```\n\nCreates a new object with the own properties of the first object merged with the own properties of the second object. If a key exists in both objects:\n\n  - and both values are objects, the two values will be recursively merged\n  - otherwise the value from the second object will be used.\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nmergeDeepRight\u003cOutput\u003e(target: object, newProps: object): Output;\nmergeDeepRight\u003cOutput\u003e(target: object): (newProps: object) =\u003e Output;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.mergeDeepRight\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { clone } from './clone.js'\nimport { type } from './type.js'\n\nexport function mergeDeepRight(target, source){\n  if (arguments.length === 1){\n    return sourceHolder =\u003e mergeDeepRight(target, sourceHolder)\n  }\n\n  const willReturn = clone(target)\n\n  Object.keys(source).forEach(key =\u003e {\n    if (type(source[ key ]) === 'Object'){\n      if (type(target[ key ]) === 'Object'){\n        willReturn[ key ] = mergeDeepRight(target[ key ], source[ key ])\n      } else {\n        willReturn[ key ] = source[ key ]\n      }\n    } else {\n      willReturn[ key ] = source[ key ]\n    }\n  })\n\n  return willReturn\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { mergeDeepRight } from './mergeDeepRight.js'\n\nconst student = {\n  name    : 'foo',\n  age     : 10,\n  contact : {\n    a     : 1,\n    email : 'foo@example.com',\n  },\n}\nconst teacher = {\n  age     : 40,\n  contact : { email : 'baz@example.com' },\n  songs   : { title : 'Remains the same' },\n}\n\ntest('when merging object with lists inside them', () =\u003e {\n  const a = {\n    a : [ 1, 2, 3 ],\n    b : [ 4, 5, 6 ],\n  }\n  const b = {\n    a : [ 7, 8, 9 ],\n    b : [ 10, 11, 12 ],\n  }\n  const result = mergeDeepRight(a, b)\n  const expected = {\n    a : [ 7, 8, 9 ],\n    b : [ 10, 11, 12 ],\n  }\n  expect(result).toEqual(expected)\n})\n\ntest('happy', () =\u003e {\n  const result = mergeDeepRight(student, teacher)\n  const curryResult = mergeDeepRight(student)(teacher)\n  const expected = {\n    age     : 40,\n    name    : 'foo',\n    contact : {\n      a     : 1,\n      email : 'baz@example.com',\n    },\n    songs : { title : 'Remains the same' },\n  }\n\n  expect(result).toEqual(expected)\n  expect(curryResult).toEqual(expected)\n})\n\ntest('issue 650', () =\u003e {\n  expect(Object.keys(mergeDeepRight({ a : () =\u003e {} }, { b : () =\u003e {} }))).toEqual([\n    'a',\n    'b',\n  ])\n})\n\ntest('ramda compatible test 1', () =\u003e {\n  const a = {\n    w : 1,\n    x : 2,\n    y : { z : 3 },\n  }\n  const b = {\n    a : 4,\n    b : 5,\n    c : { d : 6 },\n  }\n  const result = mergeDeepRight(a, b)\n  const expected = {\n    w : 1,\n    x : 2,\n    y : { z : 3 },\n    a : 4,\n    b : 5,\n    c : { d : 6 },\n  }\n\n  expect(result).toEqual(expected)\n})\n\ntest('ramda compatible test 2', () =\u003e {\n  const a = {\n    a : {\n      b : 1,\n      c : 2,\n    },\n    y : 0,\n  }\n  const b = {\n    a : {\n      b : 3,\n      d : 4,\n    },\n    z : 0,\n  }\n  const result = mergeDeepRight(a, b)\n  const expected = {\n    a : {\n      b : 3,\n      c : 2,\n      d : 4,\n    },\n    y : 0,\n    z : 0,\n  }\n\n  expect(result).toEqual(expected)\n})\n\ntest('ramda compatible test 3', () =\u003e {\n  const a = {\n    w : 1,\n    x : { y : 2 },\n  }\n  const result = mergeDeepRight(a, { x : { y : 3 } })\n  const expected = {\n    w : 1,\n    x : { y : 3 },\n  }\n  expect(result).toEqual(expected)\n})\n\ntest('functions are not discarded', () =\u003e {\n  const obj = { foo : () =\u003e {} }\n  expect(typeof mergeDeepRight(obj, {}).foo).toBe('function')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {mergeDeepRight} from 'rambda'\n\ninterface Output {\n  foo: {\n    bar: number,\n  },\n}\n\ndescribe('R.mergeDeepRight', () =\u003e {\n  const result = mergeDeepRight\u003cOutput\u003e({foo: {bar: 1}}, {foo: {bar: 2}})\n  result.foo.bar // $ExpectType number\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#mergeDeepRight)\n\n### mergeLeft\n\n```typescript\n\nmergeLeft\u003cOutput\u003e(newProps: object, target: object): Output\n```\n\nSame as `R.merge`, but in opposite direction.\n\n```javascript\nconst result = R.mergeLeft(\n  {a: 10},\n  {a: 1, b: 2}\n)\n// =\u003e {a:10, b: 2}\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.mergeLeft(%0A%20%20%7Ba%3A%2010%7D%2C%0A%20%20%7Ba%3A%201%2C%20b%3A%202%7D%0A)%0A%2F%2F%20%3D%3E%20%7Ba%3A10%2C%20b%3A%202%7D\"\u003eTry this \u003cstrong\u003eR.mergeLeft\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nmergeLeft\u003cOutput\u003e(newProps: object, target: object): Output;\nmergeLeft\u003cOutput\u003e(newProps: object): (target: object) =\u003e Output;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.mergeLeft\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { mergeRight } from './mergeRight.js'\n\nexport function mergeLeft(x, y){\n  if (arguments.length === 1) return _y =\u003e mergeLeft(x, _y)\n\n  return mergeRight(y, x)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { mergeLeft } from './mergeLeft.js'\n\nconst obj = {\n  foo : 1,\n  bar : 2,\n}\n\ntest('happy', () =\u003e {\n  expect(mergeLeft({ bar : 20 }, obj)).toEqual({\n    foo : 1,\n    bar : 20,\n  })\n})\n\ntest('curry', () =\u003e {\n  expect(mergeLeft({ baz : 3 })(obj)).toEqual({\n    foo : 1,\n    bar : 2,\n    baz : 3,\n  })\n})\n\ntest('when undefined or null instead of object', () =\u003e {\n  expect(mergeLeft(null, undefined)).toEqual({})\n  expect(mergeLeft(obj, null)).toEqual(obj)\n  expect(mergeLeft(obj, undefined)).toEqual(obj)\n  expect(mergeLeft(undefined, obj)).toEqual(obj)\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {mergeLeft} from 'rambda'\n\ninterface Output {\n  foo: number,\n  bar: number,\n}\n\ndescribe('R.mergeLeft', () =\u003e {\n  const result = mergeLeft\u003cOutput\u003e({foo: 1}, {bar: 2})\n  const curriedResult = mergeLeft\u003cOutput\u003e({foo: 1})({bar: 2})\n\n  result.foo // $ExpectType number\n  result.bar // $ExpectType number\n  curriedResult.bar // $ExpectType number\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#mergeLeft)\n\n### mergeRight\n\nIt creates a copy of `target` object with overwritten `newProps` properties. Previously known as `R.merge` but renamed after Ramda did the same.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20target%20%3D%20%7B%20'foo'%3A%200%2C%20'bar'%3A%201%20%7D%0Aconst%20newProps%20%3D%20%7B%20'foo'%3A%207%20%7D%0A%0Aconst%20result%20%3D%20R.mergeRight(target%2C%20newProps)%0A%2F%2F%20%3D%3E%20%7B%20'foo'%3A%207%2C%20'bar'%3A%201%20%7D\"\u003eTry this \u003cstrong\u003eR.mergeRight\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#mergeRight)\n\n### mergeWith\n\n```typescript\n\nmergeWith(fn: (x: any, z: any) =\u003e any, a: Record\u003cstring, unknown\u003e, b: Record\u003cstring, unknown\u003e): Record\u003cstring, unknown\u003e\n```\n\nIt takes two objects and a function, which will be used when there is an overlap between the keys.\n\n```javascript\nconst result = R.mergeWith(\n  R.concat,\n  {values : [ 10, 20 ]},\n  {values : [ 15, 35 ]}\n)\n// =\u003e [ 10, 20, 15, 35 ]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.mergeWith(%0A%20%20R.concat%2C%0A%20%20%7Bvalues%20%3A%20%5B%2010%2C%2020%20%5D%7D%2C%0A%20%20%7Bvalues%20%3A%20%5B%2015%2C%2035%20%5D%7D%0A)%0A%2F%2F%20%3D%3E%20%5B%2010%2C%2020%2C%2015%2C%2035%20%5D\"\u003eTry this \u003cstrong\u003eR.mergeWith\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nmergeWith(fn: (x: any, z: any) =\u003e any, a: Record\u003cstring, unknown\u003e, b: Record\u003cstring, unknown\u003e): Record\u003cstring, unknown\u003e;\nmergeWith\u003cOutput\u003e(fn: (x: any, z: any) =\u003e any, a: Record\u003cstring, unknown\u003e, b: Record\u003cstring, unknown\u003e): Output;\nmergeWith(fn: (x: any, z: any) =\u003e any, a: Record\u003cstring, unknown\u003e): (b: Record\u003cstring, unknown\u003e) =\u003e Record\u003cstring, unknown\u003e;\nmergeWith\u003cOutput\u003e(fn: (x: any, z: any) =\u003e any, a: Record\u003cstring, unknown\u003e): (b: Record\u003cstring, unknown\u003e) =\u003e Output;\nmergeWith(fn: (x: any, z: any) =\u003e any): \u003cU, V\u003e(a: U, b: V) =\u003e Record\u003cstring, unknown\u003e;\nmergeWith\u003cOutput\u003e(fn: (x: any, z: any) =\u003e any): \u003cU, V\u003e(a: U, b: V) =\u003e Output;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.mergeWith\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { curry } from './curry.js'\n\nexport function mergeWithFn(\n  mergeFn, aInput, bInput\n){\n  const a = aInput ?? {}\n  const b = bInput ?? {}\n  const willReturn = {}\n\n  Object.keys(a).forEach(key =\u003e {\n    if (b[ key ] === undefined) willReturn[ key ] = a[ key ]\n    else willReturn[ key ] = mergeFn(a[ key ], b[ key ])\n  })\n\n  Object.keys(b).forEach(key =\u003e {\n    if (willReturn[ key ] !== undefined) return\n\n    if (a[ key ] === undefined) willReturn[ key ] = b[ key ]\n    else willReturn[ key ] = mergeFn(a[ key ], b[ key ])\n  })\n\n  return willReturn\n}\n\nexport const mergeWith = curry(mergeWithFn)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { concat } from './concat.js'\nimport { mergeWithFn } from './mergeWith.js'\n\ntest('happy', () =\u003e {\n  const result = mergeWithFn(\n    concat,\n    {\n      a      : true,\n      values : [ 10, 20 ],\n    },\n    {\n      b      : true,\n      values : [ 15, 35 ],\n    }\n  )\n  const expected = {\n    a      : true,\n    b      : true,\n    values : [ 10, 20, 15, 35 ],\n  }\n  expect(result).toEqual(expected)\n})\n\n// https://github.com/ramda/ramda/pull/3222/files#diff-d925d9188b478d2f1d4b26012c6dddac374f9e9d7a336604d654b9a113bfc857\ndescribe('acts as if nil values are simply empty objects', () =\u003e {\n  it('if the first object is nil and the second empty', () =\u003e {\n    expect(mergeWithFn(\n      concat, undefined, {}\n    )).toEqual({})\n  })\n\n  it('if the first object is empty and the second nil', () =\u003e {\n    expect(mergeWithFn(\n      concat, {}, null\n    )).toEqual({})\n  })\n\n  it('if both objects are nil', () =\u003e {\n    expect(mergeWithFn(\n      concat, undefined, null\n    )).toEqual({})\n  })\n\n  it('if the first object is not empty and the second is nil', () =\u003e {\n    expect(mergeWithFn(\n      concat, { a : 'a' }, null\n    )).toEqual({ a : 'a' })\n  })\n\n  it('if the first object is nil and the second is not empty', () =\u003e {\n    expect(mergeWithFn(\n      concat, undefined, { a : 'a' }\n    )).toEqual({ a : 'a' })\n  })\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {concat, mergeWith} from 'rambda'\n\ninterface Output {\n  a: boolean,\n  b: boolean,\n  values: number[],\n}\nconst A = {\n  a: true,\n  values: [10, 20],\n}\nconst B = {\n  b: true,\n  values: [15, 35],\n}\n\ndescribe('R.mergeWith', () =\u003e {\n  test('no curry | without explicit types', () =\u003e {\n    const result = mergeWith(concat, A, B)\n    result // $ExpectType Record\u003cstring, unknown\u003e\n  })\n  test('no curry | with explicit types', () =\u003e {\n    const result = mergeWith\u003cOutput\u003e(concat, A, B)\n    result // $ExpectType Output\n  })\n  test('curry 1 | without explicit types', () =\u003e {\n    const result = mergeWith(concat, A)(B)\n    result // $ExpectType Record\u003cstring, unknown\u003e\n  })\n  test('curry 1 | with explicit types', () =\u003e {\n    const result = mergeWith\u003cOutput\u003e(concat, A)(B)\n    result // $ExpectType Output\n  })\n  test('curry 2 | without explicit types', () =\u003e {\n    const result = mergeWith(concat)(A, B)\n    result // $ExpectType Record\u003cstring, unknown\u003e\n  })\n  test('curry 2 | with explicit types', () =\u003e {\n    const result = mergeWith\u003cOutput\u003e(concat)(A, B)\n    result // $ExpectType Output\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#mergeWith)\n\n### min\n\nIt returns the lesser value between `x` and `y`.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5B%0A%20%20R.min(5%2C%207)%2C%20%20%0A%20%20R.min('bar'%2C%20'foo')%2C%20%20%0A%5D%0A%2F%2F%20%3D%3E%20%5B5%2C%20'bar'%5D\"\u003eTry this \u003cstrong\u003eR.min\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#min)\n\n### minBy\n\nIt returns the lesser value between `x` and `y` according to `compareFn` function.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20compareFn%20%3D%20Math.abs%0A%0Aconst%20result%20%3D%20R.minBy(compareFn%2C%20-5%2C%202)%20%2F%2F%20%3D%3E%20-5\"\u003eTry this \u003cstrong\u003eR.minBy\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#minBy)\n\n### modify\n\n```typescript\n\nmodify\u003cK extends PropertyKey, T\u003e(prop: K, fn: (value: T) =\u003e T): \u003cU extends Record\u003cK, T\u003e\u003e(object: U) =\u003e U\n```\n\n```javascript\nconst result = R.modify()\n// =\u003e\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.modify()%0A%2F%2F%20%3D%3E\"\u003eTry this \u003cstrong\u003eR.modify\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nmodify\u003cK extends PropertyKey, T\u003e(prop: K, fn: (value: T) =\u003e T): \u003cU extends Record\u003cK, T\u003e\u003e(object: U) =\u003e U;\nmodify\u003cU, K extends keyof U\u003e(prop: K, fn: (value: U[K]) =\u003e U[K], object: U): U;\nmodify\u003cK extends PropertyKey\u003e(prop: K): {\n  \u003cT\u003e(fn: (value: T) =\u003e T): \u003cU extends Record\u003cK, T\u003e\u003e(object: U) =\u003e U;\n  \u003cT, U extends Record\u003cK, T\u003e\u003e(fn: (value: T) =\u003e T, object: U): U;\n};\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.modify\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { isArray } from './_internals/isArray.js'\nimport { isIterable } from './_internals/isIterable.js'\nimport { curry } from './curry.js'\nimport { updateFn } from './update.js'\n\nfunction modifyFn(\n  property, fn, iterable\n){\n  if (!isIterable(iterable)) return iterable\n  if (iterable[ property ] === undefined) return iterable\n  if (isArray(iterable)){\n    return updateFn(\n      property, fn(iterable[ property ]), iterable\n    )\n  }\n\n  return {\n    ...iterable,\n    [ property ] : fn(iterable[ property ]),\n  }\n}\n\nexport const modify = curry(modifyFn)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { modify as modifyRamda } from 'ramda'\n\nimport { compareCombinations, FALSY_VALUES } from './_internals/testUtils.js'\nimport { add } from './add.js'\nimport { compose } from './compose.js'\nimport { modify } from './modify.js'\n\nconst person = {\n  name : 'foo',\n  age  : 20,\n}\n\ntest('happy', () =\u003e {\n  expect(modify(\n    'age', x =\u003e x + 1, person\n  )).toEqual({\n    name : 'foo',\n    age  : 21,\n  })\n})\n\ntest('property is missing', () =\u003e {\n  expect(modify(\n    'foo', x =\u003e x + 1, person\n  )).toEqual(person)\n})\n\ntest('adjust if `array` at the given key with the `transformation` function', () =\u003e {\n  expect(modify(\n    1, add(1), [ 100, 1400 ]\n  )).toEqual([ 100, 1401 ])\n})\n\ndescribe('ignores transformations if the input value is not Array and Object', () =\u003e {\n  ;[ 42, undefined, null, '' ].forEach(value =\u003e {\n    it(`${ value }`, () =\u003e {\n      expect(modify(\n        'a', add(1), value\n      )).toEqual(value)\n    })\n  })\n})\n\nconst possibleProperties = [ ...FALSY_VALUES, 'foo', 0 ]\nconst possibleTransformers = [\n  ...FALSY_VALUES,\n  add(1),\n  add('foo'),\n  compose,\n  String,\n]\nconst possibleObjects = [\n  ...FALSY_VALUES,\n  {},\n  [ 1, 2, 3 ],\n  {\n    a   : 1,\n    foo : 2,\n  },\n  {\n    a   : 1,\n    foo : [ 1 ],\n  },\n  {\n    a   : 1,\n    foo : 'bar',\n  },\n]\n\ndescribe('brute force', () =\u003e {\n  compareCombinations({\n    fn          : modify,\n    fnRamda     : modifyRamda,\n    firstInput  : possibleProperties,\n    secondInput : possibleTransformers,\n    thirdInput  : possibleObjects,\n    callback    : errorsCounters =\u003e {\n      expect(errorsCounters).toMatchInlineSnapshot(`\n        {\n          \"ERRORS_MESSAGE_MISMATCH\": 0,\n          \"ERRORS_TYPE_MISMATCH\": 0,\n          \"RESULTS_MISMATCH\": 0,\n          \"SHOULD_NOT_THROW\": 0,\n          \"SHOULD_THROW\": 0,\n          \"TOTAL_TESTS\": 630,\n        }\n      `)\n    },\n  })\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport { add, identity, map, modify, pipe, toUpper } from 'rambda';\n\ntype Obj = {\n\tfoo: string;\n\tbar: number;\n};\n\ndescribe('R.modify', () =\u003e {\n\tit('ramda tests', () =\u003e {\n\t\tconst result1 = modify('foo', toUpper, {} as Obj);\n\t\tresult1; // $ExpectType Obj\n\n\t\tconst result2 = modify('bar', add(1), {} as Obj);\n\t\tresult2; // $ExpectType Obj\n\n\t\tconst result3 = modify('foo', toUpper)({} as Obj);\n\t\tresult3; // $ExpectType Obj\n\n\t\tconst result4 = modify('bar', add(1))({} as Obj);\n\t\tresult4; // $ExpectType Obj\n\n\t\tconst result5 = modify('foo')(toUpper)({} as Obj);\n\t\tresult5; // $ExpectType Obj\n\n\t\tconst result6 = modify('bar')(add(1))({} as Obj);\n\t\tresult6; // $ExpectType Obj\n\n\t\tconst result7 = modify('foo')(toUpper, {} as Obj);\n\t\tresult7; // $ExpectType Obj\n\n\t\tconst result8 = modify('bar')(add(1), {} as Obj);\n\t\tresult8; // $ExpectType Obj\n\n\t\tconst result9 = modify('foo', identity, {} as Obj);\n\t\tresult9; // $ExpectType Obj\n\n\t\t// @ts-expect-error\n\t\tmodify('foo', add(1), {} as Obj);\n\t\t// @ts-expect-error\n\t\tmodify('bar', toUpper, {} as Obj);\n\n\t\tconst f = pipe(map\u003cObj, Obj\u003e(modify('foo', toUpper)));\n\n\t\tf([] as Obj[]); // $ExpectType Obj[]\n\t});\n});\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#modify)\n\n### modifyPath\n\nIt changes a property of object on the base of provided path and transformer function.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.modifyPath('a.b.c'%2C%20x%3D%3E%20x%2B1%2C%20%7Ba%3A%7Bb%3A%20%7Bc%3A1%7D%7D%7D)%0A%2F%2F%20%3D%3E%20%7Ba%3A%7Bb%3A%20%7Bc%3A2%7D%7D%7D\"\u003eTry this \u003cstrong\u003eR.modifyPath\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#modifyPath)\n\n### modulo\n\nCurried version of `x%y`.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.modulo(17%2C%203)%20%2F%2F%20%3D%3E%202\"\u003eTry this \u003cstrong\u003eR.modulo\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#modulo)\n\n### move\n\nIt returns a copy of `list` with exchanged `fromIndex` and `toIndex` elements.\n\n\u003e :boom: Rambda.move doesn't support negative indexes - it throws an error.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B1%2C%202%2C%203%5D%0Aconst%20result%20%3D%20R.move(0%2C%201%2C%20list)%0A%2F%2F%20%3D%3E%20%5B2%2C%201%2C%203%5D\"\u003eTry this \u003cstrong\u003eR.move\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#move)\n\n### multiply\n\nCurried version of `x*y`.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.multiply(2%2C%204)%20%2F%2F%20%3D%3E%208\"\u003eTry this \u003cstrong\u003eR.multiply\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#multiply)\n\n### negate\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.negate(420)%2F%2F%20%3D%3E%20-420\"\u003eTry this \u003cstrong\u003eR.negate\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#negate)\n\n### none\n\n```typescript\n\nnone\u003cT\u003e(predicate: (x: T) =\u003e boolean, list: T[]): boolean\n```\n\nIt returns `true`, if all members of array `list` returns `false`, when applied as argument to `predicate` function.\n\n```javascript\nconst list = [ 0, 1, 2, 3, 4 ]\nconst predicate = x =\u003e x \u003e 6\n\nconst result = R.none(predicate, arr)\n// =\u003e true\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B%200%2C%201%2C%202%2C%203%2C%204%20%5D%0Aconst%20predicate%20%3D%20x%20%3D%3E%20x%20%3E%206%0A%0Aconst%20result%20%3D%20R.none(predicate%2C%20arr)%0A%2F%2F%20%3D%3E%20true\"\u003eTry this \u003cstrong\u003eR.none\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nnone\u003cT\u003e(predicate: (x: T) =\u003e boolean, list: T[]): boolean;\nnone\u003cT\u003e(predicate: (x: T) =\u003e boolean): (list: T[]) =\u003e boolean;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.none\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function none(predicate, list){\n  if (arguments.length === 1) return _list =\u003e none(predicate, _list)\n\n  for (let i = 0; i \u003c list.length; i++){\n    if (predicate(list[ i ])) return false\n  }\n\n  return true\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { none } from './none.js'\n\nconst isEven = n =\u003e n % 2 === 0\n\ntest('when true', () =\u003e {\n  expect(none(isEven, [ 1, 3, 5, 7 ])).toBeTrue()\n})\n\ntest('when false curried', () =\u003e {\n  expect(none(input =\u003e input \u003e 1, [ 1, 2, 3 ])).toBeFalse()\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {none} from 'rambda'\n\ndescribe('R.none', () =\u003e {\n  it('happy', () =\u003e {\n    const result = none(\n      x =\u003e {\n        x // $ExpectType number\n        return x \u003e 0\n      },\n      [1, 2, 3]\n    )\n    result // $ExpectType boolean\n  })\n  it('curried needs a type', () =\u003e {\n    const result = none\u003cnumber\u003e(x =\u003e {\n      x // $ExpectType number\n      return x \u003e 0\n    })([1, 2, 3])\n    result // $ExpectType boolean\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#none)\n\n### not\n\n```typescript\n\nnot(input: any): boolean\n```\n\nIt returns a boolean negated version of `input`.\n\n```javascript\nR.not(false) // true\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.not(false)%20%2F%2F%20true\"\u003eTry this \u003cstrong\u003eR.not\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nnot(input: any): boolean;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.not\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function not(input){\n  return !input\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { not } from './not.js'\n\ntest('not', () =\u003e {\n  expect(not(false)).toBeTrue()\n  expect(not(true)).toBeFalse()\n  expect(not(0)).toBeTrue()\n  expect(not(1)).toBeFalse()\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {not} from 'rambda'\n\ndescribe('R.not', () =\u003e {\n  it('happy', () =\u003e {\n    const result = not(4)\n\n    result // $ExpectType boolean\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#not)\n\n### nth\n\n```typescript\n\nnth(index: number, input: string): string\n```\n\nCurried version of `input[index]`.\n\n```javascript\nconst list = [1, 2, 3]\nconst str = 'foo'\n\nconst result = [\n  R.nth(2, list),\n  R.nth(6, list),\n  R.nth(0, str),\n]\n// =\u003e [3, undefined, 'f']\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B1%2C%202%2C%203%5D%0Aconst%20str%20%3D%20'foo'%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.nth(2%2C%20list)%2C%0A%20%20R.nth(6%2C%20list)%2C%0A%20%20R.nth(0%2C%20str)%2C%0A%5D%0A%2F%2F%20%3D%3E%20%5B3%2C%20undefined%2C%20'f'%5D\"\u003eTry this \u003cstrong\u003eR.nth\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nnth(index: number, input: string): string;\t\nnth\u003cT\u003e(index: number, input: T[]): T | undefined;\t\nnth(n: number): {\n  \u003cT\u003e(input: T[]): T | undefined;\n  (input: string): string;\n};\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.nth\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function nth(index, input){\n  if (arguments.length === 1) return _input =\u003e nth(index, _input)\n\n  const idx = index \u003c 0 ? input.length + index : index\n\n  return Object.prototype.toString.call(input) === '[object String]' ?\n    input.charAt(idx) :\n    input[ idx ]\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { nth } from './nth.js'\n\ntest('happy', () =\u003e {\n  expect(nth(2, [ 1, 2, 3, 4 ])).toBe(3)\n})\n\ntest('with curry', () =\u003e {\n  expect(nth(2)([ 1, 2, 3, 4 ])).toBe(3)\n})\n\ntest('with string and correct index', () =\u003e {\n  expect(nth(2)('foo')).toBe('o')\n})\n\ntest('with string and invalid index', () =\u003e {\n  expect(nth(20)('foo')).toBe('')\n})\n\ntest('with negative index', () =\u003e {\n  expect(nth(-3)([ 1, 2, 3, 4 ])).toBe(2)\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {nth} from 'rambda'\n\nconst list = [1, 2, 3]\n\ndescribe('R.nth', () =\u003e {\n  it('happy', () =\u003e {\n    const result = nth(4, list)\n\n    result // $ExpectType number | undefined\n  })\n  it('curried', () =\u003e {\n    const result = nth(1)(list)\n\n    result // $ExpectType number | undefined\n  })\n})\n\ndescribe('R.nth - string', () =\u003e {\n  const str = 'abc'\n  it('happy', () =\u003e {\n    const result = nth(4, str)\n\n    result // $ExpectType string\n  })\n  it('curried', () =\u003e {\n    const result = nth(1)(str)\n\n    result // $ExpectType string\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#nth)\n\n### objOf\n\nIt creates an object with a single key-value pair.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.objOf('foo'%2C%20'bar')%0A%2F%2F%20%3D%3E%20%7Bfoo%3A%20'bar'%7D\"\u003eTry this \u003cstrong\u003eR.objOf\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#objOf)\n\n### of\n\n```typescript\n\nof\u003cT\u003e(x: T): T[]\n```\n\n```javascript\nR.of(null); // =\u003e [null]\nR.of([42]); // =\u003e [[42]]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?R.of(null)%3B%20%2F%2F%20%3D%3E%20%5Bnull%5D%0Aconst%20result%20%3D%20R.of(%5B42%5D)%3B%20%2F%2F%20%3D%3E%20%5B%5B42%5D%5D\"\u003eTry this \u003cstrong\u003eR.of\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nof\u003cT\u003e(x: T): T[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.of\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function of(value){\n  return [ value ]\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { of } from './of.js'\n\ntest('happy', () =\u003e {\n  expect(of(3)).toEqual([ 3 ])\n\n  expect(of(null)).toEqual([ null ])\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {of} from 'rambda'\n\nconst list = [1, 2, 3]\n\ndescribe('R.of', () =\u003e {\n  it('happy', () =\u003e {\n    const result = of(4)\n\n    result // $ExpectType number[]\n  })\n  it('curried', () =\u003e {\n    const result = of(list)\n\n    result // $ExpectType number[][]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#of)\n\n### omit\n\n```typescript\n\nomit\u003cT, K extends string\u003e(propsToOmit: K[], obj: T): Omit\u003cT, K\u003e\n```\n\nIt returns a partial copy of an `obj` without `propsToOmit` properties.\n\n\u003e :boom: When using this method with `TypeScript`, it is much easier to pass `propsToOmit` as an array. If passing a string, you will need to explicitly declare the output type.\n\n```javascript\nconst obj = {a: 1, b: 2, c: 3}\nconst propsToOmit = 'a,c,d'\nconst propsToOmitList = ['a', 'c', 'd']\n\nconst result = [\n  R.omit(propsToOmit, Record\u003cstring, unknown\u003e), \n  R.omit(propsToOmitList, Record\u003cstring, unknown\u003e) \n]\n// =\u003e [{b: 2}, {b: 2}]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20obj%20%3D%20%7Ba%3A%201%2C%20b%3A%202%2C%20c%3A%203%7D%0Aconst%20propsToOmit%20%3D%20'a%2Cc%2Cd'%0Aconst%20propsToOmitList%20%3D%20%5B'a'%2C%20'c'%2C%20'd'%5D%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.omit(propsToOmit%2C%20Record%3Cstring%2C%20unknown%3E)%2C%20%0A%20%20R.omit(propsToOmitList%2C%20Record%3Cstring%2C%20unknown%3E)%20%0A%5D%0A%2F%2F%20%3D%3E%20%5B%7Bb%3A%202%7D%2C%20%7Bb%3A%202%7D%5D\"\u003eTry this \u003cstrong\u003eR.omit\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nomit\u003cT, K extends string\u003e(propsToOmit: K[], obj: T): Omit\u003cT, K\u003e;\nomit\u003cK extends string\u003e(propsToOmit: K[]): \u003cT\u003e(obj: T) =\u003e Omit\u003cT, K\u003e;\nomit\u003cT, U\u003e(propsToOmit: string, obj: T): U;\nomit\u003cT, U\u003e(propsToOmit: string): (obj: T) =\u003e U;\nomit\u003cT\u003e(propsToOmit: string, obj: object): T;\nomit\u003cT\u003e(propsToOmit: string): (obj: object) =\u003e T;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.omit\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { createPath } from './_internals/createPath.js'\nimport { includes } from './_internals/includes.js'\n\nexport function omit(propsToOmit, obj){\n  if (arguments.length === 1) return _obj =\u003e omit(propsToOmit, _obj)\n\n  if (obj === null || obj === undefined)\n    return undefined\n\n  const propsToOmitValue = createPath(propsToOmit, ',')\n  const willReturn = {}\n\n  for (const key in obj)\n    if (!includes(key, propsToOmitValue))\n      willReturn[ key ] = obj[ key ]\n\n  return willReturn\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { omit } from './omit.js'\n\ntest('with string as condition', () =\u003e {\n  const obj = {\n    a : 1,\n    b : 2,\n    c : 3,\n  }\n  const result = omit('a,c', obj)\n  const resultCurry = omit('a,c')(obj)\n  const expectedResult = { b : 2 }\n\n  expect(result).toEqual(expectedResult)\n  expect(resultCurry).toEqual(expectedResult)\n})\n\ntest.only('with number as property to omit', () =\u003e {\n  const obj = {\n    1 : 1,\n    b : 2,\n  }\n  const result = omit([ 1 ], obj)\n  expect(result).toEqual({ b : 2 })\n})\n\ntest('with null', () =\u003e {\n  expect(omit('a,b', null)).toBeUndefined()\n})\n\ntest('happy', () =\u003e {\n  expect(omit([ 'a', 'c' ])({\n    a : 'foo',\n    b : 'bar',\n    c : 'baz',\n  })).toEqual({ b : 'bar' })\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {omit} from 'rambda'\n\ndescribe('R.omit with array as props input', () =\u003e {\n  it('allow Typescript to infer object type', () =\u003e {\n    const input = {a: 'foo', b: 2, c: 3, d: 4}\n    const result = omit(['b,c'], input)\n\n    result.a // $ExpectType string\n    result.d // $ExpectType number\n\n    const curriedResult = omit(['a,c'], input)\n\n    curriedResult.a // $ExpectType string\n    curriedResult.d // $ExpectType number\n  })\n\n  it('declare type of input object', () =\u003e {\n    interface Input {\n      a: string,\n      b: number,\n      c: number,\n      d: number,\n    }\n    const input: Input = {a: 'foo', b: 2, c: 3, d: 4}\n    const result = omit(['b,c'], input)\n    result // $ExpectType Omit\u003cInput, \"b,c\"\u003e\n\n    result.a // $ExpectType string\n    result.d // $ExpectType number\n\n    const curriedResult = omit(['a,c'], input)\n\n    curriedResult.a // $ExpectType string\n    curriedResult.d // $ExpectType number\n  })\n})\n\ndescribe('R.omit with string as props input', () =\u003e {\n  interface Output {\n    b: number,\n    d: number,\n  }\n\n  it('explicitly declare output', () =\u003e {\n    const result = omit\u003cOutput\u003e('a,c', {a: 1, b: 2, c: 3, d: 4})\n    result // $ExpectType Output\n    result.b // $ExpectType number\n\n    const curriedResult = omit\u003cOutput\u003e('a,c')({a: 1, b: 2, c: 3, d: 4})\n\n    curriedResult.b // $ExpectType number\n  })\n\n  it('explicitly declare input and output', () =\u003e {\n    interface Input {\n      a: number,\n      b: number,\n      c: number,\n      d: number,\n    }\n    const result = omit\u003cInput, Output\u003e('a,c', {a: 1, b: 2, c: 3, d: 4})\n    result // $ExpectType Output\n    result.b // $ExpectType number\n\n    const curriedResult = omit\u003cInput, Output\u003e('a,c')({\n      a: 1,\n      b: 2,\n      c: 3,\n      d: 4,\n    })\n\n    curriedResult.b // $ExpectType number\n  })\n\n  it('without passing type', () =\u003e {\n    const result = omit('a,c', {a: 1, b: 2, c: 3, d: 4})\n    result // $ExpectType unknown\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#omit)\n\n### on\n\nIt passes the two inputs through `unaryFn` and then the results are passed as inputs the the `binaryFn` to receive the final result(`binaryFn(unaryFn(FIRST_INPUT), unaryFn(SECOND_INPUT))`). \n\nThis method is also known as P combinator.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.on((a%2C%20b)%20%3D%3E%20a%20%2B%20b%2C%20R.prop('a')%2C%20%7Bb%3A0%2C%20a%3A1%7D%2C%20%7Ba%3A2%7D)%0A%2F%2F%20%3D%3E%203\"\u003eTry this \u003cstrong\u003eR.on\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#on)\n\n### once\n\n```typescript\n\nonce\u003cT extends AnyFunction, C = unknown\u003e(fn: T, context?: C): T\n```\n\nIt returns a function, which invokes only once `fn` function.\n\n```javascript\nlet result = 0\nconst addOnce = R.once((x) =\u003e result = result + x)\n\naddOnce(1)\naddOnce(1)\n// =\u003e 1\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?let%20result%20%3D%200%0Aconst%20addOnce%20%3D%20R.once((x)%20%3D%3E%20result%20%3D%20result%20%2B%20x)%0A%0AaddOnce(1)%0Aconst%20result%20%3D%20addOnce(1)%0A%2F%2F%20%3D%3E%201\"\u003eTry this \u003cstrong\u003eR.once\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nonce\u003cT extends AnyFunction, C = unknown\u003e(fn: T, context?: C): T;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.once\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { curry } from './curry.js'\n\nfunction onceFn(fn, context){\n  let result\n\n  return function (){\n    if (fn){\n      result = fn.apply(context || this, arguments)\n      fn = null\n    }\n\n    return result\n  }\n}\n\nexport function once(fn, context){\n  if (arguments.length === 1){\n    const wrap = onceFn(fn, context)\n\n    return curry(wrap)\n  }\n\n  return onceFn(fn, context)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { once } from './once.js'\n\ntest('with counter', () =\u003e {\n  let counter = 0\n  const runOnce = once(x =\u003e {\n    counter++\n\n    return x + 2\n  })\n  expect(runOnce(1)).toBe(3)\n  runOnce(1)\n  runOnce(1)\n  runOnce(1)\n  expect(counter).toBe(1)\n})\n\ntest('happy path', () =\u003e {\n  const addOneOnce = once((\n    a, b, c\n  ) =\u003e a + b + c, 1)\n\n  expect(addOneOnce(\n    10, 20, 30\n  )).toBe(60)\n  expect(addOneOnce(40)).toBe(60)\n})\n\ntest('with context', () =\u003e {\n  const context = { name: 'fris' }\n  const getNameOnce = once(function (){\n    return this.name\n  }, context)\n\n  expect(getNameOnce()).toBe('fris')\n  expect(getNameOnce()).toBe('fris')\n  expect(getNameOnce()).toBe('fris')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {once} from 'rambda'\n\ndescribe('R.once', () =\u003e {\n  it('happy', () =\u003e {\n    const runOnce = once((x: number) =\u003e {\n      return x + 2\n    })\n\n    const result = runOnce(1)\n    result // $ExpectType number\n  })\n  it('with context', () =\u003e {\n    const runOnce = once(function (this: any, x: number) {\n      return x + 2\n    })\n\n    const result = runOnce.call({}, 1)\n    result // $ExpectType number\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#once)\n\n### or\n\nLogical OR\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?R.or(false%2C%20true)%3B%20%2F%2F%20%3D%3E%20true%0AR.or(false%2C%20false)%3B%20%2F%2F%20%3D%3E%20false%0Aconst%20result%20%3D%20R.or(false%2C%20'foo')%3B%20%2F%2F%20%3D%3E%20'foo'\"\u003eTry this \u003cstrong\u003eR.or\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#or)\n\n### over\n\n```typescript\n\nover\u003cS, A\u003e(lens: Lens\u003cS, A\u003e): {\n  (fn: (a: A) =\u003e A): (value: S) =\u003e S\n```\n\nIt returns a copied **Object** or **Array** with modified value received by applying function `fn` to `lens` focus.\n\n```javascript\nconst headLens = R.lensIndex(0)\n \nR.over(headLens, R.toUpper, ['foo', 'bar', 'baz']) // =\u003e ['FOO', 'bar', 'baz']\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20headLens%20%3D%20R.lensIndex(0)%0A%20%0Aconst%20result%20%3D%20R.over(headLens%2C%20R.toUpper%2C%20%5B'foo'%2C%20'bar'%2C%20'baz'%5D)%20%2F%2F%20%3D%3E%20%5B'FOO'%2C%20'bar'%2C%20'baz'%5D\"\u003eTry this \u003cstrong\u003eR.over\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nover\u003cS, A\u003e(lens: Lens\u003cS, A\u003e): {\n  (fn: (a: A) =\u003e A): (value: S) =\u003e S;\n  (fn: (a: A) =\u003e A, value: S): S;\n};\nover\u003cS, A\u003e(lens: Lens\u003cS, A\u003e, fn: (a: A) =\u003e A): (value: S) =\u003e S;\nover\u003cS, A\u003e(lens: Lens\u003cS, A\u003e, fn: (a: A) =\u003e A, value: S): S;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.over\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { curry } from './curry.js'\n\nconst Identity = x =\u003e ({\n  x,\n  map : fn =\u003e Identity(fn(x)),\n})\n\nfunction overFn(\n  lens, fn, object\n){\n  return lens(x =\u003e Identity(fn(x)))(object).x\n}\n\nexport const over = curry(overFn)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { assoc } from './assoc.js'\nimport { lens } from './lens.js'\nimport { lensIndex } from './lensIndex.js'\nimport { lensPath } from './lensPath.js'\nimport { over } from './over.js'\nimport { prop } from './prop.js'\nimport { toUpper } from './toUpper.js'\n\nconst testObject = {\n  foo : 'bar',\n  baz : {\n    a : 'x',\n    b : 'y',\n  },\n}\n\ntest('assoc lens', () =\u003e {\n  const assocLens = lens(prop('foo'), assoc('foo'))\n  const result = over(\n    assocLens, toUpper, testObject\n  )\n  const expected = {\n    ...testObject,\n    foo : 'BAR',\n  }\n  expect(result).toEqual(expected)\n})\n\ntest('path lens', () =\u003e {\n  const pathLens = lensPath('baz.a')\n  const result = over(\n    pathLens, toUpper, testObject\n  )\n  const expected = {\n    ...testObject,\n    baz : {\n      a : 'X',\n      b : 'y',\n    },\n  }\n  expect(result).toEqual(expected)\n})\n\ntest('index lens', () =\u003e {\n  const indexLens = lensIndex(0)\n  const result = over(indexLens, toUpper)([ 'foo', 'bar' ])\n  expect(result).toEqual([ 'FOO', 'bar' ])\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#over)\n\n### partial\n\n```typescript\n\npartial\u003cV0, V1, T\u003e(fn: (x0: V0, x1: V1) =\u003e T, args: [V0]): (x1: V1) =\u003e T\n```\n\nIt is very similar to `R.curry`, but you can pass initial arguments when you create the curried function.\n\n`R.partial` will keep returning a function until all the arguments that the function `fn` expects are passed.\nThe name comes from the fact that you partially inject the inputs.\n\n\u003e :boom: Rambda's partial doesn't need the input arguments to be wrapped as array.\n\n```javascript\nconst fn = (title, firstName, lastName) =\u003e {\n  return title + ' ' + firstName + ' ' + lastName + '!'\n}\n\nconst canPassAnyNumberOfArguments = R.partial(fn, 'Hello')\nconst ramdaStyle = R.partial(fn, ['Hello'])\n\nconst finalFn = canPassAnyNumberOfArguments('Foo')\n\nfinalFn('Bar') // =\u003e  'Hello, Foo Bar!'\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20fn%20%3D%20(title%2C%20firstName%2C%20lastName)%20%3D%3E%20%7B%0A%20%20return%20title%20%2B%20'%20'%20%2B%20firstName%20%2B%20'%20'%20%2B%20lastName%20%2B%20'!'%0A%7D%0A%0Aconst%20canPassAnyNumberOfArguments%20%3D%20R.partial(fn%2C%20'Hello')%0Aconst%20ramdaStyle%20%3D%20R.partial(fn%2C%20%5B'Hello'%5D)%0A%0Aconst%20finalFn%20%3D%20canPassAnyNumberOfArguments('Foo')%0A%0Aconst%20result%20%3D%20finalFn('Bar')%20%2F%2F%20%3D%3E%20%20'Hello%2C%20Foo%20Bar!'\"\u003eTry this \u003cstrong\u003eR.partial\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\npartial\u003cV0, V1, T\u003e(fn: (x0: V0, x1: V1) =\u003e T, args: [V0]): (x1: V1) =\u003e T;\npartial\u003cV0, V1, V2, T\u003e(fn: (x0: V0, x1: V1, x2: V2) =\u003e T, args: [V0, V1]): (x2: V2) =\u003e T;\npartial\u003cV0, V1, V2, T\u003e(fn: (x0: V0, x1: V1, x2: V2) =\u003e T, args: [V0]): (x1: V1, x2: V2) =\u003e T;\npartial\u003cV0, V1, V2, V3, T\u003e(\n  fn: (x0: V0, x1: V1, x2: V2, x3: V3) =\u003e T,\n  args: [V0, V1, V2],\n): (x2: V3) =\u003e T;\npartial\u003cV0, V1, V2, V3, T\u003e(\n  fn: (x0: V0, x1: V1, x2: V2, x3: V3) =\u003e T,\n  args: [V0, V1],\n): (x2: V2, x3: V3) =\u003e T;\npartial\u003cV0, V1, V2, V3, T\u003e(\n  fn: (x0: V0, x1: V1, x2: V2, x3: V3) =\u003e T,\n  args: [V0],\n): (x1: V1, x2: V2, x3: V3) =\u003e T;\npartial\u003cT\u003e(fn: (...a: any[]) =\u003e T, args: any[]): (...a: any[]) =\u003e T;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.partial\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { isArray } from './_internals/isArray.js'\n\nexport function partial(fn, ...args){\n  const len = fn.length\n\n  // If a single array argument is given, those are the args (a la Ramda).\n  // Otherwise, the variadic arguments are the args.\n  const argList = args.length === 1 \u0026\u0026 isArray(args[0]) ? args[0] : args\n\n  return (...rest) =\u003e {\n    if (argList.length + rest.length \u003e= len){\n      return fn(...argList, ...rest)\n    }\n\n    return partial(fn, ...[ ...argList, ...rest ])\n  }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { partial } from './partial.js'\nimport { type } from './type.js'\n\nconst greet = (\n  salutation, title, firstName, lastName\n) =\u003e\n  [salutation, title, firstName, lastName]\n\ntest('happy', () =\u003e {\n  const canPassAnyNumberOfArguments = partial(\n    greet, 'Hello', 'Ms.'\n  )\n  const fn = canPassAnyNumberOfArguments('foo')\n  const sayHello = partial(greet, [ 'Hello' ])\n  const sayHelloRamda = partial(sayHello, [ 'Ms.' ])\n\n  expect(type(fn)).toBe('Function')\n\n  expect(fn('bar')).toStrictEqual(['Hello', 'Ms.', 'foo', 'bar'])\n  expect(sayHelloRamda('foo', 'bar')).toStrictEqual(['Hello', 'Ms.', 'foo', 'bar'])\n})\n\ntest('extra arguments are ignored', () =\u003e {\n  const canPassAnyNumberOfArguments = partial(\n    greet, 'Hello', 'Ms.'\n  )\n  const fn = canPassAnyNumberOfArguments('foo')\n\n  expect(type(fn)).toBe('Function')\n\n  expect(fn(\n    'bar', 1, 2\n  )).toStrictEqual(['Hello', 'Ms.', 'foo', 'bar'])\n})\n\ntest('when array is input', () =\u003e {\n  const fooFn = (\n    a, b, c, d\n  ) =\u003e ({\n    a,\n    b,\n    c,\n    d,\n  })\n  const barFn = partial(\n    fooFn, [ 1, 2 ], []\n  )\n\n  expect(barFn(1, 2)).toEqual({\n    a : [ 1, 2 ],\n    b : [],\n    c : 1,\n    d : 2,\n  })\n})\n\ntest('ramda spec', () =\u003e {\n  const sayHello = partial(greet, 'Hello')\n  const sayHelloToMs = partial(sayHello, 'Ms.')\n\n  expect(sayHelloToMs('Jane', 'Jones')).toStrictEqual(['Hello', 'Ms.', 'Jane', 'Jones'])\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {partial} from 'rambda'\n\ndescribe('R.partial', () =\u003e {\n  it('happy', () =\u003e {\n    function fn(\n      aString: string,\n      aNumber: number,\n      aBoolean: boolean,\n      aNull: null\n    ) {\n      return {aString, aNumber, aBoolean, aNull}\n    }\n\n    // @ts-expect-error\n    partial(fn, 1)\n\n    const fn1 = partial(fn, ['a'])\n    partial(fn1, ['b'])\n\n    const fn2 = partial(fn1, [2])\n    const result = fn2(true, null)\n    result // $ExpectType { aString: string; aNumber: number; aBoolean: boolean; aNull: null; }\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#partial)\n\n### partialObject\n\n```typescript\n\npartialObject\u003cInput, PartialInput, Output\u003e(\n  fn: (input: Input) =\u003e Output, \n  partialInput: PartialInput,\n): (input: Pick\u003cInput, Exclude\u003ckeyof Input, keyof PartialInput\u003e\u003e) =\u003e Output\n```\n\n`R.partialObject` is a curry helper designed specifically for functions accepting object as a single argument.\n\nInitially the function knows only a part from the whole input object and then `R.partialObject` helps in preparing the function for the second part, when it receives the rest of the input.\n\n\u003e :boom: Function input can be asynchronous\n\n```javascript\nconst fn = ({ a, b, c }) =\u003e a + b + c\nconst curried = R.partialObject(fn, { a : 1 })\nconst result = curried({\n  b : 2,\n  c : 3,\n})\n// =\u003e 6\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20fn%20%3D%20(%7B%20a%2C%20b%2C%20c%20%7D)%20%3D%3E%20a%20%2B%20b%20%2B%20c%0Aconst%20curried%20%3D%20R.partialObject(fn%2C%20%7B%20a%20%3A%201%20%7D)%0Aconst%20result%20%3D%20curried(%7B%0A%20%20b%20%3A%202%2C%0A%20%20c%20%3A%203%2C%0A%7D)%0A%2F%2F%20%3D%3E%206\"\u003eTry this \u003cstrong\u003eR.partialObject\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\npartialObject\u003cInput, PartialInput, Output\u003e(\n  fn: (input: Input) =\u003e Output, \n  partialInput: PartialInput,\n): (input: Pick\u003cInput, Exclude\u003ckeyof Input, keyof PartialInput\u003e\u003e) =\u003e Output;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.partialObject\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { mergeDeepRight } from './mergeDeepRight.js'\n\nexport function partialObject(fn, input){\n  return nextInput =\u003e fn(mergeDeepRight(nextInput, input))\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { delay } from './delay.js'\nimport { partialObject } from './partialObject.js'\nimport { type } from './type.js'\n\ntest('with plain function', () =\u003e {\n  const fn = ({ a, b, c }) =\u003e a + b + c\n  const curried = partialObject(fn, { a : 1 })\n\n  expect(type(curried)).toBe('Function')\n  expect(curried({\n    b : 2,\n    c : 3,\n  })).toBe(6)\n})\n\ntest('with function that throws an error', () =\u003e {\n  const fn = ({ a, b, c }) =\u003e {\n    throw new Error('foo')\n  }\n  const curried = partialObject(fn, { a : 1 })\n\n  expect(type(curried)).toBe('Function')\n  expect(() =\u003e\n    curried({\n      b : 2,\n      c : 3,\n    })).toThrowErrorMatchingInlineSnapshot('\"foo\"')\n})\n\ntest('with async', async () =\u003e {\n  const fn = async ({ a, b, c }) =\u003e {\n    await delay(100)\n\n    return a + b + c\n  }\n\n  const curried = partialObject(fn, { a : 1 })\n\n  const result = await curried({\n    b : 2,\n    c : 3,\n  })\n\n  expect(result).toBe(6)\n})\n\ntest('async function throwing an error', async () =\u003e {\n  const fn = async ({ a, b, c }) =\u003e {\n    await delay(100)\n    throw new Error('foo')\n  }\n\n  const curried = partialObject(fn, { a : 1 })\n\n  try {\n    await curried({\n      b : 2,\n      c : 3,\n    })\n    expect(true).toBeFalsy()\n  } catch (e){\n    expect(e.message).toBe('foo')\n  }\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {partialObject, delay} from 'rambda'\n\ndescribe('R.partialObject', () =\u003e {\n  it('happy', () =\u003e {\n    interface Input {\n      a: number,\n      b: number,\n      c: string,\n    }\n    const fn = ({a, b, c}: Input) =\u003e a + b + c\n    const curried = partialObject(fn, {a: 1})\n    const result = curried({\n      b: 2,\n      c: 'foo',\n    })\n    result // $ExpectType string\n  })\n  it('asynchronous', async() =\u003e {\n    interface Input {\n      a: number,\n      b: number,\n      c: string,\n    }\n    const fn = async({a, b, c}: Input) =\u003e {\n      await delay(100)\n      return a + b + c\n    }\n    const curried = partialObject(fn, {a: 1})\n    const result = await curried({\n      b: 2,\n      c: 'foo',\n    })\n    result // $ExpectType string\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#partialObject)\n\n### partition\n\n```typescript\n\npartition\u003cT\u003e(\n  predicate: Predicate\u003cT\u003e,\n  input: T[]\n): [T[], T[]]\n```\n\nIt will return array of two objects/arrays according to `predicate` function. The first member holds all instances of `input` that pass the `predicate` function, while the second member - those who doesn't.\n\n```javascript\nconst list = [1, 2, 3]\nconst obj = {a: 1, b: 2, c: 3}\nconst predicate = x =\u003e x \u003e 2\n\nconst result = [\n  R.partition(predicate, list),\n  R.partition(predicate, Record\u003cstring, unknown\u003e)\n]\nconst expected = [\n  [[3], [1, 2]],\n  [{c: 3},  {a: 1, b: 2}],\n]\n// `result` is equal to `expected`\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B1%2C%202%2C%203%5D%0Aconst%20obj%20%3D%20%7Ba%3A%201%2C%20b%3A%202%2C%20c%3A%203%7D%0Aconst%20predicate%20%3D%20x%20%3D%3E%20x%20%3E%202%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.partition(predicate%2C%20list)%2C%0A%20%20R.partition(predicate%2C%20Record%3Cstring%2C%20unknown%3E)%0A%5D%0Aconst%20expected%20%3D%20%5B%0A%20%20%5B%5B3%5D%2C%20%5B1%2C%202%5D%5D%2C%0A%20%20%5B%7Bc%3A%203%7D%2C%20%20%7Ba%3A%201%2C%20b%3A%202%7D%5D%2C%0A%5D%0A%2F%2F%20%60result%60%20is%20equal%20to%20%60expected%60\"\u003eTry this \u003cstrong\u003eR.partition\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\npartition\u003cT\u003e(\n  predicate: Predicate\u003cT\u003e,\n  input: T[]\n): [T[], T[]];\npartition\u003cT\u003e(\n  predicate: Predicate\u003cT\u003e\n): (input: T[]) =\u003e [T[], T[]];\npartition\u003cT\u003e(\n  predicate: (x: T, prop?: string) =\u003e boolean,\n  input: { [key: string]: T}\n): [{ [key: string]: T}, { [key: string]: T}];\npartition\u003cT\u003e(\n  predicate: (x: T, prop?: string) =\u003e boolean\n): (input: { [key: string]: T}) =\u003e [{ [key: string]: T}, { [key: string]: T}];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.partition\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { isArray } from './_internals/isArray.js'\n\nexport function partitionObject(predicate, iterable){\n  const yes = {}\n  const no = {}\n  Object.entries(iterable).forEach(([ prop, value ]) =\u003e {\n    if (predicate(value, prop)){\n      yes[ prop ] = value\n    } else {\n      no[ prop ] = value\n    }\n  })\n\n  return [ yes, no ]\n}\n\nexport function partitionArray(\n  predicate, list, indexed = false\n){\n  const yes = []\n  const no = []\n  let counter = -1\n\n  while (counter++ \u003c list.length - 1){\n    if (\n      indexed ? predicate(list[ counter ], counter) : predicate(list[ counter ])\n    ){\n      yes.push(list[ counter ])\n    } else {\n      no.push(list[ counter ])\n    }\n  }\n\n  return [ yes, no ]\n}\n\nexport function partition(predicate, iterable){\n  if (arguments.length === 1){\n    return listHolder =\u003e partition(predicate, listHolder)\n  }\n  if (!isArray(iterable)) return partitionObject(predicate, iterable)\n\n  return partitionArray(predicate, iterable)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { partition } from './partition.js'\n\ntest('with array', () =\u003e {\n  const predicate = x =\u003e x \u003e 2\n  const list = [ 1, 2, 3, 4 ]\n\n  const result = partition(predicate, list)\n  const expectedResult = [\n    [ 3, 4 ],\n    [ 1, 2 ],\n  ]\n\n  expect(result).toEqual(expectedResult)\n})\n\ntest('with object', () =\u003e {\n  const predicate = (value, prop) =\u003e {\n    expect(typeof prop).toBe('string')\n\n    return value \u003e 2\n  }\n  const hash = {\n    a : 1,\n    b : 2,\n    c : 3,\n    d : 4,\n  }\n\n  const result = partition(predicate)(hash)\n  const expectedResult = [\n    {\n      c : 3,\n      d : 4,\n    },\n    {\n      a : 1,\n      b : 2,\n    },\n  ]\n\n  expect(result).toEqual(expectedResult)\n})\n\ntest('readme example', () =\u003e {\n  const list = [ 1, 2, 3 ]\n  const obj = {\n    a : 1,\n    b : 2,\n    c : 3,\n  }\n  const predicate = x =\u003e x \u003e 2\n\n  const result = [ partition(predicate, list), partition(predicate, obj) ]\n  const expected = [\n    [ [ 3 ], [ 1, 2 ] ],\n    [\n      { c : 3 },\n      {\n        a : 1,\n        b : 2,\n      },\n    ],\n  ]\n  expect(result).toEqual(expected)\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {partition} from 'rambda'\n\ndescribe('R.partition', () =\u003e {\n  it('with array', () =\u003e {\n    const predicate = (x: number) =\u003e {\n      return x \u003e 2\n    }\n    const list = [1, 2, 3, 4]\n\n    const result = partition(predicate, list)\n    const curriedResult = partition(predicate)(list)\n    result // $ExpectType [number[], number[]]\n    curriedResult // $ExpectType [number[], number[]]\n  })\n\n  /*\n    revert to old version of `dtslint` and `R.partition` typing\n    as there is diff between VSCode types(correct) and dtslint(incorrect)\n    \n    it('with object', () =\u003e {\n      const predicate = (value: number, prop?: string) =\u003e {\n        return value \u003e 2\n      }\n      const hash = {\n        a: 1,\n        b: 2,\n        c: 3,\n        d: 4,\n      }\n  \n      const result = partition(predicate, hash)\n      const curriedResult = partition(predicate)(hash)\n      result[0] // $xExpectType { [key: string]: number; }\n      result[1] // $xExpectType { [key: string]: number; }\n      curriedResult[0] // $xExpectType { [key: string]: number; }\n      curriedResult[1] // $xExpectType { [key: string]: number; }\n    })\n    */\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#partition)\n\n### path\n\n```typescript\n\npath\u003cS, K0 extends keyof S = keyof S\u003e(path: [K0], obj: S): S[K0]\n```\n\nIf `pathToSearch` is `'a.b'` then it will return `1` if `obj` is `{a:{b:1}}`.\n\nIt will return `undefined`, if such path is not found.\n\n\u003e :boom: String annotation of `pathToSearch` is one of the differences between `Rambda` and `Ramda`.\n\n```javascript\nconst obj = {a: {b: 1}}\nconst pathToSearch = 'a.b'\nconst pathToSearchList = ['a', 'b']\n\nconst result = [\n  R.path(pathToSearch, Record\u003cstring, unknown\u003e),\n  R.path(pathToSearchList, Record\u003cstring, unknown\u003e),\n  R.path('a.b.c.d', Record\u003cstring, unknown\u003e)\n]\n// =\u003e [1, 1, undefined]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20obj%20%3D%20%7Ba%3A%20%7Bb%3A%201%7D%7D%0Aconst%20pathToSearch%20%3D%20'a.b'%0Aconst%20pathToSearchList%20%3D%20%5B'a'%2C%20'b'%5D%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.path(pathToSearch%2C%20Record%3Cstring%2C%20unknown%3E)%2C%0A%20%20R.path(pathToSearchList%2C%20Record%3Cstring%2C%20unknown%3E)%2C%0A%20%20R.path('a.b.c.d'%2C%20Record%3Cstring%2C%20unknown%3E)%0A%5D%0A%2F%2F%20%3D%3E%20%5B1%2C%201%2C%20undefined%5D\"\u003eTry this \u003cstrong\u003eR.path\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\npath\u003cS, K0 extends keyof S = keyof S\u003e(path: [K0], obj: S): S[K0];\npath\u003cS, K0 extends keyof S = keyof S, K1 extends keyof S[K0] = keyof S[K0]\u003e(path: [K0, K1], obj: S): S[K0][K1];\npath\u003c\n    S,\n    K0 extends keyof S = keyof S,\n    K1 extends keyof S[K0] = keyof S[K0],\n    K2 extends keyof S[K0][K1] = keyof S[K0][K1]\n\u003e(path: [K0, K1, K2], obj: S): S[K0][K1][K2];\npath\u003c\n    S,\n    K0 extends keyof S = keyof S,\n    K1 extends keyof S[K0] = keyof S[K0],\n    K2 extends keyof S[K0][K1] = keyof S[K0][K1],\n    K3 extends keyof S[K0][K1][K2] = keyof S[K0][K1][K2],\n\u003e(path: [K0, K1, K2, K3], obj: S): S[K0][K1][K2][K3];\npath\u003c\n    S,\n    K0 extends keyof S = keyof S,\n    K1 extends keyof S[K0] = keyof S[K0],\n    K2 extends keyof S[K0][K1] = keyof S[K0][K1],\n    K3 extends keyof S[K0][K1][K2] = keyof S[K0][K1][K2],\n    K4 extends keyof S[K0][K1][K2][K3] = keyof S[K0][K1][K2][K3],\n\u003e(path: [K0, K1, K2, K3, K4], obj: S): S[K0][K1][K2][K3][K4];\npath\u003c\n    S,\n    K0 extends keyof S = keyof S,\n    K1 extends keyof S[K0] = keyof S[K0],\n    K2 extends keyof S[K0][K1] = keyof S[K0][K1],\n    K3 extends keyof S[K0][K1][K2] = keyof S[K0][K1][K2],\n    K4 extends keyof S[K0][K1][K2][K3] = keyof S[K0][K1][K2][K3],\n    K5 extends keyof S[K0][K1][K2][K3][K4] = keyof S[K0][K1][K2][K3][K4],\n\u003e(path: [K0, K1, K2, K3, K4, K5], obj: S): S[K0][K1][K2][K3][K4][K5];\npath\u003cT\u003e(pathToSearch: string, obj: any): T | undefined;\npath\u003cT\u003e(pathToSearch: string): (obj: any) =\u003e T | undefined;\npath\u003cT\u003e(pathToSearch: RamdaPath): (obj: any) =\u003e T | undefined;\npath\u003cT\u003e(pathToSearch: RamdaPath, obj: any): T | undefined;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.path\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { createPath } from './_internals/createPath.js'\n\nexport function pathFn(pathInput, obj){\n  let willReturn = obj\n  let counter = 0\n\n  const pathArrValue = createPath(pathInput)\n\n  while (counter \u003c pathArrValue.length){\n    if (willReturn === null || willReturn === undefined){\n      return undefined\n    }\n    if (willReturn[ pathArrValue[ counter ] ] === null) return undefined\n\n    willReturn = willReturn[ pathArrValue[ counter ] ]\n    counter++\n  }\n\n  return willReturn\n}\n\nexport function path(pathInput, obj){\n  if (arguments.length === 1) return _obj =\u003e path(pathInput, _obj)\n\n  if (obj === null || obj === undefined){\n    return undefined\n  }\n\n  return pathFn(pathInput, obj)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { path } from './path.js'\n\ntest('with array inside object', () =\u003e {\n  const obj = { a : { b : [ 1, { c : 1 } ] } }\n\n  expect(path('a.b.1.c', obj)).toBe(1)\n})\n\ntest('works with undefined', () =\u003e {\n  const obj = { a : { b : { c : 1 } } }\n\n  expect(path('a.b.c.d.f', obj)).toBeUndefined()\n  expect(path('foo.babaz', undefined)).toBeUndefined()\n  expect(path('foo.babaz')(undefined)).toBeUndefined()\n})\n\ntest('works with string instead of array', () =\u003e {\n  expect(path('foo.bar.baz')({ foo : { bar : { baz : 'yes' } } })).toBe('yes')\n})\n\ntest('path', () =\u003e {\n  expect(path([ 'foo', 'bar', 'baz' ])({ foo : { bar : { baz : 'yes' } } })).toBe('yes')\n\n  expect(path([ 'foo', 'bar', 'baz' ])(null)).toBeUndefined()\n\n  expect(path([ 'foo', 'bar', 'baz' ])({ foo : { bar : 'baz' } })).toBeUndefined()\n})\n\ntest('null is not a valid path', () =\u003e {\n  expect(path('audio_tracks', {\n    a            : 1,\n    audio_tracks : null,\n  })).toBeUndefined()\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {path} from 'rambda'\n\nconst input = {a: {b: {c: true}}}\n\ndescribe('R.path with string as path', () =\u003e {\n  it('without specified output type', () =\u003e {\n    // $ExpectType unknown\n    path('a.b.c', input)\n    // $ExpectType unknown\n    path('a.b.c')(input)\n  })\n  it('with specified output type', () =\u003e {\n    // $ExpectType boolean | undefined\n    path\u003cboolean\u003e('a.b.c', input)\n    // $ExpectType boolean | undefined\n    path\u003cboolean\u003e('a.b.c')(input)\n  })\n})\n\ndescribe('R.path with list as path', () =\u003e {\n  it('with array as path', () =\u003e {\n    // $ExpectType boolean\n    path(['a', 'b', 'c'], input)\n    // $ExpectType unknown\n    path(['a', 'b', 'c'])(input)\n  })\n  test('shallow property', () =\u003e {\n    // $ExpectType number\n    path(['a'], {a: 1})\n\n    // $ExpectType unknown\n    path(['b'], {a: 1})\n  })\n  test('deep property', () =\u003e {\n    const testObject = {a: {b: {c: {d: {e: {f: 1}}}}}}\n    const result = path(['a', 'b', 'c', 'd', 'e', 'f'], testObject)\n    // $ExpectType number\n    result\n    const curriedResult = path(['a', 'b', 'c', 'd', 'e', 'f'])(testObject)\n    // $ExpectType unknown\n    curriedResult\n  })\n  test('issue #668 - path is not correct', () =\u003e {\n    const object = {\n      is: {\n        a: 'path',\n      },\n    }\n    const result = path(['is', 'not', 'a'], object)\n    // $ExpectType unknown\n    result\n    const curriedResult = path(['is', 'not', 'a'])(object)\n    // $ExpectType unknown\n    curriedResult\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#path)\n\n### pathEq\n\n```typescript\n\npathEq(pathToSearch: Path, target: any, input: any): boolean\n```\n\nIt returns `true` if `pathToSearch` of `input` object is equal to `target` value.\n\n`pathToSearch` is passed to `R.path`, which means that it can be either a string or an array. Also equality between `target` and the found value is determined by `R.equals`.\n\n```javascript\nconst path = 'a.b'\nconst target = {c: 1}\nconst input = {a: {b: {c: 1}}}\n\nconst result = R.pathEq(\n  path,\n  target,\n  input\n)\n// =\u003e true\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20path%20%3D%20'a.b'%0Aconst%20target%20%3D%20%7Bc%3A%201%7D%0Aconst%20input%20%3D%20%7Ba%3A%20%7Bb%3A%20%7Bc%3A%201%7D%7D%7D%0A%0Aconst%20result%20%3D%20R.pathEq(%0A%20%20path%2C%0A%20%20target%2C%0A%20%20input%0A)%0A%2F%2F%20%3D%3E%20true\"\u003eTry this \u003cstrong\u003eR.pathEq\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\npathEq(pathToSearch: Path, target: any, input: any): boolean;\npathEq(pathToSearch: Path, target: any): (input: any) =\u003e boolean;\npathEq(pathToSearch: Path): (target: any) =\u003e (input: any) =\u003e boolean;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.pathEq\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { curry } from './curry.js'\nimport { equals } from './equals.js'\nimport { path } from './path.js'\n\nfunction pathEqFn(\n  pathToSearch, target, input\n){\n  return equals(path(pathToSearch, input), target)\n}\n\nexport const pathEq = curry(pathEqFn)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { pathEq } from './pathEq.js'\n\ntest('when true', () =\u003e {\n  const path = 'a.b'\n  const obj = { a : { b : { c : 1 } } }\n  const target = { c : 1 }\n\n  expect(pathEq(\n    path, target, obj\n  )).toBeTrue()\n})\n\ntest('when false', () =\u003e {\n  const path = 'a.b'\n  const obj = { a : { b : 1 } }\n  const target = 2\n\n  expect(pathEq(path, target)(obj)).toBeFalse()\n})\n\ntest('when wrong path', () =\u003e {\n  const path = 'foo.bar'\n  const obj = { a : { b : 1 } }\n  const target = 2\n\n  expect(pathEq(\n    path, target, obj\n  )).toBeFalse()\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {pathEq} from 'rambda'\n\ndescribe('R.pathEq', () =\u003e {\n  it('with string path', () =\u003e {\n    const pathToSearch = 'a.b.c'\n    const input = {a: {b: {c: 1}}}\n    const target = {c: 1}\n\n    const result = pathEq(pathToSearch, input, target)\n    const curriedResult = pathEq(pathToSearch, input, target)\n    result // $ExpectType boolean\n    curriedResult // $ExpectType boolean\n  })\n\n  it('with array path', () =\u003e {\n    const pathToSearch = ['a', 'b', 'c']\n    const input = {a: {b: {c: 1}}}\n    const target = {c: 1}\n\n    const result = pathEq(pathToSearch, input, target)\n    const curriedResult = pathEq(pathToSearch, input, target)\n    result // $ExpectType boolean\n    curriedResult // $ExpectType boolean\n  })\n})\n\ndescribe('with ramda specs', () =\u003e {\n  const testPath = ['x', 0, 'y']\n  const testObj = {\n    x: [\n      {y: 2, z: 3},\n      {y: 4, z: 5},\n    ],\n  }\n\n  const result1 = pathEq(testPath, 2, testObj)\n  const result2 = pathEq(testPath, 2)(testObj)\n  const result3 = pathEq(testPath)(2)(testObj)\n  result1 // $ExpectType boolean\n  result2 // $ExpectType boolean\n  result3 // $ExpectType boolean\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#pathEq)\n\n### pathOr\n\n```typescript\n\npathOr\u003cT\u003e(defaultValue: T, pathToSearch: Path, obj: any): T\n```\n\nIt reads `obj` input and returns either `R.path(pathToSearch, Record\u003cstring, unknown\u003e)` result or `defaultValue` input.\n\n```javascript\nconst defaultValue = 'DEFAULT_VALUE'\nconst pathToSearch = 'a.b'\nconst pathToSearchList = ['a', 'b']\n\nconst obj = {\n  a : {\n    b : 1\n  }\n}\n\nconst result = [\n  R.pathOr(DEFAULT_VALUE, pathToSearch, Record\u003cstring, unknown\u003e),\n  R.pathOr(DEFAULT_VALUE, pathToSearchList, Record\u003cstring, unknown\u003e), \n  R.pathOr(DEFAULT_VALUE, 'a.b.c', Record\u003cstring, unknown\u003e)\n]\n// =\u003e [1, 1, 'DEFAULT_VALUE']\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20defaultValue%20%3D%20'DEFAULT_VALUE'%0Aconst%20pathToSearch%20%3D%20'a.b'%0Aconst%20pathToSearchList%20%3D%20%5B'a'%2C%20'b'%5D%0A%0Aconst%20obj%20%3D%20%7B%0A%20%20a%20%3A%20%7B%0A%20%20%20%20b%20%3A%201%0A%20%20%7D%0A%7D%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.pathOr(DEFAULT_VALUE%2C%20pathToSearch%2C%20Record%3Cstring%2C%20unknown%3E)%2C%0A%20%20R.pathOr(DEFAULT_VALUE%2C%20pathToSearchList%2C%20Record%3Cstring%2C%20unknown%3E)%2C%20%0A%20%20R.pathOr(DEFAULT_VALUE%2C%20'a.b.c'%2C%20Record%3Cstring%2C%20unknown%3E)%0A%5D%0A%2F%2F%20%3D%3E%20%5B1%2C%201%2C%20'DEFAULT_VALUE'%5D\"\u003eTry this \u003cstrong\u003eR.pathOr\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\npathOr\u003cT\u003e(defaultValue: T, pathToSearch: Path, obj: any): T;\npathOr\u003cT\u003e(defaultValue: T, pathToSearch: Path): (obj: any) =\u003e T;\npathOr\u003cT\u003e(defaultValue: T): (pathToSearch: Path) =\u003e (obj: any) =\u003e T;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.pathOr\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { curry } from './curry.js'\nimport { defaultTo } from './defaultTo.js'\nimport { path } from './path.js'\n\nfunction pathOrFn(\n  defaultValue, pathInput, obj\n){\n  return defaultTo(defaultValue, path(pathInput, obj))\n}\n\nexport const pathOr = curry(pathOrFn)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { pathOr } from './pathOr.js'\n\ntest('with undefined', () =\u003e {\n  const result = pathOr(\n    'foo', 'x.y', { x : { y : 1 } }\n  )\n\n  expect(result).toBe(1)\n})\n\ntest('with null', () =\u003e {\n  const result = pathOr(\n    'foo', 'x.y', null\n  )\n\n  expect(result).toBe('foo')\n})\n\ntest('with NaN', () =\u003e {\n  const result = pathOr(\n    'foo', 'x.y', NaN\n  )\n\n  expect(result).toBe('foo')\n})\n\ntest('curry case (x)(y)(z)', () =\u003e {\n  const result = pathOr('foo')('x.y.z')({ x : { y : { a : 1 } } })\n\n  expect(result).toBe('foo')\n})\n\ntest('curry case (x)(y,z)', () =\u003e {\n  const result = pathOr('foo', 'x.y.z')({ x : { y : { a : 1 } } })\n\n  expect(result).toBe('foo')\n})\n\ntest('curry case (x,y)(z)', () =\u003e {\n  const result = pathOr('foo')('x.y.z', { x : { y : { a : 1 } } })\n\n  expect(result).toBe('foo')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {pathOr} from 'rambda'\n\ndescribe('R.pathOr', () =\u003e {\n  it('with string path', () =\u003e {\n    const x = pathOr\u003cstring\u003e('foo', 'x.y', {x: {y: 'bar'}})\n    x // $ExpectType string\n  })\n  it('with array path', () =\u003e {\n    const x = pathOr\u003cstring\u003e('foo', ['x', 'y'], {x: {y: 'bar'}})\n    x // $ExpectType string\n  })\n  it('without passing type looks bad', () =\u003e {\n    const x = pathOr('foo', 'x.y', {x: {y: 'bar'}})\n    x // $ExpectType \"foo\"\n  })\n  it('curried', () =\u003e {\n    const x = pathOr\u003cstring\u003e('foo', 'x.y')({x: {y: 'bar'}})\n    x // $ExpectType string\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#pathOr)\n\n### paths\n\n```typescript\n\npaths\u003cInput, T\u003e(pathsToSearch: Path[], obj: Input): (T | undefined)[]\n```\n\nIt loops over members of `pathsToSearch` as `singlePath` and returns the array produced by `R.path(singlePath, Record\u003cstring, unknown\u003e)`.\n\nBecause it calls `R.path`, then `singlePath` can be either string or a list.\n\n```javascript\nconst obj = {\n  a : {\n    b : {\n      c : 1,\n      d : 2\n    }\n  }\n}\n\nconst result = R.paths([\n  'a.b.c',\n  'a.b.d',\n  'a.b.c.d.e',\n], Record\u003cstring, unknown\u003e)\n// =\u003e [1, 2, undefined]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20obj%20%3D%20%7B%0A%20%20a%20%3A%20%7B%0A%20%20%20%20b%20%3A%20%7B%0A%20%20%20%20%20%20c%20%3A%201%2C%0A%20%20%20%20%20%20d%20%3A%202%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D%0A%0Aconst%20result%20%3D%20R.paths(%5B%0A%20%20'a.b.c'%2C%0A%20%20'a.b.d'%2C%0A%20%20'a.b.c.d.e'%2C%0A%5D%2C%20Record%3Cstring%2C%20unknown%3E)%0A%2F%2F%20%3D%3E%20%5B1%2C%202%2C%20undefined%5D\"\u003eTry this \u003cstrong\u003eR.paths\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\npaths\u003cInput, T\u003e(pathsToSearch: Path[], obj: Input): (T | undefined)[];\npaths\u003cInput, T\u003e(pathsToSearch: Path[]): (obj: Input) =\u003e (T | undefined)[];\npaths\u003cT\u003e(pathsToSearch: Path[], obj: any): (T | undefined)[];\npaths\u003cT\u003e(pathsToSearch: Path[]): (obj: any) =\u003e (T | undefined)[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.paths\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { path } from './path.js'\n\nexport function paths(pathsToSearch, obj){\n  if (arguments.length === 1){\n    return _obj =\u003e paths(pathsToSearch, _obj)\n  }\n\n  return pathsToSearch.map(singlePath =\u003e path(singlePath, obj))\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { paths } from './paths.js'\n\nconst obj = {\n  a : {\n    b : {\n      c : 1,\n      d : 2,\n    },\n  },\n  p : [ { q : 3 } ],\n  x : {\n    y : 'FOO',\n    z : [ [ {} ] ],\n  },\n}\n\ntest('with string path + curry', () =\u003e {\n  const pathsInput = [ 'a.b.d', 'p.q' ]\n  const expected = [ 2, undefined ]\n  const result = paths(pathsInput, obj)\n  const curriedResult = paths(pathsInput)(obj)\n\n  expect(result).toEqual(expected)\n  expect(curriedResult).toEqual(expected)\n})\n\ntest('with array path', () =\u003e {\n  const result = paths([\n    [ 'a', 'b', 'c' ],\n    [ 'x', 'y' ],\n  ],\n  obj)\n\n  expect(result).toEqual([ 1, 'FOO' ])\n})\n\ntest('takes a paths that contains indices into arrays', () =\u003e {\n  expect(paths([\n    [ 'p', 0, 'q' ],\n    [ 'x', 'z', 0, 0 ],\n  ],\n  obj)).toEqual([ 3, {} ])\n  expect(paths([\n    [ 'p', 0, 'q' ],\n    [ 'x', 'z', 2, 1 ],\n  ],\n  obj)).toEqual([ 3, undefined ])\n})\n\ntest('gets a deep property\\'s value from objects', () =\u003e {\n  expect(paths([ [ 'a', 'b' ] ], obj)).toEqual([ obj.a.b ])\n  expect(paths([ [ 'p', 0 ] ], obj)).toEqual([ obj.p[ 0 ] ])\n})\n\ntest('returns undefined for items not found', () =\u003e {\n  expect(paths([ [ 'a', 'x', 'y' ] ], obj)).toEqual([ undefined ])\n  expect(paths([ [ 'p', 2 ] ], obj)).toEqual([ undefined ])\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {paths} from 'rambda'\n\ninterface Input {\n  a: number,\n  b: number,\n  c: number,\n}\n\nconst input: Input = {a: 1, b: 2, c: 3}\n\ndescribe('R.paths', () =\u003e {\n  it('with dot notation', () =\u003e {\n    const result = paths\u003cnumber\u003e(['a.b.c', 'foo.bar'], input)\n    result // $ExpectType (number | undefined)[]\n  })\n\n  it('without type', () =\u003e {\n    const result = paths(['a.b.c', 'foo.bar'], input)\n    result // $ExpectType unknown[]\n  })\n\n  it('with array as path', () =\u003e {\n    const result = paths\u003cnumber\u003e([['a', 'b', 'c'], ['foo.bar']], input)\n    result // $ExpectType (number | undefined)[]\n  })\n\n  it('curried', () =\u003e {\n    const result = paths\u003cnumber\u003e([['a', 'b', 'c'], ['foo.bar']])(input)\n    result // $ExpectType (number | undefined)[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#paths)\n\n### pathSatisfies\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.pathSatisfies(%0A%20%20x%20%3D%3E%20x%20%3E%200%2C%0A%20%20%5B'a'%2C%20'b'%2C%20'c'%5D%2C%0A%20%20%7Ba%3A%20%7Bb%3A%20%7Bc%3A%201%7D%7D%7D%0A)%0A%2F%2F%20%3D%3E%20true\"\u003eTry this \u003cstrong\u003eR.pathSatisfies\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#pathSatisfies)\n\n### pick\n\n```typescript\n\npick\u003cT, K extends string | number | symbol\u003e(propsToPick: K[], input: T): Pick\u003cT, Exclude\u003ckeyof T, Exclude\u003ckeyof T, K\u003e\u003e\u003e\n```\n\nIt returns a partial copy of an `input` containing only `propsToPick` properties.\n\n`input` can be either an object or an array.\n\nString annotation of `propsToPick` is one of the differences between `Rambda` and `Ramda`.\n\n\u003e :boom: When using this method with `TypeScript`, it is much easier to pass `propsToPick` as an array. If passing a string, you will need to explicitly declare the output type.\n\n```javascript\nconst obj = {\n  a : 1,\n  b : false,\n  foo: 'cherry'\n}\nconst list = [1, 2, 3, 4]\nconst propsToPick = 'a,foo'\nconst propsToPickList = ['a', 'foo']\n\nconst result = [\n  R.pick(propsToPick, Record\u003cstring, unknown\u003e),\n  R.pick(propsToPickList, Record\u003cstring, unknown\u003e),\n  R.pick('a,bar', Record\u003cstring, unknown\u003e),\n  R.pick('bar', Record\u003cstring, unknown\u003e),\n  R.pick([0, 3, 5], list),\n  R.pick('0,3,5', list),\n]\n\nconst expected = [\n  {a:1, foo: 'cherry'},\n  {a:1, foo: 'cherry'},\n  {a:1},\n  {},\n  {0: 1, 3: 4},\n  {0: 1, 3: 4},\n]\n// =\u003e `result` is equal to `expected`\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20obj%20%3D%20%7B%0A%20%20a%20%3A%201%2C%0A%20%20b%20%3A%20false%2C%0A%20%20foo%3A%20'cherry'%0A%7D%0Aconst%20list%20%3D%20%5B1%2C%202%2C%203%2C%204%5D%0Aconst%20propsToPick%20%3D%20'a%2Cfoo'%0Aconst%20propsToPickList%20%3D%20%5B'a'%2C%20'foo'%5D%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.pick(propsToPick%2C%20Record%3Cstring%2C%20unknown%3E)%2C%0A%20%20R.pick(propsToPickList%2C%20Record%3Cstring%2C%20unknown%3E)%2C%0A%20%20R.pick('a%2Cbar'%2C%20Record%3Cstring%2C%20unknown%3E)%2C%0A%20%20R.pick('bar'%2C%20Record%3Cstring%2C%20unknown%3E)%2C%0A%20%20R.pick(%5B0%2C%203%2C%205%5D%2C%20list)%2C%0A%20%20R.pick('0%2C3%2C5'%2C%20list)%2C%0A%5D%0A%0Aconst%20expected%20%3D%20%5B%0A%20%20%7Ba%3A1%2C%20foo%3A%20'cherry'%7D%2C%0A%20%20%7Ba%3A1%2C%20foo%3A%20'cherry'%7D%2C%0A%20%20%7Ba%3A1%7D%2C%0A%20%20%7B%7D%2C%0A%20%20%7B0%3A%201%2C%203%3A%204%7D%2C%0A%20%20%7B0%3A%201%2C%203%3A%204%7D%2C%0A%5D%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60\"\u003eTry this \u003cstrong\u003eR.pick\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\npick\u003cT, K extends string | number | symbol\u003e(propsToPick: K[], input: T): Pick\u003cT, Exclude\u003ckeyof T, Exclude\u003ckeyof T, K\u003e\u003e\u003e;\npick\u003cK extends string | number | symbol\u003e(propsToPick: K[]): \u003cT\u003e(input: T) =\u003e Pick\u003cT, Exclude\u003ckeyof T, Exclude\u003ckeyof T, K\u003e\u003e\u003e;\npick\u003cT, U\u003e(propsToPick: string, input: T): U;\npick\u003cT, U\u003e(propsToPick: string): (input: T) =\u003e U;\npick\u003cT\u003e(propsToPick: string, input: object): T;\npick\u003cT\u003e(propsToPick: string): (input: object) =\u003e T;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.pick\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { createPath } from './_internals/createPath.js'\n\nexport function pick(propsToPick, input){\n  if (arguments.length === 1) return _input =\u003e pick(propsToPick, _input)\n\n  if (input === null || input === undefined){\n    return undefined\n  }\n  const keys = createPath(propsToPick, ',')\n  const willReturn = {}\n  let counter = 0\n\n  while (counter \u003c keys.length){\n    if (keys[ counter ] in input){\n      willReturn[ keys[ counter ] ] = input[ keys[ counter ] ]\n    }\n    counter++\n  }\n\n  return willReturn\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { pick } from './pick.js'\n\nconst obj = {\n  a : 1,\n  b : 2,\n  c : 3,\n}\n\ntest('props to pick is a string', () =\u003e {\n  const result = pick('a,c', obj)\n  const resultCurry = pick('a,c')(obj)\n  const expectedResult = {\n    a : 1,\n    c : 3,\n  }\n\n  expect(result).toEqual(expectedResult)\n  expect(resultCurry).toEqual(expectedResult)\n})\n\ntest('when prop is missing', () =\u003e {\n  const result = pick('a,d,f', obj)\n  expect(result).toEqual({ a : 1 })\n})\n\ntest('with list indexes as props', () =\u003e {\n  const list = [ 1, 2, 3 ]\n  const expected = {\n    0 : 1,\n    2 : 3,\n  }\n  expect(pick([ 0, 2, 3 ], list)).toEqual(expected)\n  expect(pick('0,2,3', list)).toEqual(expected)\n})\n\ntest('props to pick is an array', () =\u003e {\n  expect(pick([ 'a', 'c' ])({\n    a : 'foo',\n    b : 'bar',\n    c : 'baz',\n  })).toEqual({\n    a : 'foo',\n    c : 'baz',\n  })\n\n  expect(pick([ 'a', 'd', 'e', 'f' ])({\n    a : 'foo',\n    b : 'bar',\n    c : 'baz',\n  })).toEqual({ a : 'foo' })\n\n  expect(pick('a,d,e,f')(null)).toBeUndefined()\n})\n\ntest('works with list as input and number as props - props to pick is an array', () =\u003e {\n  const result = pick([ 1, 2 ], [ 'a', 'b', 'c', 'd' ])\n  expect(result).toEqual({\n    1 : 'b',\n    2 : 'c',\n  })\n})\n\ntest('works with list as input and number as props - props to pick is a string', () =\u003e {\n  const result = pick('1,2', [ 'a', 'b', 'c', 'd' ])\n  expect(result).toEqual({\n    1 : 'b',\n    2 : 'c',\n  })\n})\n\ntest('with symbol', () =\u003e {\n  const symbolProp = Symbol('s')\n  expect(pick([ symbolProp ], { [ symbolProp ] : 'a' })).toMatchInlineSnapshot(`\n{\n  Symbol(s): \"a\",\n}\n`)\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {pick} from 'rambda'\n\nconst input = {a: 'foo', b: 2, c: 3, d: 4}\n\ndescribe('R.pick with array as props input', () =\u003e {\n  it('without passing type', () =\u003e {\n    const result = pick(['a', 'c'], input)\n    result.a // $ExpectType string\n    result.c // $ExpectType number\n  })\n})\n\ndescribe('R.pick with string as props input', () =\u003e {\n  interface Input {\n    a: string,\n    b: number,\n    c: number,\n    d: number,\n  }\n  interface Output {\n    a: string,\n    c: number,\n  }\n  it('explicitly declare output', () =\u003e {\n    const result = pick\u003cOutput\u003e('a,c', input)\n    result // $ExpectType Output\n    result.a // $ExpectType string\n    result.c // $ExpectType number\n\n    const curriedResult = pick\u003cOutput\u003e('a,c')(input)\n\n    curriedResult.a // $ExpectType string\n  })\n\n  it('explicitly declare input and output', () =\u003e {\n    const result = pick\u003cInput, Output\u003e('a,c', input)\n    result // $ExpectType Output\n    result.a // $ExpectType string\n\n    const curriedResult = pick\u003cInput, Output\u003e('a,c')(input)\n\n    curriedResult.a // $ExpectType string\n  })\n\n  it('without passing type', () =\u003e {\n    const result = pick('a,c', input)\n    result // $ExpectType unknown\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#pick)\n\n### pickAll\n\n```typescript\n\npickAll\u003cT, K extends keyof T\u003e(propsToPicks: K[], input: T): Pick\u003cT, K\u003e\n```\n\nSame as `R.pick` but it won't skip the missing props, i.e. it will assign them to `undefined`.\n\n\u003e :boom: When using this method with `TypeScript`, it is much easier to pass `propsToPick` as an array. If passing a string, you will need to explicitly declare the output type.\n\n```javascript\nconst obj = {\n  a : 1,\n  b : false,\n  foo: 'cherry'\n}\nconst propsToPick = 'a,foo,bar'\nconst propsToPickList = ['a', 'foo', 'bar']\n\nconst result = [\n  R.pickAll(propsToPick, Record\u003cstring, unknown\u003e),\n  R.pickAll(propsToPickList, Record\u003cstring, unknown\u003e),\n  R.pickAll('a,bar', Record\u003cstring, unknown\u003e),\n  R.pickAll('bar', Record\u003cstring, unknown\u003e),\n]\nconst expected = [\n  {a:1, foo: 'cherry', bar: undefined},\n  {a:1, foo: 'cherry', bar: undefined},\n  {a:1, bar: undefined},\n  {bar: undefined}\n]\n// =\u003e `result` is equal to `expected`\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20obj%20%3D%20%7B%0A%20%20a%20%3A%201%2C%0A%20%20b%20%3A%20false%2C%0A%20%20foo%3A%20'cherry'%0A%7D%0Aconst%20propsToPick%20%3D%20'a%2Cfoo%2Cbar'%0Aconst%20propsToPickList%20%3D%20%5B'a'%2C%20'foo'%2C%20'bar'%5D%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.pickAll(propsToPick%2C%20Record%3Cstring%2C%20unknown%3E)%2C%0A%20%20R.pickAll(propsToPickList%2C%20Record%3Cstring%2C%20unknown%3E)%2C%0A%20%20R.pickAll('a%2Cbar'%2C%20Record%3Cstring%2C%20unknown%3E)%2C%0A%20%20R.pickAll('bar'%2C%20Record%3Cstring%2C%20unknown%3E)%2C%0A%5D%0Aconst%20expected%20%3D%20%5B%0A%20%20%7Ba%3A1%2C%20foo%3A%20'cherry'%2C%20bar%3A%20undefined%7D%2C%0A%20%20%7Ba%3A1%2C%20foo%3A%20'cherry'%2C%20bar%3A%20undefined%7D%2C%0A%20%20%7Ba%3A1%2C%20bar%3A%20undefined%7D%2C%0A%20%20%7Bbar%3A%20undefined%7D%0A%5D%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60\"\u003eTry this \u003cstrong\u003eR.pickAll\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\npickAll\u003cT, K extends keyof T\u003e(propsToPicks: K[], input: T): Pick\u003cT, K\u003e;\npickAll\u003cT, U\u003e(propsToPicks: string[], input: T): U;\npickAll(propsToPicks: string[]): \u003cT, U\u003e(input: T) =\u003e U;\npickAll\u003cT, U\u003e(propsToPick: string, input: T): U;\npickAll\u003cT, U\u003e(propsToPick: string): (input: T) =\u003e U;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.pickAll\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { createPath } from './_internals/createPath.js'\n\nexport function pickAll(propsToPick, obj){\n  if (arguments.length === 1) return _obj =\u003e pickAll(propsToPick, _obj)\n\n  if (obj === null || obj === undefined){\n    return undefined\n  }\n  const keysValue = createPath(propsToPick, ',')\n  const willReturn = {}\n  let counter = 0\n\n  while (counter \u003c keysValue.length){\n    if (keysValue[ counter ] in obj){\n      willReturn[ keysValue[ counter ] ] = obj[ keysValue[ counter ] ]\n    } else {\n      willReturn[ keysValue[ counter ] ] = undefined\n    }\n    counter++\n  }\n\n  return willReturn\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { pickAll } from './pickAll.js'\n\ntest('when input is undefined or null', () =\u003e {\n  expect(pickAll('a', null)).toBeUndefined()\n  expect(pickAll('a', undefined)).toBeUndefined()\n})\n\ntest('with string as condition', () =\u003e {\n  const obj = {\n    a : 1,\n    b : 2,\n    c : 3,\n  }\n  const result = pickAll('a,c', obj)\n  const resultCurry = pickAll('a,c')(obj)\n  const expectedResult = {\n    a : 1,\n    b : undefined,\n    c : 3,\n  }\n\n  expect(result).toEqual(expectedResult)\n  expect(resultCurry).toEqual(expectedResult)\n})\n\ntest('with array as condition', () =\u003e {\n  expect(pickAll([ 'a', 'b', 'c' ], {\n    a : 'foo',\n    c : 'baz',\n  })).toEqual({\n    a : 'foo',\n    b : undefined,\n    c : 'baz',\n  })\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {pickAll} from 'rambda'\n\ninterface Input {\n  a: string,\n  b: number,\n  c: number,\n  d: number,\n}\ninterface Output {\n  a?: string,\n  c?: number,\n}\nconst input = {a: 'foo', b: 2, c: 3, d: 4}\n\ndescribe('R.pickAll with array as props input', () =\u003e {\n  it('without passing type', () =\u003e {\n    const result = pickAll(['a', 'c'], input)\n    result.a // $ExpectType string\n    result.c // $ExpectType number\n  })\n  it('without passing type + curry', () =\u003e {\n    const result = pickAll(['a', 'c'])(input)\n    result // $ExpectType unknown\n  })\n  it('explicitly passing types', () =\u003e {\n    const result = pickAll\u003cInput, Output\u003e(['a', 'c'], input)\n    result.a // $ExpectType string | undefined\n    result.c // $ExpectType number | undefined\n  })\n})\n\ndescribe('R.pickAll with string as props input', () =\u003e {\n  it('without passing type', () =\u003e {\n    const result = pickAll('a,c', input)\n    result // $ExpectType unknown\n  })\n  it('without passing type + curry', () =\u003e {\n    const result = pickAll('a,c')(input)\n    result // $ExpectType unknown\n  })\n  it('explicitly passing types', () =\u003e {\n    const result = pickAll\u003cInput, Output\u003e('a,c', input)\n    result.a // $ExpectType string | undefined\n    result.c // $ExpectType number | undefined\n  })\n  it('explicitly passing types + curry', () =\u003e {\n    const result = pickAll\u003cInput, Output\u003e('a,c')(input)\n    result.a // $ExpectType string | undefined\n    result.c // $ExpectType number | undefined\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#pickAll)\n\n### pickBy\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.pickBy(%0A%20%20x%20%3D%3E%20x%20%3E%201%2C%0A%20%20%7Ba%3A%201%2C%20b%3A%202%2C%20c%3A%203%7D%0A)%0A%2F%2F%20%3D%3E%20%7Bb%3A%202%2C%20c%3A%203%7D\"\u003eTry this \u003cstrong\u003eR.pickBy\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#pickBy)\n\n### pipe\n\nIt performs left-to-right function composition.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.pipe(%0A%20%20R.filter(val%20%3D%3E%20val%20%3E%202)%2C%0A%20%20R.map(a%20%3D%3E%20a%20*%202)%0A)(%5B1%2C%202%2C%203%2C%204%5D)%0A%0A%2F%2F%20%3D%3E%20%5B6%2C%208%5D\"\u003eTry this \u003cstrong\u003eR.pipe\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#pipe)\n\n### pluck\n\n```typescript\n\npluck\u003cK extends keyof T, T\u003e(property: K, list: T[]): T[K][]\n```\n\nIt returns list of the values of `property` taken from the all objects inside `list`.\n\n```javascript\nconst list = [{a: 1}, {a: 2}, {b: 3}]\nconst property = 'a'\n\nconst result = R.pluck(property, list) \n// =\u003e [1, 2]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B%7Ba%3A%201%7D%2C%20%7Ba%3A%202%7D%2C%20%7Bb%3A%203%7D%5D%0Aconst%20property%20%3D%20'a'%0A%0Aconst%20result%20%3D%20R.pluck(property%2C%20list)%20%0A%2F%2F%20%3D%3E%20%5B1%2C%202%5D\"\u003eTry this \u003cstrong\u003eR.pluck\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\npluck\u003cK extends keyof T, T\u003e(property: K, list: T[]): T[K][];\npluck\u003cT\u003e(property: number, list: { [k: number]: T }[]):  T[];\npluck\u003cP extends string\u003e(property: P): \u003cT\u003e(list: Record\u003cP, T\u003e[]) =\u003e T[];\npluck(property: number): \u003cT\u003e(list: { [k: number]: T }[]) =\u003e T[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.pluck\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { map } from './map.js'\n\nexport function pluck(property, list){\n  if (arguments.length === 1) return _list =\u003e pluck(property, _list)\n\n  const willReturn = []\n\n  map(x =\u003e {\n    if (x[ property ] !== undefined){\n      willReturn.push(x[ property ])\n    }\n  }, list)\n\n  return willReturn\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { pluck } from './pluck.js'\n\ntest('happy', () =\u003e {\n  expect(pluck('a')([ { a : 1 }, { a : 2 }, { b : 1 } ])).toEqual([ 1, 2 ])\n})\n\ntest('with undefined', () =\u003e {\n  expect(pluck(undefined)([ { a : 1 }, { a : 2 }, { b : 1 } ])).toEqual([ ])\n})\n\ntest('with number', () =\u003e {\n  const input = [\n    [ 1, 2 ],\n    [ 3, 4 ],\n  ]\n\n  expect(pluck(0, input)).toEqual([ 1, 3 ])\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {pluck} from 'rambda'\n\ndescribe('R.pluck', () =\u003e {\n  it('with object', () =\u003e {\n    interface ListMember {\n      a: number,\n      b: string,\n    }\n    const input: ListMember[] = [\n      {a: 1, b: 'foo'},\n      {a: 2, b: 'bar'},\n    ]\n    const resultA = pluck('a', input)\n    const resultB = pluck('b')(input)\n    resultA // $ExpectType number[]\n    resultB // $ExpectType string[]\n  })\n\n  it('with array', () =\u003e {\n    const input = [\n      [1, 2],\n      [3, 4],\n      [5, 6],\n    ]\n    const result = pluck(0, input)\n    const resultCurry = pluck(0)(input)\n    result // $ExpectType number[]\n    resultCurry // $ExpectType number[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#pluck)\n\n### prepend\n\n```typescript\n\nprepend\u003cT\u003e(xToPrepend: T, iterable: T[]): T[]\n```\n\nIt adds element `x` at the beginning of `list`.\n\n```javascript\nconst result = R.prepend('foo', ['bar', 'baz'])\n// =\u003e ['foo', 'bar', 'baz']\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.prepend('foo'%2C%20%5B'bar'%2C%20'baz'%5D)%0A%2F%2F%20%3D%3E%20%5B'foo'%2C%20'bar'%2C%20'baz'%5D\"\u003eTry this \u003cstrong\u003eR.prepend\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nprepend\u003cT\u003e(xToPrepend: T, iterable: T[]): T[];\nprepend\u003cT, U\u003e(xToPrepend: T, iterable: IsFirstSubtypeOfSecond\u003cT, U\u003e[]) : U[];\nprepend\u003cT\u003e(xToPrepend: T): \u003cU\u003e(iterable: IsFirstSubtypeOfSecond\u003cT, U\u003e[]) =\u003e U[];\nprepend\u003cT\u003e(xToPrepend: T): (iterable: T[]) =\u003e T[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.prepend\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function prepend(x, input){\n  if (arguments.length === 1) return _input =\u003e prepend(x, _input)\n\n  if (typeof input === 'string') return [ x ].concat(input.split(''))\n\n  return [ x ].concat(input)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { prepend } from './prepend.js'\n\ntest('happy', () =\u003e {\n  expect(prepend('yes', [ 'foo', 'bar', 'baz' ])).toEqual([\n    'yes',\n    'foo',\n    'bar',\n    'baz',\n  ])\n})\n\ntest('with empty list', () =\u003e {\n  expect(prepend('foo')([])).toEqual([ 'foo' ])\n})\n\ntest('with string instead of array', () =\u003e {\n  expect(prepend('foo')('bar')).toEqual([ 'foo', 'b', 'a', 'r' ])\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#prepend)\n\n### product\n\n```typescript\n\nproduct(list: number[]): number\n```\n\n```javascript\nR.product([ 2, 3, 4 ])\n// =\u003e 24)\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.product(%5B%202%2C%203%2C%204%20%5D)%0A%2F%2F%20%3D%3E%2024)\"\u003eTry this \u003cstrong\u003eR.product\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nproduct(list: number[]): number;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.product\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { multiply } from './multiply.js'\nimport { reduce } from './reduce.js'\n\nexport const product = reduce(multiply, 1)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { product } from './product.js'\n\ntest('happy', () =\u003e {\n  expect(product([ 2, 3, 4 ])).toBe(24)\n})\n\ntest('bad input', () =\u003e {\n  expect(product([ null ])).toBe(0)\n  expect(product([])).toBe(1)\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {product} from 'rambda'\n\ndescribe('R.product', () =\u003e {\n  it('happy', () =\u003e {\n    const result = product([1, 2, 3])\n\n    result // $ExpectType number\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#product)\n\n### prop\n\n```typescript\n\nprop\u003c_, P extends keyof never, T\u003e(p: P, value: T): Prop\u003cT, P\u003e\n```\n\nIt returns the value of property `propToFind` in `obj`.\n\nIf there is no such property, it returns `undefined`.\n\n```javascript\nconst result = [\n  R.prop('x', {x: 100}), \n  R.prop('x', {a: 1}) \n]\n// =\u003e [100, undefined]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5B%0A%20%20R.prop('x'%2C%20%7Bx%3A%20100%7D)%2C%20%0A%20%20R.prop('x'%2C%20%7Ba%3A%201%7D)%20%0A%5D%0A%2F%2F%20%3D%3E%20%5B100%2C%20undefined%5D\"\u003eTry this \u003cstrong\u003eR.prop\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nprop\u003c_, P extends keyof never, T\u003e(p: P, value: T): Prop\u003cT, P\u003e;\nprop\u003cV\u003e(p: keyof never, value: unknown): V;\nprop\u003c_, P extends keyof never\u003e(p: P): \u003cT\u003e(value: T) =\u003e Prop\u003cT, P\u003e;\nprop\u003cV\u003e(p: keyof never): (value: unknown) =\u003e V;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.prop\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function propFn(searchProperty, obj){\n  if (!obj) return undefined\n\n  return obj[ searchProperty ]\n}\n\nexport function prop(searchProperty, obj){\n  if (arguments.length === 1) return _obj =\u003e prop(searchProperty, _obj)\n\n  return propFn(searchProperty, obj)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { prop } from './prop.js'\n\ntest('prop', () =\u003e {\n  expect(prop('foo')({ foo : 'baz' })).toBe('baz')\n\n  expect(prop('bar')({ foo : 'baz' })).toBeUndefined()\n\n  expect(prop('bar')(null)).toBeUndefined()\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {prop} from 'rambda'\n\ndescribe('R.prop', () =\u003e {\n  interface Foo {\n    a: number,\n    b: string,\n    c?: number,\n  }\n  const obj: Foo = {a: 1, b: 'foo'}\n\n  it('issue #553', () =\u003e {\n    const result = {\n      a: prop('a', obj),\n      b: prop('b', obj),\n      c: prop('c', obj),\n    }\n    const curriedResult = {\n      a: prop('a')(obj),\n      b: prop('b')(obj),\n      c: prop('c')(obj),\n    }\n\n    result // $ExpectType { a: number; b: string; c: number | undefined; }\n    curriedResult // $ExpectType { a: number; b: string; c: number | undefined; }\n  })\n})\n\ndescribe('with number as prop', () =\u003e {\n  const list = [1, 2, 3]\n  const index = 1\n  it('happy', () =\u003e {\n    const result = prop(index, list)\n\n    result // $ExpectType number\n  })\n  it('curried require explicit type', () =\u003e {\n    const result = prop\u003cnumber\u003e(index)(list)\n\n    result // $ExpectType number\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#prop)\n\n### propEq\n\n```typescript\n\npropEq\u003cK extends string | number\u003e(valueToMatch: any, propToFind: K, obj: Record\u003cK, any\u003e): boolean\n```\n\nIt returns true if `obj` has property `propToFind` and its value is equal to `valueToMatch`.\n\n```javascript\nconst obj = { foo: 'bar' }\nconst secondObj = { foo: 1 }\n\nconst propToFind = 'foo'\nconst valueToMatch = 'bar'\n\nconst result = [\n  R.propEq(propToFind, valueToMatch, Record\u003cstring, unknown\u003e),\n  R.propEq(propToFind, valueToMatch, secondRecord\u003cstring, unknown\u003e)\n]\n// =\u003e [true, false]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20obj%20%3D%20%7B%20foo%3A%20'bar'%20%7D%0Aconst%20secondObj%20%3D%20%7B%20foo%3A%201%20%7D%0A%0Aconst%20propToFind%20%3D%20'foo'%0Aconst%20valueToMatch%20%3D%20'bar'%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.propEq(propToFind%2C%20valueToMatch%2C%20Record%3Cstring%2C%20unknown%3E)%2C%0A%20%20R.propEq(propToFind%2C%20valueToMatch%2C%20secondRecord%3Cstring%2C%20unknown%3E)%0A%5D%0A%2F%2F%20%3D%3E%20%5Btrue%2C%20false%5D\"\u003eTry this \u003cstrong\u003eR.propEq\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\npropEq\u003cK extends string | number\u003e(valueToMatch: any, propToFind: K, obj: Record\u003cK, any\u003e): boolean;\npropEq\u003cK extends string | number\u003e(valueToMatch: any, propToFind: K): (obj: Record\u003cK, any\u003e) =\u003e boolean;\npropEq(valueToMatch: any): {\n  \u003cK extends string | number\u003e(propToFind: K, obj: Record\u003cK, any\u003e): boolean;\n  \u003cK extends string | number\u003e(propToFind: K): (obj: Record\u003cK, any\u003e) =\u003e boolean;\n};\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.propEq\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { curry } from './curry.js'\nimport { equals } from './equals.js'\nimport { prop } from './prop.js'\n\nfunction propEqFn(\n  valueToMatch, propToFind, obj\n){\n  if (!obj) return false\n\n  return equals(valueToMatch, prop(propToFind, obj))\n}\n\nexport const propEq = curry(propEqFn)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { BAR, FOO } from './_internals/testUtils.js'\nimport { propEq } from './propEq.js'\n\ntest('happy', () =\u003e {\n  const obj = { [ FOO ] : BAR }\n  expect(propEq(BAR, FOO)(obj)).toBeTrue()\n  expect(propEq(1, FOO)(obj)).toBeFalse()\n  expect(propEq(1)(FOO)(obj)).toBeFalse()\n  expect(propEq(\n    1, 1, null\n  )).toBeFalse()\n})\n\ntest('returns false if called with a null or undefined object', () =\u003e {\n  expect(propEq(\n    'name', 'Abby', null\n  )).toBeFalse()\n  expect(propEq(\n    'name', 'Abby', undefined\n  )).toBeFalse()\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {propEq} from 'rambda'\n\nconst property = 'foo'\nconst numberProperty = 1\nconst value = 'bar'\nconst obj = {[property]: value}\nconst objWithNumberIndex = {[numberProperty]: value}\n\ndescribe('R.propEq', () =\u003e {\n  it('happy', () =\u003e {\n    const result = propEq(value, property, obj)\n    result // $ExpectType boolean\n  })\n\n  it('number is property', () =\u003e {\n    const result = propEq(value, 1, objWithNumberIndex)\n    result // $ExpectType boolean\n  })\n\n  it('with optional property', () =\u003e {\n    interface MyType {\n      optional?: string | number,\n    }\n\n    const myObject: MyType = {}\n    const valueToFind = '1111'\n    // @ts-expect-error\n    propEq(valueToFind, 'optional', myObject)\n  })\n\n  it('imported from @types/ramda', () =\u003e {\n    interface A {\n      foo: string | null,\n    }\n    const obj: A = {\n      foo: 'bar',\n    }\n    const value = ''\n    const result = propEq(value, 'foo')(obj)\n    result // $ExpectType boolean\n\n    // @ts-expect-error\n    propEq(value, 'bar')(obj)\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#propEq)\n\n### propIs\n\n```typescript\n\npropIs\u003cC extends AnyFunction, K extends keyof any\u003e(type: C, name: K, obj: any): obj is Record\u003cK, ReturnType\u003cC\u003e\u003e\n```\n\nIt returns `true` if `property` of `obj` is from `target` type.\n\n```javascript\nconst obj = {a:1, b: 'foo'}\n\nconst result = [\n  R.propIs(Number, 'a', Record\u003cstring, unknown\u003e),\n  R.propIs(String, 'b', Record\u003cstring, unknown\u003e),\n  R.propIs(Number, 'b', Record\u003cstring, unknown\u003e),\n]\n// =\u003e [true, true, false]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20obj%20%3D%20%7Ba%3A1%2C%20b%3A%20'foo'%7D%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.propIs(Number%2C%20'a'%2C%20Record%3Cstring%2C%20unknown%3E)%2C%0A%20%20R.propIs(String%2C%20'b'%2C%20Record%3Cstring%2C%20unknown%3E)%2C%0A%20%20R.propIs(Number%2C%20'b'%2C%20Record%3Cstring%2C%20unknown%3E)%2C%0A%5D%0A%2F%2F%20%3D%3E%20%5Btrue%2C%20true%2C%20false%5D\"\u003eTry this \u003cstrong\u003eR.propIs\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\npropIs\u003cC extends AnyFunction, K extends keyof any\u003e(type: C, name: K, obj: any): obj is Record\u003cK, ReturnType\u003cC\u003e\u003e;\npropIs\u003cC extends AnyConstructor, K extends keyof any\u003e(type: C, name: K, obj: any): obj is Record\u003cK, InstanceType\u003cC\u003e\u003e;\npropIs\u003cC extends AnyFunction, K extends keyof any\u003e(type: C, name: K): (obj: any) =\u003e obj is Record\u003cK, ReturnType\u003cC\u003e\u003e;\npropIs\u003cC extends AnyConstructor, K extends keyof any\u003e(type: C, name: K): (obj: any) =\u003e obj is Record\u003cK, InstanceType\u003cC\u003e\u003e;\npropIs\u003cC extends AnyFunction\u003e(type: C): {\n    \u003cK extends keyof any\u003e(name: K, obj: any): obj is Record\u003cK, ReturnType\u003cC\u003e\u003e;\n    \u003cK extends keyof any\u003e(name: K): (obj: any) =\u003e obj is Record\u003cK, ReturnType\u003cC\u003e\u003e;\n};\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.propIs\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { curry } from './curry.js'\nimport { is } from './is.js'\n\nfunction propIsFn(\n  targetPrototype, property, obj\n){\n  return is(targetPrototype, obj[ property ])\n}\n\nexport const propIs = curry(propIsFn)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { propIs } from './propIs.js'\n\nconst obj = {\n  a : 1,\n  b : 'foo',\n}\n\ntest('when true', () =\u003e {\n  expect(propIs(\n    Number, 'a', obj\n  )).toBeTrue()\n  expect(propIs(\n    String, 'b', obj\n  )).toBeTrue()\n})\n\ntest('when false', () =\u003e {\n  expect(propIs(\n    String, 'a', obj\n  )).toBeFalse()\n  expect(propIs(\n    Number, 'b', obj\n  )).toBeFalse()\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {propIs} from 'rambda'\n\nconst property = 'a'\nconst obj = {a: 1}\n\ndescribe('R.propIs', () =\u003e {\n  it('happy', () =\u003e {\n    const result = propIs(Number, property, obj)\n    result // $ExpectType boolean\n  })\n\n  it('curried', () =\u003e {\n    const result = propIs(Number, property)(obj)\n    result // $ExpectType boolean\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#propIs)\n\n### propOr\n\n```typescript\n\npropOr\u003cT, P extends string\u003e(defaultValue: T, property: P, obj: Partial\u003cRecord\u003cP, T\u003e\u003e | undefined): T\n```\n\nIt returns either `defaultValue` or the value of `property` in `obj`.\n\n```javascript\nconst obj = {a: 1}\nconst defaultValue = 'DEFAULT_VALUE'\nconst property = 'a'\n\nconst result = [\n  R.propOr(defaultValue, property, Record\u003cstring, unknown\u003e),\n  R.propOr(defaultValue, 'foo', Record\u003cstring, unknown\u003e)\n]\n// =\u003e [1, 'DEFAULT_VALUE']\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20obj%20%3D%20%7Ba%3A%201%7D%0Aconst%20defaultValue%20%3D%20'DEFAULT_VALUE'%0Aconst%20property%20%3D%20'a'%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.propOr(defaultValue%2C%20property%2C%20Record%3Cstring%2C%20unknown%3E)%2C%0A%20%20R.propOr(defaultValue%2C%20'foo'%2C%20Record%3Cstring%2C%20unknown%3E)%0A%5D%0A%2F%2F%20%3D%3E%20%5B1%2C%20'DEFAULT_VALUE'%5D\"\u003eTry this \u003cstrong\u003eR.propOr\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\npropOr\u003cT, P extends string\u003e(defaultValue: T, property: P, obj: Partial\u003cRecord\u003cP, T\u003e\u003e | undefined): T;\npropOr\u003cT, P extends string\u003e(defaultValue: T, property: P): (obj: Partial\u003cRecord\u003cP, T\u003e\u003e | undefined) =\u003e T;\npropOr\u003cT\u003e(defaultValue: T): {\n  \u003cP extends string\u003e(property: P, obj: Partial\u003cRecord\u003cP, T\u003e\u003e | undefined): T;\n  \u003cP extends string\u003e(property: P): (obj: Partial\u003cRecord\u003cP, T\u003e\u003e | undefined) =\u003e T;\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.propOr\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { curry } from './curry.js'\nimport { defaultTo } from './defaultTo.js'\n\nfunction propOrFn(\n  defaultValue, property, obj\n){\n  if (!obj) return defaultValue\n\n  return defaultTo(defaultValue, obj[ property ])\n}\n\nexport const propOr = curry(propOrFn)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { propOr } from './propOr.js'\n\ntest('propOr (result)', () =\u003e {\n  const obj = { a : 1 }\n  expect(propOr(\n    'default', 'a', obj\n  )).toBe(1)\n  expect(propOr(\n    'default', 'notExist', obj\n  )).toBe('default')\n  expect(propOr(\n    'default', 'notExist', null\n  )).toBe('default')\n})\n\ntest('propOr (currying)', () =\u003e {\n  const obj = { a : 1 }\n  expect(propOr('default')('a', obj)).toBe(1)\n  expect(propOr('default', 'a')(obj)).toBe(1)\n  expect(propOr('default')('notExist', obj)).toBe('default')\n  expect(propOr('default', 'notExist')(obj)).toBe('default')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {propOr} from 'rambda'\n\nconst obj = {foo: 'bar'}\nconst property = 'foo'\nconst fallback = 'fallback'\n\ndescribe('R.propOr', () =\u003e {\n  it('happy', () =\u003e {\n    const result = propOr(fallback, property, obj)\n    result // $ExpectType string\n  })\n  it('curry 1', () =\u003e {\n    const result = propOr(fallback)(property, obj)\n    result // $ExpectType string\n  })\n  it('curry 2', () =\u003e {\n    const result = propOr(fallback, property)(obj)\n    result // $ExpectType string\n  })\n  it('curry 3', () =\u003e {\n    const result = propOr(fallback)(property)(obj)\n    result // $ExpectType string\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#propOr)\n\n### props\n\n```typescript\n\nprops\u003cP extends string, T\u003e(propsToPick: P[], obj: Record\u003cP, T\u003e): T[]\n```\n\nIt takes list with properties `propsToPick` and returns a list with property values in `obj`.\n\n```javascript\nconst result = R.props(\n  ['a', 'b'], \n  {a:1, c:3}\n)\n// =\u003e [1, undefined]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.props(%0A%20%20%5B'a'%2C%20'b'%5D%2C%20%0A%20%20%7Ba%3A1%2C%20c%3A3%7D%0A)%0A%2F%2F%20%3D%3E%20%5B1%2C%20undefined%5D\"\u003eTry this \u003cstrong\u003eR.props\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nprops\u003cP extends string, T\u003e(propsToPick: P[], obj: Record\u003cP, T\u003e): T[];\nprops\u003cP extends string\u003e(propsToPick: P[]): \u003cT\u003e(obj: Record\u003cP, T\u003e) =\u003e T[];\nprops\u003cP extends string, T\u003e(propsToPick: P[]): (obj: Record\u003cP, T\u003e) =\u003e T[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.props\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { isArray } from './_internals/isArray.js'\nimport { mapArray } from './map.js'\n\nexport function props(propsToPick, obj){\n  if (arguments.length === 1){\n    return _obj =\u003e props(propsToPick, _obj)\n  }\n  if (!isArray(propsToPick)){\n    throw new Error('propsToPick is not a list')\n  }\n\n  return mapArray(prop =\u003e obj[ prop ], propsToPick)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { props } from './props.js'\n\nconst obj = {\n  a : 1,\n  b : 2,\n}\nconst propsToPick = [ 'a', 'c' ]\n\ntest('happy', () =\u003e {\n  const result = props(propsToPick, obj)\n  expect(result).toEqual([ 1, undefined ])\n})\n\ntest('curried', () =\u003e {\n  const result = props(propsToPick)(obj)\n  expect(result).toEqual([ 1, undefined ])\n})\n\ntest('wrong input', () =\u003e {\n  expect(() =\u003e props(null)(obj)).toThrowErrorMatchingInlineSnapshot('\"propsToPick is not a list\"')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {props} from 'rambda'\n\nconst obj = {a: 1, b: 2}\n\ndescribe('R.props', () =\u003e {\n  it('happy', () =\u003e {\n    const result = props(['a', 'b'], obj)\n\n    result // $ExpectType number[]\n  })\n  it('curried', () =\u003e {\n    const result = props(['a', 'b'])(obj)\n\n    result // $ExpectType number[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#props)\n\n### propSatisfies\n\n```typescript\n\npropSatisfies\u003cT\u003e(predicate: Predicate\u003cT\u003e, property: string, obj: Record\u003cstring, T\u003e): boolean\n```\n\nIt returns `true` if the object property satisfies a given predicate.\n\n```javascript\nconst obj = {a: {b:1}}\nconst property = 'a'\nconst predicate = x =\u003e x?.b === 1\n\nconst result = R.propSatisfies(predicate, property, Record\u003cstring, unknown\u003e)\n// =\u003e true\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20obj%20%3D%20%7Ba%3A%20%7Bb%3A1%7D%7D%0Aconst%20property%20%3D%20'a'%0Aconst%20predicate%20%3D%20x%20%3D%3E%20x%3F.b%20%3D%3D%3D%201%0A%0Aconst%20result%20%3D%20R.propSatisfies(predicate%2C%20property%2C%20Record%3Cstring%2C%20unknown%3E)%0A%2F%2F%20%3D%3E%20true\"\u003eTry this \u003cstrong\u003eR.propSatisfies\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\npropSatisfies\u003cT\u003e(predicate: Predicate\u003cT\u003e, property: string, obj: Record\u003cstring, T\u003e): boolean;\npropSatisfies\u003cT\u003e(predicate: Predicate\u003cT\u003e, property: string): (obj: Record\u003cstring, T\u003e) =\u003e boolean;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.propSatisfies\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { curry } from './curry.js'\nimport { prop } from './prop.js'\n\nfunction propSatisfiesFn(\n  predicate, property, obj\n){\n  return predicate(prop(property, obj))\n}\n\nexport const propSatisfies = curry(propSatisfiesFn)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { propSatisfies } from './propSatisfies.js'\n\nconst obj = { a : 1 }\n\ntest('when true', () =\u003e {\n  expect(propSatisfies(\n    x =\u003e x \u003e 0, 'a', obj\n  )).toBeTrue()\n})\n\ntest('when false', () =\u003e {\n  expect(propSatisfies(x =\u003e x \u003c 0, 'a')(obj)).toBeFalse()\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {propSatisfies} from 'rambda'\n\nconst obj = {a: 1}\n\ndescribe('R.propSatisfies', () =\u003e {\n  it('happy', () =\u003e {\n    const result = propSatisfies(x =\u003e x \u003e 0, 'a', obj)\n\n    result // $ExpectType boolean\n  })\n  it('curried requires explicit type', () =\u003e {\n    const result = propSatisfies\u003cnumber\u003e(x =\u003e x \u003e 0, 'a')(obj)\n\n    result // $ExpectType boolean\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#propSatisfies)\n\n### range\n\n```typescript\n\nrange(startInclusive: number, endExclusive: number): number[]\n```\n\nIt returns list of numbers between `startInclusive` to `endExclusive` markers.\n\n```javascript\nR.range(0, 5)\n// =\u003e [0, 1, 2, 3, 4]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.range(0%2C%205)%0A%2F%2F%20%3D%3E%20%5B0%2C%201%2C%202%2C%203%2C%204%5D\"\u003eTry this \u003cstrong\u003eR.range\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nrange(startInclusive: number, endExclusive: number): number[];\nrange(startInclusive: number): (endExclusive: number) =\u003e number[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.range\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function range(start, end){\n  if (arguments.length === 1) return _end =\u003e range(start, _end)\n\n  if (Number.isNaN(Number(start)) || Number.isNaN(Number(end))){\n    throw new TypeError('Both arguments to range must be numbers')\n  }\n\n  if (end \u003c start) return []\n\n  const len = end - start\n  const willReturn = Array(len)\n\n  for (let i = 0; i \u003c len; i++){\n    willReturn[ i ] = start + i\n  }\n\n  return willReturn\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { range } from './range.js'\n\ntest('happy', () =\u003e {\n  expect(range(0, 10)).toEqual([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ])\n})\n\ntest('end range is bigger than start range', () =\u003e {\n  expect(range(7, 3)).toEqual([])\n  expect(range(5, 5)).toEqual([])\n})\n\ntest('with bad input', () =\u003e {\n  const throwMessage = 'Both arguments to range must be numbers'\n  expect(() =\u003e range('a', 6)).toThrowWithMessage(Error, throwMessage)\n  expect(() =\u003e range(6, 'z')).toThrowWithMessage(Error, throwMessage)\n})\n\ntest('curry', () =\u003e {\n  expect(range(0)(10)).toEqual([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ])\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {range} from 'rambda'\n\ndescribe('R.range', () =\u003e {\n  it('happy', () =\u003e {\n    const result = range(1, 4)\n\n    result // $ExpectType number[]\n  })\n  it('curried', () =\u003e {\n    const result = range(1)(4)\n\n    result // $ExpectType number[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#range)\n\n### reduce\n\n\u003e :boom: It passes index of the list as third argument to `reducer` function.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B1%2C%202%2C%203%5D%0Aconst%20initialValue%20%3D%2010%0Aconst%20reducer%20%3D%20(prev%2C%20current)%20%3D%3E%20prev%20*%20current%0A%0Aconst%20result%20%3D%20R.reduce(reducer%2C%20initialValue%2C%20list)%0A%2F%2F%20%3D%3E%2060\"\u003eTry this \u003cstrong\u003eR.reduce\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#reduce)\n\n### reduceBy\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.reduceBy(%0A%20%20(acc%2C%20elem)%20%3D%3E%20acc%20%2B%20elem%2C%0A%20%200%2C%0A%20%20x%20%3D%3E%20x%20%3E%202%20%3F%20'big'%20%3A%20'small'%2C%0A%20%20%5B1%2C%202%2C%203%2C%204%2C%205%5D%0A)%0A%2F%2F%20%3D%3E%20%7B%20big%3A%2012%2C%20small%3A%203%20%7D\"\u003eTry this \u003cstrong\u003eR.reduceBy\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#reduceBy)\n\n### reject\n\n```typescript\n\nreject\u003cT\u003e(predicate: Predicate\u003cT\u003e, list: T[]): T[]\n```\n\nIt has the opposite effect of `R.filter`.\n\n```javascript\nconst list = [1, 2, 3, 4]\nconst obj = {a: 1, b: 2}\nconst predicate = x =\u003e x \u003e 1\n\nconst result = [\n  R.reject(predicate, list),\n  R.reject(predicate, Record\u003cstring, unknown\u003e)\n]\n// =\u003e [[1], {a: 1}]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B1%2C%202%2C%203%2C%204%5D%0Aconst%20obj%20%3D%20%7Ba%3A%201%2C%20b%3A%202%7D%0Aconst%20predicate%20%3D%20x%20%3D%3E%20x%20%3E%201%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.reject(predicate%2C%20list)%2C%0A%20%20R.reject(predicate%2C%20Record%3Cstring%2C%20unknown%3E)%0A%5D%0A%2F%2F%20%3D%3E%20%5B%5B1%5D%2C%20%7Ba%3A%201%7D%5D\"\u003eTry this \u003cstrong\u003eR.reject\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nreject\u003cT\u003e(predicate: Predicate\u003cT\u003e, list: T[]): T[];\nreject\u003cT\u003e(predicate: Predicate\u003cT\u003e): (list: T[]) =\u003e T[];\nreject\u003cT\u003e(predicate: Predicate\u003cT\u003e, obj: Dictionary\u003cT\u003e): Dictionary\u003cT\u003e;\nreject\u003cT, U\u003e(predicate: Predicate\u003cT\u003e): (obj: Dictionary\u003cT\u003e) =\u003e Dictionary\u003cT\u003e;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.reject\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { filter } from './filter.js'\n\nexport function reject(predicate, list){\n  if (arguments.length === 1) return _list =\u003e reject(predicate, _list)\n\n  return filter(x =\u003e !predicate(x), list)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { reject } from './reject.js'\n\nconst isOdd = n =\u003e n % 2 === 1\n\ntest('with array', () =\u003e {\n  expect(reject(isOdd)([ 1, 2, 3, 4 ])).toEqual([ 2, 4 ])\n})\n\ntest('with object', () =\u003e {\n  const obj = {\n    a : 1,\n    b : 2,\n    c : 3,\n    d : 4,\n  }\n  expect(reject(isOdd, obj)).toEqual({\n    b : 2,\n    d : 4,\n  })\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {reject} from 'rambda'\n\ndescribe('R.reject with array', () =\u003e {\n  it('happy', () =\u003e {\n    const result = reject(\n      x =\u003e {\n        x // $ExpectType number\n        return x \u003e 1\n      },\n      [1, 2, 3]\n    )\n    result // $ExpectType number[]\n  })\n  it('curried require explicit type', () =\u003e {\n    const result = reject\u003cnumber\u003e(x =\u003e {\n      x // $ExpectType number\n      return x \u003e 1\n    })([1, 2, 3])\n    result // $ExpectType number[]\n  })\n})\n\ndescribe('R.reject with objects', () =\u003e {\n  it('happy', () =\u003e {\n    const result = reject(\n      x =\u003e {\n        x // $ExpectType number\n\n        return x \u003e 1\n      },\n      {a: 1, b: 2}\n    )\n    result // $ExpectType Dictionary\u003cnumber\u003e\n  })\n  it('curried require dummy type', () =\u003e {\n    const result = reject\u003cnumber, any\u003e(x =\u003e {\n      return x \u003e 1\n    })({a: 1, b: 2})\n    result // $ExpectType Dictionary\u003cnumber\u003e\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#reject)\n\n### removeIndex\n\n```typescript\n\nremoveIndex\u003cT\u003e(index: number, list: T[]): T[]\n```\n\nIt returns a copy of `list` input with removed `index`.\n\n```javascript\nconst list = [1, 2, 3, 4]\nconst result = R.removeIndex(1, list)\n// =\u003e [1, 3, 4]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B1%2C%202%2C%203%2C%204%5D%0Aconst%20result%20%3D%20R.removeIndex(1%2C%20list)%0A%2F%2F%20%3D%3E%20%5B1%2C%203%2C%204%5D\"\u003eTry this \u003cstrong\u003eR.removeIndex\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nremoveIndex\u003cT\u003e(index: number, list: T[]): T[];\nremoveIndex(index: number): \u003cT\u003e(list: T[]) =\u003e T[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.removeIndex\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function removeIndex(index, list){\n  if (arguments.length === 1) return _list =\u003e removeIndex(index, _list)\n  if (index \u003c= 0) return list.slice(1)\n  if (index \u003e= list.length - 1) return list.slice(0, list.length - 1)\n\n  return [ ...list.slice(0, index), ...list.slice(index + 1) ]\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { removeIndex } from './removeIndex.js'\n\nconst list = [ 1, 2, 3, 4 ]\n\ntest('first or before first index', () =\u003e {\n  expect(removeIndex(-2, list)).toEqual([ 2, 3, 4 ])\n  expect(removeIndex(-2)(list)).toEqual([ 2, 3, 4 ])\n})\n\ntest('last or after last index', () =\u003e {\n  expect(removeIndex(4, list)).toEqual([ 1, 2, 3 ])\n  expect(removeIndex(10, list)).toEqual([ 1, 2, 3 ])\n})\n\ntest('middle index', () =\u003e {\n  expect(removeIndex(1, list)).toEqual([ 1, 3, 4 ])\n  expect(removeIndex(2, list)).toEqual([ 1, 2, 4 ])\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {removeIndex} from 'rambda'\n\ndescribe('R.removeIndex', () =\u003e {\n  it('happy', () =\u003e {\n    const result = removeIndex(1, [1, 2, 3])\n\n    result // $ExpectType number[]\n  })\n  it('curried', () =\u003e {\n    const result = removeIndex(1)([1, 2, 3])\n\n    result // $ExpectType number[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#removeIndex)\n\n### repeat\n\n```typescript\n\nrepeat\u003cT\u003e(x: T): (timesToRepeat: number) =\u003e T[]\n```\n\n```javascript\nR.repeat('foo', 3)\n// =\u003e ['foo', 'foo', 'foo']\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.repeat('foo'%2C%203)%0A%2F%2F%20%3D%3E%20%5B'foo'%2C%20'foo'%2C%20'foo'%5D\"\u003eTry this \u003cstrong\u003eR.repeat\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nrepeat\u003cT\u003e(x: T): (timesToRepeat: number) =\u003e T[];\nrepeat\u003cT\u003e(x: T, timesToRepeat: number): T[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.repeat\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function repeat(x, timesToRepeat){\n  if (arguments.length === 1){\n    return _timesToRepeat =\u003e repeat(x, _timesToRepeat)\n  }\n\n  return Array(timesToRepeat).fill(x)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { repeat } from './repeat.js'\n\ntest('repeat', () =\u003e {\n  expect(repeat('')(3)).toEqual([ '', '', '' ])\n  expect(repeat('foo', 3)).toEqual([ 'foo', 'foo', 'foo' ])\n\n  const obj = {}\n  const arr = repeat(obj, 3)\n\n  expect(arr).toEqual([ {}, {}, {} ])\n\n  expect(arr[ 0 ] === arr[ 1 ]).toBeTrue()\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {repeat} from 'rambda'\n\ndescribe('R.repeat', () =\u003e {\n  it('happy', () =\u003e {\n    const result = repeat(4, 7)\n\n    result // $ExpectType number[]\n  })\n  it('curried', () =\u003e {\n    const result = repeat(4)(7)\n\n    result // $ExpectType number[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#repeat)\n\n### replace\n\n```typescript\n\nreplace(strOrRegex: RegExp | string, replacer: RegExpReplacer, str: string): string\n```\n\nIt replaces `strOrRegex` found in `str` with `replacer`.\n\n```javascript\nconst strOrRegex = /o/g\n\nconst result = R.replace(strOrRegex, '|0|', 'foo')\n// =\u003e 'f|0||0|'\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20strOrRegex%20%3D%20%2Fo%2Fg%0A%0Aconst%20result%20%3D%20R.replace(strOrRegex%2C%20'%7C0%7C'%2C%20'foo')%0A%2F%2F%20%3D%3E%20'f%7C0%7C%7C0%7C'\"\u003eTry this \u003cstrong\u003eR.replace\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nreplace(strOrRegex: RegExp | string, replacer: RegExpReplacer, str: string): string;\nreplace(strOrRegex: RegExp | string, replacer: RegExpReplacer): (str: string) =\u003e string;\nreplace(strOrRegex: RegExp | string): (replacer: RegExpReplacer) =\u003e (str: string) =\u003e string;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.replace\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { curry } from './curry.js'\n\nfunction replaceFn(\n  pattern, replacer, str\n){\n  return str.replace(pattern, replacer)\n}\n\nexport const replace = curry(replaceFn)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { replace } from './replace.js'\n\ntest('happy', () =\u003e {\n  expect(replace(\n    /\\s/g, '|', 'foo bar baz'\n  )).toBe('foo|bar|baz')\n})\n\ntest('with function as replacer input', () =\u003e {\n  expect(replace(\n    /\\s/g,\n    (\n      match, offset, str\n    ) =\u003e {\n      expect(match).toBe(' ')\n      expect([ 3, 7 ].includes(offset)).toBeTrue()\n      expect(str).toBe('foo bar baz')\n\n      return '|'\n    },\n    'foo bar baz'\n  )).toBe('foo|bar|baz')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {replace} from 'rambda'\n\nconst str = 'foo bar foo'\nconst replacer = 'bar'\n\ndescribe('R.replace', () =\u003e {\n  it('happy', () =\u003e {\n    const result = replace(/foo/g, replacer, str)\n\n    result // $ExpectType string\n  })\n  it('with string as search pattern', () =\u003e {\n    const result = replace('foo', replacer, str)\n\n    result // $ExpectType string\n  })\n  it('with function as replacer', () =\u003e {\n    const result = replace('f(o)o', (m: string, p1: string, offset: number) =\u003e {\n      m // $ExpectType string\n      p1 // $ExpectType string\n      offset // $ExpectType number\n      return p1\n    }, str)\n\n    result // $ExpectType string\n  })\n})\n\ndescribe('R.replace - curried', () =\u003e {\n  it('happy', () =\u003e {\n    const result = replace(/foo/g, replacer)(str)\n\n    result // $ExpectType string\n  })\n  it('with string as search pattern', () =\u003e {\n    const result = replace('foo', replacer)(str)\n\n    result // $ExpectType string\n  })\n  it('with function as replacer', () =\u003e {\n    const result = replace('f(o)o')((m: string, p1: string, offset: number) =\u003e {\n      m // $ExpectType string\n      p1 // $ExpectType string\n      offset // $ExpectType number\n      return p1\n    })(str)\n\n    result // $ExpectType string\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#replace)\n\n### reverse\n\n```typescript\n\nreverse\u003cT\u003e(input: T[]): T[]\n```\n\nIt returns a reversed copy of list or string `input`.\n\n```javascript\nconst result = [\n  R.reverse('foo'),\n  R.reverse([1, 2, 3])\n]\n// =\u003e ['oof', [3, 2, 1]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5B%0A%20%20R.reverse('foo')%2C%0A%20%20R.reverse(%5B1%2C%202%2C%203%5D)%0A%5D%0A%2F%2F%20%3D%3E%20%5B'oof'%2C%20%5B3%2C%202%2C%201%5D\"\u003eTry this \u003cstrong\u003eR.reverse\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nreverse\u003cT\u003e(input: T[]): T[];\nreverse(input: string): string;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.reverse\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function reverse(listOrString) {\n  if (typeof listOrString === 'string') {\n    return listOrString.split('').reverse().join('')\n  }\n\n  const clone = listOrString.slice()\n\n  return clone.reverse()\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport {reverse} from './reverse.js'\n\ntest('happy', () =\u003e {\n  expect(reverse([1, 2, 3])).toEqual([3, 2, 1])\n})\n\ntest('with string', () =\u003e {\n  expect(reverse('baz')).toBe('zab')\n})\n\ntest(\"it doesn't mutate\", () =\u003e {\n  const arr = [1, 2, 3]\n\n  expect(reverse(arr)).toEqual([3, 2, 1])\n\n  expect(arr).toEqual([1, 2, 3])\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {reverse} from 'rambda'\n\nconst list = [1, 2, 3, 4, 5]\n\ndescribe('R.reverse', () =\u003e {\n  it('happy', () =\u003e {\n    const result = reverse(list)\n    result // $ExpectType number[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#reverse)\n\n### set\n\n```typescript\n\nset\u003cS, A\u003e(lens: Lens\u003cS, A\u003e): {\n  (a: A): (obj: S) =\u003e S\n  (a: A, obj: S): S\n}\n```\n\nIt returns a copied **Object** or **Array** with modified `lens` focus set to `replacer` value.\n\n```javascript\nconst input = {x: 1, y: 2}\nconst xLens = R.lensProp('x')\n\nconst result = [\n  R.set(xLens, 4, input),\n  R.set(xLens, 8, input) \n]\n// =\u003e [{x: 4, y: 2}, {x: 8, y: 2}]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20input%20%3D%20%7Bx%3A%201%2C%20y%3A%202%7D%0Aconst%20xLens%20%3D%20R.lensProp('x')%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.set(xLens%2C%204%2C%20input)%2C%0A%20%20R.set(xLens%2C%208%2C%20input)%20%0A%5D%0A%2F%2F%20%3D%3E%20%5B%7Bx%3A%204%2C%20y%3A%202%7D%2C%20%7Bx%3A%208%2C%20y%3A%202%7D%5D\"\u003eTry this \u003cstrong\u003eR.set\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nset\u003cS, A\u003e(lens: Lens\u003cS, A\u003e): {\n  (a: A): (obj: S) =\u003e S\n  (a: A, obj: S): S\n};\nset\u003cS, A\u003e(lens: Lens\u003cS, A\u003e, a: A): (obj: S) =\u003e S;\nset\u003cS, A\u003e(lens: Lens\u003cS, A\u003e, a: A, obj: S): S;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.set\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport {always} from './always.js'\nimport {curry} from './curry.js'\nimport {over} from './over.js'\n\nfunction setFn(lens, replacer, x) {\n  return over(lens, always(replacer), x)\n}\n\nexport const set = curry(setFn)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport {assoc} from './assoc.js'\nimport {lens} from './lens.js'\nimport {lensIndex} from './lensIndex.js'\nimport {lensPath} from './lensPath.js'\nimport {prop} from './prop.js'\nimport {set} from './set.js'\n\nconst testObject = {\n  foo: 'bar',\n  baz: {\n    a: 'x',\n    b: 'y',\n  },\n}\n\ntest('assoc lens', () =\u003e {\n  const assocLens = lens(prop('foo'), assoc('foo'))\n  const result = set(assocLens, 'FOO', testObject)\n  const expected = {\n    ...testObject,\n    foo: 'FOO',\n  }\n  expect(result).toEqual(expected)\n})\n\ntest('path lens', () =\u003e {\n  const pathLens = lensPath('baz.a')\n  const result = set(pathLens, 'z', testObject)\n  const expected = {\n    ...testObject,\n    baz: {\n      a: 'z',\n      b: 'y',\n    },\n  }\n  expect(result).toEqual(expected)\n})\n\ntest('index lens', () =\u003e {\n  const indexLens = lensIndex(0)\n\n  const result = set(indexLens, 3, [1, 2])\n  expect(result).toEqual([3, 2])\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#set)\n\n### slice\n\n```typescript\n\nslice(from: number, to: number, input: string): string\n```\n\n```javascript\nconst list = [0, 1, 2, 3, 4, 5]\nconst str = 'FOO_BAR'\nconst from = 1\nconst to = 4\n\nconst result = [\n  R.slice(from, to, str),\n  R.slice(from, to, list)\n]\n// =\u003e ['OO_', [1, 2, 3]]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B0%2C%201%2C%202%2C%203%2C%204%2C%205%5D%0Aconst%20str%20%3D%20'FOO_BAR'%0Aconst%20from%20%3D%201%0Aconst%20to%20%3D%204%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.slice(from%2C%20to%2C%20str)%2C%0A%20%20R.slice(from%2C%20to%2C%20list)%0A%5D%0A%2F%2F%20%3D%3E%20%5B'OO_'%2C%20%5B1%2C%202%2C%203%5D%5D\"\u003eTry this \u003cstrong\u003eR.slice\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nslice(from: number, to: number, input: string): string;\nslice\u003cT\u003e(from: number, to: number, input: T[]): T[];\nslice(from: number, to: number): {\n  (input: string): string;\n  \u003cT\u003e(input: T[]): T[];\n};\nslice(from: number): {\n  (to: number, input: string): string;\n  \u003cT\u003e(to: number, input: T[]): T[];\n};\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.slice\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { curry } from './curry.js'\n\nfunction sliceFn(\n  from, to, list\n){\n  return list.slice(from, to)\n}\n\nexport const slice = curry(sliceFn)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { slice } from './slice.js'\n\ntest('slice', () =\u003e {\n  expect(slice(\n    1, 3, [ 'a', 'b', 'c', 'd' ]\n  )).toEqual([ 'b', 'c' ])\n  expect(slice(\n    1, Infinity, [ 'a', 'b', 'c', 'd' ]\n  )).toEqual([ 'b', 'c', 'd' ])\n  expect(slice(\n    0, -1, [ 'a', 'b', 'c', 'd' ]\n  )).toEqual([ 'a', 'b', 'c' ])\n  expect(slice(\n    -3, -1, [ 'a', 'b', 'c', 'd' ]\n  )).toEqual([ 'b', 'c' ])\n  expect(slice(\n    0, 3, 'ramda'\n  )).toBe('ram')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {slice} from 'rambda'\n\nconst list = [1, 2, 3, 4, 5]\n\ndescribe('R.slice', () =\u003e {\n  it('happy', () =\u003e {\n    const result = slice(1, 3, list)\n    result // $ExpectType number[]\n  })\n  it('curried', () =\u003e {\n    const result = slice(1, 3)(list)\n    result // $ExpectType number[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#slice)\n\n### sort\n\n```typescript\n\nsort\u003cT\u003e(sortFn: (a: T, b: T) =\u003e number, list: T[]): T[]\n```\n\nIt returns copy of `list` sorted by `sortFn` function, where `sortFn` needs to return only `-1`, `0` or `1`.\n\n```javascript\nconst list = [\n  {a: 2},\n  {a: 3},\n  {a: 1}\n]\nconst sortFn = (x, y) =\u003e {\n  return x.a \u003e y.a ? 1 : -1\n}\n\nconst result = R.sort(sortFn, list)\nconst expected = [\n  {a: 1},\n  {a: 2},\n  {a: 3}\n]\n// =\u003e `result` is equal to `expected`\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B%0A%20%20%7Ba%3A%202%7D%2C%0A%20%20%7Ba%3A%203%7D%2C%0A%20%20%7Ba%3A%201%7D%0A%5D%0Aconst%20sortFn%20%3D%20(x%2C%20y)%20%3D%3E%20%7B%0A%20%20return%20x.a%20%3E%20y.a%20%3F%201%20%3A%20-1%0A%7D%0A%0Aconst%20result%20%3D%20R.sort(sortFn%2C%20list)%0Aconst%20expected%20%3D%20%5B%0A%20%20%7Ba%3A%201%7D%2C%0A%20%20%7Ba%3A%202%7D%2C%0A%20%20%7Ba%3A%203%7D%0A%5D%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60\"\u003eTry this \u003cstrong\u003eR.sort\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nsort\u003cT\u003e(sortFn: (a: T, b: T) =\u003e number, list: T[]): T[];\nsort\u003cT\u003e(sortFn: (a: T, b: T) =\u003e number): (list: T[]) =\u003e T[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.sort\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { cloneList } from './_internals/cloneList.js'\n\nexport function sort(sortFn, list){\n  if (arguments.length === 1) return _list =\u003e sort(sortFn, _list)\n\n  return cloneList(list).sort(sortFn)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { sort } from './sort.js'\n\nconst fn = (a, b) =\u003e a \u003e b ? 1 : -1\n\ntest('sort', () =\u003e {\n  expect(sort((a, b) =\u003e a - b)([ 2, 3, 1 ])).toEqual([ 1, 2, 3 ])\n})\n\ntest('it doesn\\'t mutate', () =\u003e {\n  const list = [ 'foo', 'bar', 'baz' ]\n\n  expect(sort(fn, list)).toEqual([ 'bar', 'baz', 'foo' ])\n\n  expect(list[ 0 ]).toBe('foo')\n  expect(list[ 1 ]).toBe('bar')\n  expect(list[ 2 ]).toBe('baz')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {sort} from 'rambda'\n\nconst list = [3, 0, 5, 2, 1]\n\nfunction sortFn(a: number, b: number): number {\n  return a \u003e b ? 1 : -1\n}\n\ndescribe('R.sort', () =\u003e {\n  it('happy', () =\u003e {\n    const result = sort(sortFn, list)\n    result // $ExpectType number[]\n  })\n  it('curried', () =\u003e {\n    const result = sort(sortFn)(list)\n    result // $ExpectType number[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#sort)\n\n### sortBy\n\n```typescript\n\nsortBy\u003cT\u003e(sortFn: (a: T) =\u003e Ord, list: T[]): T[]\n```\n\nIt returns copy of `list` sorted by `sortFn` function, where `sortFn` function returns a value to compare, i.e. it doesn't need to return only `-1`, `0` or `1`.\n\n```javascript\nconst list = [\n  {a: 2},\n  {a: 3},\n  {a: 1}\n]\nconst sortFn = x =\u003e x.a\n\nconst result = R.sortBy(sortFn, list)\nconst expected = [\n  {a: 1},\n  {a: 2},\n  {a: 3}\n]\n// =\u003e `result` is equal to `expected`\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B%0A%20%20%7Ba%3A%202%7D%2C%0A%20%20%7Ba%3A%203%7D%2C%0A%20%20%7Ba%3A%201%7D%0A%5D%0Aconst%20sortFn%20%3D%20x%20%3D%3E%20x.a%0A%0Aconst%20result%20%3D%20R.sortBy(sortFn%2C%20list)%0Aconst%20expected%20%3D%20%5B%0A%20%20%7Ba%3A%201%7D%2C%0A%20%20%7Ba%3A%202%7D%2C%0A%20%20%7Ba%3A%203%7D%0A%5D%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60\"\u003eTry this \u003cstrong\u003eR.sortBy\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nsortBy\u003cT\u003e(sortFn: (a: T) =\u003e Ord, list: T[]): T[];\nsortBy\u003cT\u003e(sortFn: (a: T) =\u003e Ord): (list: T[]) =\u003e T[];\nsortBy(sortFn: (a: any) =\u003e Ord): \u003cT\u003e(list: T[]) =\u003e T[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.sortBy\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { cloneList } from './_internals/cloneList.js'\n\nexport function sortBy(sortFn, list){\n  if (arguments.length === 1) return _list =\u003e sortBy(sortFn, _list)\n\n  const clone = cloneList(list)\n\n  return clone.sort((a, b) =\u003e {\n    const aSortResult = sortFn(a)\n    const bSortResult = sortFn(b)\n\n    if (aSortResult === bSortResult) return 0\n\n    return aSortResult \u003c bSortResult ? -1 : 1\n  })\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { compose } from './compose.js'\nimport { prop } from './prop.js'\nimport { sortBy } from './sortBy.js'\nimport { toLower } from './toLower.js'\n\ntest('happy', () =\u003e {\n  const input = [ { a : 2 }, { a : 1 }, { a : 1 }, { a : 3 } ]\n  const expected = [ { a : 1 }, { a : 1 }, { a : 2 }, { a : 3 } ]\n\n  const result = sortBy(x =\u003e x.a)(input)\n  expect(result).toEqual(expected)\n})\n\ntest('with compose', () =\u003e {\n  const alice = {\n    name : 'ALICE',\n    age  : 101,\n  }\n  const bob = {\n    name : 'Bob',\n    age  : -10,\n  }\n  const clara = {\n    name : 'clara',\n    age  : 314.159,\n  }\n  const people = [ clara, bob, alice ]\n  const sortByNameCaseInsensitive = sortBy(compose(toLower, prop('name')))\n\n  expect(sortByNameCaseInsensitive(people)).toEqual([ alice, bob, clara ])\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {sortBy, pipe} from 'rambda'\n\ninterface Input {\n  a: number,\n}\n\ndescribe('R.sortBy', () =\u003e {\n  it('passing type to sort function', () =\u003e {\n    function fn(x: any): number {\n      return x.a\n    }\n    function fn2(x: Input): number {\n      return x.a\n    }\n\n    const input = [{a: 2}, {a: 1}, {a: 0}]\n    const result = sortBy(fn, input)\n    const curriedResult = sortBy(fn2)(input)\n\n    result // $ExpectType { a: number; }[]\n    curriedResult // $ExpectType Input[]\n    result[0].a // $ExpectType number\n    curriedResult[0].a // $ExpectType number\n  })\n  it('passing type to sort function and list', () =\u003e {\n    function fn(x: Input): number {\n      return x.a\n    }\n\n    const input: Input[] = [{a: 2}, {a: 1}, {a: 0}]\n    const result = sortBy(fn, input)\n    const curriedResult = sortBy(fn)(input)\n\n    result // $ExpectType Input[]\n    curriedResult // $ExpectType Input[]\n    result[0].a // $ExpectType number\n  })\n  it('with R.pipe', () =\u003e {\n    interface Obj {\n      value: number,\n    }\n    const fn = pipe(sortBy\u003cObj\u003e(x =\u003e x.value))\n\n    const result = fn([{value: 1}, {value: 2}])\n    result // $ExpectType Obj[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#sortBy)\n\n### sortWith\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.sortWith(%5B%0A%20%20%20%20(a%2C%20b)%20%3D%3E%20a.a%20%3D%3D%3D%20b.a%20%3F%200%20%3A%20a.a%20%3E%20b.a%20%3F%201%20%3A%20-1%2C%0A%20%20%20%20(a%2C%20b)%20%3D%3E%20a.b%20%3D%3D%3D%20b.b%20%3F%200%20%3A%20a.b%20%3E%20b.b%20%3F%201%20%3A%20-1%2C%0A%5D%2C%20%5B%0A%20%20%7Ba%3A%201%2C%20b%3A%202%7D%2C%0A%20%20%7Ba%3A%202%2C%20b%3A%201%7D%2C%0A%20%20%7Ba%3A%202%2C%20b%3A%202%7D%2C%0A%20%20%7Ba%3A%201%2C%20b%3A%201%7D%2C%0A%5D)%0Aconst%20expected%20%3D%20%5B%0A%20%20%7Ba%3A%201%2C%20b%3A%201%7D%2C%0A%20%20%7Ba%3A%201%2C%20b%3A%202%7D%2C%0A%20%20%7Ba%3A%202%2C%20b%3A%201%7D%2C%0A%20%20%7Ba%3A%202%2C%20b%3A%202%7D%2C%0A%5D%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60\"\u003eTry this \u003cstrong\u003eR.sortWith\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#sortWith)\n\n### split\n\n```typescript\n\nsplit(separator: string | RegExp): (str: string) =\u003e string[]\n```\n\nCurried version of `String.prototype.split`\n\n```javascript\nconst str = 'foo|bar|baz'\nconst separator = '|'\nconst result = R.split(separator, str)\n// =\u003e [ 'foo', 'bar', 'baz' ]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20str%20%3D%20'foo%7Cbar%7Cbaz'%0Aconst%20separator%20%3D%20'%7C'%0Aconst%20result%20%3D%20R.split(separator%2C%20str)%0A%2F%2F%20%3D%3E%20%5B%20'foo'%2C%20'bar'%2C%20'baz'%20%5D\"\u003eTry this \u003cstrong\u003eR.split\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nsplit(separator: string | RegExp): (str: string) =\u003e string[];\nsplit(separator: string | RegExp, str: string): string[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.split\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function split(separator, str){\n  if (arguments.length === 1) return _str =\u003e split(separator, _str)\n\n  return str.split(separator)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { split } from './split.js'\n\nconst str = 'foo|bar|baz'\nconst splitChar = '|'\nconst expected = [ 'foo', 'bar', 'baz' ]\n\ntest('happy', () =\u003e {\n  expect(split(splitChar, str)).toEqual(expected)\n})\n\ntest('curried', () =\u003e {\n  expect(split(splitChar)(str)).toEqual(expected)\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {split} from 'rambda'\n\nconst str = 'foo|bar|baz'\nconst splitChar = '|'\n\ndescribe('R.split', () =\u003e {\n  it('happy', () =\u003e {\n    const result = split(splitChar, str)\n\n    result // $ExpectType string[]\n  })\n  it('curried', () =\u003e {\n    const result = split(splitChar)(str)\n\n    result // $ExpectType string[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#split)\n\n### splitAt\n\n```typescript\n\nsplitAt\u003cT\u003e(index: number, input: T[]): [T[], T[]]\n```\n\nIt splits string or array at a given index.\n\n```javascript\nconst list = [ 1, 2, 3 ]\nconst result = R.splitAt(2, list)\n// =\u003e [[ 1, 2 ], [ 3 ]]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B%201%2C%202%2C%203%20%5D%0Aconst%20result%20%3D%20R.splitAt(2%2C%20list)%0A%2F%2F%20%3D%3E%20%5B%5B%201%2C%202%20%5D%2C%20%5B%203%20%5D%5D\"\u003eTry this \u003cstrong\u003eR.splitAt\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nsplitAt\u003cT\u003e(index: number, input: T[]): [T[], T[]];\nsplitAt(index: number, input: string): [string, string];\nsplitAt(index: number): {\n    \u003cT\u003e(input: T[]): [T[], T[]];\n    (input: string): [string, string];\n};\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.splitAt\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { isArray } from './_internals/isArray.js'\nimport { drop } from './drop.js'\nimport { maybe } from './maybe.js'\nimport { take } from './take.js'\n\nexport function splitAt(index, input){\n  if (arguments.length === 1){\n    return _list =\u003e splitAt(index, _list)\n  }\n  if (!input) throw new TypeError(`Cannot read property 'slice' of ${ input }`)\n\n  if (!isArray(input) \u0026\u0026 typeof input !== 'string') return [ [], [] ]\n\n  const correctIndex = maybe(\n    index \u003c 0,\n    input.length + index \u003c 0 ? 0 : input.length + index,\n    index\n  )\n\n  return [ take(correctIndex, input), drop(correctIndex, input) ]\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { splitAt as splitAtRamda } from 'ramda'\n\nimport { splitAt } from './splitAt.js'\n\nconst list = [ 1, 2, 3 ]\nconst str = 'foo bar'\n\ntest('with array', () =\u003e {\n  const result = splitAt(2, list)\n  expect(result).toEqual([ [ 1, 2 ], [ 3 ] ])\n})\n\ntest('with array - index is negative number', () =\u003e {\n  const result = splitAt(-6, list)\n  expect(result).toEqual([ [], list ])\n})\n\ntest('with array - index is out of scope', () =\u003e {\n  const result = splitAt(4, list)\n  expect(result).toEqual([ [ 1, 2, 3 ], [] ])\n})\n\ntest('with string', () =\u003e {\n  const result = splitAt(4, str)\n  expect(result).toEqual([ 'foo ', 'bar' ])\n})\n\ntest('with string - index is negative number', () =\u003e {\n  const result = splitAt(-2, str)\n  expect(result).toEqual([ 'foo b', 'ar' ])\n})\n\ntest('with string - index is out of scope', () =\u003e {\n  const result = splitAt(10, str)\n  expect(result).toEqual([ str, '' ])\n})\n\ntest('with array - index is out of scope', () =\u003e {\n  const result = splitAt(4)(list)\n  expect(result).toEqual([ [ 1, 2, 3 ], [] ])\n})\n\nconst badInputs = [ 1, true, /foo/g, {} ]\nconst throwingBadInputs = [ null, undefined ]\n\ntest('with bad inputs', () =\u003e {\n  throwingBadInputs.forEach(badInput =\u003e {\n    expect(() =\u003e splitAt(1, badInput)).toThrowWithMessage(TypeError,\n      `Cannot read property 'slice' of ${ badInput }`)\n    expect(() =\u003e splitAtRamda(1, badInput)).toThrowWithMessage(TypeError,\n      `Cannot read properties of ${ badInput } (reading 'slice')`)\n  })\n\n  badInputs.forEach(badInput =\u003e {\n    const result = splitAt(1, badInput)\n    const ramdaResult = splitAtRamda(1, badInput)\n    expect(result).toEqual(ramdaResult)\n  })\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {splitAt} from 'rambda'\n\nconst index = 1\nconst str = 'foo'\nconst list = [1, 2, 3]\n\ndescribe('R.splitAt with array', () =\u003e {\n  it('happy', () =\u003e {\n    const result = splitAt(index, list)\n\n    result // $ExpectType [number[], number[]]\n  })\n  it('curried', () =\u003e {\n    const result = splitAt(index)(list)\n\n    result // $ExpectType [number[], number[]]\n  })\n})\n\ndescribe('R.splitAt with string', () =\u003e {\n  it('happy', () =\u003e {\n    const result = splitAt(index, str)\n\n    result // $ExpectType [string, string]\n  })\n  it('curried', () =\u003e {\n    const result = splitAt(index)(str)\n\n    result // $ExpectType [string, string]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#splitAt)\n\n### splitEvery\n\n```typescript\n\nsplitEvery\u003cT\u003e(sliceLength: number, input: T[]): (T[])[]\n```\n\nIt splits `input` into slices of `sliceLength`.\n\n```javascript\nconst result = [\n  R.splitEvery(2, [1, 2, 3]), \n  R.splitEvery(3, 'foobar') \n]\n\nconst expected = [\n  [[1, 2], [3]],\n  ['foo', 'bar']\n]\n// =\u003e `result` is equal to `expected`\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5B%0A%20%20R.splitEvery(2%2C%20%5B1%2C%202%2C%203%5D)%2C%20%0A%20%20R.splitEvery(3%2C%20'foobar')%20%0A%5D%0A%0Aconst%20expected%20%3D%20%5B%0A%20%20%5B%5B1%2C%202%5D%2C%20%5B3%5D%5D%2C%0A%20%20%5B'foo'%2C%20'bar'%5D%0A%5D%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60\"\u003eTry this \u003cstrong\u003eR.splitEvery\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nsplitEvery\u003cT\u003e(sliceLength: number, input: T[]): (T[])[];\nsplitEvery(sliceLength: number, input: string): string[];\nsplitEvery(sliceLength: number): {\n  (input: string): string[];\n  \u003cT\u003e(input: T[]): (T[])[];\n};\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.splitEvery\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function splitEvery(sliceLength, listOrString){\n  if (arguments.length === 1){\n    return _listOrString =\u003e splitEvery(sliceLength, _listOrString)\n  }\n\n  if (sliceLength \u003c 1){\n    throw new Error('First argument to splitEvery must be a positive integer')\n  }\n\n  const willReturn = []\n  let counter = 0\n\n  while (counter \u003c listOrString.length){\n    willReturn.push(listOrString.slice(counter, counter += sliceLength))\n  }\n\n  return willReturn\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { splitEvery } from './splitEvery.js'\n\ntest('happy', () =\u003e {\n  expect(splitEvery(3, [ 1, 2, 3, 4, 5, 6, 7 ])).toEqual([\n    [ 1, 2, 3 ],\n    [ 4, 5, 6 ],\n    [ 7 ],\n  ])\n\n  expect(splitEvery(3)('foobarbaz')).toEqual([ 'foo', 'bar', 'baz' ])\n})\n\ntest('with bad input', () =\u003e {\n  expect(() =\u003e\n    expect(splitEvery(0)('foo')).toEqual([ 'f', 'o', 'o' ])).toThrowErrorMatchingInlineSnapshot('\"First argument to splitEvery must be a positive integer\"')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {splitEvery} from 'rambda'\n\nconst list = [1, 2, 3, 4, 5, 6, 7]\n\ndescribe('R.splitEvery', () =\u003e {\n  it('happy', () =\u003e {\n    const result = splitEvery(3, list)\n\n    result // $ExpectType number[][]\n  })\n  it('curried', () =\u003e {\n    const result = splitEvery(3)(list)\n\n    result // $ExpectType number[][]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#splitEvery)\n\n### splitWhen\n\n```typescript\n\nsplitWhen\u003cT, U\u003e(predicate: Predicate\u003cT\u003e, list: U[]): (U[])[]\n```\n\nIt splits `list` to two arrays according to a `predicate` function. \n\nThe first array contains all members of `list` before `predicate` returns `true`.\n\n```javascript\nconst list = [1, 2, 1, 2]\nconst result = R.splitWhen(R.equals(2), list)\n// =\u003e [[1], [2, 1, 2]]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B1%2C%202%2C%201%2C%202%5D%0Aconst%20result%20%3D%20R.splitWhen(R.equals(2)%2C%20list)%0A%2F%2F%20%3D%3E%20%5B%5B1%5D%2C%20%5B2%2C%201%2C%202%5D%5D\"\u003eTry this \u003cstrong\u003eR.splitWhen\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nsplitWhen\u003cT, U\u003e(predicate: Predicate\u003cT\u003e, list: U[]): (U[])[];\nsplitWhen\u003cT\u003e(predicate: Predicate\u003cT\u003e): \u003cU\u003e(list: U[]) =\u003e (U[])[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.splitWhen\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function splitWhen(predicate, input){\n  if (arguments.length === 1){\n    return _input =\u003e splitWhen(predicate, _input)\n  }\n  if (!input)\n    throw new TypeError(`Cannot read property 'length' of ${ input }`)\n\n  const preFound = []\n  const postFound = []\n  let found = false\n  let counter = -1\n\n  while (counter++ \u003c input.length - 1){\n    if (found){\n      postFound.push(input[ counter ])\n    } else if (predicate(input[ counter ])){\n      postFound.push(input[ counter ])\n      found = true\n    } else {\n      preFound.push(input[ counter ])\n    }\n  }\n\n  return [ preFound, postFound ]\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { splitWhen as splitWhenRamda } from 'ramda'\n\nimport { equals } from './equals.js'\nimport { splitWhen } from './splitWhen.js'\n\nconst list = [ 1, 2, 1, 2 ]\n\ntest('happy', () =\u003e {\n  const result = splitWhen(equals(2), list)\n  expect(result).toEqual([ [ 1 ], [ 2, 1, 2 ] ])\n})\n\ntest('when predicate returns false', () =\u003e {\n  const result = splitWhen(equals(3))(list)\n  expect(result).toEqual([ list, [] ])\n})\n\nconst badInputs = [ 1, true, /foo/g, {} ]\nconst throwingBadInputs = [ null, undefined ]\n\ntest('with bad inputs', () =\u003e {\n  throwingBadInputs.forEach(badInput =\u003e {\n    expect(() =\u003e splitWhen(equals(2), badInput)).toThrowWithMessage(TypeError,\n      `Cannot read property 'length' of ${ badInput }`)\n    expect(() =\u003e splitWhenRamda(equals(2), badInput)).toThrowWithMessage(TypeError,\n      `Cannot read properties of ${ badInput } (reading 'length')`)\n  })\n\n  badInputs.forEach(badInput =\u003e {\n    const result = splitWhen(equals(2), badInput)\n    const ramdaResult = splitWhenRamda(equals(2), badInput)\n    expect(result).toEqual(ramdaResult)\n  })\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {splitWhen} from 'rambda'\n\nconst list = [1, 2, 1, 2]\nconst predicate = (x: number) =\u003e x === 2\n\ndescribe('R.splitWhen', () =\u003e {\n  it('happy', () =\u003e {\n    const result = splitWhen(predicate, list)\n\n    result // $ExpectType number[][]\n  })\n  it('curried', () =\u003e {\n    const result = splitWhen(predicate)(list)\n\n    result // $ExpectType number[][]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#splitWhen)\n\n### startsWith\n\n```typescript\n\nstartsWith\u003cT extends string\u003e(question: T, input: string): boolean\n```\n\nWhen iterable is a string, then it behaves as `String.prototype.startsWith`.\nWhen iterable is a list, then it uses R.equals to determine if the target list starts in the same way as the given target.\n\n\u003e :boom: It doesn't work with arrays unlike its corresponding **Ramda** method.\n\n```javascript\nconst str = 'foo-bar'\nconst list = [{a:1}, {a:2}, {a:3}]\n\nconst result = [\n  R.startsWith('foo', str),\n  R.startsWith([{a:1}, {a:2}], list)\n]\n// =\u003e [true, true]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20str%20%3D%20'foo-bar'%0Aconst%20list%20%3D%20%5B%7Ba%3A1%7D%2C%20%7Ba%3A2%7D%2C%20%7Ba%3A3%7D%5D%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.startsWith('foo'%2C%20str)%2C%0A%20%20R.startsWith(%5B%7Ba%3A1%7D%2C%20%7Ba%3A2%7D%5D%2C%20list)%0A%5D%0A%2F%2F%20%3D%3E%20%5Btrue%2C%20true%5D\"\u003eTry this \u003cstrong\u003eR.startsWith\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nstartsWith\u003cT extends string\u003e(question: T, input: string): boolean;\nstartsWith\u003cT extends string\u003e(question: T): (input: string) =\u003e boolean;\nstartsWith\u003cT\u003e(question: T[], input: T[]): boolean;\nstartsWith\u003cT\u003e(question: T[]): (input: T[]) =\u003e boolean;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.startsWith\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { isArray } from './_internals/isArray.js'\nimport { equals } from './equals.js'\n\nexport function startsWith(question, iterable){\n  if (arguments.length === 1)\n    return _iterable =\u003e startsWith(question, _iterable)\n\n  if (typeof iterable === 'string'){\n    return iterable.startsWith(question)\n  }\n  if (!isArray(question)) return false\n\n  let correct = true\n  const filtered = question.filter((x, index) =\u003e {\n    if (!correct) return false\n    const result = equals(x, iterable[ index ])\n    if (!result) correct = false\n\n    return result\n  })\n\n  return filtered.length === question.length\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { startsWith as startsWithRamda } from 'ramda'\n\nimport { compareCombinations } from './_internals/testUtils.js'\nimport { possibleIterables, possibleTargets } from './endsWith.spec.js'\nimport { startsWith } from './startsWith.js'\n\ntest('with string', () =\u003e {\n  expect(startsWith('foo', 'foo-bar')).toBeTrue()\n  expect(startsWith('baz')('foo-bar')).toBeFalse()\n})\n\ntest('use R.equals with array', () =\u003e {\n  const list = [ { a : 1 }, { a : 2 }, { a : 3 } ]\n  expect(startsWith({ a : 1 }, list)).toBeFalse()\n  expect(startsWith([ { a : 1 } ], list)).toBeTrue()\n  expect(startsWith([ { a : 1 }, { a : 2 } ], list)).toBeTrue()\n  expect(startsWith(list, list)).toBeTrue()\n  expect(startsWith([ { a : 2 } ], list)).toBeFalse()\n})\n\ndescribe('brute force', () =\u003e {\n  compareCombinations({\n    fn          : startsWith,\n    fnRamda     : startsWithRamda,\n    firstInput  : possibleTargets,\n    secondInput : possibleIterables,\n    callback    : errorsCounters =\u003e {\n      expect(errorsCounters).toMatchInlineSnapshot(`\n        {\n          \"ERRORS_MESSAGE_MISMATCH\": 0,\n          \"ERRORS_TYPE_MISMATCH\": 0,\n          \"RESULTS_MISMATCH\": 0,\n          \"SHOULD_NOT_THROW\": 0,\n          \"SHOULD_THROW\": 0,\n          \"TOTAL_TESTS\": 32,\n        }\n      `)\n    },\n  })\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {startsWith} from 'rambda'\n\ndescribe('R.startsWith - array', () =\u003e {\n  const question = [{a: 1}]\n  const iterable = [{a: 1}, {a: 2}]\n  it('happy', () =\u003e {\n    const result = startsWith(question, iterable)\n    result // $ExpectType boolean\n  })\n  it('curried', () =\u003e {\n    const result = startsWith(question)(iterable)\n    result // $ExpectType boolean\n  })\n})\n\ndescribe('R.startsWith - string', () =\u003e {\n  const question = 'foo'\n  const iterable = 'foo bar'\n  it('happy', () =\u003e {\n    const result = startsWith(question, iterable)\n    result // $ExpectType boolean\n  })\n  it('curried', () =\u003e {\n    const result = startsWith(question)(iterable)\n    result // $ExpectType boolean\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#startsWith)\n\n### subtract\n\nCurried version of `x - y`\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20x%20%3D%203%0Aconst%20y%20%3D%201%0A%0Aconst%20result%20%3D%20R.subtract(x%2C%20y)%20%0A%2F%2F%20%3D%3E%202\"\u003eTry this \u003cstrong\u003eR.subtract\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#subtract)\n\n### sum\n\n```typescript\n\nsum(list: number[]): number\n```\n\n```javascript\nR.sum([1, 2, 3, 4, 5]) \n// =\u003e 15\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.sum(%5B1%2C%202%2C%203%2C%204%2C%205%5D)%20%0A%2F%2F%20%3D%3E%2015\"\u003eTry this \u003cstrong\u003eR.sum\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nsum(list: number[]): number;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.sum\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function sum(list){\n  return list.reduce((prev, current) =\u003e prev + current, 0)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { sum } from './sum.js'\n\ntest('happy', () =\u003e {\n  expect(sum([ 1, 2, 3, 4, 5 ])).toBe(15)\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#sum)\n\n### swap\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.swap(1%2C%202%2C%20%5B1%2C%202%2C%203%5D)%0A%2F%2F%20%3D%3E%20%5B1%2C%203%2C%202%5D\"\u003eTry this \u003cstrong\u003eR.swap\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#swap)\n\n### symmetricDifference\n\n```typescript\n\nsymmetricDifference\u003cT\u003e(x: T[], y: T[]): T[]\n```\n\nIt returns a merged list of `x` and `y` with all equal elements removed.\n\n`R.equals` is used to determine equality.\n\n```javascript\nconst x = [ 1, 2, 3, 4 ]\nconst y = [ 3, 4, 5, 6 ]\n\nconst result = R.symmetricDifference(x, y)\n// =\u003e [ 1, 2, 5, 6 ]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20x%20%3D%20%5B%201%2C%202%2C%203%2C%204%20%5D%0Aconst%20y%20%3D%20%5B%203%2C%204%2C%205%2C%206%20%5D%0A%0Aconst%20result%20%3D%20R.symmetricDifference(x%2C%20y)%0A%2F%2F%20%3D%3E%20%5B%201%2C%202%2C%205%2C%206%20%5D\"\u003eTry this \u003cstrong\u003eR.symmetricDifference\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nsymmetricDifference\u003cT\u003e(x: T[], y: T[]): T[];\nsymmetricDifference\u003cT\u003e(x: T[]): \u003cT\u003e(y: T[]) =\u003e T[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.symmetricDifference\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { concat } from './concat.js'\nimport { filter } from './filter.js'\nimport { includes } from './includes.js'\n\nexport function symmetricDifference(x, y){\n  if (arguments.length === 1){\n    return _y =\u003e symmetricDifference(x, _y)\n  }\n\n  return concat(filter(value =\u003e !includes(value, y), x),\n    filter(value =\u003e !includes(value, x), y))\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { symmetricDifference } from './symmetricDifference.js'\n\ntest('symmetricDifference', () =\u003e {\n  const list1 = [ 1, 2, 3, 4 ]\n  const list2 = [ 3, 4, 5, 6 ]\n  expect(symmetricDifference(list1)(list2)).toEqual([ 1, 2, 5, 6 ])\n\n  expect(symmetricDifference([], [])).toEqual([])\n})\n\ntest('symmetricDifference with objects', () =\u003e {\n  const list1 = [ { id : 1 }, { id : 2 }, { id : 3 }, { id : 4 } ]\n  const list2 = [ { id : 3 }, { id : 4 }, { id : 5 }, { id : 6 } ]\n  expect(symmetricDifference(list1)(list2)).toEqual([\n    { id : 1 },\n    { id : 2 },\n    { id : 5 },\n    { id : 6 },\n  ])\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {symmetricDifference} from 'rambda'\n\ndescribe('R.symmetricDifference', () =\u003e {\n  it('happy', () =\u003e {\n    const list1 = [1, 2, 3, 4]\n    const list2 = [3, 4, 5, 6]\n    const result = symmetricDifference(list1, list2)\n\n    result // $ExpectType number[]\n  })\n\n  it('curried', () =\u003e {\n    const list1 = [{id: 1}, {id: 2}, {id: 3}, {id: 4}]\n    const list2 = [{id: 3}, {id: 4}, {id: 5}, {id: 6}]\n    const result = symmetricDifference(list1)(list2)\n\n    result // $ExpectType { id: number; }[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#symmetricDifference)\n\n### T\n\n```typescript\n\nT(): boolean\n```\n\n```javascript\nR.T() \n// =\u003e true\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.T()%20%0A%2F%2F%20%3D%3E%20true\"\u003eTry this \u003cstrong\u003eR.T\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nT(): boolean;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.T\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function T(){\n  return true\n}\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#T)\n\n### tail\n\n```typescript\n\ntail\u003cT extends unknown[]\u003e(input: T): T extends [any, ...infer U] ? U : [...T]\n```\n\nIt returns all but the first element of `input`.\n\n```javascript\nconst result = [\n  R.tail([1, 2, 3]),  \n  R.tail('foo') \n]\n// =\u003e [[2, 3], 'oo']\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5B%0A%20%20R.tail(%5B1%2C%202%2C%203%5D)%2C%20%20%0A%20%20R.tail('foo')%20%0A%5D%0A%2F%2F%20%3D%3E%20%5B%5B2%2C%203%5D%2C%20'oo'%5D\"\u003eTry this \u003cstrong\u003eR.tail\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\ntail\u003cT extends unknown[]\u003e(input: T): T extends [any, ...infer U] ? U : [...T];\ntail(input: string): string;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.tail\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { drop } from './drop.js'\n\nexport function tail(listOrString){\n  return drop(1, listOrString)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { tail } from './tail.js'\n\ntest('tail', () =\u003e {\n  expect(tail([ 1, 2, 3 ])).toEqual([ 2, 3 ])\n  expect(tail([ 1, 2 ])).toEqual([ 2 ])\n  expect(tail([ 1 ])).toEqual([])\n  expect(tail([])).toEqual([])\n\n  expect(tail('abc')).toBe('bc')\n  expect(tail('ab')).toBe('b')\n  expect(tail('a')).toBe('')\n  expect(tail('')).toBe('')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {tail} from 'rambda'\n\ndescribe('R.tail', () =\u003e {\n  it('with string', () =\u003e {\n    const result = tail('foo')\n\n    result // $ExpectType string\n  })\n  it('with list - one type', () =\u003e {\n    const result = tail([1, 2, 3])\n\n    result // $ExpectType number[]\n  })\n  it('with list - mixed types', () =\u003e {\n    const result = tail(['foo', 'bar', 1, 2, 3])\n\n    result // $ExpectType (string | number)[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#tail)\n\n### take\n\n```typescript\n\ntake\u003cT\u003e(howMany: number, input: T[]): T[]\n```\n\nIt returns the first `howMany` elements of `input`.\n\n```javascript\nconst howMany = 2\n\nconst result = [\n  R.take(howMany, [1, 2, 3]),\n  R.take(howMany, 'foobar'),\n]\n// =\u003e [[1, 2], 'fo']\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20howMany%20%3D%202%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.take(howMany%2C%20%5B1%2C%202%2C%203%5D)%2C%0A%20%20R.take(howMany%2C%20'foobar')%2C%0A%5D%0A%2F%2F%20%3D%3E%20%5B%5B1%2C%202%5D%2C%20'fo'%5D\"\u003eTry this \u003cstrong\u003eR.take\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\ntake\u003cT\u003e(howMany: number, input: T[]): T[];\ntake(howMany: number, input: string): string;\ntake\u003cT\u003e(howMany: number): {\n  \u003cT\u003e(input: T[]): T[];\n  (input: string): string;\n};\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.take\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport baseSlice from './_internals/baseSlice.js'\n\nexport function take(howMany, listOrString){\n  if (arguments.length === 1)\n    return _listOrString =\u003e take(howMany, _listOrString)\n  if (howMany \u003c 0) return listOrString.slice()\n  if (typeof listOrString === 'string') return listOrString.slice(0, howMany)\n\n  return baseSlice(\n    listOrString, 0, howMany\n  )\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { take } from './take.js'\n\ntest('happy', () =\u003e {\n  const arr = [ 'foo', 'bar', 'baz' ]\n\n  expect(take(1, arr)).toEqual([ 'foo' ])\n\n  expect(arr).toEqual([ 'foo', 'bar', 'baz' ])\n\n  expect(take(2)([ 'foo', 'bar', 'baz' ])).toEqual([ 'foo', 'bar' ])\n  expect(take(3, [ 'foo', 'bar', 'baz' ])).toEqual([ 'foo', 'bar', 'baz' ])\n  expect(take(4, [ 'foo', 'bar', 'baz' ])).toEqual([ 'foo', 'bar', 'baz' ])\n  expect(take(3)('rambda')).toBe('ram')\n})\n\ntest('with negative index', () =\u003e {\n  expect(take(-1, [ 1, 2, 3 ])).toEqual([ 1, 2, 3 ])\n  expect(take(-Infinity, [ 1, 2, 3 ])).toEqual([ 1, 2, 3 ])\n})\n\ntest('with zero index', () =\u003e {\n  expect(take(0, [ 1, 2, 3 ])).toEqual([])\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {take} from 'rambda'\n\nconst list = [1, 2, 3, 4]\nconst str = 'foobar'\nconst howMany = 2\n\ndescribe('R.take - array', () =\u003e {\n  it('happy', () =\u003e {\n    const result = take(howMany, list)\n\n    result // $ExpectType number[]\n  })\n  it('curried', () =\u003e {\n    const result = take(howMany)(list)\n\n    result // $ExpectType number[]\n  })\n})\n\ndescribe('R.take - string', () =\u003e {\n  it('happy', () =\u003e {\n    const result = take(howMany, str)\n\n    result // $ExpectType string\n  })\n  it('curried', () =\u003e {\n    const result = take(howMany)(str)\n\n    result // $ExpectType string\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#take)\n\n### takeLast\n\n```typescript\n\ntakeLast\u003cT\u003e(howMany: number, input: T[]): T[]\n```\n\nIt returns the last `howMany` elements of `input`.\n\n```javascript\nconst howMany = 2\n\nconst result = [\n  R.takeLast(howMany, [1, 2, 3]),\n  R.takeLast(howMany, 'foobar'),\n]\n// =\u003e [[2, 3], 'ar']\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20howMany%20%3D%202%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.takeLast(howMany%2C%20%5B1%2C%202%2C%203%5D)%2C%0A%20%20R.takeLast(howMany%2C%20'foobar')%2C%0A%5D%0A%2F%2F%20%3D%3E%20%5B%5B2%2C%203%5D%2C%20'ar'%5D\"\u003eTry this \u003cstrong\u003eR.takeLast\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\ntakeLast\u003cT\u003e(howMany: number, input: T[]): T[];\ntakeLast(howMany: number, input: string): string;\ntakeLast\u003cT\u003e(howMany: number): {\n  \u003cT\u003e(input: T[]): T[];\n  (input: string): string;\n};\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.takeLast\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport baseSlice from './_internals/baseSlice.js'\n\nexport function takeLast(howMany, listOrString){\n  if (arguments.length === 1)\n    return _listOrString =\u003e takeLast(howMany, _listOrString)\n\n  const len = listOrString.length\n  if (howMany \u003c 0) return listOrString.slice()\n  let numValue = howMany \u003e len ? len : howMany\n\n  if (typeof listOrString === 'string')\n    return listOrString.slice(len - numValue)\n\n  numValue = len - numValue\n\n  return baseSlice(\n    listOrString, numValue, len\n  )\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { takeLast } from './takeLast.js'\n\ntest('with arrays', () =\u003e {\n  expect(takeLast(1, [ 'foo', 'bar', 'baz' ])).toEqual([ 'baz' ])\n\n  expect(takeLast(2)([ 'foo', 'bar', 'baz' ])).toEqual([ 'bar', 'baz' ])\n\n  expect(takeLast(3, [ 'foo', 'bar', 'baz' ])).toEqual([ 'foo', 'bar', 'baz' ])\n\n  expect(takeLast(4, [ 'foo', 'bar', 'baz' ])).toEqual([ 'foo', 'bar', 'baz' ])\n\n  expect(takeLast(10, [ 'foo', 'bar', 'baz' ])).toEqual([ 'foo', 'bar', 'baz' ])\n})\n\ntest('with strings', () =\u003e {\n  expect(takeLast(3, 'rambda')).toBe('bda')\n\n  expect(takeLast(7, 'rambda')).toBe('rambda')\n})\n\ntest('with negative index', () =\u003e {\n  expect(takeLast(-1, [ 1, 2, 3 ])).toEqual([ 1, 2, 3 ])\n  expect(takeLast(-Infinity, [ 1, 2, 3 ])).toEqual([ 1, 2, 3 ])\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {takeLast} from 'rambda'\n\nconst list = [1, 2, 3, 4]\nconst str = 'foobar'\nconst howMany = 2\n\ndescribe('R.takeLast - array', () =\u003e {\n  it('happy', () =\u003e {\n    const result = takeLast(howMany, list)\n\n    result // $ExpectType number[]\n  })\n  it('curried', () =\u003e {\n    const result = takeLast(howMany)(list)\n\n    result // $ExpectType number[]\n  })\n})\n\ndescribe('R.takeLast - string', () =\u003e {\n  it('happy', () =\u003e {\n    const result = takeLast(howMany, str)\n\n    result // $ExpectType string\n  })\n  it('curried', () =\u003e {\n    const result = takeLast(howMany)(str)\n\n    result // $ExpectType string\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#takeLast)\n\n### takeLastWhile\n\n```typescript\n\ntakeLastWhile(predicate: (x: string) =\u003e boolean, input: string): string\n```\n\n```javascript\nconst result = R.takeLastWhile(\n  x =\u003e x \u003e 2,\n  [1, 2, 3, 4]\n)\n// =\u003e [3, 4]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.takeLastWhile(%0A%20%20x%20%3D%3E%20x%20%3E%202%2C%0A%20%20%5B1%2C%202%2C%203%2C%204%5D%0A)%0A%2F%2F%20%3D%3E%20%5B3%2C%204%5D\"\u003eTry this \u003cstrong\u003eR.takeLastWhile\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\ntakeLastWhile(predicate: (x: string) =\u003e boolean, input: string): string;\ntakeLastWhile(predicate: (x: string) =\u003e boolean): (input: string) =\u003e string;\ntakeLastWhile\u003cT\u003e(predicate: (x: T) =\u003e boolean, input: T[]): T[];\ntakeLastWhile\u003cT\u003e(predicate: (x: T) =\u003e boolean): \u003cT\u003e(input: T[]) =\u003e T[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.takeLastWhile\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { isArray } from './_internals/isArray.js'\n\nexport function takeLastWhile(predicate, input){\n  if (arguments.length === 1){\n    return _input =\u003e takeLastWhile(predicate, _input)\n  }\n  if (input.length === 0) return input\n\n  const toReturn = []\n  let counter = input.length\n\n  while (counter){\n    const item = input[ --counter ]\n    if (!predicate(item)){\n      break\n    }\n    toReturn.push(item)\n  }\n\n  return isArray(input) ? toReturn.reverse() : toReturn.reverse().join('')\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { takeLastWhile } from './takeLastWhile.js'\nconst assert = require('assert')\n\nconst list = [ 1, 2, 3, 4 ]\n\ntest('happy', () =\u003e {\n  const predicate = x =\u003e x \u003e 2\n  const result = takeLastWhile(predicate, list)\n  expect(result).toEqual([ 3, 4 ])\n})\n\ntest('predicate is always true', () =\u003e {\n  const predicate = () =\u003e true\n  const result = takeLastWhile(predicate)(list)\n  expect(result).toEqual(list)\n})\n\ntest('predicate is always false', () =\u003e {\n  const predicate = () =\u003e false\n  const result = takeLastWhile(predicate, list)\n  expect(result).toEqual([])\n})\n\ntest('with string', () =\u003e {\n  const result = takeLastWhile(x =\u003e x !== 'F', 'FOOBAR')\n  expect(result).toBe('OOBAR')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {takeLastWhile} from 'rambda'\n\nconst list = [1, 2, 3]\nconst str = 'FOO'\n\ndescribe('R.takeLastWhile', () =\u003e {\n  it('with array', () =\u003e {\n    const result = takeLastWhile(x =\u003e x \u003e 1, list)\n\n    result // $ExpectType number[]\n  })\n  it('with array - curried', () =\u003e {\n    const result = takeLastWhile(x =\u003e x \u003e 1, list)\n\n    result // $ExpectType number[]\n  })\n  it('with string', () =\u003e {\n    const result = takeLastWhile(x =\u003e x !== 'F', str)\n\n    result // $ExpectType string\n  })\n  it('with string - curried', () =\u003e {\n    const result = takeLastWhile(x =\u003e x !== 'F')(str)\n\n    result // $ExpectType string\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#takeLastWhile)\n\n### takeWhile\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B1%2C%202%2C%203%2C%204%5D%0Aconst%20predicate%20%3D%20x%20%3D%3E%20x%20%3C%203%0A%0Aconst%20result%20%3D%20R.takeWhile(predicate%2C%20list)%0A%2F%2F%20%3D%3E%20%5B1%2C%202%5D\"\u003eTry this \u003cstrong\u003eR.takeWhile\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#takeWhile)\n\n### tap\n\n```typescript\n\ntap\u003cT\u003e(fn: (x: T) =\u003e void, input: T): T\n```\n\nIt applies function `fn` to input `x` and returns `x`. \n\nOne use case is debugging in the middle of `R.compose`.\n\n```javascript\nconst list = [1, 2, 3]\n\nR.compose(\n  R.map(x =\u003e x * 2)\n  R.tap(console.log),\n  R.filter(x =\u003e x \u003e 1)\n)(list)\n// =\u003e `2` and `3` will be logged\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B1%2C%202%2C%203%5D%0A%0AR.compose(%0A%20%20R.map(x%20%3D%3E%20x%20*%202)%0A%20%20R.tap(console.log)%2C%0A%20%20R.filter(x%20%3D%3E%20x%20%3E%201)%0A)(list)%0A%2F%2F%20%3D%3E%20%602%60%20and%20%603%60%20will%20be%20logged\"\u003eTry this \u003cstrong\u003eR.tap\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\ntap\u003cT\u003e(fn: (x: T) =\u003e void, input: T): T;\ntap\u003cT\u003e(fn: (x: T) =\u003e void): (input: T) =\u003e T;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.tap\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function tap(fn, x){\n  if (arguments.length === 1) return _x =\u003e tap(fn, _x)\n\n  fn(x)\n\n  return x\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { tap } from './tap.js'\n\ntest('tap', () =\u003e {\n  let a = 1\n  const sayX = x =\u003e a = x\n\n  expect(tap(sayX, 100)).toBe(100)\n  expect(tap(sayX)(100)).toBe(100)\n  expect(a).toBe(100)\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {tap, pipe} from 'rambda'\n\ndescribe('R.tap', () =\u003e {\n  it('happy', () =\u003e {\n    pipe(\n      tap(x =\u003e {\n        x // $ExpectType number[]\n      }),\n      (x: number[]) =\u003e x.length\n    )([1, 2])\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#tap)\n\n### test\n\n```typescript\n\ntest(regExpression: RegExp): (str: string) =\u003e boolean\n```\n\nIt determines whether `str` matches `regExpression`.\n\n```javascript\nR.test(/^f/, 'foo')\n// =\u003e true\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.test(%2F%5Ef%2F%2C%20'foo')%0A%2F%2F%20%3D%3E%20true\"\u003eTry this \u003cstrong\u003eR.test\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\ntest(regExpression: RegExp): (str: string) =\u003e boolean;\ntest(regExpression: RegExp, str: string): boolean;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.test\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function test(pattern, str){\n  if (arguments.length === 1) return _str =\u003e test(pattern, _str)\n\n  if (typeof pattern === 'string'){\n    throw new TypeError(`R.test requires a value of type RegExp as its first argument; received \"${ pattern }\"`)\n  }\n\n  return str.search(pattern) !== -1\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { test as testMethod } from './test.js'\n\ntest('happy', () =\u003e {\n  expect(testMethod(/^x/, 'xyz')).toBeTrue()\n\n  expect(testMethod(/^y/)('xyz')).toBeFalse()\n})\n\ntest('throws if first argument is not regex', () =\u003e {\n  expect(() =\u003e testMethod('foo', 'bar')).toThrowErrorMatchingInlineSnapshot('\"R.test requires a value of type RegExp as its first argument; received \"foo\"\"')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {test} from 'rambda'\n\nconst input = 'foo   '\nconst regex = /foo/\n\ndescribe('R.test', () =\u003e {\n  it('happy', () =\u003e {\n    const result = test(regex, input)\n\n    result // $ExpectType boolean\n  })\n  it('curried', () =\u003e {\n    const result = test(regex)(input)\n\n    result // $ExpectType boolean\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#test)\n\n### times\n\n```typescript\n\ntimes\u003cT\u003e(fn: (i: number) =\u003e T, howMany: number): T[]\n```\n\nIt returns the result of applying function `fn` over members of range array.\n\nThe range array includes numbers between `0` and `howMany`(exclusive).\n\n```javascript\nconst fn = x =\u003e x * 2\nconst howMany = 5\n\nR.times(fn, howMany)\n// =\u003e [0, 2, 4, 6, 8]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20fn%20%3D%20x%20%3D%3E%20x%20*%202%0Aconst%20howMany%20%3D%205%0A%0Aconst%20result%20%3D%20R.times(fn%2C%20howMany)%0A%2F%2F%20%3D%3E%20%5B0%2C%202%2C%204%2C%206%2C%208%5D\"\u003eTry this \u003cstrong\u003eR.times\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\ntimes\u003cT\u003e(fn: (i: number) =\u003e T, howMany: number): T[];\ntimes\u003cT\u003e(fn: (i: number) =\u003e T): (howMany: number) =\u003e T[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.times\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { isInteger } from './_internals/isInteger.js'\nimport { map } from './map.js'\nimport { range } from './range.js'\n\nexport function times(fn, howMany){\n  if (arguments.length === 1) return _howMany =\u003e times(fn, _howMany)\n  if (!isInteger(howMany) || howMany \u003c 0){\n    throw new RangeError('n must be an integer')\n  }\n\n  return map(fn, range(0, howMany))\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport assert from 'assert'\n\nimport { identity } from './identity.js'\nimport { times } from './times.js'\n\ntest('happy', () =\u003e {\n  const result = times(identity, 5)\n\n  expect(result).toEqual([ 0, 1, 2, 3, 4 ])\n})\n\ntest('with bad input', () =\u003e {\n  assert.throws(() =\u003e {\n    times(3)('cheers!')\n  }, RangeError)\n  assert.throws(() =\u003e {\n    times(identity, -1)\n  }, RangeError)\n})\n\ntest('curry', () =\u003e {\n  const result = times(identity)(5)\n\n  expect(result).toEqual([ 0, 1, 2, 3, 4 ])\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {times, identity} from 'rambda'\n\ndescribe('R.times', () =\u003e {\n  it('happy', () =\u003e {\n    const result = times(identity, 5)\n    result // $ExpectType number[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#times)\n\n### toLower\n\n```typescript\n\ntoLower\u003cS extends string\u003e(str: S): Lowercase\u003cS\u003e\n```\n\n```javascript\nR.toLower('FOO')\n// =\u003e 'foo'\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.toLower('FOO')%0A%2F%2F%20%3D%3E%20'foo'\"\u003eTry this \u003cstrong\u003eR.toLower\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\ntoLower\u003cS extends string\u003e(str: S): Lowercase\u003cS\u003e;\ntoLower(str: string): string;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.toLower\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function toLower(str){\n  return str.toLowerCase()\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { toLower } from './toLower.js'\n\ntest('toLower', () =\u003e {\n  expect(toLower('FOO|BAR|BAZ')).toBe('foo|bar|baz')\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#toLower)\n\n### toPairs\n\n```typescript\n\ntoPairs\u003cO extends object, K extends Extract\u003ckeyof O, string | number\u003e\u003e(obj: O): Array\u003c{ [key in K]: [`${key}`, O[key]] }[K]\u003e\n```\n\nIt transforms an object to a list.\n\n```javascript\nconst list = {\n  a : 1,\n  b : 2,\n  c : [ 3, 4 ],\n}\nconst expected = [ [ 'a', 1 ], [ 'b', 2 ], [ 'c', [ 3, 4 ] ] ]\n\nconst result = R.toPairs(list)\n// =\u003e `result` is equal to `expected`\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%7B%0A%20%20a%20%3A%201%2C%0A%20%20b%20%3A%202%2C%0A%20%20c%20%3A%20%5B%203%2C%204%20%5D%2C%0A%7D%0Aconst%20expected%20%3D%20%5B%20%5B%20'a'%2C%201%20%5D%2C%20%5B%20'b'%2C%202%20%5D%2C%20%5B%20'c'%2C%20%5B%203%2C%204%20%5D%20%5D%20%5D%0A%0Aconst%20result%20%3D%20R.toPairs(list)%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60\"\u003eTry this \u003cstrong\u003eR.toPairs\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\ntoPairs\u003cO extends object, K extends Extract\u003ckeyof O, string | number\u003e\u003e(obj: O): Array\u003c{ [key in K]: [`${key}`, O[key]] }[K]\u003e;\ntoPairs\u003cS\u003e(obj: Record\u003cstring | number, S\u003e): Array\u003c[string, S]\u003e;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.toPairs\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function toPairs(obj){\n  return Object.entries(obj)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { toPairs } from './toPairs.js'\n\nconst obj = {\n  a : 1,\n  b : 2,\n  c : [ 3, 4 ],\n}\nconst expected = [\n  [ 'a', 1 ],\n  [ 'b', 2 ],\n  [ 'c', [ 3, 4 ] ],\n]\n\ntest('happy', () =\u003e {\n  expect(toPairs(obj)).toEqual(expected)\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#toPairs)\n\n### toString\n\n```typescript\n\ntoString(x: unknown): string\n```\n\n```javascript\nR.toString([1, 2]) \n// =\u003e '1,2'\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.toString(%5B1%2C%202%5D)%20%0A%2F%2F%20%3D%3E%20'1%2C2'\"\u003eTry this \u003cstrong\u003eR.toString\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\ntoString(x: unknown): string;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.toString\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function toString(x){\n  return x.toString()\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { toString } from './toString.js'\n\ntest('happy', () =\u003e {\n  expect(toString([ 1, 2, 3 ])).toBe('1,2,3')\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#toString)\n\n### toUpper\n\n```typescript\n\ntoUpper\u003cS extends string\u003e(str: S): Uppercase\u003cS\u003e\n```\n\n```javascript\nR.toUpper('foo')\n// =\u003e 'FOO'\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.toUpper('foo')%0A%2F%2F%20%3D%3E%20'FOO'\"\u003eTry this \u003cstrong\u003eR.toUpper\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\ntoUpper\u003cS extends string\u003e(str: S): Uppercase\u003cS\u003e;\ntoUpper(str: string): string;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.toUpper\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function toUpper(str){\n  return str.toUpperCase()\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { toUpper } from './toUpper.js'\n\ntest('toUpper', () =\u003e {\n  expect(toUpper('foo|bar|baz')).toBe('FOO|BAR|BAZ')\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#toUpper)\n\n### transpose\n\n```typescript\n\ntranspose\u003cT\u003e(list: (T[])[]): (T[])[]\n```\n\n```javascript\nconst list = [[10, 11], [20], [], [30, 31, 32]]\nconst expected = [[10, 20, 30], [11, 31], [32]]\n\nconst result = R.transpose(list)\n// =\u003e `result` is equal to `expected`\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B%5B10%2C%2011%5D%2C%20%5B20%5D%2C%20%5B%5D%2C%20%5B30%2C%2031%2C%2032%5D%5D%0Aconst%20expected%20%3D%20%5B%5B10%2C%2020%2C%2030%5D%2C%20%5B11%2C%2031%5D%2C%20%5B32%5D%5D%0A%0Aconst%20result%20%3D%20R.transpose(list)%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60\"\u003eTry this \u003cstrong\u003eR.transpose\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\ntranspose\u003cT\u003e(list: (T[])[]): (T[])[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.transpose\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { isArray } from './_internals/isArray.js'\n\nexport function transpose(array){\n  return array.reduce((acc, el) =\u003e {\n    el.forEach((nestedEl, i) =\u003e\n      isArray(acc[ i ]) ? acc[ i ].push(nestedEl) : acc.push([ nestedEl ]))\n\n    return acc\n  }, [])\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { transpose } from './transpose.js'\n\ntest('happy', () =\u003e {\n  const input = [\n    [ 'a', 1 ],\n    [ 'b', 2 ],\n    [ 'c', 3 ],\n  ]\n\n  expect(transpose(input)).toEqual([\n    [ 'a', 'b', 'c' ],\n    [ 1, 2, 3 ],\n  ])\n})\n\ntest('when rows are shorter', () =\u003e {\n  const actual = transpose([ [ 10, 11 ], [ 20 ], [], [ 30, 31, 32 ] ])\n  const expected = [ [ 10, 20, 30 ], [ 11, 31 ], [ 32 ] ]\n  expect(actual).toEqual(expected)\n})\n\ntest('with empty array', () =\u003e {\n  expect(transpose([])).toEqual([])\n})\n\ntest('array with falsy values', () =\u003e {\n  const actual = transpose([\n    [ true, false, undefined, null ],\n    [ null, undefined, false, true ],\n  ])\n  const expected = [\n    [ true, null ],\n    [ false, undefined ],\n    [ undefined, false ],\n    [ null, true ],\n  ]\n  expect(actual).toEqual(expected)\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {transpose} from 'rambda'\n\nconst input = [\n  ['a', 1],\n  ['b', 2],\n  ['c', 3],\n]\n\ndescribe('R.transpose', () =\u003e {\n  it('happy', () =\u003e {\n    const result = transpose(input)\n\n    result // $ExpectType (string | number)[][]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#transpose)\n\n### trim\n\n```typescript\n\ntrim(str: string): string\n```\n\n```javascript\nR.trim('  foo  ') \n// =\u003e 'foo'\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.trim('%20%20foo%20%20')%20%0A%2F%2F%20%3D%3E%20'foo'\"\u003eTry this \u003cstrong\u003eR.trim\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\ntrim(str: string): string;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.trim\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function trim(str){\n  return str.trim()\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { trim } from './trim.js'\n\ntest('trim', () =\u003e {\n  expect(trim(' foo ')).toBe('foo')\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#trim)\n\n### tryCatch\n\nIt returns function that runs `fn` in `try/catch` block. If there was an error, then `fallback` is used to return the result. Note that `fn` can be value or asynchronous/synchronous function(unlike `Ramda` where fallback can only be a synchronous function).\n\n\u003e :boom: Please check the tests of `R.tryCatch` to fully understand how this method works.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20fn%20%3D%20x%20%3D%3E%20x.foo%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.tryCatch(fn%2C%20false)(null)%2C%0A%20%20R.tryCatch(fn%2C%20false)(%7Bfoo%3A%20'bar'%7D)%0A%5D%0A%2F%2F%20%3D%3E%20%5Bfalse%2C%20'bar'%5D\"\u003eTry this \u003cstrong\u003eR.tryCatch\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#tryCatch)\n\n### type\n\nIt accepts any input and it returns its type.\n\n\u003e :boom: `NaN`, `Promise` and `Async` are types specific for **Rambda**.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.type(()%20%3D%3E%20%7B%7D)%20%2F%2F%20%3D%3E%20'Function'%0AR.type(async%20()%20%3D%3E%20%7B%7D)%20%2F%2F%20%3D%3E%20'Async'%0AR.type(%5B%5D)%20%2F%2F%20%3D%3E%20'Array'%0AR.type(%7B%7D)%20%2F%2F%20%3D%3E%20'Object'%0AR.type('foo')%20%2F%2F%20%3D%3E%20'String'%0AR.type(1)%20%2F%2F%20%3D%3E%20'Number'%0AR.type(true)%20%2F%2F%20%3D%3E%20'Boolean'%0AR.type(null)%20%2F%2F%20%3D%3E%20'Null'%0AR.type(%2F%5BA-z%5D%2F)%20%2F%2F%20%3D%3E%20'RegExp'%0AR.type('foo'*1)%20%2F%2F%20%3D%3E%20'NaN'%0A%0Aconst%20delay%20%3D%20ms%20%3D%3E%20new%20Promise(resolve%20%3D%3E%20%7B%0A%20%20setTimeout(function%20()%20%7B%0A%20%20%20%20resolve()%0A%20%20%7D%2C%20ms)%0A%7D)%0AR.type(delay)%20%2F%2F%20%3D%3E%20'Promise'\"\u003eTry this \u003cstrong\u003eR.type\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#type)\n\n### unapply\n\n```typescript\n\nunapply\u003cT = any\u003e(fn: (args: any[]) =\u003e T): (...args: any[]) =\u003e T\n```\n\nIt calls a function `fn` with the list of values of the returned function. \n\n`R.unapply` is the opposite of `R.apply` method.\n\n```javascript\nR.unapply(JSON.stringify)(1, 2, 3)\n//=\u003e '[1,2,3]'\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.unapply(JSON.stringify)(1%2C%202%2C%203)%0A%2F%2F%3D%3E%20'%5B1%2C2%2C3%5D'\"\u003eTry this \u003cstrong\u003eR.unapply\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nunapply\u003cT = any\u003e(fn: (args: any[]) =\u003e T): (...args: any[]) =\u003e T;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.unapply\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function unapply(fn){\n  return function (...args){\n    return fn.call(this, args)\n  }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { apply } from './apply.js'\nimport { converge } from './converge.js'\nimport { identity } from './identity.js'\nimport { prop } from './prop.js'\nimport { sum } from './sum.js'\nimport { unapply } from './unapply.js'\n\ntest('happy', () =\u003e {\n  const fn = unapply(identity)\n  expect(fn(\n    1, 2, 3\n  )).toEqual([ 1, 2, 3 ])\n  expect(fn()).toEqual([])\n})\n\ntest('returns a function which is always passed one argument', () =\u003e {\n  const fn = unapply(function (){\n    return arguments.length\n  })\n  expect(fn('x')).toBe(1)\n  expect(fn('x', 'y')).toBe(1)\n  expect(fn(\n    'x', 'y', 'z'\n  )).toBe(1)\n})\n\ntest('forwards arguments to decorated function as an array', () =\u003e {\n  const fn = unapply(xs =\u003e '[' + xs + ']')\n  expect(fn(2)).toBe('[2]')\n  expect(fn(2, 4)).toBe('[2,4]')\n  expect(fn(\n    2, 4, 6\n  )).toBe('[2,4,6]')\n})\n\ntest('returns a function with length 0', () =\u003e {\n  const fn = unapply(identity)\n  expect(fn).toHaveLength(0)\n})\n\ntest('is the inverse of R.apply', () =\u003e {\n  let a, b, c, d, e, f, g, n\n  const rand = function (){\n    return Math.floor(200 * Math.random()) - 100\n  }\n\n  f = Math.max\n  g = unapply(apply(f))\n  n = 1\n  while (n \u003c= 100){\n    a = rand()\n    b = rand()\n    c = rand()\n    d = rand()\n    e = rand()\n    expect(f(\n      a, b, c, d, e\n    )).toEqual(g(\n      a, b, c, d, e\n    ))\n    n += 1\n  }\n\n  f = function (xs){\n    return '[' + xs + ']'\n  }\n  g = apply(unapply(f))\n  n = 1\n  while (n \u003c= 100){\n    a = rand()\n    b = rand()\n    c = rand()\n    d = rand()\n    e = rand()\n    expect(f([ a, b, c, d, e ])).toEqual(g([ a, b, c, d, e ]))\n    n += 1\n  }\n})\n\ntest('it works with converge', () =\u003e {\n  const fn = unapply(sum)\n  const convergeFn = converge(fn, [ prop('a'), prop('b'), prop('c') ])\n  const obj = {\n    a : 1337,\n    b : 42,\n    c : 1,\n  }\n  const expected = 1337 + 42 + 1\n  expect(convergeFn(obj)).toEqual(expected)\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {join, unapply, sum} from 'rambda'\n\ndescribe('R.unapply', () =\u003e {\n  it('happy', () =\u003e {\n    const fn = unapply(sum)\n\n    fn(1, 2, 3) // $ExpectType number\n  })\n\n  it('joins a string', () =\u003e {\n    const fn = unapply(join(''))\n\n    fn('s', 't', 'r', 'i', 'n', 'g') // $ExpectType string\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#unapply)\n\n### union\n\n```typescript\n\nunion\u003cT\u003e(x: T[], y: T[]): T[]\n```\n\nIt takes two lists and return a new list containing a merger of both list with removed duplicates. \n\n`R.equals` is used to compare for duplication.\n\n```javascript\nconst result = R.union([1,2,3], [3,4,5]);\n// =\u003e [1, 2, 3, 4, 5]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.union(%5B1%2C2%2C3%5D%2C%20%5B3%2C4%2C5%5D)%3B%0A%2F%2F%20%3D%3E%20%5B1%2C%202%2C%203%2C%204%2C%205%5D\"\u003eTry this \u003cstrong\u003eR.union\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nunion\u003cT\u003e(x: T[], y: T[]): T[];\nunion\u003cT\u003e(x: T[]): (y: T[]) =\u003e T[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.union\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { cloneList } from './_internals/cloneList.js'\nimport { includes } from './includes.js'\n\nexport function union(x, y){\n  if (arguments.length === 1) return _y =\u003e union(x, _y)\n\n  const toReturn = cloneList(x)\n\n  y.forEach(yInstance =\u003e {\n    if (!includes(yInstance, x)) toReturn.push(yInstance)\n  })\n\n  return toReturn\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { union } from './union.js'\n\ntest('happy', () =\u003e {\n  expect(union([ 1, 2 ], [ 2, 3 ])).toEqual([ 1, 2, 3 ])\n})\n\ntest('with list of objects', () =\u003e {\n  const list1 = [ { a : 1 }, { a : 2 } ]\n  const list2 = [ { a : 2 }, { a : 3 } ]\n  const result = union(list1)(list2)\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {union} from 'rambda'\n\ndescribe('R.union', () =\u003e {\n  it('happy', () =\u003e {\n    const result = union([1, 2], [2, 3])\n\n    result // $ExpectType number[]\n  })\n  it('with array of objects - case 1', () =\u003e {\n    const list1 = [{a: 1}, {a: 2}]\n    const list2 = [{a: 2}, {a: 3}]\n    const result = union(list1, list2)\n    result // $ExpectType { a: number; }[]\n  })\n  it('with array of objects - case 2', () =\u003e {\n    const list1 = [{a: 1, b: 1}, {a: 2}]\n    const list2 = [{a: 2}, {a: 3, b: 3}]\n    const result = union(list1, list2)\n    result[0].a // $ExpectType number\n    result[0].b // $ExpectType number | undefined\n  })\n})\n\ndescribe('R.union - curried', () =\u003e {\n  it('happy', () =\u003e {\n    const result = union([1, 2])([2, 3])\n\n    result // $ExpectType number[]\n  })\n  it('with array of objects - case 1', () =\u003e {\n    const list1 = [{a: 1}, {a: 2}]\n    const list2 = [{a: 2}, {a: 3}]\n    const result = union(list1)(list2)\n    result // $ExpectType { a: number; }[]\n  })\n  it('with array of objects - case 2', () =\u003e {\n    const list1 = [{a: 1, b: 1}, {a: 2}]\n    const list2 = [{a: 2}, {a: 3, b: 3}]\n    const result = union(list1)(list2)\n    result[0].a // $ExpectType number\n    result[0].b // $ExpectType number | undefined\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#union)\n\n### uniq\n\n```typescript\n\nuniq\u003cT\u003e(list: T[]): T[]\n```\n\nIt returns a new array containing only one copy of each element of `list`.\n\n`R.equals` is used to determine equality.\n\n```javascript\nconst list = [1, 1, {a: 1}, {a: 2}, {a:1}]\n\nR.uniq(list)\n// =\u003e [1, {a: 1}, {a: 2}]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B1%2C%201%2C%20%7Ba%3A%201%7D%2C%20%7Ba%3A%202%7D%2C%20%7Ba%3A1%7D%5D%0A%0Aconst%20result%20%3D%20R.uniq(list)%0A%2F%2F%20%3D%3E%20%5B1%2C%20%7Ba%3A%201%7D%2C%20%7Ba%3A%202%7D%5D\"\u003eTry this \u003cstrong\u003eR.uniq\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nuniq\u003cT\u003e(list: T[]): T[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.uniq\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { _Set } from './_internals/set.js'\n\nexport function uniq(list){\n  const set = new _Set()\n  const willReturn = []\n  list.forEach(item =\u003e {\n    if (set.checkUniqueness(item)){\n      willReturn.push(item)\n    }\n  })\n\n  return willReturn\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { uniq } from './uniq.js'\n\ntest('happy', () =\u003e {\n  const list = [ 1, 2, 3, 3, 3, 1, 2, 0 ]\n  expect(uniq(list)).toEqual([ 1, 2, 3, 0 ])\n})\n\ntest('with object', () =\u003e {\n  const list = [ { a : 1 }, { a : 2 }, { a : 1 }, { a : 2 } ]\n  expect(uniq(list)).toEqual([ { a : 1 }, { a : 2 } ])\n})\n\ntest('with nested array', () =\u003e {\n  expect(uniq([ [ 42 ], [ 42 ] ])).toEqual([ [ 42 ] ])\n})\n\ntest('with booleans', () =\u003e {\n  expect(uniq([ [ false ], [ false ], [ true ] ])).toEqual([ [ false ], [ true ] ])\n})\n\ntest('with falsy values', () =\u003e {\n  expect(uniq([ undefined, null ])).toEqual([ undefined, null ])\n})\n\ntest('can distinct between string and number', () =\u003e {\n  expect(uniq([ 1, '1' ])).toEqual([ 1, '1' ])\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {uniq} from 'rambda'\n\ndescribe('R.uniq', () =\u003e {\n  it('happy', () =\u003e {\n    const result = uniq([1, 2, 3, 3, 3, 1, 2, 0])\n    result // $ExpectType number[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#uniq)\n\n### uniqBy\n\nIt applies uniqueness to input list based on function that defines what to be used for comparison between elements.\n\n`R.equals` is used to determine equality.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B%7Ba%3A1%7D%2C%20%7Ba%3A2%7D%2C%20%7Ba%3A1%7D%5D%0Aconst%20result%20%3D%20R.uniqBy(x%20%3D%3E%20x%2C%20list)%0A%0A%2F%2F%20%3D%3E%20%5B%7Ba%3A1%7D%2C%20%7Ba%3A2%7D%5D\"\u003eTry this \u003cstrong\u003eR.uniqBy\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#uniqBy)\n\n### uniqWith\n\n```typescript\n\nuniqWith\u003cT, U\u003e(predicate: (x: T, y: T) =\u003e boolean, list: T[]): T[]\n```\n\nIt returns a new array containing only one copy of each element in `list` according to `predicate` function.\n\nThis predicate should return true, if two elements are equal.\n\n```javascript\nconst list = [\n  {id: 0, title:'foo'},\n  {id: 1, title:'bar'},\n  {id: 2, title:'baz'},\n  {id: 3, title:'foo'},\n  {id: 4, title:'bar'},\n]\n\nconst expected = [\n  {id: 0, title:'foo'},\n  {id: 1, title:'bar'},\n  {id: 2, title:'baz'},\n]\n\nconst predicate = (x,y) =\u003e x.title === y.title\n\nconst result = R.uniqWith(predicate, list)\n// =\u003e `result` is equal to `expected`\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list%20%3D%20%5B%0A%20%20%7Bid%3A%200%2C%20title%3A'foo'%7D%2C%0A%20%20%7Bid%3A%201%2C%20title%3A'bar'%7D%2C%0A%20%20%7Bid%3A%202%2C%20title%3A'baz'%7D%2C%0A%20%20%7Bid%3A%203%2C%20title%3A'foo'%7D%2C%0A%20%20%7Bid%3A%204%2C%20title%3A'bar'%7D%2C%0A%5D%0A%0Aconst%20expected%20%3D%20%5B%0A%20%20%7Bid%3A%200%2C%20title%3A'foo'%7D%2C%0A%20%20%7Bid%3A%201%2C%20title%3A'bar'%7D%2C%0A%20%20%7Bid%3A%202%2C%20title%3A'baz'%7D%2C%0A%5D%0A%0Aconst%20predicate%20%3D%20(x%2Cy)%20%3D%3E%20x.title%20%3D%3D%3D%20y.title%0A%0Aconst%20result%20%3D%20R.uniqWith(predicate%2C%20list)%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60\"\u003eTry this \u003cstrong\u003eR.uniqWith\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nuniqWith\u003cT, U\u003e(predicate: (x: T, y: T) =\u003e boolean, list: T[]): T[];\nuniqWith\u003cT, U\u003e(predicate: (x: T, y: T) =\u003e boolean): (list: T[]) =\u003e T[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.uniqWith\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nfunction includesWith(\n  predicate, target, list\n){\n  let willReturn = false\n  let index = -1\n\n  while (++index \u003c list.length \u0026\u0026 !willReturn){\n    const value = list[ index ]\n\n    if (predicate(target, value)){\n      willReturn = true\n    }\n  }\n\n  return willReturn\n}\n\nexport function uniqWith(predicate, list){\n  if (arguments.length === 1) return _list =\u003e uniqWith(predicate, _list)\n\n  let index = -1\n  const willReturn = []\n\n  while (++index \u003c list.length){\n    const value = list[ index ]\n\n    if (!includesWith(\n      predicate, value, willReturn\n    )){\n      willReturn.push(value)\n    }\n  }\n\n  return willReturn\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { uniqWith as uniqWithRamda } from 'ramda'\n\nimport { uniqWith } from './uniqWith.js'\n\nconst list = [ { a : 1 }, { a : 1 } ]\n\ntest('happy', () =\u003e {\n  const fn = (x, y) =\u003e x.a === y.a\n\n  const result = uniqWith(fn, list)\n  expect(result).toEqual([ { a : 1 } ])\n})\n\ntest('with list of strings', () =\u003e {\n  const fn = (x, y) =\u003e x.length === y.length\n  const list = [ '0', '11', '222', '33', '4', '55' ]\n  const result = uniqWith(fn)(list)\n  const resultRamda = uniqWithRamda(fn, list)\n  expect(result).toEqual([ '0', '11', '222' ])\n  expect(resultRamda).toEqual([ '0', '11', '222' ])\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {uniqWith} from 'rambda'\n\ndescribe('R.uniqWith', () =\u003e {\n  it('happy', () =\u003e {\n    const list = [{a: 1}, {a: 1}]\n\n    const fn = (x: any, y: any) =\u003e x.a === y.a\n\n    const result = uniqWith(fn, list)\n    result // $ExpectType { a: number; }[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#uniqWith)\n\n### unless\n\n```typescript\n\nunless\u003cT, U\u003e(predicate: (x: T) =\u003e boolean, whenFalseFn: (x: T) =\u003e U, x: T): T | U\n```\n\nThe method returns function that will be called with argument `input`.\n\nIf `predicate(input)` returns `false`, then the end result will be the outcome of `whenFalse(input)`.\n\nIn the other case, the final output will be the `input` itself.\n\n```javascript\nconst fn = R.unless(\n  x =\u003e x \u003e 2,\n  x =\u003e x + 10\n)\n\nconst result = [\n  fn(1),\n  fn(5)\n]\n// =\u003e [11, 5]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20fn%20%3D%20R.unless(%0A%20%20x%20%3D%3E%20x%20%3E%202%2C%0A%20%20x%20%3D%3E%20x%20%2B%2010%0A)%0A%0Aconst%20result%20%3D%20%5B%0A%20%20fn(1)%2C%0A%20%20fn(5)%0A%5D%0A%2F%2F%20%3D%3E%20%5B11%2C%205%5D\"\u003eTry this \u003cstrong\u003eR.unless\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nunless\u003cT, U\u003e(predicate: (x: T) =\u003e boolean, whenFalseFn: (x: T) =\u003e U, x: T): T | U;\nunless\u003cT, U\u003e(predicate: (x: T) =\u003e boolean, whenFalseFn: (x: T) =\u003e U): (x: T) =\u003e T | U;\nunless\u003cT\u003e(predicate: (x: T) =\u003e boolean, whenFalseFn: (x: T) =\u003e T, x: T): T;\nunless\u003cT\u003e(predicate: (x: T) =\u003e boolean, whenFalseFn: (x: T) =\u003e T): (x: T) =\u003e T;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.unless\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { curry } from './curry.js'\n\nfunction unlessFn(\n  predicate, whenFalseFn, input\n){\n  if (predicate(input)) return input\n\n  return whenFalseFn(input)\n}\n\nexport const unless = curry(unlessFn)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { inc } from './inc.js'\nimport { isNil } from './isNil.js'\nimport { unless } from './unless.js'\n\ntest('happy', () =\u003e {\n  const safeInc = unless(isNil, inc)\n  expect(safeInc(null)).toBeNull()\n  expect(safeInc(1)).toBe(2)\n})\n\ntest('curried', () =\u003e {\n  const safeIncCurried = unless(isNil)(inc)\n  expect(safeIncCurried(null)).toBeNull()\n})\n\ntest('with 3 inputs', () =\u003e {\n  let result = unless(x =\u003e x.startsWith('/'), x=\u003e x.concat('/'), '/api')\n  expect(result).toBe('/api')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {unless, inc} from 'rambda'\n\ndescribe('R.unless', () =\u003e {\n  it('happy', () =\u003e {\n    const fn = unless(x =\u003e x \u003e 5, inc)\n    const result = fn(1)\n    result // $ExpectType number\n  })\n  it('with one explicit type', () =\u003e {\n    const result = unless(\n      x =\u003e {\n        x // $ExpectType number\n        return x \u003e 5\n      },\n      x =\u003e {\n        x // $ExpectType number\n        return x + 1\n      },\n      1\n    )\n    result // $ExpectType number\n  })\n  it('with two different explicit types', () =\u003e {\n    const result = unless(\n      x =\u003e {\n        x // $ExpectType number\n        return x \u003e 5\n      },\n      x =\u003e {\n        x // $ExpectType number\n        return `${x}-foo`\n      },\n      1\n    )\n    result // $ExpectType string | number\n  })\n})\n\ndescribe('R.unless - curried', () =\u003e {\n  it('happy', () =\u003e {\n    const fn = unless(x =\u003e x \u003e 5, inc)\n    const result = fn(1)\n    result // $ExpectType number\n  })\n  it('with one explicit type', () =\u003e {\n    const fn = unless\u003cnumber\u003e(\n      x =\u003e {\n        x // $ExpectType number\n        return x \u003e 5\n      },\n      x =\u003e {\n        x // $ExpectType number\n        return x + 1\n      }\n    )\n    const result = fn(1)\n    result // $ExpectType number\n  })\n  it('with two different explicit types', () =\u003e {\n    const fn = unless\u003cnumber, string\u003e(\n      x =\u003e {\n        x // $ExpectType number\n        return x \u003e 5\n      },\n      x =\u003e {\n        x // $ExpectType number\n        return `${x}-foo`\n      }\n    )\n    const result = fn(1)\n    result // $ExpectType string | number\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#unless)\n\n### unnest\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20R.unnest(%5B1%2C%20%5B2%5D%2C%20%5B%5B3%5D%5D%5D)%0A%2F%2F%20%3D%3E%20%5B1%2C%202%2C%20%5B3%5D%5D\"\u003eTry this \u003cstrong\u003eR.unnest\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#unnest)\n\n### unwind\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20obj%20%3D%20%7B%0A%20%20a%3A%201%2C%0A%20%20b%3A%20%5B2%2C%203%5D%2C%0A%7D%0Aconst%20result%20%3D%20R.unwind('b'%2C%20obj)%0Aconst%20expected%20%3D%20%5B%7Ba%3A1%2C%20b%3A2%7D%2C%20%7Ba%3A1%2C%20b%3A3%7D%5D%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60\"\u003eTry this \u003cstrong\u003eR.unwind\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#unwind)\n\n### update\n\n```typescript\n\nupdate\u003cT\u003e(index: number, newValue: T, list: T[]): T[]\n```\n\nIt returns a copy of `list` with updated element at `index` with `newValue`.\n\n```javascript\nconst index = 2\nconst newValue = 88\nconst list = [1, 2, 3, 4, 5]\n\nconst result = R.update(index, newValue, list)\n// =\u003e [1, 2, 88, 4, 5]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20index%20%3D%202%0Aconst%20newValue%20%3D%2088%0Aconst%20list%20%3D%20%5B1%2C%202%2C%203%2C%204%2C%205%5D%0A%0Aconst%20result%20%3D%20R.update(index%2C%20newValue%2C%20list)%0A%2F%2F%20%3D%3E%20%5B1%2C%202%2C%2088%2C%204%2C%205%5D\"\u003eTry this \u003cstrong\u003eR.update\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nupdate\u003cT\u003e(index: number, newValue: T, list: T[]): T[];\nupdate\u003cT\u003e(index: number, newValue: T): (list: T[]) =\u003e T[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.update\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { cloneList } from './_internals/cloneList.js'\nimport { curry } from './curry.js'\n\nexport function updateFn(\n  index, newValue, list\n){\n  const clone = cloneList(list)\n  if (index === -1) return clone.fill(newValue, index)\n\n  return clone.fill(\n    newValue, index, index + 1\n  )\n}\n\nexport const update = curry(updateFn)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { update } from './update.js'\n\nconst list = [ 1, 2, 3 ]\n\ntest('happy', () =\u003e {\n  const newValue = 8\n  const index = 1\n  const result = update(\n    index, newValue, list\n  )\n  const curriedResult = update(index, newValue)(list)\n  const tripleCurriedResult = update(index)(newValue)(list)\n\n  const expected = [ 1, 8, 3 ]\n  expect(result).toEqual(expected)\n  expect(curriedResult).toEqual(expected)\n  expect(tripleCurriedResult).toEqual(expected)\n})\n\ntest('list has no such index', () =\u003e {\n  const newValue = 8\n  const index = 10\n  const result = update(\n    index, newValue, list\n  )\n\n  expect(result).toEqual(list)\n})\n\ntest('with negative index', () =\u003e {\n  expect(update(\n    -1, 10, [ 1 ]\n  )).toEqual([ 10 ])\n  expect(update(\n    -1, 10, []\n  )).toEqual([])\n  expect(update(\n    -1, 10, list\n  )).toEqual([ 1, 2, 10 ])\n  expect(update(\n    -2, 10, list\n  )).toEqual([ 1, 10, 3 ])\n  expect(update(\n    -3, 10, list\n  )).toEqual([ 10, 2, 3 ])\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {update} from 'rambda'\n\ndescribe('R.update', () =\u003e {\n  it('happy', () =\u003e {\n    const result = update(1, 0, [1, 2, 3])\n    result // $ExpectType number[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#update)\n\n### values\n\n```typescript\n\nvalues\u003cT extends object, K extends keyof T\u003e(obj: T): T[K][]\n```\n\nWith correct input, this is nothing more than `Object.values(Record\u003cstring, unknown\u003e)`. If `obj` is not an object, then it returns an empty array.\n\n```javascript\nconst obj = {a:1, b:2}\n\nR.values(Record\u003cstring, unknown\u003e)\n// =\u003e [1, 2]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20obj%20%3D%20%7Ba%3A1%2C%20b%3A2%7D%0A%0Aconst%20result%20%3D%20R.values(Record%3Cstring%2C%20unknown%3E)%0A%2F%2F%20%3D%3E%20%5B1%2C%202%5D\"\u003eTry this \u003cstrong\u003eR.values\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nvalues\u003cT extends object, K extends keyof T\u003e(obj: T): T[K][];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.values\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { type } from './type.js'\n\nexport function values(obj){\n  if (type(obj) !== 'Object') return []\n  return Object.values(obj)\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { values } from './values.js'\n\ntest('happy', () =\u003e {\n  expect(values({\n    a : 1,\n    b : 2,\n    c : 3,\n  })).toEqual([ 1, 2, 3 ])\n})\n\ntest('with bad input', () =\u003e {\n  expect(values(null)).toEqual([])\n  expect(values(undefined)).toEqual([])\n  expect(values(55)).toEqual([])\n  expect(values('foo')).toEqual([])\n  expect(values(true)).toEqual([])\n  expect(values(false)).toEqual([])\n  expect(values(NaN)).toEqual([])\n  expect(values(Infinity)).toEqual([])\n  expect(values([])).toEqual([])\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {values} from 'rambda'\n\ndescribe('R.values', () =\u003e {\n  it('happy', () =\u003e {\n    const result = values({\n      a: 1,\n      b: 2,\n      c: 3,\n    })\n    result // $ExpectType number[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#values)\n\n### view\n\n```typescript\n\nview\u003cS, A\u003e(lens: Lens\u003cS, A\u003e): (obj: S) =\u003e A\n```\n\nIt returns the value of `lens` focus over `target` object.\n\n```javascript\nconst lens = R.lensProp('x')\n\nR.view(lens, {x: 1, y: 2}) // =\u003e 1\nR.view(lens, {x: 4, y: 2}) // =\u003e 4\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20lens%20%3D%20R.lensProp('x')%0A%0AR.view(lens%2C%20%7Bx%3A%201%2C%20y%3A%202%7D)%20%2F%2F%20%3D%3E%201%0Aconst%20result%20%3D%20R.view(lens%2C%20%7Bx%3A%204%2C%20y%3A%202%7D)%20%2F%2F%20%3D%3E%204\"\u003eTry this \u003cstrong\u003eR.view\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nview\u003cS, A\u003e(lens: Lens\u003cS, A\u003e): (obj: S) =\u003e A;\nview\u003cS, A\u003e(lens: Lens\u003cS, A\u003e, obj: S): A;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.view\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nconst Const = x =\u003e ({\n  x,\n  map : fn =\u003e Const(x),\n})\n\nexport function view(lens, target){\n  if (arguments.length === 1) return _target =\u003e view(lens, _target)\n\n  return lens(Const)(target).x\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { assoc } from './assoc.js'\nimport { lens } from './lens.js'\nimport { prop } from './prop.js'\nimport { view } from './view.js'\n\nconst testObject = { foo : 'Led Zeppelin' }\nconst assocLens = lens(prop('foo'), assoc('foo'))\n\ntest('happy', () =\u003e {\n  expect(view(assocLens, testObject)).toBe('Led Zeppelin')\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#view)\n\n### when\n\n```typescript\n\nwhen\u003cT, U\u003e(predicate: (x: T) =\u003e boolean, whenTrueFn: (a: T) =\u003e U, input: T): T | U\n```\n\nIt pass `input` to `predicate` function and if the result is `true`, it will return the result of `whenTrueFn(input)`. \nIf the `predicate` returns `false`, then it will simply return `input`.\n\n```javascript\nconst predicate = x =\u003e typeof x === 'number'\nconst whenTrueFn = R.add(11)\n\nconst fn = when(predicate, whenTrueResult)\n\nconst positiveInput = 88\nconst negativeInput = 'foo'\n\nconst result = [\n  fn(positiveInput),\n  fn(positiveInput),\n]\n\nconst expected = [\n  99,\n  'foo',\n]\n// =\u003e `result` is equal to `expected`\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20predicate%20%3D%20x%20%3D%3E%20typeof%20x%20%3D%3D%3D%20'number'%0Aconst%20whenTrueFn%20%3D%20R.add(11)%0A%0Aconst%20fn%20%3D%20when(predicate%2C%20whenTrueResult)%0A%0Aconst%20positiveInput%20%3D%2088%0Aconst%20negativeInput%20%3D%20'foo'%0A%0Aconst%20result%20%3D%20%5B%0A%20%20fn(positiveInput)%2C%0A%20%20fn(positiveInput)%2C%0A%5D%0A%0Aconst%20expected%20%3D%20%5B%0A%20%2099%2C%0A%20%20'foo'%2C%0A%5D%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60\"\u003eTry this \u003cstrong\u003eR.when\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nwhen\u003cT, U\u003e(predicate: (x: T) =\u003e boolean, whenTrueFn: (a: T) =\u003e U, input: T): T | U;\nwhen\u003cT, U\u003e(predicate: (x: T) =\u003e boolean, whenTrueFn: (a: T) =\u003e U): (input: T) =\u003e T | U;\nwhen\u003cT, U\u003e(predicate: (x: T) =\u003e boolean): ((whenTrueFn: (a: T) =\u003e U) =\u003e (input: T) =\u003e T | U);\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.when\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { curry } from './curry.js'\n\nfunction whenFn(\n  predicate, whenTrueFn, input\n){\n  if (!predicate(input)) return input\n\n  return whenTrueFn(input)\n}\n\nexport const when = curry(whenFn)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { add } from './add.js'\nimport { when } from './when.js'\n\nconst predicate = x =\u003e typeof x === 'number'\n\ntest('happy', () =\u003e {\n  const fn = when(predicate, add(11))\n  expect(fn(11)).toBe(22)\n  expect(fn('foo')).toBe('foo')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {when} from 'rambda'\n\nconst predicate = (x: number) =\u003e x \u003e 2\nconst whenTrueFn = (x: number) =\u003e String(x)\n\ndescribe('R.when', () =\u003e {\n  it('happy', () =\u003e {\n    const result = when(predicate, whenTrueFn, 1)\n    result // $ExpectType string | 1\n  })\n\n  it('curry 1', () =\u003e {\n    const fn = when(predicate, whenTrueFn)\n    const result = fn(1)\n    result // $ExpectType string | number\n  })\n\n  it('curry 2 require explicit types', () =\u003e {\n    const fn = when\u003cnumber, string\u003e(predicate)(whenTrueFn)\n    const result = fn(1)\n    result // $ExpectType string | number\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#when)\n\n### where\n\n```typescript\n\nwhere\u003cT, U\u003e(conditions: T, input: U): boolean\n```\n\nIt returns `true` if all each property in `conditions` returns `true` when applied to corresponding property in `input` object.\n\n```javascript\nconst condition = R.where({\n  a : x =\u003e typeof x === \"string\",\n  b : x =\u003e x === 4\n})\nconst input = {\n  a : \"foo\",\n  b : 4,\n  c : 11,\n}\n\nconst result = condition(input) \n// =\u003e true\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20condition%20%3D%20R.where(%7B%0A%20%20a%20%3A%20x%20%3D%3E%20typeof%20x%20%3D%3D%3D%20%22string%22%2C%0A%20%20b%20%3A%20x%20%3D%3E%20x%20%3D%3D%3D%204%0A%7D)%0Aconst%20input%20%3D%20%7B%0A%20%20a%20%3A%20%22foo%22%2C%0A%20%20b%20%3A%204%2C%0A%20%20c%20%3A%2011%2C%0A%7D%0A%0Aconst%20result%20%3D%20condition(input)%20%0A%2F%2F%20%3D%3E%20true\"\u003eTry this \u003cstrong\u003eR.where\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nwhere\u003cT, U\u003e(conditions: T, input: U): boolean;\nwhere\u003cT\u003e(conditions: T): \u003cU\u003e(input: U) =\u003e boolean;\nwhere\u003cObjFunc2, U\u003e(conditions: ObjFunc2, input: U): boolean;\nwhere\u003cObjFunc2\u003e(conditions: ObjFunc2): \u003cU\u003e(input: U) =\u003e boolean;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.where\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function where(conditions, input){\n  if (input === undefined){\n    return _input =\u003e where(conditions, _input)\n  }\n  let flag = true\n  for (const prop in conditions){\n    if (!flag) continue\n    const result = conditions[ prop ](input[ prop ])\n    if (flag \u0026\u0026 result === false){\n      flag = false\n    }\n  }\n\n  return flag\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { equals } from './equals.js'\nimport { where } from './where.js'\n\ntest('when true', () =\u003e {\n  const result = where({\n    a : equals('foo'),\n    b : equals('bar'),\n  },\n  {\n    a : 'foo',\n    b : 'bar',\n    x : 11,\n    y : 19,\n  })\n\n  expect(result).toBeTrue()\n})\n\ntest('when false | early exit', () =\u003e {\n  let counter = 0\n  const equalsFn = expected =\u003e input =\u003e {\n    console.log(expected, 'expected')\n    counter++\n\n    return input === expected\n  }\n  const predicate = where({\n    a : equalsFn('foo'),\n    b : equalsFn('baz'),\n  })\n  expect(predicate({\n    a : 'notfoo',\n    b : 'notbar',\n  })).toBeFalse()\n  expect(counter).toBe(1)\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {where, equals} from 'rambda'\n\ndescribe('R.where', () =\u003e {\n  it('happy', () =\u003e {\n    const input = {\n      a: 'foo',\n      b: 'bar',\n      x: 11,\n      y: 19,\n    }\n    const conditions = {\n      a: equals('foo'),\n      b: equals('bar'),\n    }\n    const result = where(conditions, input)\n    const curriedResult = where(conditions)(input)\n    result // $ExpectType boolean\n    curriedResult // $ExpectType boolean\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#where)\n\n### whereAny\n\nSame as `R.where`, but it will return `true` if at least one condition check returns `true`.\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20conditions%20%3D%20%7B%0A%20%20a%3A%20a%20%3D%3E%20a%20%3E%201%2C%0A%20%20b%3A%20b%20%3D%3E%20b%20%3E%202%2C%0A%7D%0Aconst%20result%20%3D%20%5B%0A%20%20R.whereAny(conditions%2C%20%7Bb%3A3%7D)%2C%0A%20%20R.whereAny(conditions%2C%20%7Bc%3A4%7D)%0A%5D%0A%2F%2F%20%3D%3E%20%5Btrue%2C%20false%5D\"\u003eTry this \u003cstrong\u003eR.whereAny\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#whereAny)\n\n### whereEq\n\n```typescript\n\nwhereEq\u003cT, U\u003e(condition: T, input: U): boolean\n```\n\nIt will return `true` if all of `input` object fully or partially include `rule` object.\n\n`R.equals` is used to determine equality.\n\n```javascript\nconst condition = { a : { b : 1 } }\nconst input = {\n  a : { b : 1 },\n  c : 2\n}\n\nconst result = whereEq(condition, input)\n// =\u003e true\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20condition%20%3D%20%7B%20a%20%3A%20%7B%20b%20%3A%201%20%7D%20%7D%0Aconst%20input%20%3D%20%7B%0A%20%20a%20%3A%20%7B%20b%20%3A%201%20%7D%2C%0A%20%20c%20%3A%202%0A%7D%0A%0Aconst%20result%20%3D%20whereEq(condition%2C%20input)%0A%2F%2F%20%3D%3E%20true\"\u003eTry this \u003cstrong\u003eR.whereEq\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nwhereEq\u003cT, U\u003e(condition: T, input: U): boolean;\nwhereEq\u003cT\u003e(condition: T): \u003cU\u003e(input: U) =\u003e boolean;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.whereEq\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { equals } from './equals.js'\nimport { filter } from './filter.js'\n\nexport function whereEq(condition, input){\n  if (arguments.length === 1){\n    return _input =\u003e whereEq(condition, _input)\n  }\n\n  const result = filter((conditionValue, conditionProp) =\u003e\n    equals(conditionValue, input[ conditionProp ]),\n  condition)\n\n  return Object.keys(result).length === Object.keys(condition).length\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { whereEq } from './whereEq.js'\n\ntest('when true', () =\u003e {\n  const condition = { a : 1 }\n  const input = {\n    a : 1,\n    b : 2,\n  }\n\n  const result = whereEq(condition, input)\n  const expectedResult = true\n\n  expect(result).toEqual(expectedResult)\n})\n\ntest('when false', () =\u003e {\n  const condition = { a : 1 }\n  const input = { b : 2 }\n\n  const result = whereEq(condition, input)\n  const expectedResult = false\n\n  expect(result).toEqual(expectedResult)\n})\n\ntest('with nested object', () =\u003e {\n  const condition = { a : { b : 1 } }\n  const input = {\n    a : { b : 1 },\n    c : 2,\n  }\n\n  const result = whereEq(condition)(input)\n  const expectedResult = true\n\n  expect(result).toEqual(expectedResult)\n})\n\ntest('with wrong input', () =\u003e {\n  const condition = { a : { b : 1 } }\n\n  expect(() =\u003e whereEq(condition, null)).toThrowErrorMatchingInlineSnapshot('\"Cannot read properties of null (reading \\'a\\')\"')\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {whereEq} from 'rambda'\n\ndescribe('R.whereEq', () =\u003e {\n  it('happy', () =\u003e {\n    const result = whereEq({a: {b: 2}}, {b: 2})\n    const curriedResult = whereEq({a: {b: 2}})({b: 2})\n    result // $ExpectType boolean\n    curriedResult // $ExpectType boolean\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#whereEq)\n\n### without\n\n```typescript\n\nwithout\u003cT\u003e(matchAgainst: T[], source: T[]): T[]\n```\n\nIt will return a new array, based on all members of `source` list that are not part of `matchAgainst` list.\n\n`R.equals` is used to determine equality.\n\n```javascript\nconst source = [1, 2, 3, 4]\nconst matchAgainst = [2, 3]\n\nconst result = R.without(matchAgainst, source)\n// =\u003e [1, 4]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20source%20%3D%20%5B1%2C%202%2C%203%2C%204%5D%0Aconst%20matchAgainst%20%3D%20%5B2%2C%203%5D%0A%0Aconst%20result%20%3D%20R.without(matchAgainst%2C%20source)%0A%2F%2F%20%3D%3E%20%5B1%2C%204%5D\"\u003eTry this \u003cstrong\u003eR.without\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nwithout\u003cT\u003e(matchAgainst: T[], source: T[]): T[];\nwithout\u003cT\u003e(matchAgainst: T[]): (source: T[]) =\u003e T[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.without\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { _indexOf } from './equals.js'\nimport { reduce } from './reduce.js'\n\nexport function without(matchAgainst, source){\n  if (source === undefined){\n    return _source =\u003e without(matchAgainst, _source)\n  }\n\n  return reduce(\n    (prev, current) =\u003e\n      _indexOf(current, matchAgainst) \u003e -1 ? prev : prev.concat(current),\n    [],\n    source\n  )\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { without as withoutRamda } from 'ramda'\n\nimport { without } from './without.js'\n\ntest('should return a new list without values in the first argument', () =\u003e {\n  const itemsToOmit = [ 'A', 'B', 'C' ]\n  const collection = [ 'A', 'B', 'C', 'D', 'E', 'F' ]\n\n  expect(without(itemsToOmit, collection)).toEqual([ 'D', 'E', 'F' ])\n  expect(without(itemsToOmit)(collection)).toEqual([ 'D', 'E', 'F' ])\n})\n\ntest('with list of objects', () =\u003e {\n  const itemsToOmit = [ { a : 1 }, { c : 3 } ]\n  const collection = [ { a : 1 }, { b : 2 }, { c : 3 }, { d : 4 } ]\n  const expected = [ { b : 2 }, { d : 4 } ]\n\n  expect(without(itemsToOmit, collection)).toEqual(expected)\n  expect(withoutRamda(itemsToOmit, collection)).toEqual(expected)\n})\n\ntest('ramda accepts string as target input while rambda throws', () =\u003e {\n  expect(withoutRamda('0:1', [ '0', '0:1' ])).toEqual([ '0:1' ])\n  expect(() =\u003e\n    without('0:1', [ '0', '0:1' ])).toThrowErrorMatchingInlineSnapshot('\"Cannot read property \\'indexOf\\' of 0:1\"')\n  expect(without([ '0:1' ], [ '0', '0:1' ])).toEqual([ '0' ])\n})\n\ntest('ramda test', () =\u003e {\n  expect(without([ 1, 2 ])([ 1, 2, 1, 3, 4 ])).toEqual([ 3, 4 ])\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {without} from 'rambda'\n\nconst itemsToOmit = ['A', 'B', 'C']\nconst collection = ['A', 'B', 'C', 'D', 'E', 'F']\n\ndescribe('R.without', () =\u003e {\n  it('happy', () =\u003e {\n    const result = without(itemsToOmit, collection)\n\n    result // $ExpectType string[]\n  })\n  it('curried', () =\u003e {\n    const result = without(itemsToOmit)(collection)\n\n    result // $ExpectType string[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#without)\n\n### xor\n\n```typescript\n\nxor(x: boolean, y: boolean): boolean\n```\n\nLogical XOR\n\n```javascript\nconst result = [\n  xor(true, true),\n  xor(false, false),\n  xor(false, true),\n]\n// =\u003e [false, false, true]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20result%20%3D%20%5B%0A%20%20xor(true%2C%20true)%2C%0A%20%20xor(false%2C%20false)%2C%0A%20%20xor(false%2C%20true)%2C%0A%5D%0A%2F%2F%20%3D%3E%20%5Bfalse%2C%20false%2C%20true%5D\"\u003eTry this \u003cstrong\u003eR.xor\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nxor(x: boolean, y: boolean): boolean;\nxor(y: boolean): (y: boolean) =\u003e boolean;\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.xor\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function xor(a, b){\n  if (arguments.length === 1) return _b =\u003e xor(a, _b)\n\n  return Boolean(a) \u0026\u0026 !b || Boolean(b) \u0026\u0026 !a\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { xor } from './xor.js'\n\ntest('compares two values with exclusive or', () =\u003e {\n  expect(xor(true, true)).toBeFalse()\n  expect(xor(true, false)).toBeTrue()\n  expect(xor(false, true)).toBeTrue()\n  expect(xor(false, false)).toBeFalse()\n})\n\ntest('when both values are truthy, it should return false', () =\u003e {\n  expect(xor(true, 'foo')).toBeFalse()\n  expect(xor(42, true)).toBeFalse()\n  expect(xor('foo', 42)).toBeFalse()\n  expect(xor({}, true)).toBeFalse()\n  expect(xor(true, [])).toBeFalse()\n  expect(xor([], {})).toBeFalse()\n  expect(xor(new Date(), true)).toBeFalse()\n  expect(xor(true, Infinity)).toBeFalse()\n  expect(xor(Infinity, new Date())).toBeFalse()\n})\n\ntest('when both values are falsy, it should return false', () =\u003e {\n  expect(xor(null, false)).toBeFalse()\n  expect(xor(false, undefined)).toBeFalse()\n  expect(xor(undefined, null)).toBeFalse()\n  expect(xor(0, false)).toBeFalse()\n  expect(xor(false, NaN)).toBeFalse()\n  expect(xor(NaN, 0)).toBeFalse()\n  expect(xor('', false)).toBeFalse()\n})\n\ntest('when one argument is truthy and the other is falsy, it should return true', () =\u003e {\n  expect(xor('foo', null)).toBeTrue()\n  expect(xor(null, 'foo')).toBeTrue()\n  expect(xor(undefined, 42)).toBeTrue()\n  expect(xor(42, undefined)).toBeTrue()\n  expect(xor(Infinity, NaN)).toBeTrue()\n  expect(xor(NaN, Infinity)).toBeTrue()\n  expect(xor({}, '')).toBeTrue()\n  expect(xor('', {})).toBeTrue()\n  expect(xor(new Date(), 0)).toBeTrue()\n  expect(xor(0, new Date())).toBeTrue()\n  expect(xor([], null)).toBeTrue()\n  expect(xor(undefined, [])).toBeTrue()\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {xor} from 'rambda'\n\ndescribe('R.xor', () =\u003e {\n  it('happy', () =\u003e {\n    xor(true, false) // $ExpectType boolean\n  })\n  it('curry', () =\u003e {\n    xor(true)(false) // $ExpectType boolean\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#xor)\n\n### zip\n\n```typescript\n\nzip\u003cK, V\u003e(x: K[], y: V[]): KeyValuePair\u003cK, V\u003e[]\n```\n\nIt will return a new array containing tuples of equally positions items from both `x` and `y` lists. \n\nThe returned list will be truncated to match the length of the shortest supplied list.\n\n```javascript\nconst x = [1, 2]\nconst y = ['A', 'B']\nR.zip(x, y)\n// =\u003e [[1, 'A'], [2, 'B']]\n\n// truncates to shortest list\nR.zip([...x, 3], ['A', 'B'])\n// =\u003e [[1, 'A'], [2, 'B']]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20x%20%3D%20%5B1%2C%202%5D%0Aconst%20y%20%3D%20%5B'A'%2C%20'B'%5D%0AR.zip(x%2C%20y)%0A%2F%2F%20%3D%3E%20%5B%5B1%2C%20'A'%5D%2C%20%5B2%2C%20'B'%5D%5D%0A%0A%2F%2F%20truncates%20to%20shortest%20list%0Aconst%20result%20%3D%20R.zip(%5B...x%2C%203%5D%2C%20%5B'A'%2C%20'B'%5D)%0A%2F%2F%20%3D%3E%20%5B%5B1%2C%20'A'%5D%2C%20%5B2%2C%20'B'%5D%5D\"\u003eTry this \u003cstrong\u003eR.zip\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nzip\u003cK, V\u003e(x: K[], y: V[]): KeyValuePair\u003cK, V\u003e[];\nzip\u003cK\u003e(x: K[]): \u003cV\u003e(y: V[]) =\u003e KeyValuePair\u003cK, V\u003e[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.zip\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nexport function zip(left, right){\n  if (arguments.length === 1) return _right =\u003e zip(left, _right)\n\n  const result = []\n  const length = Math.min(left.length, right.length)\n\n  for (let i = 0; i \u003c length; i++){\n    result[ i ] = [ left[ i ], right[ i ] ]\n  }\n\n  return result\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { zip } from './zip.js'\n\nconst array1 = [ 1, 2, 3 ]\nconst array2 = [ 'A', 'B', 'C' ]\n\ntest('should return an array', () =\u003e {\n  const actual = zip(array1)(array2)\n  expect(actual).toBeInstanceOf(Array)\n})\n\ntest('should return and array or tuples', () =\u003e {\n  const expected = [\n    [ 1, 'A' ],\n    [ 2, 'B' ],\n    [ 3, 'C' ],\n  ]\n  const actual = zip(array1, array2)\n  expect(actual).toEqual(expected)\n})\n\ntest('should truncate result to length of shorted input list', () =\u003e {\n  const expectedA = [\n    [ 1, 'A' ],\n    [ 2, 'B' ],\n  ]\n  const actualA = zip([ 1, 2 ], array2)\n  expect(actualA).toEqual(expectedA)\n\n  const expectedB = [\n    [ 1, 'A' ],\n    [ 2, 'B' ],\n  ]\n  const actualB = zip(array1, [ 'A', 'B' ])\n  expect(actualB).toEqual(expectedB)\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {zip} from 'rambda'\n\ndescribe('R.zip', () =\u003e {\n  it('happy', () =\u003e {\n    const array1 = [1, 2, 3]\n    const array2 = ['A', 'B', 'C']\n\n    const result = zip(array1)(array2)\n    result // $ExpectType KeyValuePair\u003cnumber, string\u003e[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#zip)\n\n### zipObj\n\n```typescript\n\nzipObj\u003cT, K extends string\u003e(keys: K[], values: T[]): { [P in K]: T }\n```\n\nIt will return a new object with keys of `keys` array and values of `values` array.\n\n```javascript\nconst keys = ['a', 'b', 'c']\n\nR.zipObj(keys, [1, 2, 3])\n// =\u003e {a: 1, b: 2, c: 3}\n\n// truncates to shortest list\nR.zipObj(keys, [1, 2])\n// =\u003e {a: 1, b: 2}\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20keys%20%3D%20%5B'a'%2C%20'b'%2C%20'c'%5D%0A%0AR.zipObj(keys%2C%20%5B1%2C%202%2C%203%5D)%0A%2F%2F%20%3D%3E%20%7Ba%3A%201%2C%20b%3A%202%2C%20c%3A%203%7D%0A%0A%2F%2F%20truncates%20to%20shortest%20list%0Aconst%20result%20%3D%20R.zipObj(keys%2C%20%5B1%2C%202%5D)%0A%2F%2F%20%3D%3E%20%7Ba%3A%201%2C%20b%3A%202%7D\"\u003eTry this \u003cstrong\u003eR.zipObj\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nzipObj\u003cT, K extends string\u003e(keys: K[], values: T[]): { [P in K]: T };\nzipObj\u003cK extends string\u003e(keys: K[]): \u003cT\u003e(values: T[]) =\u003e { [P in K]: T };\nzipObj\u003cT, K extends number\u003e(keys: K[], values: T[]): { [P in K]: T };\nzipObj\u003cK extends number\u003e(keys: K[]): \u003cT\u003e(values: T[]) =\u003e { [P in K]: T };\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.zipObj\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { take } from './take.js'\n\nexport function zipObj(keys, values){\n  if (arguments.length === 1) return yHolder =\u003e zipObj(keys, yHolder)\n\n  return take(values.length, keys).reduce((\n    prev, xInstance, i\n  ) =\u003e {\n    prev[ xInstance ] = values[ i ]\n\n    return prev\n  }, {})\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { equals } from './equals.js'\nimport { zipObj } from './zipObj.js'\n\ntest('zipObj', () =\u003e {\n  expect(zipObj([ 'a', 'b', 'c' ], [ 1, 2, 3 ])).toEqual({\n    a : 1,\n    b : 2,\n    c : 3,\n  })\n})\n\ntest('0', () =\u003e {\n  expect(zipObj([ 'a', 'b' ])([ 1, 2, 3 ])).toEqual({\n    a : 1,\n    b : 2,\n  })\n})\n\ntest('1', () =\u003e {\n  expect(zipObj([ 'a', 'b', 'c' ])([ 1, 2 ])).toEqual({\n    a : 1,\n    b : 2,\n  })\n})\n\ntest('ignore extra keys', () =\u003e {\n  const result = zipObj([ 'a', 'b', 'c', 'd', 'e', 'f' ], [ 1, 2, 3 ])\n  const expected = {\n    a : 1,\n    b : 2,\n    c : 3,\n  }\n\n  expect(equals(result, expected)).toBeTrue()\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {zipObj} from 'rambda'\n\ndescribe('R.zipObj', () =\u003e {\n  it('happy', () =\u003e {\n    // this is wrong since 24.10.2020 `@types/ramda` changes\n    const result = zipObj(['a', 'b', 'c', 'd'], [1, 2, 3])\n    ;[result.a, result.b, result.c, result.d] // $ExpectType number[]\n  })\n  it('imported from @types/ramda', () =\u003e {\n    const result = zipObj(['a', 'b', 'c'], [1, 2, 3])\n    const curriedResult = zipObj(['a', 'b', 'c'])([1, 2, 3])\n    ;[result.a, result.b, result.c] // $ExpectType number[]\n    ;[curriedResult.a, curriedResult.b, curriedResult.c] // $ExpectType number[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#zipObj)\n\n### zipWith\n\n```typescript\n\nzipWith\u003cT, U, TResult\u003e(fn: (x: T, y: U) =\u003e TResult, list1: T[], list2: U[]): TResult[]\n```\n\n```javascript\nconst list1 = [ 10, 20, 30, 40 ]\nconst list2 = [ 100, 200 ]\n\nconst result = R.zipWith(\n  R.add, list1, list2\n)\n// =\u003e [110, 220]\n```\n\n\u003ca title=\"redirect to Rambda Repl site\" href=\"https://rambda.now.sh?const%20list1%20%3D%20%5B%2010%2C%2020%2C%2030%2C%2040%20%5D%0Aconst%20list2%20%3D%20%5B%20100%2C%20200%20%5D%0A%0Aconst%20result%20%3D%20R.zipWith(%0A%20%20R.add%2C%20list1%2C%20list2%0A)%0A%2F%2F%20%3D%3E%20%5B110%2C%20220%5D\"\u003eTry this \u003cstrong\u003eR.zipWith\u003c/strong\u003e example in Rambda REPL\u003c/a\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eAll TypeScript definitions\u003c/summary\u003e\n\n```typescript\nzipWith\u003cT, U, TResult\u003e(fn: (x: T, y: U) =\u003e TResult, list1: T[], list2: U[]): TResult[];\nzipWith\u003cT, U, TResult\u003e(fn: (x: T, y: U) =\u003e TResult, list1: T[]): (list2: U[]) =\u003e TResult[];\nzipWith\u003cT, U, TResult\u003e(fn: (x: T, y: U) =\u003e TResult): (list1: T[], list2: U[]) =\u003e TResult[];\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eR.zipWith\u003c/strong\u003e source\u003c/summary\u003e\n\n```javascript\nimport { curry } from './curry.js'\nimport { take } from './take.js'\n\nfunction zipWithFn(\n  fn, x, y\n){\n  return take(x.length \u003e y.length ? y.length : x.length, x).map((xInstance, i) =\u003e fn(xInstance, y[ i ]))\n}\n\nexport const zipWith = curry(zipWithFn)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTests\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nimport { add } from './add.js'\nimport { zipWith } from './zipWith.js'\n\nconst list1 = [ 1, 2, 3 ]\nconst list2 = [ 10, 20, 30, 40 ]\nconst list3 = [ 100, 200 ]\n\ntest('when second list is shorter', () =\u003e {\n  const result = zipWith(\n    add, list1, list3\n  )\n  expect(result).toEqual([ 101, 202 ])\n})\n\ntest('when second list is longer', () =\u003e {\n  const result = zipWith(\n    add, list1, list2\n  )\n  expect(result).toEqual([ 11, 22, 33 ])\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003e\u003cstrong\u003eTypeScript\u003c/strong\u003e test\u003c/summary\u003e\n\n```typescript\nimport {zipWith} from 'rambda'\n\nconst list1 = [1, 2]\nconst list2 = [10, 20, 30]\n\ndescribe('R.zipWith', () =\u003e {\n  it('happy', () =\u003e {\n    const result = zipWith(\n      (x, y) =\u003e {\n        x // $ExpectType number\n        y // $ExpectType number\n        return `${x}-${y}`\n      },\n      list1,\n      list2\n    )\n\n    result // $ExpectType string[]\n  })\n  it('curried', () =\u003e {\n    const result = zipWith((x, y) =\u003e {\n      x // $ExpectType unknown\n      y // $ExpectType unknown\n      return `${x}-${y}`\n    })(list1, list2)\n\n    result // $ExpectType string[]\n  })\n})\n```\n\n\u003c/details\u003e\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#zipWith)\n\n## ❯ CHANGELOG\n\n9.3.0\n\n- Breaking change in relation to TS typings of `R.assoc`, `R.dissoc` and `R.modify` - https://github.com/ramda/types/pull/37\n\n- Add `R.isNotEmpty` as it is new method in `Ramda`\n\n- Fix `R.head`/`R.last` TS definition - It returns `undefined` if array has length of 0. Before \n\n9.2.1\n\n- Broken `Deno` build - [Issue #731](https://github.com/selfrefactor/rambda/issues/731)\n\n9.2.0\n\n- `R.once` TS type definition miss to context argument and its type - [Issue #728](https://github.com/selfrefactor/rambda/issues/728)\n\n- Fix implementation of `R.unless` function - https://github.com/selfrefactor/rambda/pull/726 \n\n9.1.1\n\n- Faster R.equals with Object.is short circuit - https://github.com/selfrefactor/rambda/pull/725\n\n- Fix R.cond transform is unary - https://github.com/selfrefactor/rambda/issues/720\n\n9.1.0\n\nAdd these methods\n\n- insert\n- insertAll\n- lt\n- lte\n- isNotNil\n- pickBy\n- pathSatisfies\n- swap\n- mergeDeepLeft\n\n9.0.1\n\n- Fix bad TS typings, due to missing declaration - [Issue #716](https://github.com/selfrefactor/rambda/issues/716)\n\n9.0.0\n\nBreaking change in TS definitions of `lenses` as now they are synced to `Ramda` types.\n\n- Add `R.sortWith` - [Issue #707](https://github.com/selfrefactor/rambda/issues/707)\n\n- Add `R.innerJoin`, `R.gt`, `R.gte`, `R.reduceBy`, `R.hasIn`\n\n8.6.0\n\n- Wrong typing for `R.dissocPath` - [Issue #709](https://github.com/selfrefactor/rambda/issues/709)\n\n- Update build dependencies\n\n8.5.0\n\n- Revert changes in `R.anyPass` introduced in `8.4.0` release. The reason is that the change was breaking the library older than `5.2.0` TypeScript.\n\n- Wrong `R.partial` TS definition  - [Issue #705](https://github.com/selfrefactor/rambda/issues/705)\n\n- Add `R.dropRepeatsBy`\n\n- Add `R.empty`\n\n- Add `R.eqBy`\n\n- Add `R.forEachObjIndexed`\n\n8.4.0\n\n- Add `R.dissocPath`\n\n- Fix TS definitions of `R.head/R.last` and add missing handle of empty string\n\n- Add `R.removeIndex` - method was before only in `Rambdax`, but now since `R.dissocPath` is using it, it is added to main library.\n\n- Allow `R.omit` to pass numbers as part of properties to omit, i.e. `R.omit(['a', 1], {a: {1: 1, 2: 2}})`\n\n- R.keys always returns strings - [MR #700](https://github.com/selfrefactor/rambda/pull/700)\n\n- Improve `R.prepend/R.append` type interference - [MR #699](https://github.com/selfrefactor/rambda/pull/699)\n\n- Change `R.reduce` TS definitions so index is always received - [MR #696](https://github.com/selfrefactor/rambda/pull/696)\n\n- Functions as a type guard in `R.anyPass` TS definitions - [MR #695](https://github.com/selfrefactor/rambda/pull/695)\n\n- Fix R.append's curried type - [MR #694](https://github.com/selfrefactor/rambda/pull/694)\n\n- Fix cannot compare errors in `Deno` with `R.equals` - [Issue #704](https://github.com/selfrefactor/rambda/issues/704).\n\n- Fix cannot compare `BigInt` with `R.equals` \n\n8.3.0\n\nAdd the following methods:\n\n- binary\n- call\n- collectBy\n- comparator\n- composeWith\n\n8.2.0\n\nAdd the following methods:\n\n- addIndex\n- addIndexRight\n- ap\n- aperture\n- applyTo\n- ascend\n- descend\n\n8.1.0\n\n- Fix input order of TS definitions for `R.propEq` method  - [Issue #688](https://github.com/selfrefactor/rambda/issues/688). The issue was due to 8.0.0 was shipped with TS definitions of `7.5.0` release.\n\n- Add `R.differenceWith` method  - [Issue #91](https://github.com/selfrefactor/rambdax/issues/91)\n\n8.0.0\n\n- handle falsy values in merge methods - https://github.com/ramda/ramda/pull/3222\n\n- `R.head`/`R.last` don't return `undefined` for non-empty arrays\n\n- `R.type` supports dates in TS definition - `Rambda` already did support dates in JS.\n\n- Improve typings of `R.endsWith/startsWith` with regard to `string` input. - [PR #622](https://github.com/selfrefactor/rambda/pull/622)\n\n- Handle list as falsy value in `R.reduce` - [Ramda MR](https://github.com/ramda/ramda/pull/2997/files)\n\n- `R.nop` is removed - it will be moved to `Rambdax` as `R.noop`\n\n- `R.includes` is no longer using string literal in TypeScript definitions\n\n\u003e Reason for breaking change - synchronize with Ramda `0.29.0` release:\n\n- change order of `R.propEq` - [Ramda MR](https://github.com/ramda/ramda/pull/2938/files)\n\n7.5.0\n\n- IMPORTANT: Remove `export` property in `package.json` in order to allow `Rambda`  support for projects with `\"type\": \"module\"` in `package.json` - [Issue #667](https://github.com/selfrefactor/rambda/issues/657)\n\n- Add `R.unnest` - [Rambdax issue 89](https://github.com/selfrefactor/rambdax/issues/89)\n\n- `R.uniq` is not using `R.equals` as Ramda does - [Issue #88](https://github.com/selfrefactor/rambdax/issues/88)\n\n- Fix `R.path(['non','existing','path'], obj)` TS definition as 7.4.0 release caused TS errors - [Issue #668](https://github.com/selfrefactor/rambda/issues/668)\n\n7.4.0\n\n- Synchronize with `@types/ramda` - `R.prop`, `R.path`, `R.pickAll`\n\n- Remove `esm` Rollup output due to tree-shaking issues.\n\n- Upgrade all dev dependencies.\n\n7.3.0\n\n- Important - changing import declaration in `package.json` in order to fix tree-shaking issue - [Issue #647](https://github.com/selfrefactor/rambda/issues/647)\n\n- Add `R.modify`\n\n- Allow multiple inputs in TypeScript versions of `R.anyPass` and `R.allPass` - [Issue #642](https://github.com/selfrefactor/rambda/issues/604)\n\n- Using wrong clone of object in `R.mergeDeepRight` - [Issue #650](https://github.com/selfrefactor/rambda/issues/650)\n\n- Missing early return in `R.where` - [Issue #648](https://github.com/selfrefactor/rambda/issues/648)\n\n- `R.allPass` doesn't accept more than 1 parameters for function predicates- [Issue #604](https://github.com/selfrefactor/rambda/issues/604)\n\n7.2.1\n\n- Remove bad typings of `R.propIs` which caused the library to cannot be build with TypeScript. \n\n- Drop support for `Wallaby` as per [https://github.com/wallabyjs/public/issues/3037](https://github.com/wallabyjs/public/issues/3037)\n\n7.2.0\n\n- Wrong `R.update` if index is `-1` - [PR #593](https://github.com/selfrefactor/rambda/pull/593)\n\n- Wrong curried typings in `R.anyPass` - [Issue #642](https://github.com/selfrefactor/rambda/issues/642)\n\n- `R.modifyPath` not exported - [Issue #640](https://github.com/selfrefactor/rambda/issues/640)\n\n- Add new method `R.uniqBy`. Implementation is coming from [Ramda MR#2641](https://github.com/ramda/ramda/pull/2641)\n\n- Apply the following changes from `@types/rambda`:\n\n-- [https://github.com/DefinitelyTyped/DefinitelyTyped/commit/bab47272d52fc7bb81e85da36dbe9c905a04d067](add `AnyFunction` and `AnyConstructor`)\n\n-- Improve `R.ifElse` typings - https://github.com/DefinitelyTyped/DefinitelyTyped/pull/59291\n\n-- Make `R.propEq` safe for `null/undefined` arguments - https://github.com/ramda/ramda/pull/2594/files\n\n7.1.4\n\n- `R.mergeRight` not found on `Deno` import - [Issue #633](https://github.com/selfrefactor/rambda/issues/633)\n\n7.1.0\n\n- Add `R.mergeRight` - introduced by Ramda's latest release. While Ramda renames `R.merge`, Rambda will keep `R.merge`.\n\n- Rambda's `pipe/compose` doesn't return proper length of composed function which leads to issue with `R.applySpec`. It was fixed by using Ramda's `pipe/compose` logic - [Issue #627](https://github.com/selfrefactor/rambda/issues/627)\n\n- Replace `Async` with `Promise` as return type of `R.type`.\n\n- Add new types as TypeScript output for `R.type` - \"Map\", \"WeakMap\", \"Generator\", \"GeneratorFunction\", \"BigInt\", \"ArrayBuffer\"\n\n- Add `R.juxt` method\n\n- Add `R.propSatisfies` method\n\n- Add new methods after `Ramda` version upgrade to `0.28.0`:\n\n-- R.count\n-- R.modifyPath\n-- R.on\n-- R.whereAny\n-- R.partialObject\n\n7.0.3\n\nRambda.none has wrong logic introduced in version `7.0.0` - [Issue #625](https://github.com/selfrefactor/rambda/issues/625)\n\n7.0.2\n\nRambda doesn't work with `pnpm` due to wrong export configuration - [Issue #619](https://github.com/selfrefactor/rambda/issues/619)\n\n7.0.1\n\n- Wrong ESM export configuration in `package.json` - [Issue #614](https://github.com/selfrefactor/rambda/issues/614)\n\n7.0.0\n\n- Breaking change - sync `R.compose`/`R.pipe` with `@types/ramda`. That is significant change so as safeguard, it will lead a major bump. Important - this lead to raising required TypeScript version to `4.2.2`. In other words, to use `Rambda` you'll need TypeScript version `4.2.2` or newer.\n\nRelated commit in `@types/ramda` - https://github.com/DefinitelyTyped/DefinitelyTyped/commit/286eff4f76d41eb8f091e7437eabd8a60d97fc1f#diff-4f74803fa83a81e47cb17a7d8a4e46a7e451f4d9e5ce2f1bd7a70a72d91f4bc1\n\nThere are several other changes in `@types/ramda` as stated in [this comment](https://github.com/ramda/ramda/issues/2976#issuecomment-990408945). This leads to change of typings for the following methods in **Rambda**:\n\n-- R.unless\n\n-- R.toString\n\n-- R.ifElse\n\n-- R.always\n\n-- R.complement\n\n-- R.cond\n\n-- R.is\n\n-- R.sortBy\n\n-- R.dissoc\n\n-- R.toPairs\n\n-- R.assoc\n\n-- R.toLower\n\n-- R.toUpper\n\n- One more reason for the breaking change is changing of export declarations in `package.json` based on [this blog post](https://devblogs.microsoft.com/typescript/announcing-typescript-4-5-beta/#packagejson-exports-imports-and-self-referencing) and [this merged Ramda's PR](https://github.com/ramda/ramda/pull/2999). This also led to renaming of `babel.config.js` to `babel.config.cjs`. \n\n- Add `R.apply`, `R.bind` and `R.unapply`\n\n- `R.startsWith/R.endsWith` now support lists as inputs. This way, it matches current Ramda behavior. \n\n- Remove unused typing for `R.chain`.\n\n- `R.map`/`R.filter` no longer accept bad inputs as iterable. This way, Rambda behaves more like Ramda, which also throws.\n\n- Make `R.lastIndexOf` follow the logic of `R.indexOf`.\n\n- Change `R.type` logic to Ramda logic. This way, `R.type` can return `Error` and `Set` as results.\n\n- Add missing logic in `R.equals` to compare sets - [Issue #599](https://github.com/selfrefactor/rambda/issues/599)\n\n- Improve list cloning - [Issue #595](https://github.com/selfrefactor/rambda/issues/595)\n\n- Handle multiple inputs with `R.allPass` and `R.anyPass` - [Issue #604](https://github.com/selfrefactor/rambda/issues/604)\n\n- Fix `R.length` wrong logic with inputs as `{length: 123}` - [Issue #606](https://github.com/selfrefactor/rambda/issues/606).\n\n- Improve non-curry typings of `R.merge` by using types from [mobily/ts-belt](https://github.com/mobily/ts-belt).\n\n- Improve performance of `R.uniqWith`.\n\n- Wrong `R.update` if index is `-1` - [PR #593](https://github.com/selfrefactor/rambda/pull/593)\n\n- Make `R.eqProps` safe for falsy inputs - based on [this opened Ramda PR](https://github.com/ramda/ramda/pull/2943).\n\n- Incorrect benchmarks for `R.pipe/R.compose` - [Issue #608](https://github.com/selfrefactor/rambda/issues/608)\n\n- Fix `R.last/R.head` typings - [Issue #609](https://github.com/selfrefactor/rambda/issues/609) \n\n6.9.0\n\n- Fix slow `R.uniq` methods - [Issue #581](https://github.com/selfrefactor/rambda/issues/581)\n\nFixing `R.uniq` was done by improving `R.indexOf` which has performance implication to all methods importing `R.indexOf`:\n\n- R.includes\n- R.intersection\n- R.difference\n- R.excludes\n- R.symmetricDifference\n- R.union\n\n- R.without no longer support the following case - `without('0:1', ['0', '0:1']) // =\u003e ['0']`. Now it throws as the first argument should be a list, not a string. Ramda, on the other hand, returns an empty list - https://github.com/ramda/ramda/issues/3086. \n\n6.8.3\n\n- Fix TypeScript build process with `rambda/immutable` - [Issue #572](https://github.com/selfrefactor/rambda/issues/572)\n\n- Add `R.objOf` method\n\n- Add `R.mapObjIndexed` method\n\n- Publish shorter README.md version to NPM\n\n6.8.0\n\n- `R.has` use `Object.prototype.hasOwnProperty`- [Issue #572](https://github.com/selfrefactor/rambda/issues/572)\n\n- Expose `immutable.ts` typings which are Rambda typings with `readonly` statements - [Issue #565](https://github.com/selfrefactor/rambda/issues/565)\n\n- Fix `R.intersection` wrong order compared to Ramda.\n\n- `R.path` wrong return of `null` instead of `undefined` when path value is `null` - [PR #577](https://github.com/selfrefactor/rambda/pull/577)\n\n6.7.0\n\n- Remove `ts-toolbelt` types from TypeScript definitions. Most affected are the following methods, which lose one of its curried definitions:\n\n1. R.maxBy\n2. R.minBy\n3. R.pathEq\n4. R.viewOr\n5. R.when\n6. R.merge\n7. R.mergeDeepRight\n8. R.mergeLeft\n\n6.6.0\n\n- Change `R.piped` typings to mimic that of `R.pipe`. Main difference is that `R.pipe` is focused on unary functions.\n\n- Fix wrong logic when `R.without` use `R.includes` while it should use array version of `R.includes`.\n\n- Use uglify plugin for UMD bundle.\n\n- Remove `dist` folder from `.gitignore` in order to fix `Deno` broken package. [Issue #570](https://github.com/selfrefactor/rambda/issues/570)\n\n- Improve `R.fromPairs` typings - [Issue #567](https://github.com/selfrefactor/rambda/issues/567)\n\n6.5.3\n\n- Wrong logic where `R.without` use `R.includes` while it should use the array version of `R.includes`\n\nThis is Ramda bug, that Rambda also has before this release - https://github.com/ramda/ramda/issues/3086\n\n6.5.2\n\n- Wrong `R.defaultTo` typings - changes introduced in v6.5.0 are missing their TS equivalent.\n\n- Update dependencies\n\n6.5.1\n\nFix wrong versions in changelog\n\n6.5.0\n\n- `R.defaultTo` no longer accepts infinite inputs, thus it follows Ramda implementation.\n\n- `R.equals` supports equality of functions.\n\n- `R.pipe` doesn't use `R.compose`.\n\n- Close [Issue #561](https://github.com/selfrefactor/rambda/issues/561) - export several internal TS interfaces and types\n\n- Close [Issue #559](https://github.com/selfrefactor/rambda/issues/559) - improve `R.propOr` typings\n\n- Add `CHANGELOG.md` file in release files list\n\n\u003e This is only part of the changelog. You can read the full text in [CHANGELOG.md](CHANGELOG.md) file.\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#-changelog)\n\n## ❯ Additional info\n\n\u003e Most influential contributors(in alphabetical order)\n\n- ![farwayer avatar](https://avatars.githubusercontent.com/farwayer) [@farwayer](https://github.com/farwayer) - improving performance in R.find, R.filter; give the idea how to make benchmarks more reliable;\n\n- ![thejohnfreeman avatar](https://avatars.githubusercontent.com/thejohnfreeman) [@thejohnfreeman](https://github.com/thejohnfreeman) - add R.assoc, R.chain;\n\n- ![peeja avatar](https://avatars.githubusercontent.com/peeja) [@peeja](https://github.com/peeja) - add several methods and fix mutiple issues; provides great MR documentation\n\n- ![helmuthdu avatar](https://avatars.githubusercontent.com/helmuthdu) [@helmuthdu](https://github.com/helmuthdu) - add R.clone; help improve code style;\n\n- ![jpgorman avatar](https://avatars.githubusercontent.com/jpgorman) [@jpgorman](https://github.com/jpgorman) - add R.zip, R.reject, R.without, R.addIndex;\n\n- ![ku8ar avatar](https://avatars.githubusercontent.com/ku8ar) [@ku8ar](https://github.com/ku8ar) - add R.slice, R.propOr, R.identical, R.propIs and several math related methods; introduce the idea to display missing Ramda methods;\n\n- ![romgrk avatar](https://avatars.githubusercontent.com/romgrk) [@romgrk](https://github.com/romgrk) - add R.groupBy, R.indexBy, R.findLast, R.findLastIndex;\n\n- ![squidfunk avatar](https://avatars.githubusercontent.com/squidfunk) [@squidfunk](https://github.com/squidfunk) - add R.assocPath, R.symmetricDifference, R.difference, R.intersperse;\n\n- ![synthet1c avatar](https://avatars.githubusercontent.com/synthet1c) [@synthet1c](https://github.com/synthet1c) - add all lenses methods; add R.applySpec, R.converge;\n\n- ![vlad-zhukov avatar](https://avatars.githubusercontent.com/vlad-zhukov) [@vlad-zhukov](https://github.com/vlad-zhukov) - help with configuring Rollup, Babel; change export file to use ES module exports;\n\n\u003e Rambda references\n\n- [Interview with Dejan Totef at SurviveJS blog](https://survivejs.com/blog/rambda-interview/)\n\n- [Awesome functional Javascript programming libraries](https://github.com/stoeffel/awesome-fp-js#libraries)\n\n- [Overview of Rambda pros/cons](https://mobily.github.io/ts-belt/docs/#rambda-%EF%B8%8F)\n\n\u003e Links to Rambda\n\n- [awesome-fp-js](https://github.com/stoeffel/awesome-fp-js)\n\n- [Web Tools Weekly #280](https://mailchi.mp/webtoolsweekly/web-tools-280)\n\n- [awesome-docsify](https://github.com/docsifyjs/awesome-docsify)\n\n\u003e Deprecated from `Used by` section\n\n- [SAP's Cloud SDK](https://github.com/SAP/cloud-sdk) - This repo doesn't uses `Rambda` since *October/2020* [commit that removes Rambda](https://github.com/SAP/cloud-sdk/commit/b29b4f915c4e4e9c2441e7b6b67cf83dac1fdac3)\n\n[![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#-additional-info)\n\n## My other libraries\n\n\u003ctable\u003e\n    \u003ctbody\u003e\n        \u003ctr valign=\"top\"\u003e\n            \u003ctd width=\"20%\" align=\"center\"\u003e\n                \u003ch4\u003eNiketa theme\u003c/h4\u003e\n                \u003ca href=\"https://marketplace.visualstudio.com/items?itemName=selfrefactor.Niketa-theme\"\u003eCollection of 9 light VSCode themes\u003c/a\u003e\n            \u003c/td\u003e\n            \u003ctd width=\"20%\" align=\"center\"\u003e\n                \u003ch4\u003eNiketa dark theme\u003c/h4\u003e\n                \u003ca href=\"https://marketplace.visualstudio.com/items?itemName=selfrefactor.niketa-dark-theme\"\u003eCollection of 9 dark VSCode themes\u003c/a\u003e\n            \u003c/td\u003e\n            \u003ctd width=\"20%\" align=\"center\"\u003e\n                \u003ch4\u003eString-fn\u003c/h4\u003e\n                \u003ca href=\"https://github.com/selfrefactor/services/tree/master/packages/string-fn\"\u003eString utility library\u003c/a\u003e\n            \u003c/td\u003e\n            \u003ctd width=\"20%\" align=\"center\"\u003e\n                \u003ch4\u003eUseful Javascript libraries\u003c/h4\u003e\n                \u003ca href=\"https://github.com/selfrefactor/useful-javascript-libraries\"\u003eLarge collection of JavaScript,TypeScript and Angular related repos links\u003c/a\u003e\n            \u003c/td\u003e\n            \u003ctd width=\"20%\" align=\"center\"\u003e\n                \u003ch4\u003eRun-fn\u003c/h4\u003e\n                \u003ca href=\"https://github.com/selfrefactor/services/tree/master/packages/run-fn\"\u003eCLI commands for lint JS/TS files, commit git changes and upgrade of dependencies\u003c/a\u003e\n            \u003c/td\u003e\n        \u003c/tr\u003e\n    \u003c/tbody\u003e\n\u003c/table\u003e\n\n## Stargazers over time\n\n[![Stargazers over time](https://starchart.cc/selfrefactor/rambda.svg)](https://starchart.cc/selfrefactor/rambda)","funding_links":[],"categories":["JavaScript","functional-programming","Libraries","Rambdax"],"sub_categories":["selfrefactor/rambdax"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselfrefactor%2Frambdax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fselfrefactor%2Frambdax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselfrefactor%2Frambdax/lists"}