diff --git a/.editorconfig b/.editorconfig index 8e84acc..dd7255e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,11 +1,8 @@ -# EditorConfig is awesome: http://EditorConfig.org - root = true [*] -indent_size = 2 indent_style = space +indent_size = 2 end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true insert_final_newline = true +trim_trailing_whitespace = true diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..07764a7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text eol=lf \ No newline at end of file diff --git a/.gitignore b/.gitignore index abd4794..929c2ab 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,3 @@ -node_modules -dist -*.swp -*.swo -.session.vim -.sizecache.json -test.js -*.log +coverage/ +node_modules/ +ramda/ diff --git a/.travis.yml b/.travis.yml index 963767e..740698e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,26 @@ -sudo: false language: node_js -notifications: - email: - on_success: never - on_failure: never # change +node_js: +- stable script: - - npm run lint - # - npm run bundle - - npm rm tslint - - npm install $TYPESCRIPT --force - # - npm run exec - - npm run test +- yarn run lint +- yarn run build-check +- yarn run remap-check +- yarn run test-utils -- --verbose --coverage +- yarn run test -- --verbose +- yarn run test-actual -- --verbose -u -env: - # - TYPESCRIPT=typescript@2.2 - - TYPESCRIPT=typescript@latest - - TYPESCRIPT=typescript@next +after_success: +- if [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./scripts/deploy.sh; fi -node_js: - - "stable" +cache: + yarn: true + directories: + - node_modules + +matrix: + fast_finish: true + +notifications: + email: false diff --git a/.vscode/settings.json b/.vscode/settings.json index 9bbf37f..e70b9d1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,4 @@ -// Place your settings in this file to overwrite default and user settings. { - "typescript.tsdk": "node_modules/typescript/lib" + "tslint.ignoreDefinitionFiles": false, + "tslint.exclude": "**/{node_modules,ramda}/**/*" } diff --git a/README.md b/README.md index a92b8a1..5191d12 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,74 @@ -## Type definitions for [Ramda](https://github.com/ramda/ramda) +# types/npm-ramda -[![Greenkeeper badge](https://badges.greenkeeper.io/types/npm-ramda.svg)](https://greenkeeper.io/) - -[![Build Status](https://travis-ci.org/types/npm-ramda.svg?branch=master)](https://travis-ci.org/types/npm-ramda) +[![Travis](https://travis-ci.org/types/npm-ramda.svg?branch=master)](https://travis-ci.org/types/npm-ramda) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/donnut/typescript-ramda) +[![Greenkeeper](https://badges.greenkeeper.io/types/npm-ramda.svg)](https://greenkeeper.io/) + +TypeScript's type definitions for [Ramda](https://github.com/ramda/ramda) ## Status -Typing compatible with ramda version 0.23.0. +Typing compatible with ramda version v0.24.1 ***Note***: many of the functions in Ramda are still hard to properly type in Ramda, with issues mainly centered around partial application, currying, and composition, especially so in the presence of generics. And yes, those are probably why you'd be using Ramda in the first place, making these issues particularly problematic to type Ramda for TypeScript. A few links to issues at TS can be found [below](#Roadmap). +## Features + +- support placeholder ( `R.__` ) +- support partial import ( `import * as map from "ramda/src/map"` ) +- support selectable overloads ( use 0-param: `R.map<"11", "list">()` ) + ## Usage -Install the typings for node using: -```bash -npm install types/npm-ramda --saveDev +The following command install the types from the `dist` branch, which is the newest version and contains `selectable` and `placeholder` types. + +```sh +# using npm +npm install --save-dev ikatyang/types-ramda#dist + +# using yarn +yarn add --dev ikatyang/types-ramda#dist ``` + If you use the package through a script tag, install with the `--global` flag instead. -## Testing: -``` -# check using `typings-checker` (recommended): -npm run types +## Testing + +```sh +# build types (./templates/*.ts -> ./ramda/dist/**/*.d.ts) +yarn run build + +# build types with watching mode +yarn run build-watch + +# check if generated definitions are valid +yarn run build-check + +# snapshot test for types +yarn run test -# compile errors only (doesn't prevent `any`, and can give false positives for bits that should error): -npm test -# without npm (useful on Windows): -node ./node_modules/typescript/bin/tsc --lib es2015 --module commonjs tests/test.ts --noEmit +# snapshot test for types with watching mode +yarn run test -- --watch + +# test utils +yarn run test-utils + +# actual test +yarn run test-actual + +# NOTE: test files +# unit tests -> ./tests/*.ts +# actual tests -> ./tests/ramda-tests.ts +# integration tests -> ./tests/ramda-tests.ts + +# remap snapshots (./tests/__snapshots__/*.ts.snap -> ./snapshots/*.ts) +yarn run remap + +# remap snapshots with watching mode +yarn run remap-watch + +# check if snapshot is outdated +yarn run remap-check ``` ## FAQ @@ -38,42 +79,19 @@ node ./node_modules/typescript/bin/tsc --lib es2015 --module commonjs tests/test > Why does `compose` not infer well? - TypeScript cannot do backward inference as needed for `compose` ([ref](https://github.com/Microsoft/TypeScript/issues/15680#issuecomment-307571917)). The `pipe` variants work a bit better than the `compose` versions. -## Note on placeholders -Due to incompatiblity problems with typescript's typing system, Ramda's placeholder -typing is removed. For binary functions the same functionally can be achieved using -`R.flip`. For example: - -```typescript -// using a placeholder ... -R.subtract(R.__, 3); -// ... is the same as -R.flip(R.subtract)(3); -``` - -In Ramda almost all functions are curried. TypeScript does not natively support -currying, so in cases where we've omitted a combination this might break. -Example of a potential gap: -```typescript -R.insert(2, 'x', [1,2,3,4]) -R.insert(2)('x', [1,2,3,4]) -R.insert(2, 'x')([1,2,3,4]) -R.insert(2)('x')([1,2,3,4]) // => type error! -``` - ## Contributing Pull requests are welcome! If you'd like to help out, two good places to start are the [issues](https://github.com/types/npm-ramda/issues) -as well as the [failed tests](https://github.com/types/npm-ramda/blob/master/tests/test.ts.out). +as well as the [tests](https://github.com/types/npm-ramda/blob/master/tests/ramda-tests.ts). -Do note that quite some of the typings are now being generated (manually) using the -[scripts](https://github.com/types/npm-ramda/blob/master/scripts.js), -as the typings are gradually getting out of hand to manually defined in the -[typings file](https://github.com/types/npm-ramda/blob/master/index.d.ts). +Do note that all of the typings are now being generated (automatically) using the +[tempaltes](https://github.com/types/npm-ramda/tree/master/templates#readme). ## Roadmap High-level to-do to address recurring issues: + - `pipe` / `compose`: - ~~using optional generics so as to allow annotating input parameter type(s)?~~ - [`gcnew/TypeScript#polyFuncUnification`](https://github.com/Microsoft/TypeScript/issues/9949#issuecomment-271926278)? diff --git a/fixtures/build-check/index.ts b/fixtures/build-check/index.ts new file mode 100644 index 0000000..68b7f95 --- /dev/null +++ b/fixtures/build-check/index.ts @@ -0,0 +1 @@ +import * as R from '../../ramda/dist/index'; diff --git a/fixtures/build-check/tsconfig.json b/fixtures/build-check/tsconfig.json new file mode 100644 index 0000000..29aa995 --- /dev/null +++ b/fixtures/build-check/tsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "noEmit": true, + "skipLibCheck": false, + "typeRoots": [] + } +} diff --git a/gen.ts b/gen.ts deleted file mode 100644 index e013218..0000000 --- a/gen.ts +++ /dev/null @@ -1,2013 +0,0 @@ -pathEq: { - // sole - (p: Path, v: any, o: any): boolean; - (p: Path, v: any): (o: any) => boolean; - (p: Path): { - (v: any, o: any): boolean; - (v: any): (o: any) => boolean; - }; -} - -add: { - // base - (fn1: T, val2: boolean+any): boolean; - (fn1: T): (val2: boolean+any) => boolean; - - // no_generics - (v1: any, v2: any): boolean; - (v1: any): (v2: any) => boolean; -} - -adjust: { - // sole - (fn: (a: T) => T, index: number, list: List): T[]; - (fn: (a: T) => T, index: number): (list: List) => T[]; - (fn: (a: T) => T): { - (index: number, list: List): T[]; - (index: number): (list: List) => T[]; - }; -} - -all: { - // sole - (pred: Pred, list: List): boolean; - (pred: Pred): (list: List) => boolean; -} - -allPass: { - // sole - (pred: Pred[]): Pred; -} - -always: { - // sole - (val: T): () => T; -} - -any: { - // sole - (pred: Pred, list: List): boolean; - (pred: Pred): (list: List) => boolean; -} - -anyPass: { - // sole - (preds: Pred[]): Pred; -} - -ap: { - // sole - (fns: ((a: T) => U)[], xs: List): U[]; - (fns: ((a: T) => U)[]): (xs: List) => U[]; -} - -aperture: { - // sole - (n: number, list: List): T[][]; - (n: number): (list: List) => T[][]; -} - -append: { - // sole - (el: U, list: List): (T & U)[]; - (el: U): (list: List) => (T & U)[]; -} - -apply: { - // any - (fn: (...args: any[]) => TResult, args: any[]): TResult; - (fn: (...args: any[]) => TResult): (args: any[]) => TResult; -} - -applySpec: { - // sole - (obj: any): Variadic; -} - -ascend: { - // base - >(prop: K, val: T, obj: U): {[P in K]: T} & U; - (prop: K, val: T): >(obj: U) => {[P in K]: T} & U; - (prop: K): { - >(val: T, obj: U): {[P in K]: T} & U; - (val: T): >(obj: U) => {[P in K]: T} & U; - }; - - // any object as long as the type remains unchanged - (prop: Prop, val: any, obj: T): T; - (prop: Prop, val: any): (obj: T) => T; - (prop: Prop): { - (val: any, obj: T): T; - (val: any): (obj: T) => T; - }; -} - -assoc: { - // extend object with new property - >(prop: K, val: T, obj: U): {[P in K]: T} & U; - (prop: K, val: T): >(obj: U) => {[P in K]: T} & U; - (prop: K): { - >(val: T, obj: U): {[P in K]: T} & U; - (val: T): >(obj: U) => {[P in K]: T} & U; - }; - - // any object as long as the type remains unchanged - (prop: Prop, val: any, obj: T): T; - (prop: Prop, val: any): (obj: T) => T; - (prop: Prop): { - (val: any, obj: T): T; - (val: any): (obj: T) => T; - }; -} - -assocPath: { - // sole - (path: Path, val: T, obj: U): U; - (path: Path, val: T): (obj: U) => U; - (path: Path): { - (val: T, obj: U): U; - (val: T): (obj: U) => U; - }; -} - -binary: { - // base - (fn: (a: A, b: T, ...args: any[]) => T): (a: A, b: B) => T; - - // non generics for return func - (fn: Variadic): (a:any, b:any) => T; -} - -bind: { - // sole - (fn: Variadic, thisObj: {}): Variadic; - (fn: Variadic): (thisObj: {}) => Variadic; -} - -both: { - // sole - (pred1: Pred, pred2: Pred): Pred; - (pred1: Pred): (pred2: Pred) => Pred; -} - -call: { - // sole - (fn: Variadic, ...args: any[]): T; - (fn: Variadic): (...args: any[]) => T; -} - -chain: { - // list version - (fn: (n: T) => U[], list: List): U[]; - (fn: (n: T) => U[]): (list: List) => U[]; - - // generic chain version - (fn: (n: T) => Chain, list: Chain): Chain; - (fn: (n: T) => Chain): (list: Chain) => Chain; - - // function argument - (fn: (v: V) => (list: List) => U[], monad: (list: List) => V): (list: List) => U[]; - (fn: (v: V) => (list: List) => U[]): (monad: (list: List) => V) => (list: List) => U[]; -} - -clamp: { - // sole - (min: T, max: T, value: T): T; - (min: T, max: T): (value: T) => T; - (min: T): { - (max: T, value: T): T; - (max: T): (value: T) => T; - }; -} - -clone: { - // Objects - (value: T): T; - - // Arrays - (value: List): T[]; -} - -comparator: { - // sole - (pred: (a: T, b: T) => boolean): (x: T, y: T) => number; -} - -complement: { - // sole - (pred: Variadic): Variadic; -} - -compose(fn0: (x0: V0) => T1): (x0: V0) => T1; -compose(fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T1; -compose(fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T1; -compose(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1): (x0: V0, x1: V1, x2: V2, x3: V3) => T1; -compose(fn1: (x: T1) => T2, fn0: (x0: V0) => T1): (x0: V0) => T2; -compose(fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T2; -compose(fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T2; -compose(fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1): (x0: V0, x1: V1, x2: V2, x3: V3) => T2; -compose(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0) => T1): (x0: V0) => T3; -compose(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T3; -compose(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T3; -compose(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1): (x0: V0, x1: V1, x2: V2, x3: V3) => T3; -compose(fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0) => T1): (x0: V0) => T4; -compose(fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T4; -compose(fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T4; -compose(fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1): (x0: V0, x1: V1, x2: V2, x3: V3) => T4; -compose(fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0) => T1): (x0: V0) => T5; -compose(fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T5; -compose(fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T5; -compose(fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1): (x0: V0, x1: V1, x2: V2, x3: V3) => T5; -compose(fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0) => T1): (x0: V0) => T6; -compose(fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T6; -compose(fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T6; -compose(fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1): (x0: V0, x1: V1, x2: V2, x3: V3) => T6; -compose(fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0) => T1): (x0: V0) => T7; -compose(fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T7; -compose(fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T7; -compose(fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1): (x0: V0, x1: V1, x2: V2, x3: V3) => T7; -compose(fn7: (x: T7) => T8, fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0) => T1): (x0: V0) => T8; -compose(fn7: (x: T7) => T8, fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T8; -compose(fn7: (x: T7) => T8, fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T8; -compose(fn7: (x: T7) => T8, fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1): (x0: V0, x1: V1, x2: V2, x3: V3) => T8; -compose(fn8: (x: T8) => T9, fn7: (x: T7) => T8, fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0) => T1): (x0: V0) => T9; -compose(fn8: (x: T8) => T9, fn7: (x: T7) => T8, fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T9; -compose(fn8: (x: T8) => T9, fn7: (x: T7) => T8, fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T9; -compose(fn8: (x: T8) => T9, fn7: (x: T7) => T8, fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1): (x0: V0, x1: V1, x2: V2, x3: V3) => T9; - -composeK(fn0: (v: Chain) => Chain): (v: V) => Chain; -composeK(fn1: (x: T1) => Chain, fn0: (v: Chain) => Chain): (v: V) => Chain; -composeK(fn2: (x: T2) => Chain, fn1: (x: T1) => Chain, fn0: (v: Chain) => Chain): (v: V) => Chain; -composeK(fn3: (x: T3) => Chain, fn2: (x: T2) => Chain, fn1: (x: T1) => Chain, fn0: (v: Chain) => Chain): (v: V) => Chain; -composeK(fn4: (x: T4) => Chain, fn3: (x: T3) => Chain, fn2: (x: T2) => Chain, fn1: (x: T1) => Chain, fn0: (v: Chain) => Chain): (v: V) => Chain; -composeK(fn5: (x: T5) => Chain, fn4: (x: T4) => Chain, fn3: (x: T3) => Chain, fn2: (x: T2) => Chain, fn1: (x: T1) => Chain, fn0: (v: Chain) => Chain): (v: V) => Chain; -composeK(fn6: (x: T6) => Chain, fn5: (x: T5) => Chain, fn4: (x: T4) => Chain, fn3: (x: T3) => Chain, fn2: (x: T2) => Chain, fn1: (x: T1) => Chain, fn0: (v: Chain) => Chain): (v: V) => Chain; -composeK(fn7: (x: T7) => Chain, fn6: (x: T6) => Chain, fn5: (x: T5) => Chain, fn4: (x: T4) => Chain, fn3: (x: T3) => Chain, fn2: (x: T2) => Chain, fn1: (x: T1) => Chain, fn0: (v: Chain) => Chain): (v: V) => Chain; -composeK(fn8: (x: T8) => Chain, fn7: (x: T7) => Chain, fn6: (x: T6) => Chain, fn5: (x: T5) => Chain, fn4: (x: T4) => Chain, fn3: (x: T3) => Chain, fn2: (x: T2) => Chain, fn1: (x: T1) => Chain, fn0: (v: Chain) => Chain): (v: V) => Chain; - -composeP(fn0: (x0: V0) => Promise): (x0: V0) => Promise; -composeP(fn0: (x0: V0, x1: V1) => Promise): (x0: V0, x1: V1) => Promise; -composeP(fn0: (x0: V0, x1: V1, x2: V2) => Promise): (x0: V0, x1: V1, x2: V2) => Promise; -composeP(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; -composeP(fn1: (x: T1) => Promise|T2, fn0: (x0: V0) => Promise): (x0: V0) => Promise; -composeP(fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1) => Promise): (x0: V0, x1: V1) => Promise; -composeP(fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2) => Promise): (x0: V0, x1: V1, x2: V2) => Promise; -composeP(fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; -composeP(fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0) => Promise): (x0: V0) => Promise; -composeP(fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1) => Promise): (x0: V0, x1: V1) => Promise; -composeP(fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2) => Promise): (x0: V0, x1: V1, x2: V2) => Promise; -composeP(fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; -composeP(fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0) => Promise): (x0: V0) => Promise; -composeP(fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1) => Promise): (x0: V0, x1: V1) => Promise; -composeP(fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2) => Promise): (x0: V0, x1: V1, x2: V2) => Promise; -composeP(fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; -composeP(fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0) => Promise): (x0: V0) => Promise; -composeP(fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1) => Promise): (x0: V0, x1: V1) => Promise; -composeP(fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2) => Promise): (x0: V0, x1: V1, x2: V2) => Promise; -composeP(fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; -composeP(fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0) => Promise): (x0: V0) => Promise; -composeP(fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1) => Promise): (x0: V0, x1: V1) => Promise; -composeP(fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2) => Promise): (x0: V0, x1: V1, x2: V2) => Promise; -composeP(fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; -composeP(fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0) => Promise): (x0: V0) => Promise; -composeP(fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1) => Promise): (x0: V0, x1: V1) => Promise; -composeP(fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2) => Promise): (x0: V0, x1: V1, x2: V2) => Promise; -composeP(fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; -composeP(fn7: (x: T7) => Promise|T8, fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0) => Promise): (x0: V0) => Promise; -composeP(fn7: (x: T7) => Promise|T8, fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1) => Promise): (x0: V0, x1: V1) => Promise; -composeP(fn7: (x: T7) => Promise|T8, fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2) => Promise): (x0: V0, x1: V1, x2: V2) => Promise; -composeP(fn7: (x: T7) => Promise|T8, fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; -composeP(fn8: (x: T8) => Promise|T9, fn7: (x: T7) => Promise|T8, fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0) => Promise): (x0: V0) => Promise; -composeP(fn8: (x: T8) => Promise|T9, fn7: (x: T7) => Promise|T8, fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1) => Promise): (x0: V0, x1: V1) => Promise; -composeP(fn8: (x: T8) => Promise|T9, fn7: (x: T7) => Promise|T8, fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2) => Promise): (x0: V0, x1: V1, x2: V2) => Promise; -composeP(fn8: (x: T8) => Promise|T9, fn7: (x: T7) => Promise|T8, fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; - -concat: { - // sole - >(list1: T, list2: T): T; - >(list1: T): (list2: T) => T; -} - -cond: { - // sole - (fns: [Pred, (v: T) => U][]): (v: T) => U; -} - -construct: { - // sole - (fn: Function): Function; -} - -constructN: { - // sole - (n: number, fn: Function): Function; - (n: number): (fn: Function) => Function; -} - -contains: { - // base - (a: string, list: string): boolean; - (a: string): (list: string) => boolean; - - // generics - >(a: T, list: R): boolean; - (a: T): >(list: R) => boolean; -} - -converge: { - // sole - (after: Variadic, fns: List>): Variadic; - (after: Variadic): (fns: List>) => Variadic; -} - -countBy: { - // sole - (fn: (a: T) => Prop, list: List): Obj; - (fn: (a: T) => Prop): (list: List) => Obj; -} - -dec: { - // sole - (n: number): number; -} - -defaultTo: { - // sole - (a: T, b: U | null | undefined): T|U; - (a: T): (b: U | null | undefined) => T|U; -} - -descend: { - // sole - (comparator: (val: T) => V, a: T, b: T): number; - (comparator: (val: T) => V, a: T): (b: T) => number; - (comparator: (val: T) => V): { - (a: T, b: T): number; - (a: T): (b: T) => number; - }; -} - -differenceWith: { - // sole - (pred: (a: T, b: T) => boolean, list1: List, list2: List): T[]; - (pred: (a: T, b: T) => boolean, list1: List): (list2: List) => T[]; - (pred: (a: T, b: T) => boolean): { - (list1: List, list2: List): T[]; - (list1: List): (list2: List) => T[]; - }; -} - -dissoc: { - // accurate - (prop: keyof T, obj: T): T; - (prop: keyof T): (obj: T) => T; - - // easier - (prop: Prop, obj: Struct): T; - (prop: Prop): (obj: Struct) => T; -} - -dissocPath: { - // sole - (path: Path, obj: Struct): T; - (path: Path): (obj: Struct) => T; -} - -divide: { - // sole - (a: number, b: number): number; - (a: number): (b: number) => number; -} - -drop: { - // sole - >(n: number, xs: T): T; - (n: number): >(xs: T) => T; -} - -dropLast: { - // sole - >(n: number, xs: T): T; - (n: number): >(xs: T) => T; -} - -dropLastWhile: { - // sole - >(pred: Pred, list: R): T[]; - (pred: Pred): >(list: R) => T[]; -} - -dropWhile: { - // sole - >(pred: Pred, list: R): T[]; - (pred: Pred): >(list: R) => T[]; -} - -either: { - // sole - (pred1: Pred, pred2: Pred): Pred; - (pred1: Pred): (pred2: Pred) => Pred; -} - -empty: { - // sole - (x: T): T; -} - -eqBy: { - // sole - (fn: (a: T) => T, a: T, b: T): boolean; - (fn: (a: T) => T, a: T): (b: T) => boolean; - (fn: (a: T) => T): { - (a: T, b: T): boolean; - (a: T): (b: T) => boolean; - }; -} - -eqProps: { - // base - (prop: Prop, obj1: T, obj2: U): boolean; - (prop: Prop, obj1: T): (obj2: U) => boolean; - (prop: Prop): { - (obj1: T, obj2: U): boolean; - (obj1: T): (obj2: U) => boolean; - }; - - // less generics - (prop: Prop, obj1: any, obj2: any): boolean; - (prop: Prop, obj1: any): (obj2: any) => boolean; - (prop: Prop): { - (obj1: any, obj2: any): boolean; - (obj1: any): (obj2: any) => boolean; - }; -} - -equals: { - // sole - (a: T, b: T): boolean; - (a: T): (b: T) => boolean; -} - -evolve: { - // base - (transformations: NestedObj<(v: any) => any>, obj: V): V; - (transformations: NestedObj<(v: any) => any>): (obj: V) => V; - - // no inference - (transformations: Obj, obj: any): T; - (transformations: Obj): (obj: any) => T; -} - -filter: { - // base - (pred: Pred, list: List): T[]; - (pred: Pred): (list: List) => T[]; - - // functor to functor - (pred: Pred, list: Functor): Functor[]; - (pred: Pred): (list: Functor) => Functor[]; - - // functor to array - (pred: Pred, list: Functor): T[]; - (pred: Pred): (list: Functor) => T[]; - - // object - >(pred: Pred, obj: U): Partial; - (pred: Pred): >(obj: U) => Partial; -} - -find: { - // sole - (fn: (a: T) => boolean, list: List): T; - (fn: (a: T) => boolean): (list: List) => T; -} - -findIndex: { - // sole - (fn: (a: T) => boolean, list: List): number; - (fn: (a: T) => boolean): (list: List) => number; -} - -findLast: { - // sole - (fn: (a: T) => boolean, list: List): T; - (fn: (a: T) => boolean): (list: List) => T; -} - -findLastIndex: { - // sole - (fn: (a: T) => boolean, list: List): number; - (fn: (a: T) => boolean): (list: List) => number; -} - -flatten: { - // sole - (x: NestedArray): T[]; -} - -flip: { - // base - (fn: (arg0: T, arg1: U) => TResult): (arg1:U, arg0?:T) => TResult; - - // rest arguments - (fn: (arg0: T, arg1: U, ...args: Rest[]) => TResult): (arg1: U, arg0?: T, ...args: Rest[]) => TResult; -} - -forEach: { - // sole - (fn: (x: T) => void, list: List): T[]; - (fn: (x: T) => void): (list: List) => T[]; -} - -forEachObjIndexed: { - // sole - >(fn: (val: T, key: string, obj?: Inp) => void, o: Inp): Inp; - >(fn: (val: T, key: string, obj?: Inp) => void): (o: Inp) => Inp; -} - -fromPairs: { - // sole - (pairs: List>): Obj; -} - -groupBy: { - // sole - (fn: (a: T) => prop, list: List): Obj; - (fn: (a: T) => prop): (list: List) => Obj; -} - -groupWith: { - // sole - (fn: (a: T) => Prop, list: List): Obj; - (fn: (a: T) => Prop): (list: List) => Obj; -} - -gt: { - // sole - (a: number, b: number): boolean; - (a: number): (b: number) => boolean; -} - -gte: { - // sole - (a: number, b: number): boolean; - (a: number): (b: number) => boolean; -} - -has: { - // sole - (s: Prop, obj: Struct): boolean; - (s: Prop): (obj: Struct) => boolean; -} - -hasIn: { - // sole - (s: Prop, obj: Struct): boolean; - (s: Prop): (obj: Struct) => boolean; -} - -identical: { - // sole - (a: T, b: T): boolean; - (a: T): (b: T) => boolean; -} - -ifElse: { - // sole - (fn: Pred, onTrue: (v: T) => U, onFalse: (v: T) => V): (v: T) => U|V; - (fn: Pred, onTrue: (v: T) => U): (onFalse: (v: T) => V) => (v: T) => U|V; - (fn: Pred): { - (onTrue: (v: T) => U, onFalse: (v: T) => V): (v: T) => U|V; - (onTrue: (v: T) => U): (onFalse: (v: T) => V) => (v: T) => U|V; - }; -} - -indexBy: { - // sole - (fn: (a: T) => Prop, list: List): Obj; - (fn: (a: T) => Prop): (list: List) => Obj; -} - -indexOf: { - // sole - (target: T, list: List): number; - (target: T): (list: List) => number; -} - -insert: { - // sole - (index: number, elt: T, list: List): T[]; - (index: number, elt: T): (list: List) => T[]; - (index: number): { - (elt: T, list: List): T[]; - (elt: T): (list: List) => T[]; - }; -} - -insertAll: { - // sole - (index: number, elts: List, list: List): Array; - (index: number, elts: List): (list: List) => Array; - (index: number): { - (elts: List, list: List): Array; - (elts: List): (list: List) => Array; - }; -} - -intersection: { - // sole - (list1: List, list2: List): Array; - (list1: List): (list2: List) => Array; -} - -intersectionWith: { - // sole - (pred: (a: T, b: T) => boolean, list1: List, list2: List): T[]; - (pred: (a: T, b: T) => boolean, list1: List): (list2: List) => T[]; - (pred: (a: T, b: T) => boolean): { - (list1: List, list2: List): T[]; - (list1: List): (list2: List) => T[]; - }; -} - -intersperse: { - // sole - (separator: T, list: List): T[]; - (separator: T): (list: List) => T[]; -} - -into: { - // sole - , T, U>(acc: V, xf: (list: List) => U, list: List): U; - , T, U>(acc: V, xf: (list: List) => U): (list: List) => U; - >(acc: V): { - (xf: (list: List) => U, list: List): U; - (xf: (list: List) => U): (list: List) => U; - }; -} - -invoker: { - // sole - (len: number, name: Prop, obj: T): R; - (len: number, name: Prop): (obj: T) => R; - (len: number): { - (name: Prop, obj: T): R; - (name: Prop): (obj: T) => R; - }; -} - -is: { - // sole - (ctor: Type, val: any): val is T; - (ctor: Type): (val: any) => val is T; -} - -join: { - // sole - (x: Prop, xs: Array): string; - (x: Prop): (xs: Array) => string; -} - -juxt: { - // sole - (fns: {(...args: T[]): U}[]): (...args: T[]) => U[]; -} - -lastIndexOf: { - // sole - (target: T, list: List): number; - (target: T): (list: List) => number; -} - -lens: { - // base - >(getter: (s: U) => V, setter: (a: V, s: U) => U): ManualLens; - >(getter: (s: U) => V): (setter: (a: V, s: U) => U) => ManualLens; - - // allows setter to change value type - (getter: (s: T) => U, setter: (a: U, s: T) => V): Lens; - (getter: (s: T) => U): (setter: (a: U, s: T) => V) => Lens; -} - -lift<, TResult>(fn: () => TResult): () => TResult[]; -lift(fn: (v1: T1) => TResult): (v1: List) => TResult[]; -lift(fn: (v1: T1, v2: T2) => TResult): (v1: List, v2: List) => TResult[]; -lift(fn: (v1: T1, v2: T2, v3: T3) => TResult): (v1: List, v2: List, v3: List) => TResult[]; -lift(fn: (v1: T1, v2: T2, v3: T3, v4: T4) => TResult): (v1: List, v2: List, v3: List, v4: List) => TResult[]; -lift(fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) => TResult): (v1: List, v2: List, v3: List, v4: List, v5: List) => TResult[]; -lift(fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6) => TResult): (v1: List, v2: List, v3: List, v4: List, v5: List, v6: List) => TResult[]; -lift(fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7) => TResult): (v1: List, v2: List, v3: List, v4: List, v5: List, v6: List, v7: List) => TResult[]; -lift(fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7, v8: T8) => TResult): (v1: List, v2: List, v3: List, v4: List, v5: List, v6: List, v7: List, v8: List) => TResult[]; -lift(fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7, v8: T8, v9: T9) => TResult): (v1: List, v2: List, v3: List, v4: List, v5: List, v6: List, v7: List, v8: List, v9: List) => TResult[]; - -liftN<, TResult>(n: number, fn: () => TResult): () => TResult[]; -liftN(n: number, fn: (v1: T1) => TResult): (v1: List) => TResult[]; -liftN(n: number, fn: (v1: T1, v2: T2) => TResult): (v1: List, v2: List) => TResult[]; -liftN(n: number, fn: (v1: T1, v2: T2, v3: T3) => TResult): (v1: List, v2: List, v3: List) => TResult[]; -liftN(n: number, fn: (v1: T1, v2: T2, v3: T3, v4: T4) => TResult): (v1: List, v2: List, v3: List, v4: List) => TResult[]; -liftN(n: number, fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) => TResult): (v1: List, v2: List, v3: List, v4: List, v5: List) => TResult[]; -liftN(n: number, fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6) => TResult): (v1: List, v2: List, v3: List, v4: List, v5: List, v6: List) => TResult[]; -liftN(n: number, fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7) => TResult): (v1: List, v2: List, v3: List, v4: List, v5: List, v6: List, v7: List) => TResult[]; -liftN(n: number, fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7, v8: T8) => TResult): (v1: List, v2: List, v3: List, v4: List, v5: List, v6: List, v7: List, v8: List) => TResult[]; -liftN(n: number, fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7, v8: T8, v9: T9) => TResult): (v1: List, v2: List, v3: List, v4: List, v5: List, v6: List, v7: List, v8: List, v9: List) => TResult[]; - -lt: { - // sole - (a: number, b: number): boolean; - (a: number): (b: number) => boolean; -} - -lte: { - // sole - (a: number, b: number): boolean; - (a: number): (b: number) => boolean; -} - -map: { - // base - // array - (fn: (value: T) => U): (list: List) => U[]; - - // obj_keyof - (fn: (value: T) => U): >(obj: M) => {[K in keyof M]: U}; - - // obj_record - (fn: (value: T) => U): (obj: Record) => Record; - - // functor - (fn: (value: T) => U): (obj: Functor) => Functor; - - // compose - (fn: (value: T) => U): (f1: (...args: any[]) => T) => (...args: any[]) => U; - - // mixed - (fn: (value: T) => U): { - // array - (list: List): U[]; - - // obj_keyof - >(obj: M): {[K in keyof M]: U}; - - // obj_record - (obj: Record): Record; - - // functor - (obj: Functor): Functor; - - // compose - (f1: (...args: any[]) => T): (...args: any[]) => U; - - }; -} - -mapAccum: { - // sole - (fn: (acc: U, value: T) => [U, TResult], acc: U, list: List): [U, TResult[]]; - (fn: (acc: U, value: T) => [U, TResult], acc: U): (list: List) => [U, TResult[]]; - (fn: (acc: U, value: T) => [U, TResult]): { - (acc: U, list: List): [U, TResult[]]; - (acc: U): (list: List) => [U, TResult[]]; - }; -} - -mapAccumRight: { - // sole - (fn: (value: T, acc: U) => [TResult, U], acc: U, list: List): [TResult[], U]; - (fn: (value: T, acc: U) => [TResult, U], acc: U): (list: List) => [TResult[], U]; - (fn: (value: T, acc: U) => [TResult, U]): { - (acc: U, list: List): [TResult[], U]; - (acc: U): (list: List) => [TResult[], U]; - }; -} - -mapIndexed: { - // sole - (fn: (value: T, acc: U) => [TResult, U], acc: U, list: List): [TResult[], U]; - (fn: (value: T, acc: U) => [TResult, U], acc: U): (list: List) => [TResult[], U]; - (fn: (value: T, acc: U) => [TResult, U]): { - (acc: U, list: List): [TResult[], U]; - (acc: U): (list: List) => [TResult[], U]; - }; -} - -mapObjIndexed: { - // sole - >(fn: (value: T, key: string, obj?:M) => V, obj: M): {[K in keyof M]: V}; - >(fn: (value: T, key: string, obj?:M) => V): (obj: M) => {[K in keyof M]: V}; -} - -match: { - // sole - (regexp: RegExp, str: string): string[]; - (regexp: RegExp): (str: string) => string[]; -} - -mathMod: { - // sole - (a: number, b: number): number; - (a: number): (b: number) => number; -} - -max: { - // sole - (a: T, b: T): T; - (a: T): (b: T) => T; -} - -maxBy: { - // sole - (keyFn: (a: T) => Ord, a: T, b: T): T; - (keyFn: (a: T) => Ord, a: T): (b: T) => T; - (keyFn: (a: T) => Ord): { - (a: T, b: T): T; - (a: T): (b: T) => T; - }; -} - -merge: { - // sole - , T2 extends Struct, V1, V2>(a: T1, b: T2): T1 & T2; - >(a: T1): , V1, V2>(b: T2) => T1 & T2; -} - -mergeAll: { - // sole - (list: List): T; -} - -mergeWith: { - // sole - (fn: (x: any, z: any) => any, a: U, b: V): U & V; - (fn: (x: any, z: any) => any, a: U): (b: V) => U & V; - (fn: (x: any, z: any) => any): { - (a: U, b: V): U & V; - (a: U): (b: V) => U & V; - }; -} - -mergeWithKey: { - // mergeWithKey - (fn: (str: string, x: any, z: any) => any, a: U, b: V): U & V; - (fn: (str: string, x: any, z: any) => any, a: U): (b: V) => U & V; - (fn: (str: string, x: any, z: any) => any): { - (a: U, b: V): U & V; - (a: U): (b: V) => U & V; - }; -} - -minBy: { - // sole - (keyFn: (a: T) => Ord, a: T, b: T): T; - (keyFn: (a: T) => Ord, a: T): (b: T) => T; - (keyFn: (a: T) => Ord): { - (a: T, b: T): T; - (a: T): (b: T) => T; - }; -} - -over: { - // Functor version - >(lens: Lens|ManualLens|UnknownLens, fn: (v: V) => V, value: T): T; - >(lens: Lens|ManualLens|UnknownLens, fn: (v: V) => V): (value: T) => T; - >(lens: Lens|ManualLens|UnknownLens): { - (fn: (v: V) => V, value: T): T; - (fn: (v: V) => V): (value: T) => T; - }; - - // Functor version applied to array - >(lens: Lens|ManualLens|UnknownLens, fn: (v: V) => V, value: T): V[]; - >(lens: Lens|ManualLens|UnknownLens, fn: (v: V) => V): (value: T) => V[]; - >(lens: Lens|ManualLens|UnknownLens): { - (fn: (v: V) => V, value: T): V[]; - (fn: (v: V) => V): (value: T) => V[]; - }; - - // unbound value - (lens: Lens|ManualLens|UnknownLens, fn: (v: V) => V, value: T): T; - (lens: Lens|ManualLens|UnknownLens, fn: (v: V) => V): (value: T) => T; - (lens: Lens|ManualLens|UnknownLens): { - (fn: (v: V) => V, value: T): T; - (fn: (v: V) => V): (value: T) => T; - }; -} - -path(path: [T1, T2], obj: {[K1 in T1]: {[K2 in T2]: TResult}}): TResult; -path(path: [T1, T2, T3], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: TResult}}}): TResult; -path(path: [T1, T2, T3, T4], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: TResult}}}}): TResult; -path(path: [T1, T2, T3, T4, T5], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: TResult}}}}}): TResult; -path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: {[K6 in T6]: TResult}}}}}}): TResult; -path(path: [T1, T2, T3, T4, T5, T6, T7], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: {[K6 in T6]: {[K7 in T7]: TResult}}}}}}}): TResult; -path(path: [T1, T2, T3, T4, T5, T6, T7, T8], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: {[K6 in T6]: {[K7 in T7]: {[K8 in T8]: TResult}}}}}}}}): TResult; -path(path: [T1, T2, T3, T4, T5, T6, T7, T8, T9], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: {[K6 in T6]: {[K7 in T7]: {[K8 in T8]: {[K9 in T9]: TResult}}}}}}}}}): TResult; - -pathOr: { - // sole - (d: T, p: Path, obj: Struct): T|any; - (d: T, p: Path): (obj: Struct) => T|any; - (d: T): { - (p: Path, obj: Struct): T|any; - (p: Path): (obj: Struct) => T|any; - }; -} - -pathSatisfies: { - // sole - (fn: Pred, p: Path, obj: any): boolean; - (fn: Pred, p: Path): (obj: any) => boolean; - (fn: Pred): { - (p: Path, obj: any): boolean; - (p: Path): (obj: any) => boolean; - }; -} - -pipe(fn0: (x0: V0) => T1): (x0: V0) => T1; -pipe(fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T1; -pipe(fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T1; -pipe(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1): (x0: V0, x1: V1, x2: V2, x3: V3) => T1; -pipe(fn0: (x0: V0) => T1, fn1: (x: T1) => T2): (x0: V0) => T2; -pipe(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2): (x0: V0, x1: V1) => T2; -pipe(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2): (x0: V0, x1: V1, x2: V2) => T2; -pipe(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1, fn1: (x: T1) => T2): (x0: V0, x1: V1, x2: V2, x3: V3) => T2; -pipe(fn0: (x0: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3): (x0: V0) => T3; -pipe(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3): (x0: V0, x1: V1) => T3; -pipe(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3): (x0: V0, x1: V1, x2: V2) => T3; -pipe(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3): (x0: V0, x1: V1, x2: V2, x3: V3) => T3; -pipe(fn0: (x0: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4): (x0: V0) => T4; -pipe(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4): (x0: V0, x1: V1) => T4; -pipe(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4): (x0: V0, x1: V1, x2: V2) => T4; -pipe(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4): (x0: V0, x1: V1, x2: V2, x3: V3) => T4; -pipe(fn0: (x0: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5): (x0: V0) => T5; -pipe(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5): (x0: V0, x1: V1) => T5; -pipe(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5): (x0: V0, x1: V1, x2: V2) => T5; -pipe(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5): (x0: V0, x1: V1, x2: V2, x3: V3) => T5; -pipe(fn0: (x0: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6): (x0: V0) => T6; -pipe(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6): (x0: V0, x1: V1) => T6; -pipe(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6): (x0: V0, x1: V1, x2: V2) => T6; -pipe(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6): (x0: V0, x1: V1, x2: V2, x3: V3) => T6; -pipe(fn0: (x0: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7): (x0: V0) => T7; -pipe(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7): (x0: V0, x1: V1) => T7; -pipe(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7): (x0: V0, x1: V1, x2: V2) => T7; -pipe(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7): (x0: V0, x1: V1, x2: V2, x3: V3) => T7; -pipe(fn0: (x0: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn7: (x: T7) => T8): (x0: V0) => T8; -pipe(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn7: (x: T7) => T8): (x0: V0, x1: V1) => T8; -pipe(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn7: (x: T7) => T8): (x0: V0, x1: V1, x2: V2) => T8; -pipe(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn7: (x: T7) => T8): (x0: V0, x1: V1, x2: V2, x3: V3) => T8; -pipe(fn0: (x0: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn7: (x: T7) => T8, fn8: (x: T8) => T9): (x0: V0) => T9; -pipe(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn7: (x: T7) => T8, fn8: (x: T8) => T9): (x0: V0, x1: V1) => T9; -pipe(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn7: (x: T7) => T8, fn8: (x: T8) => T9): (x0: V0, x1: V1, x2: V2) => T9; -pipe(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn7: (x: T7) => T8, fn8: (x: T8) => T9): (x0: V0, x1: V1, x2: V2, x3: V3) => T9; - -pipeK(fn0: (v: Chain) => Chain): (v: V) => Chain; -pipeK(fn0: (v: Chain) => Chain, fn1: (x: T1) => Chain): (v: V) => Chain; -pipeK(fn0: (v: Chain) => Chain, fn1: (x: T1) => Chain, fn2: (x: T2) => Chain): (v: V) => Chain; -pipeK(fn0: (v: Chain) => Chain, fn1: (x: T1) => Chain, fn2: (x: T2) => Chain, fn3: (x: T3) => Chain): (v: V) => Chain; -pipeK(fn0: (v: Chain) => Chain, fn1: (x: T1) => Chain, fn2: (x: T2) => Chain, fn3: (x: T3) => Chain, fn4: (x: T4) => Chain): (v: V) => Chain; -pipeK(fn0: (v: Chain) => Chain, fn1: (x: T1) => Chain, fn2: (x: T2) => Chain, fn3: (x: T3) => Chain, fn4: (x: T4) => Chain, fn5: (x: T5) => Chain): (v: V) => Chain; -pipeK(fn0: (v: Chain) => Chain, fn1: (x: T1) => Chain, fn2: (x: T2) => Chain, fn3: (x: T3) => Chain, fn4: (x: T4) => Chain, fn5: (x: T5) => Chain, fn6: (x: T6) => Chain): (v: V) => Chain; -pipeK(fn0: (v: Chain) => Chain, fn1: (x: T1) => Chain, fn2: (x: T2) => Chain, fn3: (x: T3) => Chain, fn4: (x: T4) => Chain, fn5: (x: T5) => Chain, fn6: (x: T6) => Chain, fn7: (x: T7) => Chain): (v: V) => Chain; -pipeK(fn0: (v: Chain) => Chain, fn1: (x: T1) => Chain, fn2: (x: T2) => Chain, fn3: (x: T3) => Chain, fn4: (x: T4) => Chain, fn5: (x: T5) => Chain, fn6: (x: T6) => Chain, fn7: (x: T7) => Chain, fn8: (x: T8) => Chain): (v: V) => Chain; - -pipeP(fn0: (x0: V0) => Promise): (x0: V0) => Promise; -pipeP(fn0: (x0: V0, x1: V1) => Promise): (x0: V0, x1: V1) => Promise; -pipeP(fn0: (x0: V0, x1: V1, x2: V2) => Promise): (x0: V0, x1: V1, x2: V2) => Promise; -pipeP(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; -pipeP(fn0: (x0: V0) => Promise, fn1: (x: T1) => Promise|T2): (x0: V0) => Promise; -pipeP(fn0: (x0: V0, x1: V1) => Promise, fn1: (x: T1) => Promise|T2): (x0: V0, x1: V1) => Promise; -pipeP(fn0: (x0: V0, x1: V1, x2: V2) => Promise, fn1: (x: T1) => Promise|T2): (x0: V0, x1: V1, x2: V2) => Promise; -pipeP(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise, fn1: (x: T1) => Promise|T2): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; -pipeP(fn0: (x0: V0) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3): (x0: V0) => Promise; -pipeP(fn0: (x0: V0, x1: V1) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3): (x0: V0, x1: V1) => Promise; -pipeP(fn0: (x0: V0, x1: V1, x2: V2) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3): (x0: V0, x1: V1, x2: V2) => Promise; -pipeP(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; -pipeP(fn0: (x0: V0) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4): (x0: V0) => Promise; -pipeP(fn0: (x0: V0, x1: V1) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4): (x0: V0, x1: V1) => Promise; -pipeP(fn0: (x0: V0, x1: V1, x2: V2) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4): (x0: V0, x1: V1, x2: V2) => Promise; -pipeP(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; -pipeP(fn0: (x0: V0) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5): (x0: V0) => Promise; -pipeP(fn0: (x0: V0, x1: V1) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5): (x0: V0, x1: V1) => Promise; -pipeP(fn0: (x0: V0, x1: V1, x2: V2) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5): (x0: V0, x1: V1, x2: V2) => Promise; -pipeP(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; -pipeP(fn0: (x0: V0) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6): (x0: V0) => Promise; -pipeP(fn0: (x0: V0, x1: V1) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6): (x0: V0, x1: V1) => Promise; -pipeP(fn0: (x0: V0, x1: V1, x2: V2) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6): (x0: V0, x1: V1, x2: V2) => Promise; -pipeP(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; -pipeP(fn0: (x0: V0) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7): (x0: V0) => Promise; -pipeP(fn0: (x0: V0, x1: V1) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7): (x0: V0, x1: V1) => Promise; -pipeP(fn0: (x0: V0, x1: V1, x2: V2) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7): (x0: V0, x1: V1, x2: V2) => Promise; -pipeP(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; -pipeP(fn0: (x0: V0) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7, fn7: (x: T7) => Promise|T8): (x0: V0) => Promise; -pipeP(fn0: (x0: V0, x1: V1) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7, fn7: (x: T7) => Promise|T8): (x0: V0, x1: V1) => Promise; -pipeP(fn0: (x0: V0, x1: V1, x2: V2) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7, fn7: (x: T7) => Promise|T8): (x0: V0, x1: V1, x2: V2) => Promise; -pipeP(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7, fn7: (x: T7) => Promise|T8): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; -pipeP(fn0: (x0: V0) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7, fn7: (x: T7) => Promise|T8, fn8: (x: T8) => Promise|T9): (x0: V0) => Promise; -pipeP(fn0: (x0: V0, x1: V1) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7, fn7: (x: T7) => Promise|T8, fn8: (x: T8) => Promise|T9): (x0: V0, x1: V1) => Promise; -pipeP(fn0: (x0: V0, x1: V1, x2: V2) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7, fn7: (x: T7) => Promise|T8, fn8: (x: T8) => Promise|T9): (x0: V0, x1: V1, x2: V2) => Promise; -pipeP(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7, fn7: (x: T7) => Promise|T8, fn8: (x: T8) => Promise|T9): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; - -propEq: { - // sole - >(name: Prop, val: any, obj: T): boolean; - (name: Prop, val: any): >(obj: T) => boolean; - (name: Prop): { - >(val: any, obj: T): boolean; - (val: any): >(obj: T) => boolean; - }; -} - -propOr: { - // sole - // record - (val: T, p: K): , V>(obj: U) => V|T; - (val: T): { - , V>(p: K, obj: U): V|T; - (p: K): , V>(obj: U) => V|T; - }; - - // keyof - (val: T, p: K): (obj: U) => U[K]|T; - (val: T): { - (p: K, obj: U): U[K]|T; - (p: K): (obj: U) => U[K]|T; - }; - - // same - (val: T, p: Prop): (obj: Struct) => T; - (val: T): { - (p: Prop, obj: Struct): T; - (p: Prop): (obj: Struct) => T; - }; - - // unbound - (val: T, p: Prop): (obj: U) => V; - (val: T): { - (p: Prop, obj: U): V; - (p: Prop): (obj: U) => V; - }; - - // mixed - (val: T): { - // record - , V>(p: K, obj: U): V|T; - (p: K): , V>(obj: U) => V|T; - - // keyof - (p: K, obj: U): U[K]|T; - (p: K): (obj: U) => U[K]|T; - - // same - (p: Prop, obj: Struct): T; - (p: Prop): (obj: Struct) => T; - - // unbound - (p: Prop, obj: U): V; - (p: Prop): (obj: U) => V; - - }; -} - -propStatisfies: { - // Record (curry-friendly) - >(pred: Pred, name: K, obj: U): boolean; - (pred: Pred, name: K): >(obj: U) => boolean; - (pred: Pred): { - >(name: K, obj: U): boolean; - (name: K): >(obj: U) => boolean; - }; - - // keyof, info too late on currying - (pred: Pred, name: Prop, obj: U): boolean; - (pred: Pred, name: Prop): (obj: U) => boolean; - (pred: Pred): { - (name: Prop, obj: U): boolean; - (name: Prop): (obj: U) => boolean; - }; -} - -reduce: { - // sole - >(fn: (acc: TResult, elem: T, idx: number, list: R) => TResult|Reduced, acc: TResult, list: R): TResult; - >(fn: (acc: TResult, elem: T, idx: number, list: R) => TResult|Reduced, acc: TResult): (list: R) => TResult; - >(fn: (acc: TResult, elem: T, idx: number, list: R) => TResult|Reduced): { - (acc: TResult, list: R): TResult; - (acc: TResult): (list: R) => TResult; - }; -} - -reduceBy: { - // sole - >(valueFn: (acc: TResult, elem: T, idx: number, list: R) => TResult, acc: TResult|any, keyFn: (elem: T) => string, list: R): TResult; - >(valueFn: (acc: TResult, elem: T, idx: number, list: R) => TResult, acc: TResult|any, keyFn: (elem: T) => string): (list: R) => TResult; - >(valueFn: (acc: TResult, elem: T, idx: number, list: R) => TResult, acc: TResult|any): { - (keyFn: (elem: T) => string, list: R): TResult; - (keyFn: (elem: T) => string): (list: R) => TResult; - }; - >(valueFn: (acc: TResult, elem: T, idx: number, list: R) => TResult): { - (acc: TResult|any, keyFn: (elem: T) => string, list: R): TResult; - (acc: TResult|any, keyFn: (elem: T) => string): (list: R) => TResult; - (acc: TResult|any): { - (keyFn: (elem: T) => string, list: R): TResult; - (keyFn: (elem: T) => string): (list: R) => TResult; - }; - }; -} - -reduceRight: { - // sole - (fn: (elem: T, acc: TResult) => TResult|Reduced, acc: TResult|any, list: List): TResult; - (fn: (elem: T, acc: TResult) => TResult|Reduced, acc: TResult|any): (list: List) => TResult; - (fn: (elem: T, acc: TResult) => TResult|Reduced): { - (acc: TResult|any, list: List): TResult; - (acc: TResult|any): (list: List) => TResult; - }; -} - -reduceWhile: { - // sole - (pred: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult|Reduced, acc: TResult, list: List): TResult; - (pred: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult|Reduced, acc: TResult): (list: List) => TResult; - (pred: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult|Reduced): { - (acc: TResult, list: List): TResult; - (acc: TResult): (list: List) => TResult; - }; - (pred: (acc: TResult, elem: T) => boolean): { - (fn: (acc: TResult, elem: T) => TResult|Reduced, acc: TResult, list: List): TResult; - (fn: (acc: TResult, elem: T) => TResult|Reduced, acc: TResult): (list: List) => TResult; - (fn: (acc: TResult, elem: T) => TResult|Reduced): { - (acc: TResult, list: List): TResult; - (acc: TResult): (list: List) => TResult; - }; - }; -} - -remove: { - // sole - (start: number, count: number, list: List): T[]; - (start: number, count: number): (list: List) => T[]; - (start: number): { - (count: number, list: List): T[]; - (count: number): (list: List) => T[]; - }; -} - -replace: { - // sole - (pattern: RegExp|Prop, replacement: Prop, str: string): string; - (pattern: RegExp|Prop, replacement: Prop): (str: string) => string; - (pattern: RegExp|Prop): { - (replacement: Prop, str: string): string; - (replacement: Prop): (str: string) => string; - }; -} - -scan: { - // sole - (fn: (acc: TResult, elem: T) => TResult|Reduced, acc: TResult, list: List): TResult[]; - (fn: (acc: TResult, elem: T) => TResult|Reduced, acc: TResult): (list: List) => TResult[]; - (fn: (acc: TResult, elem: T) => TResult|Reduced): { - (acc: TResult, list: List): TResult[]; - (acc: TResult): (list: List) => TResult[]; - }; -} - -set: { - // base - (lens: Lens, a: U, obj: T): T; - (lens: Lens, a: U): (obj: T) => T; - (lens: Lens): { - (a: U, obj: T): T; - (a: U): (obj: T) => T; - }; - - // unknown - (lens: UnknownLens, a: any, obj: T): T; - (lens: UnknownLens, a: any): (obj: T) => T; - (lens: UnknownLens): { - (a: any, obj: T): T; - (a: any): (obj: T) => T; - }; -} - -slice: { - // sole - >(a: number, b: number, list: T): T; - (a: number, b: number): >(list: T) => T; - (a: number): { - >(b: number, list: T): T; - (b: number): >(list: T) => T; - }; -} - -symmetricDifferenceWith: { - // sole - (pred: (a: T, b: T) => boolean, list1: List, list2: List): T[]; - (pred: (a: T, b: T) => boolean, list1: List): (list2: List) => T[]; - (pred: (a: T, b: T) => boolean): { - (list1: List, list2: List): T[]; - (list1: List): (list2: List) => T[]; - }; -} - -transduce: { - // sole - (xf: (arg: List) => List, fn: (acc: List, val:U) => List, acc: List, list: List): U; - (xf: (arg: List) => List, fn: (acc: List, val:U) => List, acc: List): (list: List) => U; - (xf: (arg: List) => List, fn: (acc: List, val:U) => List): { - (acc: List, list: List): U; - (acc: List): (list: List) => U; - }; - (xf: (arg: List) => List): { - (fn: (acc: List, val:U) => List, acc: List, list: List): U; - (fn: (acc: List, val:U) => List, acc: List): (list: List) => U; - (fn: (acc: List, val:U) => List): { - (acc: List, list: List): U; - (acc: List): (list: List) => U; - }; - }; -} - -traverse: { - // base - (ap: (v: T) => Applicative, fn: (v: T) => Applicative, traversable: List): Applicative>; - (ap: (v: T) => Applicative, fn: (v: T) => Applicative): (traversable: List) => Applicative>; - (ap: (v: T) => Applicative): { - (fn: (v: T) => Applicative, traversable: List): Applicative>; - (fn: (v: T) => Applicative): (traversable: List) => Applicative>; - }; - - // general ADT case - (ap: (v: T) => Applicative, fn: (v: T) => Applicative, traversable: List): Applicative>; - (ap: (v: T) => Applicative, fn: (v: T) => Applicative): (traversable: List) => Applicative>; - (ap: (v: T) => Applicative): { - (fn: (v: T) => Applicative, traversable: List): Applicative>; - (fn: (v: T) => Applicative): (traversable: List) => Applicative>; - }; -} - -unionWith: { - // sole - (pred: (a: T, b: T) => boolean, list1: List, list2: List): T[]; - (pred: (a: T, b: T) => boolean, list1: List): (list2: List) => T[]; - (pred: (a: T, b: T) => boolean): { - (list1: List, list2: List): T[]; - (list1: List): (list2: List) => T[]; - }; -} - -until: { - // sole - (pred: Pred, fn: (val: T) => U, init: U): U; - (pred: Pred, fn: (val: T) => U): (init: U) => U; - (pred: Pred): { - (fn: (val: T) => U, init: U): U; - (fn: (val: T) => U): (init: U) => U; - }; -} - -update: { - // sole - (index: number, value: T, list: List): T[]; - (index: number, value: T): (list: List) => T[]; - (index: number): { - (value: T, list: List): T[]; - (value: T): (list: List) => T[]; - }; -} - -when: { - // sole - (pred: Pred, whenTrueFn: (a: T) => U, obj: T): U; - (pred: Pred, whenTrueFn: (a: T) => U): (obj: T) => U; - (pred: Pred): { - (whenTrueFn: (a: T) => U, obj: T): U; - (whenTrueFn: (a: T) => U): (obj: T) => U; - }; -} - -and: { - // dispatch to some `and` method: - (fn1: T, val2: boolean|any): boolean; - (fn1: T): (val2: boolean|any) => boolean; - - // no generics - (v1: any, v2: any): boolean; - (v1: any): (v2: any) => boolean; -} - -difference: { - // sole - (list1: List, list2: List): T[]; - (list1: List): (list2: List) => T[]; -} - -identity: { - // sole - (a: T): T; -} - -inc: { - // sole - (n: number): number; -} - -init: { - // sole - >(list: T): T; -} - -invert: { - // sole - (obj: Struct): Obj>; -} - -invertObj: { - // sole - (obj: Struct): Obj; -} - -isArrayLike: { - // sole - (val: any): val in List; -} - -isEmpty: { - // sole - (val: any): boolean; -} - -isNil: { - // sole - (val: any): boolean; -} - -keys: { - // sole - (x: Struct): string[]; -} - -keysIn: { - // sole - (obj: Struct): string[]; -} - -last: { - // sole - , T>(list: R): T; -} - -length: { - // sole - (list: List): number; -} - -lensIndex: { - // generics - (n: number): ManualLens; - - // non-generic - (n: number): UnknownLens; -} - -lensPath: { - // generics - (path: Path): ManualLens; - - // non-generic - (path: Path): UnknownLens; -} - -lensProp: { - // generics - (prop: Prop): ManualLens; - - // non-generic - (prop: Prop): UnknownLens; -} - -mean: { - // sole - (list: List): number; -} - -median: { - // sole - (list: List): number; -} - -memoize: { - // sole - (fn: Variadic): Variadic; -} - -min: { - // sole - (a: T, b: T): T; - (a: T): (b: T) => T; -} - -modulo: { - // sole - (a: number, b: number): number; - (a: number): (b: number) => number; -} - -multiply: { - // sole - (a: number, b: number): number; - (a: number): (b: number) => number; -} - -nAry: { - // sole - (n: number, fn: Variadic): Variadic; - (n: number): (fn: Variadic) => Variadic; -} - -negate: { - // sole - (n: number): number; -} - -none: { - // sole - (fn: (a: T) => boolean, list: List): boolean; - (fn: (a: T) => boolean): (list: List) => boolean; -} - -not: { - // sole - (value: any): boolean; -} - -nth: { - // sole - (n: number, list: list): undefined; - (n: number): (list: list) => undefined; -} - -nthArg: { - // sole - (n: number): (...a : T[]) => T; -} - -objOf: { - // sole - >(key: K, value: V): T; - (key: K): >(value: V) => T; -} - -of: { - // sole - (x: T): T[]; -} - -omit: { - // sole - (names: List, obj: T): T; - (names: List): (obj: T) => T; -} - -once: { - // sole - (fn: Variadic): Variadic; -} - -or: { - // dispatch to some `or` method - T|U}, U>(fn1: T, val2: U): T|U; - T|U}>(fn1: T): (val2: U) => T|U; - - // values - (a: T, b: U): T|U; - (a: T): (b: U) => T|U; -} - -pair: { - // sole - (fst: F, snd: S): [F, S]; - (fst: F): (snd: S) => [F, S]; -} - -partial: { - // sole - (fn: Variadic, args: any[]): Variadic; - (fn: Variadic): (args: any[]) => Variadic; -} - -partialRight: { - // sole - (fn: Variadic, args: any[]): Variadic; - (fn: Variadic): (args: any[]) => Variadic; -} - -partition: { - // arrays - (fn: (a: T) => boolean, list: List): [T[], T[]]; - (fn: (a: T) => boolean): (list: List) => [T[], T[]]; - - // objects - , U extends Obj>(fn: (a: V) => boolean, obj: T & U): [T, U]; - (fn: (a: V) => boolean): , U extends Obj>(obj: T & U) => [T, U]; - - // objects, alternative notation - >(fn: (a: T) => boolean, obj: U): [Partial, Partial]; - (fn: (a: T) => boolean): >(obj: U) => [Partial, Partial]; -} - -pick: { - // generic 1 - (names: List, obj: T): Pick; - (names: List): (obj: T) => Pick; - - // generic 2 - (names: List, obj: T): Partial; - (names: List): (obj: T) => Partial; -} - -pickAll: { - // sole - (names: List, obj: T): Partial; - (names: List): (obj: T) => Partial; -} - -pickBy: { - // sole - (pred: ObjPred, obj: T): Partial; - (pred: ObjPred): (obj: T) => Partial; -} - -pluck: { - // infer - >(p: K, list: List): T[K][]; - (p: K): >(list: List) => T[K][]; - - // supply return object type manually when unable to infer it... - (p: Prop, list: Struct[]): T[]; - (p: Prop): (list: Struct[]) => T[]; -} - -prepend: { - // sole - (el: T, list: List): T[]; - (el: T): (list: List) => T[]; -} - -product: { - // sole - (list: List): number; -} - -project: { - // infer - (props: List, objs: List): Pick[]; - (props: List): (objs: List) => Pick[]; - - // supply return object type manually when unable to infer it... - (props: List, objs: List): U[]; - (props: List): (objs: List) => U[]; -} - -prop: { - // keyof version - (p: K, obj: T): T[K]; - (p: K): (obj: T) => T[K]; - - // Record version, more curry-friendly - , V>(p: K, obj: T): V; - (p: K): , V>(obj: T) => V; -} - -propIs: { - // Record - , V>(type: T, name: K, obj: U): obj is (U & Record); - (type: T, name: K): , V>(obj: U) => obj is (U & Record); - (type: T): { - , V>(name: K, obj: U): obj is (U & Record); - (name: K): , V>(obj: U) => obj is (U & Record); - }; - - // curry-friendlier fallback - (type: Function, name: Prop, obj: Struct): boolean; - (type: Function, name: Prop): (obj: Struct) => boolean; - (type: Function): { - (name: Prop, obj: Struct): boolean; - (name: Prop): (obj: Struct) => boolean; - }; -} - -propSatisfies: { - // Record - >(pred: Pred, name: K, obj: U): boolean; - (pred: Pred, name: K): >(obj: U) => boolean; - (pred: Pred): { - >(name: K, obj: U): boolean; - (name: K): >(obj: U) => boolean; - }; - - // keyof, info too late on currying - (pred: Pred, name: Pred, obj: U): boolean; - (pred: Pred, name: Pred): (obj: U) => boolean; - (pred: Pred): { - (name: Pred, obj: U): boolean; - (name: Pred): (obj: U) => boolean; - }; -} - -props: { - // sole - (ps: List, obj: Struct): T[]; - (ps: List): (obj: Struct) => T[]; -} - -range: { - // sole - (from: number, to: number): number[]; - (from: number): (to: number) => number[]; -} - -reduced: { - // sole - (el: T): Reduced; -} - -reject: { - // array - (pred: Pred, list: List): T[]; - (pred: Pred): (list: List) => T[]; - - // functor to functor - (pred: Pred, list: Functor): Functor; - (pred: Pred): (list: Functor) => Functor; - - // functor to array - (pred: Pred, list: Functor): T[]; - (pred: Pred): (list: Functor) => T[]; - - // object - >(pred: Pred, obj: U): Partial; - (pred: Pred): >(obj: U) => Partial; -} - -repeat: { - // sole - (a: T, n: number): T[]; - (a: T): (n: number) => T[]; -} - -reverse: { - // sole - (list: List): T[]; -} - -sequence: { - // common case of array as traversable - (fn: (v: T) => Applicative, traversable: List>): Applicative>; - (fn: (v: T) => Applicative): (traversable: List>) => Applicative>; - - // general ADT case: - (fn: (v: T) => Applicative, traversable: Traversable >): Applicative>; - (fn: (v: T) => Applicative): (traversable: Traversable >) => Applicative>; -} - -sort: { - // sole - (fn: (a: T, b: T) => number, list: List): T[]; - (fn: (a: T, b: T) => number): (list: List) => T[]; -} - -sortBy: { - // sole - (fn: (a: T) => string, list: List): T[]; - (fn: (a: T) => string): (list: List) => T[]; -} - -sortWith: { - // sole - (comparators: List<(a: T, b: T) => number>, list: List): T[]; - (comparators: List<(a: T, b: T) => number>): (list: List) => T[]; -} - -split: { - // sole - (sep: RegExp|Prop, str: string): string[]; - (sep: RegExp|Prop): (str: string) => string[]; -} - -splitAt: { - // string - (index: number, list: string): string[]; - (index: number): (list: string) => string[]; - - // array - (index: number, list: List): T[][]; - (index: number): (list: List) => T[][]; -} - -splitEvery: { - // sole - , T>(a: number, list: R): R[]; - (a: number): , T>(list: R) => R[]; -} - -splitWhen: { - // sole - >(pred: Pred, list: R): R[]; - (pred: Pred): >(list: R) => R[]; -} - -subtract: { - // sole - (a: number, b: number): number; - (a: number): (b: number) => number; -} - -sum: { - // sole - (list: List): number; -} - -symmetricDifference: { - // sole - (list1: List, list2: List): T[]; - (list1: List): (list2: List) => T[]; -} - -tail: { - // sole - >(list: T): T; -} - -take: { - // sole - >(n: number, xs: T): T; - (n: number): >(xs: T) => T; -} - -takeLast: { - // sole - >(n: number, xs: T): T; - (n: number): >(xs: T) => T; -} - -takeLastWhile: { - // sole - >(pred: Pred, list: R): R; - (pred: Pred): >(list: R) => R; -} - -takeWhile: { - // sole - >(pred: Pred, list: R): R; - (pred: Pred): >(list: R) => R; -} - -tap: { - // sole - (fn: (a: T) => any, value: T): T; - (fn: (a: T) => any): (value: T) => T; -} - -test: { - // sole - (regexp: RegExp, str: Prop): boolean; - (regexp: RegExp): (str: Prop) => boolean; -} - -times: { - // sole - (fn: (i: number) => T, n: number): T[]; - (fn: (i: number) => T): (n: number) => T[]; -} - -toLower: { - // sole - (str: string): string; -} - -toPairs: { - // sole - (obj: Obj): [string, T][]; -} - -toPairsIn: { - // generics - (obj: Obj): [string, T][]; - - // non-generic - (obj: Object): [string, any][]; -} - -toString: { - // sole - (val: StringRepresentable | any): string; -} - -toUpper: { - // sole - (str: string): string; -} - -transpose: { - // generics 1 - (list: List>): T[][]; - - // generics 2 - (list: List>): any[][]; -} - -trim: { - // sole - (str: string): string; -} - -tryCatch: { - // sole - (tryer: Variadic, catcher: Variadic): Variadic; - (tryer: Variadic): (catcher: Variadic) => Variadic; -} - -type: { - // sole - (val: any): string; -} - -unapply: { - // sole - (fn: (args: any[]) => T): Variadic; -} - -unary: { - // sole - (fn: (a: T, ...args: any[]) => U): (a: T) => U; -} - -uncurryN: { - // sole - (len: number, fn: (a: any) => any): Variadic; - (len: number): (fn: (a: any) => any) => Variadic; -} - -unfold: { - // sole - (fn: (seed: T) => [TResult, T] | false, seed: T): TResult[]; - (fn: (seed: T) => [TResult, T] | false): (seed: T) => TResult[]; -} - -union: { - // sole - (as: List, bs: List): T[]; - (as: List): (bs: List) => T[]; -} - -uniq: { - // sole - (list: List): T[]; -} - -uniqBy: { - // sole - (fn: (a: T) => U, list: List): T[]; - (fn: (a: T) => U): (list: List) => T[]; -} - -uniqWith: { - // sole - (pred: (x: T, y: T) => boolean, list: List): T[]; - (pred: (x: T, y: T) => boolean): (list: List) => T[]; -} - -unless: { - // sole - (pred: Pred, whenFalseFn: (a: T) => U, obj: T): U; - (pred: Pred, whenFalseFn: (a: T) => U): (obj: T) => U; - (pred: Pred): { - (whenFalseFn: (a: T) => U, obj: T): U; - (whenFalseFn: (a: T) => U): (obj: T) => U; - }; -} - -unnest: { - // sole - (x: List>): T[]; -} - -useWith: { - // sole - (fn: Variadic, transformers: List): Variadic; - (fn: Variadic): (transformers: List) => Variadic; -} - -values: { - // Struct - (obj: Struct): T[]; - - // Object - (obj: Object): any[]; -} - -valuesIn: { - // Struct - (obj: Struct): T[]; - - // Object - (obj: Object): any[]; -} - -view: { - // smart approach, unreliable - (lens: Lens, obj: T): U; - (lens: Lens): (obj: T) => U; - - // lens with type manually set - (lens: ManualLens, obj: Struct): T; - (lens: ManualLens): (obj: Struct) => T; - - // unknown lens, manually supply return type. does this add to the above case? - (lens: UnknownLens, obj: Struct): any; - (lens: UnknownLens): (obj: Struct) => any; -} - -where: { - // heterogeneous version - >(spec: {[P in keyof K]?: Pred}, testObj: T): boolean; - >(spec: {[P in keyof K]?: Pred}): (testObj: T) => boolean; - - // homogeneous version - (spec: Obj>, testObj: Obj): boolean; - (spec: Obj>): (testObj: Obj) => boolean; - - // DIY "fill in the type params yourself" version - (spec: T, testObj: U): boolean; - (spec: T): (testObj: U) => boolean; -} - -whereEq: { - // heterogeneous version - >(spec: Partial, testObj: T): boolean; - >(spec: Partial): (testObj: T) => boolean; - - // homogeneous version - (spec: Obj, testObj: Obj): boolean; - (spec: Obj): (testObj: Obj) => boolean; - - // DIY "fill in the type params yourself" version - (spec: T, testObj: U): boolean; - (spec: T): (testObj: U) => boolean; -} - -without: { - // sole - (list1: List, list2: List): T[]; - (list1: List): (list2: List) => T[]; -} - -xprod: { - // sole - (as: List, bs: List): KeyValuePair[]; - (as: List): (bs: List) => KeyValuePair[]; -} - -zip: { - // sole - (list1: List, list2: List): KeyValuePair[]; - (list1: List): (list2: List) => KeyValuePair[]; -} - -zipObj: { - // sole - (keys: List, values: List): Obj; - (keys: List): (values: List) => Obj; -} - -zipWith: { - // sole - (fn: (x: T, y: U) => TResult, list1: List, list2: List): TResult[]; - (fn: (x: T, y: U) => TResult, list1: List): (list2: List) => TResult[]; - (fn: (x: T, y: U) => TResult): { - (list1: List, list2: List): TResult[]; - (list1: List): (list2: List) => TResult[]; - }; -} - -F(): false; - -T(): true; - -head: { - // triple - (list: [T0, T1, T2]): T0; - - // tuple - (list: [T0, T1]): T0; - - // single - (list: [T]): T; - - // any - >(list: T): any; -} - -curryN: { - // sole - (length: number, fn: Variadic): Variadic; - (length: number): (fn: Variadic) => Variadic; -} diff --git a/gulpfile.ts b/gulpfile.ts new file mode 100644 index 0000000..641f0a4 --- /dev/null +++ b/gulpfile.ts @@ -0,0 +1,49 @@ +import * as del from 'del'; +import * as gulp from 'gulp'; +import * as gulp_diff from 'gulp-diff'; +import * as gulp_rename from 'gulp-rename'; +import * as gulp_run from 'run-sequence'; +import { build_watch } from './tasks/build-watch'; +import { remap_watch } from './tasks/remap-watch'; +import { + glob_templates, + output_relative_dirname, +} from './tasks/utils/constants'; +import { create_transform } from './tasks/utils/create-transform'; +import { generate_files } from './tasks/utils/generate-files'; +import { generate_index } from './tasks/utils/generate-index'; +import { generate_remap_content } from './tasks/utils/generate-remap-content'; + +gulp.task('clean', async () => del(`${output_relative_dirname}/`)); +gulp.task('build-index', generate_index); +gulp.task('build-files', () => generate_files(glob_templates)); + +gulp.task('build', ['clean'], (callback: (error?: any) => void) => + gulp_run(['build-index', 'build-files'], callback), +); + +gulp.task('build-watch', ['build'], build_watch); + +gulp.task('clean-remap', async () => del('./snapshots/')); +gulp.task('remap', ['clean-remap'], () => + gulp + .src('./tests/__snapshots__/*.ts.snap') + .pipe(create_transform(generate_remap_content)) + .pipe(gulp_rename({ extname: '' })) + .pipe(gulp.dest('./snapshots')), +); +gulp.task('remap-check', () => { + function on_error() { + throw new Error('Detected outdated remapped-snapshots'); + } + return gulp + .src('./tests/__snapshots__/*.ts.snap') + .pipe(create_transform(generate_remap_content)) + .pipe(gulp_rename({ extname: '' })) + .pipe(gulp_diff('./snapshots')) + .on('error', on_error) + .pipe(gulp_diff.reporter({ fail: true })) + .on('error', on_error); +}); + +gulp.task('remap-watch', ['remap'], remap_watch); diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 4e94d5c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,3685 +0,0 @@ -// Type definitions for ramda -// Project: [https://github.com/types/npm-ramda] -// Definitions by: Erwin Poeze -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare var R: R.Static; - -declare namespace R { - - - // Fantasyland interfaces - - // TODO: incorporate generalized inheritance e.g.: ``; possibly needs [rank 2 - // polymorphism](https://github.com/Microsoft/TypeScript/issues/1213). - - interface Setoid { - equals(b: Setoid): boolean; - } - - interface Semigroup { - concat(b: Semigroup): Semigroup; - } - - interface Monoid extends Semigroup { - /* static */ empty(): Monoid; - } - - interface Functor { - map(fn: (t: T) => U): Functor; - } - - interface Apply extends Functor { - apply(fn: Apply<(t: T) => U>): Apply; - } - - interface Applicative extends Apply { - /* static */ of(a: U): Applicative; - } - - interface Alt extends Functor { - alt(b: T): Alt; - } - - interface Plus extends Alt { - /* static */ zero(): Plus; - } - - interface Alternative extends Plus, Applicative { - } - - interface Foldable { - reduce(fn: (u: U, t: T) => U, u: U): U; - } - - interface Traversable extends Functor, Foldable { - traverse(fn: (t: T) => Applicative, of: (v: V) => Applicative): Applicative>; - } - - interface Chain extends Apply { - chain(fn: (t: T) => Chain): Chain; - } - - interface ChainRec extends Chain { - /* static */ chainRec(f: (next: (a: A) => C, done: (b: B) => C, value: A) => ChainRec, i: A): ChainRec; - } - - interface Monad extends Applicative, Chain { - } - - interface Extend { - extend(f: (v: Extend) => U): Extend; - } - - interface Comonad extends Functor, Extend { - extract(): U; // 'same U as in extend's f -- how to bind? - } - - interface Bifunctor extends Functor /*, Functor*/ { - bimap(f: (v: T) => B, g: (v: U) => D): Bifunctor; - } - - interface Profunctor extends Functor /*, Functor*/ { - promap(f: (v: T) => B, g: (v: U) => D): Profunctor; - } - - // simple types - - type Index = string | number; - type Primitive = string | number | boolean; - type Ord = string | number | boolean | Date; - - interface Dictionary { - [index: string]: T; - } - - type Obj = Dictionary; - type List = T[] | ArrayLike; - type StringLike = string | StringRepresentable; - type Prop = Index | StringRepresentable; - type Path = List; - type Struct = Obj | List; - type AccOpts = List|Obj|Transformer; - type Pred = (v: T) => boolean; - type ObjPred = (value: T, key: string) => boolean; - - // Ramda interfaces - - interface Type extends Function { - new (...args: any[]): T; - } - - interface Variadic { - (...args: any[]): T; - } - - interface KeyValuePair extends Array { 0 : K; 1 : V; } - - interface Transformer { - step: (acc: Acc, v: T) => Acc; - init: () => Acc; - result: (acc: Acc) => Res; // = R.identity - } - - interface NumericDictionary { - [index: number]: T; - } - - interface StringRepresentable { - toString(): T; - } - - interface NestedObj { - [index: string]: T|NestedObj; - } - - // interface RecursiveArray extends Array> {} - // interface ListOfRecursiveArraysOrValues extends List> {} - interface NestedArray { - [index: number]: T | NestedArray; - length: number; - } - - // // an unfortunate compromise -- while the actual lens should be generic, for the purpose of TS the structure should be supplied beforehand - // interface KeyLens, K extends keyof T> { - // // > - // (obj: T): T[K]; // get - // set(v: T[K], obj: T): T; - // // map(fn: (v: T[K]) => T[K], obj: T): T - // } - interface Lens { - (obj: T): U; // get - set(v: U, obj: T): T; - // map(fn: (v: U) => U, obj: T): T - } - interface ManualLens { - >(obj: T): U; // get - set>(v: U, obj: T): T; - // >map(fn: (v: U) => U, obj: T): T - } - interface UnknownLens { - (obj: T): U; // get - set(v: U, obj: T): T; - // map(fn: (v: U) => U, obj: T): T - } - - // @see https://gist.github.com/donnut/fd56232da58d25ceecf1, comment by @albrow - - // interface CurriedFunction1 { - // (v1: T1): R; - // } - type CurriedFunction1 = (v1: T1) => R; - - interface CurriedFunction2 { - (v1: T1): (v2: T2) => R; - (v1: T1, v2: T2): R; - } - interface CurriedFunction3 { - (v1: T1): CurriedFunction2; - (v1: T1, v2: T2): (v3: T3) => R; - (v1: T1, v2: T2, v3: T3): R; - } - interface CurriedFunction4 { - (v1: T1): CurriedFunction3; - (v1: T1, v2: T2): CurriedFunction2; - (v1: T1, v2: T2, v3: T3): (v4: T4) => R; - (v1: T1, v2: T2, v3: T3, v4: T4): R; - } - interface CurriedFunction5 { - (v1: T1): CurriedFunction4; - (v1: T1, v2: T2): CurriedFunction3; - (v1: T1, v2: T2, v3: T3): CurriedFunction2; - (v1: T1, v2: T2, v3: T3, v4: T4): (v5: T5) => R; - (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5): R; - } - interface CurriedFunction6 { - (v1: T1): CurriedFunction5; - (v1: T1, v2: T2): CurriedFunction4; - (v1: T1, v2: T2, v3: T3): CurriedFunction3; - (v1: T1, v2: T2, v3: T3, v4: T4): CurriedFunction2; - (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5): (v6: T6) => R; - (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6): R; - } - interface CurriedFunction7 { - (v1: T1): CurriedFunction6; - (v1: T1, v2: T2): CurriedFunction5; - (v1: T1, v2: T2, v3: T3): CurriedFunction4; - (v1: T1, v2: T2, v3: T3, v4: T4): CurriedFunction3; - (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5): CurriedFunction2; - (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6): (v7: T7) => R; - (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7): R; - } - interface CurriedFunction8 { - (v1: T1): CurriedFunction7; - (v1: T1, v2: T2): CurriedFunction6; - (v1: T1, v2: T2, v3: T3): CurriedFunction5; - (v1: T1, v2: T2, v3: T3, v4: T4): CurriedFunction4; - (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5): CurriedFunction3; - (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6): CurriedFunction2; - (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7): (v8: T8) => R; - (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7, v8: T8): R; - } - interface CurriedFunction9 { - (v1: T1): CurriedFunction8; - (v1: T1, v2: T2): CurriedFunction7; - (v1: T1, v2: T2, v3: T3): CurriedFunction6; - (v1: T1, v2: T2, v3: T3, v4: T4): CurriedFunction5; - (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5): CurriedFunction4; - (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6): CurriedFunction3; - (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7): CurriedFunction2; - (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7, v8: T8): (v9: T9) => R; - (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7, v8: T8, v9: T9): R; - } - - interface Reduced {} - - interface Static { - - /** - * A special placeholder value used to specify "gaps" within curried - * functions, allowing partial application of any combination of - * arguments, regardless of their positions. - * NOTE: can't type this yet, for binary functions consider R.flip! - */ - __: any; // { "@@functional/placeholder": boolean }; - // ^ don't type by value, since it can be inserted anywhere... - // Note this is still not useful, as it doesn't take into account how it changes formulas (leaving holes!). - // This remains TODO, and should be done on the level of curried functions, but that - // pretty much requires being able to express the separate functions as a single curried function... - // until that moment handling this would mean having to handle each possible combination for each function. :( - - /** - * Adds two numbers. Equivalent to a + b but curried. - */ - add(a: number, b: number): number; - add(a: number): (b: number) => number; - // add: CurriedFunction2; - - /** - * Creates a new list iteration function from an existing one by adding two new parameters to its callback - * function: the current index, and the entire list. - */ - addIndex>(fn: (f: (item: T) => U, list: V) => U[]): CurriedFunction2<(item: T, idx: number, list?: V) => U, V, U[]>; - /* Special case for forEach */ - addIndex(fn: (f: (item: T) => void, list: List) => T[]): CurriedFunction2<(item: T, idx: number, list?: List) => void, List, T[]>; - /* Special case for reduce */ - addIndex(fn: (f: (acc:U, item: T) => U, aci:U, list: List) => U): CurriedFunction3<(acc:U, item: T, idx: number, list?: List) => U, U, List, U>; - - /** - * Applies a function to the value at the given index of an array, returning a new copy of the array with the - * element at the given index replaced with the result of the function application. - */ - // adjust(fn: (a: T) => T, index: number, list: List): T[]; - // adjust(fn: (a: T) => T, index: number): (list: List) => T[]; - // adjust(fn: (a: T) => T): CurriedFunction2, T[]>; - // adjust: CurriedFunction3<(a: T) => T, number, List, T[]>; - - // base - adjust(fn: (a: T) => T, index: number, list: List): T[]; - adjust(fn: (a: T) => T, index: number):{ - (list: List): T[]; - }; - adjust(fn: (a: T) => T):{ - (index: number, list: List): T[]; - (index: number):{ - (list: List): T[]; - }; - }; - - - - /** - * Returns true if all elements of the list match the predicate, false if there are any that don't. - */ - all(pred: Pred, list: List): boolean; - all(pred: Pred): (list: List) => boolean; - // all: CurriedFunction2, List, boolean>; - - /** - * Given a list of predicates, returns a new predicate that will be true exactly when all of them are. - */ - allPass(preds: Pred[]): Pred; - - /** - * Returns a function that always returns the given value. - */ - always(val: T): () => T; - - /** - * A function that returns the first argument if it's falsy otherwise the second argument. Note that this is - * NOT short-circuited, meaning that if expressions are passed they are both evaluated. - */ - // and boolean>(fn1: T, fn2: T): T; - // and boolean>(fn1: T): (fn2: T) => T; - // no generics: - and(v1: any, v2: any): boolean; - and(v1: any): (v2: any) => boolean; - // and: CurriedFunction2; - - /** - * Returns true if at least one of elements of the list match the predicate, false otherwise. - */ - any(pred: Pred, list: List): boolean; - any(fnpred: Pred): (list: List) => boolean; - // any: CurriedFunction2, List, boolean>; - - /** - * Given a list of predicates returns a new predicate that will be true exactly when any one of them is. - */ - anyPass(preds: Pred[]): Pred; - - /** - * ap applies a list of functions to a list of values. - */ - ap(fns: ((a: T) => U)[], vs: List): U[]; - ap(fns: ((a: T) => U)[]): (vs: List) => U[]; - // ap: CurriedFunction2<((a: T) => U)[], List, U[]>; - - - /** - * Returns a new list, composed of n-tuples of consecutive elements If n is greater than the length of the list, - * an empty list is returned. - */ - aperture(n: number, list: List): T[][]; - aperture(n: number): (list: List) => T[][]; - // aperture: CurriedFunction2, T[][]>; - - /** - * Returns a new list containing the contents of the given list, followed by the given element. - */ - append(el: U, list: List): (T & U)[]; - append(el: U): (list: List) => (T & U)[]; - // append: CurriedFunction2, (T & U)[]>; - - /** - * Applies function fn to the argument list args. This is useful for creating a fixed-arity function from - * a variadic function. fn should be a bound function if context is significant. - */ - apply(fn: (...args: any[]) => TResult, args: any[]): TResult; - apply(fn: (...args: any[]) => TResult): (args: any[]) => TResult; - // apply: CurriedFunction2<(...args: any[]) => TResult, any[], TResult>; - - /** - * Given a spec object recursively mapping properties to functions, creates a function producing an object - * of the same structure, by mapping each property to the result of calling its associated function with - * the supplied arguments. - */ - applySpec(obj: any): Variadic; - - /** - * Makes an ascending comparator function out of a function that returns a value that can be compared with `<` and `>`. - */ - ascend(comparator: (val: T) => V, a: T, b: T): number; - ascend(comparator: (val: T) => V, a: T): (b: T) => number; - ascend(comparator: (val: T) => V): CurriedFunction2; - // ascend: CurriedFunction3<(val: T) => V, T, T, number>; - - /** - * Makes a shallow clone of an object, setting or overriding the specified property with the given value. - */ - // hard to mix cuz different initial generics? - - // extend object with new property - // assoc, K extends keyof U>(prop: K, val: T, obj: U): {[P in K]: T} & U; - // assoc, K extends keyof U>(prop: K, val: T): (obj: U) => {[P in K]: T} & U; // generics too early? - // assoc, K extends keyof U>(prop: K): CurriedFunction2; // generics too early? - // assoc, K extends keyof U>: CurriedFunction3; - - // // extend object with new property - // assoc>(prop: K, val: T, obj: U): {[P in K]: T} & U; - // assoc(prop: K, val: T):{ - // >(obj: U): {[P in K]: T} & U; - // }; - // assoc(prop: K):{ - // >(val: T, obj: U): {[P in K]: T} & U; - // (val: T):{ - // >(obj: U): {[P in K]: T} & U; - // }; - // }; - - - - // homogeneous object - assoc>(prop: Prop, val: T, obj: U): U; - assoc(prop: Prop, val: T): >(obj: U) => U; - assoc>(prop: Prop): CurriedFunction2; // generics too early? - // assoc>: CurriedFunction3; - - // any object as long as the type remains unchanged - assoc(prop: Prop, val: any, obj: T): T; - assoc(prop: Prop, val: any): (obj: T) => T; - assoc(prop: Prop): CurriedFunction2; // generics too early? - // assoc: CurriedFunction3; - - // any object as long as the type remains unchanged - assoc(prop: Prop, val: any, obj: T): T; - assoc(prop: Prop, val: any):{ - (obj: T): T; - }; - assoc(prop: Prop):{ - (val: any, obj: T): T; - (val: any):{ - (obj: T): T; - }; - }; - - - /** - * Makes a shallow clone of an object, setting or overriding the nodes required to create the given path, and - * placing the specific value at the tail end of that path. - */ - // assocPath(path: Path, val: T, obj: U): U; - // assocPath(path: Path, val: T): (obj: U) => U; - // assocPath(path: Path): CurriedFunction2; - // assocPath: CurriedFunction3; - - // base - assocPath(path: Path, val: T, obj: U): U; - assocPath(path: Path, val: T):{ - (obj: U): U; - }; - assocPath(path: Path):{ - (val: T, obj: U): U; - (val: T):{ - (obj: U): U; - }; - }; - - - /** - * Wraps a function of any arity (including nullary) in a function that accepts exactly 2 - * parameters. Any extraneous parameters will not be passed to the supplied function. - */ - binary(fn: (a: A, b: T, ...args: any[]) => T): (a: A, b: B) => T; - binary(fn: Variadic): (a: any, b: any) => T; - - /** - * Creates a function that is bound to a context. Note: R.bind does not provide the additional argument-binding - * capabilities of Function.prototype.bind. - */ - bind(fn: Variadic, thisObj: {}): Variadic; - bind(fn: Variadic): (thisObj: {}) => Variadic; - // bind: CurriedFunction2, {}, Variadic>; - - - /** - * A function wrapping calls to the two functions in an && operation, returning the result of the first function - * if it is false-y and the result of the second function otherwise. Note that this is short-circuited, meaning - * that the second function will not be invoked if the first returns a false-y value. - */ - both boolean>(pred1: T, pred2: T): T; - both boolean>(pred1: T): (pred2: T) => T; - // both boolean>: CurriedFunction2; - - /** - * Returns the result of calling its first argument with the remaining arguments. This is occasionally useful - * as a converging function for R.converge: the left branch can produce a function while the right branch - * produces a value to be passed to that function as an argument. - */ - // not curried! - call(fn: Variadic, ...args: any[]): T; - - /** - * `chain` maps a function over a list and concatenates the results. - * This implementation is compatible with the Fantasy-land Chain spec - */ - - // List version - chain(fn: (n: T) => U[], list: List): U[]; - chain(fn: (n: T) => U[]): (list: List) => U[]; - // chain: CurriedFunction2<(n: T) => U[], List, U[]>; - - // generic Chain version - chain(fn: (n: T) => Chain, list: Chain): Chain; - chain(fn: (n: T) => Chain): (list: Chain) => Chain; - // chain: CurriedFunction2<(n: T) => Chain, Chain, Chain>; - - // function argument - chain(fn: (v: V) => (list: Chain) => Chain, monad: (chain: Chain) => V): (list: Chain) => Chain; - chain(fn: (v: V) => (list: Chain) => Chain): (monad: (chain: Chain) => V) => (list: Chain) => Chain; - // chain: CurriedFunction2<(v: V) => (list: Chain) => Chain, (chain: Chain) => V, (list: Chain) => Chain>; - - /** - * Restricts a number to be within a range. - * Also works for other ordered types such as Strings and Date - */ - // clamp(min: T, max: T, value: T): T; - // clamp(min: T, max: T): (value: T) => T; - // clamp(min: T): CurriedFunction2; - // clamp: CurriedFunction3; - - // base - clamp(min: T, max: T, value: T): T; - clamp(min: T, max: T):{ - (value: T): T; - }; - clamp(min: T):{ - (max: T, value: T): T; - (max: T):{ - (value: T): T; - }; - }; - - - /** - * Creates a deep copy of the value which may contain (nested) Arrays and Objects, Numbers, Strings, Booleans and Dates. - */ - clone(value: T): T; - clone(value: List): T[]; - - /** - * Makes a comparator function out of a function that reports whether the first element is less than the second. - */ - comparator(pred: (a: T, b: T) => boolean): (x: T, y: T) => number; - - /** - * Takes a function f and returns a function g such that: - * - applying g to zero or more arguments will give true if applying the same arguments to f gives - * a logical false value; and - * - applying g to zero or more arguments will give false if applying the same arguments to f gives - * a logical true value. - */ - complement(pred: Variadic): Variadic; - - /** - * Performs right-to-left function composition. The rightmost function may have any arity; the remaining - * functions must be unary. - */ - compose(fn0: (x0: V0) => T1): (x0: V0) => T1; - compose(fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T1; - compose(fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T1; - compose(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1): (x0: V0, x1: V1, x2: V2, x3: V3) => T1; - compose(fn1: (x: T1) => T2, fn0: (x0: V0) => T1): (x0: V0) => T2; - compose(fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T2; - compose(fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T2; - compose(fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1): (x0: V0, x1: V1, x2: V2, x3: V3) => T2; - compose(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0) => T1): (x0: V0) => T3; - compose(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T3; - compose(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T3; - compose(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1): (x0: V0, x1: V1, x2: V2, x3: V3) => T3; - compose(fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0) => T1): (x0: V0) => T4; - compose(fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T4; - compose(fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T4; - compose(fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1): (x0: V0, x1: V1, x2: V2, x3: V3) => T4; - compose(fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0) => T1): (x0: V0) => T5; - compose(fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T5; - compose(fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T5; - compose(fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1): (x0: V0, x1: V1, x2: V2, x3: V3) => T5; - compose(fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0) => T1): (x0: V0) => T6; - compose(fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T6; - compose(fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T6; - compose(fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1): (x0: V0, x1: V1, x2: V2, x3: V3) => T6; - compose(fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0) => T1): (x0: V0) => T7; - compose(fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T7; - compose(fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T7; - compose(fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1): (x0: V0, x1: V1, x2: V2, x3: V3) => T7; - compose(fn7: (x: T7) => T8, fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0) => T1): (x0: V0) => T8; - compose(fn7: (x: T7) => T8, fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T8; - compose(fn7: (x: T7) => T8, fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T8; - compose(fn7: (x: T7) => T8, fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1): (x0: V0, x1: V1, x2: V2, x3: V3) => T8; - compose(fn8: (x: T8) => T9, fn7: (x: T7) => T8, fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0) => T1): (x0: V0) => T9; - compose(fn8: (x: T8) => T9, fn7: (x: T7) => T8, fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T9; - compose(fn8: (x: T8) => T9, fn7: (x: T7) => T8, fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T9; - compose(fn8: (x: T8) => T9, fn7: (x: T7) => T8, fn6: (x: T6) => T7, fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1): (x0: V0, x1: V1, x2: V2, x3: V3) => T9; - - /** - * Returns the right-to-left Kleisli composition of the provided functions, each of which must return a value of a type supported by chain. - */ - composeK(fn0: (v: Chain) => Chain): (v: V) => Chain; - composeK(fn1: (x: T1) => Chain, fn0: (v: Chain) => Chain): (v: V) => Chain; - composeK(fn2: (x: T2) => Chain, fn1: (x: T1) => Chain, fn0: (v: Chain) => Chain): (v: V) => Chain; - composeK(fn3: (x: T3) => Chain, fn2: (x: T2) => Chain, fn1: (x: T1) => Chain, fn0: (v: Chain) => Chain): (v: V) => Chain; - composeK(fn4: (x: T4) => Chain, fn3: (x: T3) => Chain, fn2: (x: T2) => Chain, fn1: (x: T1) => Chain, fn0: (v: Chain) => Chain): (v: V) => Chain; - composeK(fn5: (x: T5) => Chain, fn4: (x: T4) => Chain, fn3: (x: T3) => Chain, fn2: (x: T2) => Chain, fn1: (x: T1) => Chain, fn0: (v: Chain) => Chain): (v: V) => Chain; - composeK(fn6: (x: T6) => Chain, fn5: (x: T5) => Chain, fn4: (x: T4) => Chain, fn3: (x: T3) => Chain, fn2: (x: T2) => Chain, fn1: (x: T1) => Chain, fn0: (v: Chain) => Chain): (v: V) => Chain; - composeK(fn7: (x: T7) => Chain, fn6: (x: T6) => Chain, fn5: (x: T5) => Chain, fn4: (x: T4) => Chain, fn3: (x: T3) => Chain, fn2: (x: T2) => Chain, fn1: (x: T1) => Chain, fn0: (v: Chain) => Chain): (v: V) => Chain; - composeK(fn8: (x: T8) => Chain, fn7: (x: T7) => Chain, fn6: (x: T6) => Chain, fn5: (x: T5) => Chain, fn4: (x: T4) => Chain, fn3: (x: T3) => Chain, fn2: (x: T2) => Chain, fn1: (x: T1) => Chain, fn0: (v: Chain) => Chain): (v: V) => Chain; - - /** - * Performs right-to-left composition of one or more Promise-returning functions. The rightmost function may have any arity; the remaining functions must be unary. - */ - composeP(fn0: (x0: V0) => Promise): (x0: V0) => Promise; - composeP(fn0: (x0: V0, x1: V1) => Promise): (x0: V0, x1: V1) => Promise; - composeP(fn0: (x0: V0, x1: V1, x2: V2) => Promise): (x0: V0, x1: V1, x2: V2) => Promise; - composeP(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; - composeP(fn1: (x: T1) => Promise|T2, fn0: (x0: V0) => Promise): (x0: V0) => Promise; - composeP(fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1) => Promise): (x0: V0, x1: V1) => Promise; - composeP(fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2) => Promise): (x0: V0, x1: V1, x2: V2) => Promise; - composeP(fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; - composeP(fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0) => Promise): (x0: V0) => Promise; - composeP(fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1) => Promise): (x0: V0, x1: V1) => Promise; - composeP(fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2) => Promise): (x0: V0, x1: V1, x2: V2) => Promise; - composeP(fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; - composeP(fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0) => Promise): (x0: V0) => Promise; - composeP(fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1) => Promise): (x0: V0, x1: V1) => Promise; - composeP(fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2) => Promise): (x0: V0, x1: V1, x2: V2) => Promise; - composeP(fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; - composeP(fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0) => Promise): (x0: V0) => Promise; - composeP(fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1) => Promise): (x0: V0, x1: V1) => Promise; - composeP(fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2) => Promise): (x0: V0, x1: V1, x2: V2) => Promise; - composeP(fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; - composeP(fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0) => Promise): (x0: V0) => Promise; - composeP(fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1) => Promise): (x0: V0, x1: V1) => Promise; - composeP(fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2) => Promise): (x0: V0, x1: V1, x2: V2) => Promise; - composeP(fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; - composeP(fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0) => Promise): (x0: V0) => Promise; - composeP(fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1) => Promise): (x0: V0, x1: V1) => Promise; - composeP(fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2) => Promise): (x0: V0, x1: V1, x2: V2) => Promise; - composeP(fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; - composeP(fn7: (x: T7) => Promise|T8, fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0) => Promise): (x0: V0) => Promise; - composeP(fn7: (x: T7) => Promise|T8, fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1) => Promise): (x0: V0, x1: V1) => Promise; - composeP(fn7: (x: T7) => Promise|T8, fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2) => Promise): (x0: V0, x1: V1, x2: V2) => Promise; - composeP(fn7: (x: T7) => Promise|T8, fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; - composeP(fn8: (x: T8) => Promise|T9, fn7: (x: T7) => Promise|T8, fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0) => Promise): (x0: V0) => Promise; - composeP(fn8: (x: T8) => Promise|T9, fn7: (x: T7) => Promise|T8, fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1) => Promise): (x0: V0, x1: V1) => Promise; - composeP(fn8: (x: T8) => Promise|T9, fn7: (x: T7) => Promise|T8, fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2) => Promise): (x0: V0, x1: V1, x2: V2) => Promise; - composeP(fn8: (x: T8) => Promise|T9, fn7: (x: T7) => Promise|T8, fn6: (x: T6) => Promise|T7, fn5: (x: T5) => Promise|T6, fn4: (x: T4) => Promise|T5, fn3: (x: T3) => Promise|T4, fn2: (x: T2) => Promise|T3, fn1: (x: T1) => Promise|T2, fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; - - /** - * Returns a new list consisting of the elements of the first list followed by the elements - * of the second. - */ - concat>(list1: T, list2: T): T; - concat>(list1: T): (list2: T) => T; - // concat>: CurriedFunction2; - - /** - * Returns a function, fn, which encapsulates if/else-if/else logic. R.cond takes a list of [predicate, transform] pairs. - * All of the arguments to fn are applied to each of the predicates in turn until one returns a "truthy" value, at which - * point fn returns the result of applying its arguments to the corresponding transformer. If none of the predicates - * matches, fn returns undefined. - */ - cond(fns: [Pred, (v: T) => U][]): (v: T) => U; - - /** - * Wraps a constructor function inside a curried function that can be called with the same arguments and returns the same type. - */ - construct(fn: Function): Function; - - /** - * Wraps a constructor function inside a curried function that can be called with the same arguments and returns the same type. - * The arity of the function returned is specified to allow using variadic constructor functions. - */ - constructN(n: number, fn: Function): Function; - // constructN: CurriedFunction2; - - - /** - * Returns `true` if the specified item is somewhere in the list, `false` otherwise. - * Equivalent to `indexOf(a)(list) > -1`. Uses strict (`===`) equality checking. - */ - contains(a: string, list: string): boolean; - contains(a: string): (list: string) => boolean; - // contains: CurriedFunction2; - contains>(a: T, list: R): boolean; - contains(a: T): >(list: R) => boolean; - // contains>: CurriedFunction2; - - /** - * Accepts 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. - */ - converge(after: Variadic, fns: List>): Variadic; - // converge: CurriedFunction2, List>, Variadic>; - - /** - * Counts the elements of a list according to how many match each value - * of a key generated by the supplied function. Returns an object - * mapping the keys produced by `fn` to the number of occurrences in - * the list. Note that all keys are coerced to strings because of how - * JavaScript objects work. - */ - countBy(fn: (a: T) => Prop, list: List): Obj; - countBy(fn: (a: T) => Prop): (list: List) => Obj; - // countBy: CurriedFunction2<(a: T) => Prop, List, Obj>; - - /** - * Returns a curried equivalent of the provided function. - */ - curry(fn: (a: T1) => TResult): CurriedFunction1; - curry(fn: (a: T1, b: T2) => TResult): CurriedFunction2; - curry(fn: (a: T1, b: T2, c: T3) => TResult): CurriedFunction3; - curry(fn: (a: T1, b: T2, c: T3, d: T4) => TResult): CurriedFunction4; - curry(fn: (a: T1, b: T2, c: T3, d: T4, e: T5) => TResult): CurriedFunction5; - curry(fn: (a: T1, b: T2, c: T3, d: T4, e: T5, f: T6) => TResult): CurriedFunction6; - curry(fn: (a: T1, b: T2, c: T3, d: T4, e: T5, f: T6, g: T7) => TResult): CurriedFunction7; - curry(fn: (a: T1, b: T2, c: T3, d: T4, e: T5, f: T6, g: T7, h: T8) => TResult): CurriedFunction8; - curry(fn: (a: T1, b: T2, c: T3, d: T4, e: T5, f: T6, g: T7, h: T8, i: T9) => TResult): CurriedFunction9; - // curry(fn: Function): Function - - - /** - * Returns a curried equivalent of the provided function, with the specified arity. - */ - curryN(length: number, fn: Variadic): Variadic; - // curryN: CurriedFunction2, Variadic>; - - - /** - * Decrements its argument. - */ - dec(n: number): number; - - /** - * Returns the second argument if it is not null or undefined. If it is null or undefined, the - * first (default) argument is returned. - */ - defaultTo(a: T, b: U | null | undefined): T|U; - defaultTo(a: T): (b: U | null | undefined) => T|U; - // defaultTo: CurriedFunction2; - - /** - * Makes a descending comparator function out of a function that returns a value that can be compared with `<` and `>`. - */ - descend(comparator: (val: T) => V, a: T, b: T): number; - descend(comparator: (val: T) => V, a: T): (b: T) => number; - descend(comparator: (val: T) => V): CurriedFunction2; - // descend: CurriedFunction3<(val: T) => V, T, T, number>; - - /** - * Finds the set (i.e. no duplicates) of all elements in the first list not contained in the second list. - */ - difference(list1: List, list2: List): T[]; - difference(list1: List): (list2: List) => T[]; - // difference: CurriedFunction2, List, T[]>; - - /** - * Finds the set (i.e. no duplicates) of all elements in the first list not contained in the second list. - * Duplication is determined according to the value returned by applying the supplied predicate to two list - * elements. - */ - // differenceWith(pred: (a: T, b: T) => boolean, list1: List, list2: List): T[]; - // differenceWith(pred: (a: T, b: T) => boolean, list1: List): (list2: List) => T[]; - // differenceWith(pred: (a: T, b: T) => boolean): CurriedFunction2,List,T>; - // differenceWith: CurriedFunction3<(a: T, b: T) => boolean, List, List, T[]>; - - // base - differenceWith(pred: (a: T, b: T) => boolean, list1: List, list2: List): T[]; - differenceWith(pred: (a: T, b: T) => boolean, list1: List):{ - (list2: List): T[]; - }; - differenceWith(pred: (a: T, b: T) => boolean):{ - (list1: List, list2: List): T[]; - (list1: List):{ - (list2: List): T[]; - }; - }; - - - /* - * Returns a new object that does not contain a prop property. - */ - - // TODO: fix, can't yet calculate type of object minus this key - // dissoc(prop: Prop, obj: T & { [prop: Prop]: any }): T; // wanna say the original object is the same with the extra key, but can't bind it to prop - // dissoc>(prop: keyof U, obj: U): T; - - // simplified but inferrable: leave the key in - // dissoc(prop: keyof T, obj: T): T; - dissoc(prop: Prop): (obj: T) => T; // mix - // dissoc: CurriedFunction2; - // dissoc: CurriedFunction2; - - // It seems impossible to infer the return type, so this may have to be specified explicitly - dissoc(prop: Prop, obj: Struct): T; - // dissoc(prop: Prop): (obj: Struct) => T; // mix - // dissoc: CurriedFunction2, T>; - // dissoc>(prop: keyof U): (obj: U) => T; // can't do this, don't know U in time - - // mixed curry: - dissoc(prop: Prop): { - (obj: T): T; // infer - (obj: Struct): T; // manual - }; - - /** - * Makes a shallow clone of an object, omitting the property at the given path. - */ - dissocPath(path: Path, obj: Struct): T; - dissocPath(path: Path): (obj: Struct) => T; - // dissocPath: CurriedFunction2, T>; - - /** - * Divides two numbers. Equivalent to a / b. - */ - divide(a: number, b: number): number; - divide(a: number): (b: number) => number; - // divide: CurriedFunction2; - - /** - * Returns a new list containing all but the first n elements of the given list. - */ - drop>(n: number, xs: T): T; - drop>(n: number): (xs: T) => T; - // drop>: CurriedFunction2; - - /** - * Returns a list containing all but the last n elements of the given list. - */ - // = drop - dropLast>(n: number, xs: T): T; - dropLast>(n: number): (xs: T) => T; - // dropLast>: CurriedFunction2; - - /** - * Returns a new list containing all but last then elements of a given list, passing each value from the - * right to the supplied predicate function, skipping elements while the predicate function returns true. - */ - // = dropWhile - dropLastWhile>(pred: Pred, list: R): T[]; - dropLastWhile>(pred: Pred): (list: R) => T[]; - // dropLastWhile>: CurriedFunction2, R, T[]>; - - /** - * Returns a new list containing the last n elements of a given list, passing each value to the supplied - * predicate function, skipping elements while the predicate function returns true. - */ - dropWhile>(pred: Pred, list: R): T[]; - dropWhile>(pred: Pred): (list: R) => T[]; - // dropWhile>: CurriedFunction2, R, T[]>; - - /** - * A function wrapping calls to the two functions in an || operation, returning the result of the first - * function if it is truth-y and the result of the second function otherwise. Note that this is - * short-circuited, meaning that the second function will not be invoked if the first returns a truth-y value. - */ - either(pred1: Pred, pred2: Pred): Pred; - either(pred1: Pred): (pred2: Pred) => Pred; - // either: CurriedFunction2, Pred, Pred>; - - /** - * Returns the empty value of its argument's type. Ramda defines the empty value of Array ([]), Object ({}), - * String (''), and Arguments. Other types are supported if they define .empty and/or .prototype.empty. - * Dispatches to the empty method of the first argument, if present. - */ - empty(x: T): T; - - /** - * Takes a function and two values in its domain and returns true if the values map to the same value in the - * codomain; false otherwise. - */ - // eqBy(fn: (a: T) => T, a: T, b: T): boolean; - // eqBy(fn: (a: T) => T, a: T): (b: T) => boolean; - // eqBy(fn: (a: T) => T): CurriedFunction2; - // eqBy: CurriedFunction3<(a: T) => T, T, T, boolean>; - - // base - eqBy(fn: (a: T) => T, a: T, b: T): boolean; - eqBy(fn: (a: T) => T, a: T):{ - (b: T): boolean; - }; - eqBy(fn: (a: T) => T):{ - (a: T, b: T): boolean; - (a: T):{ - (b: T): boolean; - }; - }; - - - /** - * Reports whether two functions have the same value for the specified property. - */ - // hard to mix cuz different initial generics? - - // more generics - // eqProps(prop: Prop, obj1: T, obj2: U): boolean; - // eqProps(prop: Prop, obj1: T): (obj2: U) => boolean; - // eqProps(prop: Prop): CurriedFunction2; - // eqProps(prop: Prop): (obj1: T, obj2: U) => boolean; - // eqProps: CurriedFunction3; - - // less generics - // eqProps(prop: Prop, obj1: any, obj2: any): boolean; - // eqProps(prop: Prop, obj1: any): (obj2: any) => boolean; - // eqProps(prop: Prop): CurriedFunction2; - // eqProps(prop: Prop): (obj1: any, obj2: any) => boolean; - // eqProps(prop: Prop): (obj1: any) => (obj2: any) => boolean; - // eqProps: CurriedFunction3; - - // base - eqProps(prop: Prop, obj1: T, obj2: U): boolean; - eqProps(prop: Prop, obj1: T):{ - (obj2: U): boolean; - }; - eqProps(prop: Prop):{ - (obj1: T, obj2: U): boolean; - (obj1: T):{ - (obj2: U): boolean; - }; - }; - - // less generics - eqProps(prop: Prop, obj1: any, obj2: any): boolean; - eqProps(prop: Prop, obj1: any):{ - (obj2: any): boolean; - }; - eqProps(prop: Prop):{ - (obj1: any, obj2: any): boolean; - (obj1: any):{ - (obj2: any): boolean; - }; - }; - - - /** - * Returns true if its arguments are equivalent, false otherwise. Dispatches to an equals method if present. - * Handles cyclical data structures. - */ - equals(a: T, b: T): boolean; - equals(a: T): (b: T) => boolean; - // equals: CurriedFunction2; - - /** - * Creates a new object by evolving a shallow copy of object, according to the transformation functions. - */ - // hard to mix cuz different generics - - // NestedObj - evolve(transformations: NestedObj<(v: any) => any>, obj: V): V; - evolve(transformations: NestedObj<(v: any) => any>): (obj: V) => V; - // evolve: CurriedFunction2 any>, V, V>; - - // no inference, manually supply result type - evolve(transformations: Obj, obj: any): T; - evolve(transformations: Obj): (obj: any) => T; - // evolve: CurriedFunction2, any, T>; - - /* - * A function that always returns false. Any passed in parameters are ignored. - */ - F(): false; - - /** - * Returns a new list containing only those items that match a given predicate function. The predicate function is passed one argument: (value). - */ - - // array - filter(pred: Pred, list: List): T[]; - // filter(pred: Pred): (list: List) => T[]; // should disable for mixing, but this somehow makes #73 fail - // filter: CurriedFunction2, List, T[]>; - - // functor to functor - filter(pred: Pred, list: Functor): Functor; - // filter(pred: Pred): (list: Functor) => Functor; // mix - // filter: CurriedFunction2<(value: T) => boolean, Functor, Functor>; - - // functor to array - filter(pred: Pred, list: Functor): T[]; - // filter(pred: Pred): (list: Functor) => T[]; // mix - // filter: CurriedFunction2<(value: T) => boolean, Functor, T[]>; - - // object - filter>(pred: Pred, obj: U) : Partial; - // filter(pred: Pred): >(obj: U) => U; // mix - // filter>: CurriedFunction2<(value: T) => boolean, U, Partial>; - - // mixed - filter(pred: Pred): { - (list: List): T[]; - (list: Functor): Functor; - (list: Functor): T[]; - >(obj: U): U; - }; - - /** - * Returns the first element of the list which matches the predicate, or `undefined` if no - * element matches. - */ - find(fn: (a: T) => boolean, list: List): T; - find(fn: (a: T) => boolean): (list: List) => T; - // find: CurriedFunction2<(a: T) => boolean, List, T>; - - - /** - * Returns the index of the first element of the list which matches the predicate, or `-1` - * if no element matches. - */ - findIndex(fn: (a: T) => boolean, list: List): number; - findIndex(fn: (a: T) => boolean): (list: List) => number; - // findIndex: CurriedFunction2<(a: T) => boolean, List, number>; - - /** - * Returns the last element of the list which matches the predicate, or `undefined` if no - * element matches. - */ - findLast(fn: (a: T) => boolean, list: List): T; - findLast(fn: (a: T) => boolean): (list: List) => T; - // findLast: CurriedFunction2<(a: T) => boolean, List, T>; - - /** - * Returns the index of the last element of the list which matches the predicate, or - * `-1` if no element matches. - */ - findLastIndex(fn: (a: T) => boolean, list: List): number; - findLastIndex(fn: (a: T) => boolean): (list: List) => number; - // findLastIndex: CurriedFunction2<(a: T) => boolean, List, number>; - - /** - * Returns a new list by pulling every item out of it (and all its sub-arrays) and putting - * them in a new array, depth-first. - */ - // flatten(x: ArrayLike>>>>>>): T[]; - // flatten(x: ArrayLike>>>>>): T[]; - // flatten(x: ArrayLike>>>>): T[]; - // flatten(x: ArrayLike>>>): T[]; - // flatten(x: ArrayLike>>): T[]; - // flatten(x: ArrayLike>): T[]; - // flatten(x: ArrayLike): T[]; - // TODO: figure out how to handle arrays using different levels of nesting - // flatten(x: ListOfRecursiveArraysOrValues): T[]; - flatten(x: NestedArray): T[]; - - /** - * Returns a new function much like the supplied one, except that the first two arguments' - * order is reversed. - */ - flip(fn: (arg0: T, arg1: U) => TResult): (arg1: U, arg0?: T) => TResult; - flip(fn: (arg0: T, arg1: U, ...args: Rest[]) => TResult): (arg1: U, arg0?: T, ...args: Rest[]) => TResult; - - - /** - * Iterate over an input list, calling a provided function fn for each element in the list. - */ - forEach(fn: (x: T) => void, list: List): T[]; - forEach(fn: (x: T) => void): (list: List) => T[]; - // forEach: CurriedFunction2<(x: T) => void, List, T[]>; - - /** - * Iterate over an input object, calling a provided function fn for each key and value in the object. - */ - forEachObjIndexed>(fn: (val: T, key: string, obj?: Inp) => void, o: Inp): Inp; - forEachObjIndexed>(fn: (val: T, key: string, obj?: Inp) => void): (o: Inp) => Inp; - // forEachObjIndexed>: CurriedFunction2<(val: T, key: string, obj?: Inp) => void, Inp, Inp>; - - /** - * Creates a new object out of a list key-value pairs. - */ - fromPairs(pairs: List>): Obj; - - /** - * Splits a list into sublists stored in an object, based on the result of - * calling a String-returning function - * on each element, and grouping the results according to values returned. - */ - groupBy(fn: (a: T) => Prop, list: List): Obj; - groupBy(fn: (a: T) => Prop): (list: List) => Obj; - // groupBy: CurriedFunction2<(a: T) => Prop, List, Obj>; - - /** - * Takes a list and returns a list of lists where each sublist's elements are all "equal" according to the provided equality function - */ - groupWith>(fn: (x: T, y: T) => boolean, list: R): R[]; - groupWith>(fn: (x: T, y: T) => boolean): (list: R) => R[]; - // groupWith>: CurriedFunction2<(x: T, y: T) => boolean, R, R[]>; - - /** - * Returns true if the first parameter is greater than the second. - */ - gt(a: number, b: number): boolean; - gt(a: number): (b: number) => boolean; - // gt: CurriedFunction2; - - /** - * Returns true if the first parameter is greater than or equal to the second. - */ - gte(a: number, b: number): boolean; - gte(a: number): (b: number) => boolean; - // gte: CurriedFunction2; - - /** - * Returns whether or not an object has an own property with the specified name. - */ - - // no generics - has(s: Prop, obj: Struct): boolean; - has(s: Prop): (obj: Struct) => boolean; - // has: CurriedFunction2, boolean>; - - // // bound generic, hopefully gives a hint as to what goes into obj - // has>(s: Prop, obj: T): boolean; - // // has(s: Prop): >(obj: T) => boolean; // mix - // // has>: CurriedFunction2; - - // // free generic, helps make a few tests pass. TODO: kill this workaround? - // has(s: Prop, obj: T): boolean; - // // has(s: Prop): (obj: T) => boolean; // mix - // // has: CurriedFunction2; - - // // mixed - // has(s: Prop): { - // >(obj: T): boolean; - // (obj: T): boolean; - // } - - /** - * Returns whether or not an object or its prototype chain has a property with the specified name - */ - // = has - - // no generics - hasIn(s: Prop, obj: Struct): boolean; - hasIn(s: Prop): (obj: Struct) => boolean; - // hasIn: CurriedFunction2, boolean>; - - // // bound generic, hopefully gives a hint as to what goes into obj - // hasIn>(s: Prop, obj: T): boolean; - // // hasIn(s: Prop): >(obj: T) => boolean; // mix - // // hasIn>: CurriedFunction2; - - // // free generic, helps make a few tests pass. TODO: kill this workaround? - // hasIn(s: Prop, obj: T): boolean; - // // hasIn(s: Prop): (obj: T) => boolean; // mix - // // hasIn: CurriedFunction2; - - // // mixed - // hasIn(s: Prop): { - // >(obj: T): boolean; - // (obj: T): boolean; - // } - - /** - * Returns the first element in a list. - * In some libraries this function is named `first`. - */ - head>(list: T): T[0] | undefined; - head(list: string): string; - // tuple attempts; it doesn't like these. - head(list: [T]): T; - head(list: [T0, T1]): T0; - head(list: [T0, T1, T2]): T0; - - /** - * Returns true if its arguments are identical, false otherwise. Values are identical if they reference the - * same memory. NaN is identical to NaN; 0 and -0 are not identical. - */ - identical(a: T, b: T): boolean; - identical(a: T): (b: T) => boolean; - // identical: CurriedFunction2; - - /** - * A function that does nothing but return the parameter supplied to it. Good as a default - * or placeholder function. - */ - identity(a: T): T; - - /** - * Creates a function that will process either the onTrue or the onFalse function depending upon the result - * of the condition predicate. - */ - ifElse(fn: Pred, onTrue: (v: T) => U, onFalse: (v: T) => V): (v: T) => U|V; - // ifElse: CurriedFunction3, (v: T) => U, (v: T) => V, (v: T) => U|V>; - - - /** - * Increments its argument. - */ - inc(n: number): number; - - /** - * Given a function that generates a key, turns a list of objects into an object indexing the objects - * by the given key. - */ - indexBy(fn: (a: T) => Prop, list: List): Obj; - indexBy(fn: (a: T) => Prop): (list: List) => Obj; - // indexBy: CurriedFunction2<(a: T) => Prop, List, Obj>; - - /** - * Returns the position of the first occurrence of an item in an array - * (by strict equality), - * or -1 if the item is not included in the array. - */ - indexOf(target: T, list: List): number; - indexOf(target: T): (list: List) => number; - // indexOf: CurriedFunction2, number>; - - /** - * Returns all but the last element of a list. - */ - init>(list: T): T; - - /** - * Inserts the supplied element into the list, at index index. Note that - * this is not destructive: it returns a copy of the list with the changes. - */ - - // homogeneous list - // insert(index: number, elt: T, list: List): T[]; - // insert(index: number, elt: T): (list: List) => T[]; - // insert(index: number): CurriedFunction2, T[]>; - // insert(index: number): (elt: T, list: List) => T[]; - // insert(index: number): (elt: T) => (list: List) => T[]; - // insert: CurriedFunction3, T[]>; - - // base - insert(index: number, elt: T, list: List): T[]; - insert(index: number, elt: T):{ - (list: List): T[]; - }; - insert(index: number):{ - (elt: T, list: List): T[]; - (elt: T):{ - (list: List): T[]; - }; - }; - - - // TODO: tuples? - - /** - * Inserts the sub-list into the list, at index `index`. _Note that this - * is not destructive_: it returns a copy of the list with the changes. - */ - - // homogeneous lists (different types) - // insertAll(index: number, elts: List, list: List): Array; - // insertAll(index: number, elts: List): (list: List) => Array; - // insertAll(index: number): CurriedFunction2, List, Array>; - // insertAll(index: number): (elts: List, list: List) => Array; - // insertAll(index: number): (elts: List) => (list: List) => Array; - // insertAll: CurriedFunction3, List, Array>; - - // homogeneous lists (same type) - // insertAll>(index: number): CurriedFunction2; - - // TODO: allowing either or both arrays to be tuples? - - // base - insertAll(index: number, elts: List, list: List): Array; - insertAll(index: number, elts: List):{ - (list: List): Array; - }; - insertAll(index: number):{ - (elts: List, list: List): Array; - (elts: List):{ - (list: List): Array; - }; - }; - - - /** - * Combines two lists into a set (i.e. no duplicates) composed of those elements common to both lists. - */ - intersection(list1: List, list2: List): Array; - intersection(list1: List): (list2: List) => Array; - // intersection: CurriedFunction2, List, Array>; - - - /** - * Combines two lists into a set (i.e. no duplicates) composed of those - * elements common to both lists. Duplication is determined according - * to the value returned by applying the supplied predicate to two list - * elements. - */ - // intersectionWith(pred: (a: T, b: T) => boolean, list1: List, list2: List): T[]; - // intersectionWith(pred: (a: T, b: T) => boolean): CurriedFunction2, List, T[]>; - // intersectionWith: CurriedFunction3<(a: T, b: T) => boolean, List, List, T[]>; - - // base - intersectionWith(pred: (a: T, b: T) => boolean, list1: List, list2: List): T[]; - intersectionWith(pred: (a: T, b: T) => boolean, list1: List):{ - (list2: List): T[]; - }; - intersectionWith(pred: (a: T, b: T) => boolean):{ - (list1: List, list2: List): T[]; - (list1: List):{ - (list2: List): T[]; - }; - }; - - - /** - * Creates a new list with the separator interposed between elements. - */ - intersperse(separator: T, list: List): T[]; - intersperse(separator: T): (list: List) => T[]; - // intersperse: CurriedFunction2, T[]>; - - /** - * Transforms the items of the list with the transducer and appends the transformed items to the accumulator - * using an appropriate iterator function based on the accumulator type. - */ - // into>(acc: V, xf: (list: List) => U, list: List): U; - // into>(acc: V, xf: (list: List) => U): (list: List) => U; - // into>(acc: V): CurriedFunction2<(list: List) => U, List, U>; - // into>(acc: V): (xf: (list: List) => U, list: List) => U; - // into>(acc: V): (xf: (list: List) => U) => (list: List) => U; - // into>: CurriedFunction3) => U, List, U>; - - // base - into, T, U>(acc: V, xf: (list: List) => U, list: List): U; - into, T, U>(acc: V, xf: (list: List) => U):{ - (list: List): U; - }; - into, T, U>(acc: V):{ - (xf: (list: List) => U, list: List): U; - (xf: (list: List) => U):{ - (list: List): U; - }; - }; - - - /** - * Same as R.invertObj, however this accounts for objects with duplicate values by putting the values into an array. - */ - invert(obj: Struct): Obj>; - - /** - * Returns a new object with the keys of the given object as values, and the values of the given object as keys. - */ - invertObj(obj: Struct): Obj; - - /** - * Turns a named method of an object (or object prototype) into a function that can be - * called directly. Passing the optional `len` parameter restricts the returned function to - * the initial `len` parameters of the method. - * - * The returned function is curried and accepts `len + 1` parameters (or `method.length + 1` - * when `len` is not specified), and the final parameter is the target object. - */ - // with keyof -- currently can't seem do to function application like this yet - // invoker (len: number /* = 0 */, name: K, obj: T): obj[K](); - // // invoker: CurriedFunction3; - // invoker(len: number /* = 1 */, name: K, x1: P1, obj: T): obj[K](x1); - // // invoker: CurriedFunction4; - // invoker(len: number /* = 2 */, name: K, x1: P1, x2: P2, obj: T): obj[K](x1, x2); - // // invoker: CurriedFunction5; - // invoker(len: number /* = 3 */, name: K, x1: P1, x2: P2, x3: P3, obj: T): obj[K](x1, x2, x3); - // // invoker: CurriedFunction6; - // invoker(len: number /* = 4 */, name: K, x1: P1, x2: P2, x3: P3, x4: P4, obj: T): obj[K](x1, x2, x3, x4); - // // invoker: CurriedFunction7; - // invoker(len: number /* = 5 */, name: K, x1: P1, x2: P2, x3: P3, x4: P4, x5: P5, obj: T): obj[K](x1, x2, x3, x4, x5); - // // invoker: CurriedFunction8; - - // manually type results - invoker (len: number /* = 0 */, name: Prop, obj: T): R; - invoker (len: number/* = 0 */, name: Prop): (obj: T) => R; - - invoker(len: number /* = 1 */, name: Prop, x1: P1, obj: T): R; - invoker(len: number /* = 1 */, name: Prop): CurriedFunction2; - - invoker(len: number /* = 2 */, name: Prop, x1: P1, x2: P2, obj: T): R; - invoker(len: number /* = 2 */, name: Prop): CurriedFunction3; - - invoker(len: number /* = 3 */, name: Prop, x1: P1, x2: P2, x3: P3, obj: T): R; - invoker(len: number /* = 3 */, name: Prop): CurriedFunction4; - - invoker(len: number /* = 4 */, name: Prop, x1: P1, x2: P2, x3: P3, x4: P4, obj: T): R; - invoker(len: number /* = 4 */, name: Prop): CurriedFunction5; - - invoker(len: number /* = 5 */, name: Prop, x1: P1, x2: P2, x3: P3, x4: P4, x5: P5, obj: T): R; - invoker(len: number /* = 5 */, name: Prop): CurriedFunction6; - - /** - * See if an object (`val`) is an instance of the supplied constructor. - * This function will check up the inheritance chain, if any. - */ - is(ctor: Type, val: any): val is T; - is(ctor: Type): (val: any) => val is T; - // is: CurriedFunction2; // um, val undefined - - /** - * Tests whether or not an object is similar to an array. - * @deprecated: 0.23.0 - */ - isArrayLike(val: any): val is List; - // isArrayLike(val: any): boolean; - - /** - * Reports whether the list has zero elements. - */ - isEmpty(value: any): boolean; - - - /** - * Returns true if the input value is NaN. - */ - isNaN(x: any): boolean; - - /** - * Checks if the input value is null or undefined. - */ - isNil(value: any): boolean; - - /** - * Returns a string made by inserting the `separator` between each - * element and concatenating all the elements into a single string. - */ - join(x: Prop, xs: Array): string; - join(x: Prop): (xs: Array) => string; - // join: CurriedFunction2, string>; - - /** - * Applies a list of functions to a list of values. - */ - juxt(fns: {(...args: T[]): U}[]): (...args: T[]) => U[]; - - - /** - * Returns a list containing the names of all the enumerable own - * properties of the supplied object. - */ - keys(x: Struct): string[]; - - /** - * Returns a list containing the names of all the - * properties of the supplied object, including prototype properties. - */ - keysIn(obj: Struct): string[]; - - /** - * Returns the last element from a list. - */ - last>(list: R): T | undefined; - - /** - * Returns the position of the last occurrence of an item (by strict equality) in - * an array, or -1 if the item is not included in the array. - */ - // = indexOf - lastIndexOf(target: T, list: List): number; - lastIndexOf(target: T): (list: List) => number; - // lastIndexOf: CurriedFunction2, number>; - - /** - * Returns the number of elements in the array by returning list.length. - */ - length(list: List): number; - - /** - * Returns a lens for the given getter and setter functions. The getter - * "gets" the value of the focus; the setter "sets" the value of the focus. - * The setter should not mutate the data structure. - */ - // hard to mix cuz different generics - - // assume setter doesn't change the type - lens>(getter: (s: U) => V, setter: (a: V, s: U) => U): ManualLens; - lens>(getter: (s: U) => V): (setter: (a: V, s: U) => U) => ManualLens; - lens(getter: (s: Struct) => V): >(setter: (a: V, s: U) => U) => ManualLens; - // ^ ignore getter param being `U` so I can get away with 1 manual generic rather than having to add the inferred `U`. Useful if the getter doesn't have an explicit return type. - // lens>: CurriedFunction2<(s: U) => V, (a: V, s: U) => U, ManualLens>; - - // allows setter to change value type - lens(getter: (s: T) => U, setter: (a: U, s: T) => V): Lens; - lens(getter: (s: T) => U): (setter: (a: U, s: T) => V) => Lens; - // lens: CurriedFunction2<(s: T) => U, (a: U, s: T) => V, Lens>; - - /** - * Creates a lens that will focus on index n of the source array. - */ - // lensIndex(n: K): KeyLens; - lensIndex(n: number): ManualLens; - lensIndex(n: number): UnknownLens; - - /** - * Returns a lens whose focus is the specified path. - * See also view, set, over. - */ - lensPath(path: Path): ManualLens; - lensPath(path: Path): UnknownLens; - - /** - * lensProp creates a lens that will focus on property k of the source object. - */ - // lensProp(n: K): KeyLens; - lensProp(prop: Prop): ManualLens; - lensProp(prop: Prop): UnknownLens; - - /** - * "lifts" a function of arity > 1 so that it may "map over" a list, Function or other object that satisfies - * the FantasyLand Apply spec. - */ - lift(fn: () => TResult): () => TResult[]; - lift(fn: (v1: T1) => TResult): (v1: List) => TResult[]; - lift(fn: (v1: T1, v2: T2) => TResult): (v1: List, v2: List) => TResult[]; - lift(fn: (v1: T1, v2: T2, v3: T3) => TResult): (v1: List, v2: List, v3: List) => TResult[]; - lift(fn: (v1: T1, v2: T2, v3: T3, v4: T4) => TResult): (v1: List, v2: List, v3: List, v4: List) => TResult[]; - lift(fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) => TResult): (v1: List, v2: List, v3: List, v4: List, v5: List) => TResult[]; - lift(fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6) => TResult): (v1: List, v2: List, v3: List, v4: List, v5: List, v6: List) => TResult[]; - lift(fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7) => TResult): (v1: List, v2: List, v3: List, v4: List, v5: List, v6: List, v7: List) => TResult[]; - lift(fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7, v8: T8) => TResult): (v1: List, v2: List, v3: List, v4: List, v5: List, v6: List, v7: List, v8: List) => TResult[]; - lift(fn: Variadic): (...argLists: any[][]) => T[]; - - /** - * "lifts" a function to be the specified arity, so that it may "map over" that many lists, Functions or other - * objects that satisfy the FantasyLand Apply spec. - */ - liftN(n: number, fn: () => TResult): () => TResult[]; - liftN(n: number, fn: (v1: T1) => TResult): (v1: List) => TResult[]; - liftN(n: number, fn: (v1: T1, v2: T2) => TResult): (v1: List, v2: List) => TResult[]; - liftN(n: number, fn: (v1: T1, v2: T2, v3: T3) => TResult): (v1: List, v2: List, v3: List) => TResult[]; - liftN(n: number, fn: (v1: T1, v2: T2, v3: T3, v4: T4) => TResult): (v1: List, v2: List, v3: List, v4: List) => TResult[]; - liftN(n: number, fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) => TResult): (v1: List, v2: List, v3: List, v4: List, v5: List) => TResult[]; - liftN(n: number, fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6) => TResult): (v1: List, v2: List, v3: List, v4: List, v5: List, v6: List) => TResult[]; - liftN(n: number, fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7) => TResult): (v1: List, v2: List, v3: List, v4: List, v5: List, v6: List, v7: List) => TResult[]; - liftN(n: number, fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7, v8: T8) => TResult): (v1: List, v2: List, v3: List, v4: List, v5: List, v6: List, v7: List, v8: List) => TResult[]; - - liftN(n: number): { - (fn: () => TResult): () => TResult[]; - (fn: (v1: T1) => TResult): (v1: List) => TResult[]; - (fn: (v1: T1, v2: T2) => TResult): (v1: List, v2: List) => TResult[]; - (fn: (v1: T1, v2: T2, v3: T3) => TResult): (v1: List, v2: List, v3: List) => TResult[]; - (fn: (v1: T1, v2: T2, v3: T3, v4: T4) => TResult): (v1: List, v2: List, v3: List, v4: List) => TResult[]; - (fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) => TResult): (v1: List, v2: List, v3: List, v4: List, v5: List) => TResult[]; - (fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6) => TResult): (v1: List, v2: List, v3: List, v4: List, v5: List, v6: List) => TResult[]; - (fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7) => TResult): (v1: List, v2: List, v3: List, v4: List, v5: List, v6: List, v7: List) => TResult[]; - (fn: (v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7, v8: T8) => TResult): (v1: List, v2: List, v3: List, v4: List, v5: List, v6: List, v7: List, v8: List) => TResult[]; - - (fn: Variadic): (...argLists: any[][]) => T[]; - }; - - liftN(n: number, fn: Variadic): (...argLists: any[][]) => T[]; - // liftN: CurriedFunction2, (...argLists: any[][]) => T[]>; - - /** - * Returns true if the first parameter is less than the second. - */ - lt(a: number, b: number): boolean; - lt(a: number): (b: number) => boolean; - // lt: CurriedFunction2; - - /** - * Returns true if the first parameter is less than or equal to the second. - */ - lte(a: number, b: number): boolean; - lte(a: number): (b: number) => boolean; - // lte: CurriedFunction2; - - /** - * Returns a new list, constructed by applying the supplied function to every element of the supplied list. - */ - - // homogeneous: - - // array-like - map(fn: (x: T) => U, list: List): U[]; - // map(fn: (x: T) => U): (list: List) => U[]; // disabling for mix breaks a few tests? - // map: CurriedFunction2<(x: T) => U, List, U[]>; - - // object: keyof version - map>(fn: (value: T) => U, obj: M): Obj; - map>(fn: (value: T) => U, obj: M): Obj; - // map(fn: (value: T) => U): >(obj: M) => {[K in keyof M]: U}; // mix - // map>: CurriedFunction2<(value: T) => U, M, {[K in keyof M]: U}>; - - // object: Record version - map(f: (x: T) => U, obj:Obj): Obj; - // map(f: (x: T) => U): (obj: Record) => Record; // mix - // map: CurriedFunction2<(x: T) => U, Record), Record>; - - // functor - map(fn: (x: T) => U, obj: Functor): Functor; - // map(fn: (x: T) => U): (obj: Functor) => Functor; // mix - // map: CurriedFunction2<(x: T) => U, Functor, Functor>; - - // separating values: https://github.com/Microsoft/TypeScript/issues/12342 - // map(fn: (a: A) => B, tpl: [T,U]): [ typeof fn(T), typeof fn(U) ]; - // obj. version? - - // TODO: heterogeneous versions - - // array-like - // map(fn: (x: T) => U, list: [T1, T2]): [fn(T1), fn(T1)]; - // map(fn: F, list: [T1, T2]): [F(T1), F(T1)]; - // map(fn: (x: T) => U, list: [T1, T2]): [typeof fn(T1), typeof fn(T1)]; - // map(fn: F, list: [T1, T2]): [typeof F(T1), typeof F(T1)]; - // (list: [T1, T2]): [fn(T1), fn(T1)]; - - // object - - // mixed: - map(fn: (x: T) => U): { - >(obj: M): Obj; - (obj: Obj): Obj; - (obj: Functor): Functor; - (list: List): U[]; - }; - - /** - * The mapAccum function behaves like a combination of map and reduce. - */ - // mapAccum(fn: (acc: U, value: T) => [U, TResult], acc: U, list: List): [U, TResult[]]; - // mapAccum(fn: (acc: U, value: T) => [U, TResult], acc: U): (list: List) => [U, TResult[]]; - // mapAccum(fn: (acc: U, value: T) => [U, TResult]): CurriedFunction2,[U, TResult[]]>; - // mapAccum: CurriedFunction3<(acc: U, value: T) => [U, TResult], U, List, [U, TResult[]]>; - - // base - mapAccum(fn: (acc: U, value: T) => [U, TResult], acc: U, list: List): [U, TResult[]]; - mapAccum(fn: (acc: U, value: T) => [U, TResult], acc: U):{ - (list: List): [U, TResult[]]; - }; - mapAccum(fn: (acc: U, value: T) => [U, TResult]):{ - (acc: U, list: List): [U, TResult[]]; - (acc: U):{ - (list: List): [U, TResult[]]; - }; - }; - - - /** - * The mapAccumRight function behaves like a combination of map and reduce. - */ - // mapAccumRight(fn: (value: T, acc: U) => [TResult, U], acc: U, list: List): [TResult[], U]; - // mapAccumRight(fn: (value: T, acc: U) => [TResult, U], acc: U): (list: List) => [TResult[], U]; - // mapAccumRight(fn: (value: T, acc: U) => [TResult, U]): CurriedFunction2, [TResult[], U]>; - // mapAccumRight: CurriedFunction3<(value: T, acc: U) => [TResult, U], U, List, [TResult[], U]>; - - // base - mapAccumRight(fn: (value: T, acc: U) => [TResult, U], acc: U, list: List): [TResult[], U]; - mapAccumRight(fn: (value: T, acc: U) => [TResult, U], acc: U):{ - (list: List): [TResult[], U]; - }; - mapAccumRight(fn: (value: T, acc: U) => [TResult, U]):{ - (acc: U, list: List): [TResult[], U]; - (acc: U):{ - (list: List): [TResult[], U]; - }; - }; - - - /** - * Like map, but but passes additional parameters to the mapping function. - */ - mapIndexed>(fn: (val: T, key: number, list: V) => U, list: V): U[]; - mapIndexed>(fn: (val: T, key: number, list: V) => U): (list: V) => U[]; - // mapIndexed>: CurriedFunction2<(val: T, key: number, list: V) => U, V, U[]>; - - - /** - * Like mapObj, but but passes additional arguments to the predicate function. - */ - // hard to mix cuz different generics - - // keyof - mapObjIndexed>(fn: (value: T, key: string, obj?: M) => V, obj: M): Obj; - mapObjIndexed>(fn: (value: T, key: string, obj?: M) => V): (obj: M) => Obj; - // mapObjIndexed>: CurriedFunction2<(value: T, key: string, obj?: M) => V, M, {[K in keyof M]: V}>; - - // Record - mapObjIndexed(f: (value: T, key: string, obj?: Record) => U, obj: Obj): Obj; - mapObjIndexed(f: (value: T, key: string, obj?: Record) => U): (obj: Obj) => Obj; // potentially overwriting K but whatever - // mapObjIndexed: CurriedFunction2<(value: T, key: string, obj?: Record) => U, Record), Record>; - - /** - * Tests a regular expression agains a String - */ - match(regexp: RegExp, str: string): string[]; - match(regexp: RegExp): (str: string) => string[]; - // match: CurriedFunction2; - - - /** - * 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. mathMod requires Integer arguments, and returns NaN - * when the modulus is zero or negative. - */ - // |NaN? what's its type? - mathMod(a: number, b: number): number; - mathMod(a: number): (b: number) => number; - // mathMod: CurriedFunction2; - - - /** - * Returns the larger of its two arguments. - */ - max(a: T, b: T): T; - max(a: T): (b: T) => T; - // max: CurriedFunction2; - - /** - * Takes a function and two values, and returns whichever value produces - * the larger result when passed to the provided function. - */ - // maxBy(keyFn: (a: T) => Ord, a: T, b: T): T; - // maxBy(keyFn: (a: T) => Ord): CurriedFunction2; - // maxBy: CurriedFunction3<(a: T) => Ord, T, T, T>; - - // base - maxBy(keyFn: (a: T) => Ord, a: T, b: T): T; - maxBy(keyFn: (a: T) => Ord, a: T):{ - (b: T): T; - }; - maxBy(keyFn: (a: T) => Ord):{ - (a: T, b: T): T; - (a: T):{ - (b: T): T; - }; - }; - - - /** - * Returns the mean of the given list of numbers. - */ - mean(list: List): number; - - /** - * Returns the median of the given list of numbers. - */ - median(list: List): number; - - /** - * Creates a new function that, when invoked, caches the result of calling fn for a given argument set and - * returns the result. Subsequent calls to the memoized fn with the same argument set will not result in an - * additional call to fn; instead, the cached result for that set of arguments will be returned. - */ - memoize(fn: Variadic): Variadic; - - /** - * Create a new object with the own properties of a - * merged with the own properties of object b. - * This function will *not* mutate passed-in objects. - */ - merge, T2 extends Struct>(a: T1, b: T2): T1 & T2; - merge>(a: T1): >(b: T2) => T1 & T2; - // merge, T2 extends Struct>: CurriedFunction2; - - - /** - * Merges a list of objects together into one object. - */ - mergeAll(list: List): T; - - /** - * Creates a new object with the own properties of the two provided objects. If a key exists in both objects, - * the provided function is applied to the values associated with the key in each object, with the result being used as - * the value associated with the key in the returned object. The key will be excluded from the returned object if the - * resulting value is undefined. - */ - // mergeWith(fn: (x: any, z: any) => any, a: U, b: V): U & V; - // mergeWith(fn: (x: any, z: any) => any, a: U): (b: V) => U & V; - // // mergeWith(fn: (x: any, z: any) => any): (a: U, b: V) => U & V; - // mergeWith(fn: (x: any, z: any) => any): CurriedFunction2; - // // mergeWith: CurriedFunction3<(x: any, z: any) => any, U, V, U & V>; - - // base - mergeWith(fn: (x: any, z: any) => any, a: U, b: V): U & V; - mergeWith(fn: (x: any, z: any) => any, a: U):{ - (b: V): U & V; - }; - mergeWith(fn: (x: any, z: any) => any):{ - (a: U, b: V): U & V; - (a: U):{ - (b: V): U & V; - }; - }; - - - /** - * Creates a new object with the own properties of the two provided objects. If a key exists in both objects, - * the provided function is applied to the key and the values associated with the key in each object, with the - * result being used as the value associated with the key in the returned object. The key will be excluded from - * the returned object if the resulting value is undefined. - */ - // mergeWithKey(fn: (str: string, x: any, z: any) => any, a: U, b: V): U & V; - // mergeWithKey(fn: (str: string, x: any, z: any) => any, a: U): (b: V) => U & V; - // // mergeWithKey(fn: (str: string, x: any, z: any) => any): (a: U, b: V) => U & V; - // mergeWithKey(fn: (str: string, x: any, z: any) => any): CurriedFunction2; - // // mergeWithKey: CurriedFunction3<(str: string, x: any, z: any) => any, U, V, U & V>; - - // mergeWithKey - mergeWithKey(fn: (str: string, x: any, z: any) => any, a: U, b: V): U & V; - mergeWithKey(fn: (str: string, x: any, z: any) => any, a: U):{ - (b: V): U & V; - }; - mergeWithKey(fn: (str: string, x: any, z: any) => any):{ - (a: U, b: V): U & V; - (a: U):{ - (b: V): U & V; - }; - }; - - - /** - * Returns the smaller of its two arguments. - */ - min(a: T, b: T): T; - min(a: T): (b: T) => T; - // min: CurriedFunction2; - - /** - * Takes a function and two values, and returns whichever value produces - * the smaller result when passed to the provided function. - */ - // minBy(keyFn: (a: T) => Ord, a: T, b: T): T; - // minBy(keyFn: (a: T) => Ord): CurriedFunction2; - // // minBy: CurriedFunction3<(a: T) => Ord, T, T, T>; - - // base - minBy(keyFn: (a: T) => Ord, a: T, b: T): T; - minBy(keyFn: (a: T) => Ord, a: T):{ - (b: T): T; - }; - minBy(keyFn: (a: T) => Ord):{ - (a: T, b: T): T; - (a: T):{ - (b: T): T; - }; - }; - - - /** - * Divides the second parameter by the first and returns the remainder. - * The flipped version (`moduloBy`) may be more useful curried. - * Note that this functions preserves the JavaScript-style behavior for - * modulo. For mathematical modulo see `mathMod` - */ - modulo(a: number, b: number): number; - modulo(a: number): (b: number) => number; - // modulo: CurriedFunction2; - - /** - * Multiplies two numbers. Equivalent to a * b but curried. - */ - multiply(a: number, b: number): number; - multiply(a: number): (b: number) => number; - // multiply: CurriedFunction2; - - - /** - * Wraps a function of any arity (including nullary) in a function that accepts exactly n parameters. - * Any extraneous parameters will not be passed to the supplied function. - */ - nAry(n: number, fn: Variadic): Variadic; - nAry(n: number): (fn: Variadic) => Variadic; - // nAry: CurriedFunction2, Variadic>; - - /** - * Negates its argument. - */ - negate(n: number): number; - - - /** - * Returns true if no elements of the list match the predicate, false otherwise. - */ - none(fn: (a: T) => boolean, list: List): boolean; - none(fn: (a: T) => boolean): (list: List) => boolean; - // none: CurriedFunction2<(a: T) => boolean, List, boolean>; - - - /** - * A function wrapping a call to the given function in a `!` operation. It will return `true` when the - * underlying function would return a false-y value, and `false` when it would return a truth-y one. - */ - not(value: any): boolean; - - /** - * Returns the nth element in a list. - */ - nth(n: number, list: List): T | undefined; - nth(n: number): (list: List) => T | undefined; - // nth: CurriedFunction2, T>; - - /** - * Returns a function which returns its nth argument. - */ - nthArg(n: number): (...a: T[]) => T; - - /** - * Creates an object containing a single key:value pair. - */ - - // Record-based, key intact - objOf>(key: K, value: V): T; - objOf(key: K): >(value: V) => T; - // objOf>: CurriedFunction2; - - // // Obj-based, loses key - // objOf(key: Prop, value: T): Obj; - // objOf(key: Prop): (value: T) => Obj; - // // objOf: CurriedFunction2>; - - /** - * Returns a singleton array containing the value provided. - */ - of(x: T): T[]; - - /** - * Returns a partial copy of an object omitting the keys specified. - */ - omit(names: List, obj: T): T; - omit(names: List): (obj: T) => T; - // omit: CurriedFunction2, T, T>; - - /** - * Accepts a function fn and returns a function that guards invocation of fn such that fn can only ever be - * called once, no matter how many times the returned function is invoked. The first value calculated is - * returned in subsequent invocations. - */ - once(fn: Variadic): Variadic; - - /** - * A function that returns the first truthy of two arguments otherwise the last argument. Note that this is - * NOT short-circuited, meaning that if expressions are passed they are both evaluated. - * Dispatches to the or method of the first argument if applicable. - */ - // hard to mix cuz different generics - - // values - or(a: T, b: U): T|U; - or(a: T): (b: U) => T|U; - // or: CurriedFunction2; - - // dispatch to some `or` method: - or T|U;}, U>(fn1: T, val2: U): T|U; - or T|U;}, U>(fn1: T): (val2: U) => T|U; - // or T|U;}, U>: CurriedFunction2; - - /** - * Returns the result of "setting" the portion of the given data structure - * focused by the given lens to the given value. - */ - // hard to mix cuz different generics - - // key lens: - over(lens: UnknownLens, fn: (v: any) => any, value: T): T; - over(lens: UnknownLens, fn: (v: any) => any): (value: T) => T; - // over(lens: KeyLens): (fn: (v: T[K]) => T[K], value: T) => T; - over(lens: UnknownLens): CurriedFunction2<(v: any) => any, T, T>; - // over: CurriedFunction3, (v: T[K]) => T[K], T, T>; - - // regular lenses: - - // // Functor version: - // over>(lens: Lens|ManualLens|UnknownLens, fn: (v: V) => V, value: T): T; - // over(lens: ManualLens|UnknownLens, fn: (v: V) => V): >(value: T) => T; - // over>(lens: Lens|ManualLens|UnknownLens): CurriedFunction2<(v: V) => V, T, T>; - // // over>(lens: Lens|ManualLens|UnknownLens): (fn: (v: V) => V, value: T) => T; - // // over>: CurriedFunction3, (v: V) => V, T, T>; - - // // Functor version applied to array: - // over>(lens: Lens|ManualLens|UnknownLens, fn: (v: V) => V, value: T): V[]; - // over>(lens: Lens|ManualLens|UnknownLens, fn: (v: V) => V): (value: T) => V[]; - // over>(lens: Lens|ManualLens|UnknownLens): CurriedFunction2<(v: V) => V, T, V[]>; - // // over>(lens: Lens|ManualLens|UnknownLens): (fn: (v: V) => V, value: T) => V[]; - // // over>: CurriedFunction3|ManualLens|UnknownLens, (v: V) => V, T, V[]>; - - // // unbound value: - // over(lens: Lens|ManualLens|UnknownLens, fn: (v: V) => V, value: T): T; - // over(lens: ManualLens|UnknownLens, fn: (v: V) => V): (value: T) => T; - // // over(lens: UnknownLens): (fn: (v: V) => V, value: T) => T; - // over(lens: UnknownLens): CurriedFunction2<(v: V) => V, T, T>; - // // over: CurriedFunction3, (v: V) => V, T, T>; - - // Functor version - over>(lens: Lens|ManualLens|UnknownLens, fn: (v: V) => V, value: T): T; - over>(lens: Lens|ManualLens|UnknownLens, fn: (v: V) => V):{ - (value: T): T; - }; - over>(lens: Lens|ManualLens|UnknownLens):{ - (fn: (v: V) => V, value: T): T; - (fn: (v: V) => V):{ - (value: T): T; - }; - }; - - // Functor version applied to array - over>(lens: Lens|ManualLens|UnknownLens, fn: (v: V) => V, value: T): V[]; - over>(lens: Lens|ManualLens|UnknownLens, fn: (v: V) => V):{ - (value: T): V[]; - }; - over>(lens: Lens|ManualLens|UnknownLens):{ - (fn: (v: V) => V, value: T): V[]; - (fn: (v: V) => V):{ - (value: T): V[]; - }; - }; - - // unbound value - over(lens: Lens|ManualLens|UnknownLens, fn: (v: V) => V, value: T): T; - over(lens: Lens|ManualLens|UnknownLens, fn: (v: V) => V):{ - (value: T): T; - }; - over(lens: Lens|ManualLens|UnknownLens):{ - (fn: (v: V) => V, value: T): T; - (fn: (v: V) => V):{ - (value: T): T; - }; - }; - - - /** - * Takes two arguments, fst and snd, and returns [fst, snd]. - */ - pair(fst: F, snd: S): [F, S]; - pair(fst: F): (snd: S) => [F, S]; - // pair: CurriedFunction2; - - /** - * Accepts as its arguments a function and any number of values and returns a function that, - * when invoked, calls the original function with all of the values prepended to the - * original function's arguments list. In some libraries this function is named `applyLeft`. - */ - partial(fn: Variadic, args: any[]): Variadic; - partial(fn: Variadic): (args: any[]) => Variadic; - // partial: CurriedFunction2, args: any[], Variadic>; - // TODO: fixed-arity versions - - /** - * Accepts as its arguments a function and any number of values and returns a function that, - * when invoked, calls the original function with all of the values appended to the original - * function's arguments list. - */ - partialRight(fn: Variadic, args: any[]): Variadic; - partialRight(fn: Variadic): (args: any[]) => Variadic; - // partialRight: CurriedFunction2, args: any[], Variadic>; - // TODO: fixed-arity versions - - /** - * Takes a predicate and a list and returns the pair of lists of elements - * which do and do not satisfy the predicate, respectively. - */ - // arrays - partition(fn: (a: T) => boolean, list: List): [T[], T[]]; - partition(fn: (a: T) => boolean): (list: List) => [T[], T[]]; - // partition: CurriedFunction2<(a: T) => boolean, List, [T[], T[]]>; - // objects - partition,U extends Obj,V>(fn: (a: V) => boolean, obj: T & U) : [T,U]; - // partition,U extends Obj,V>: CurriedFunction2<(a: T) => boolean, obj: T & U, [T,U]>; - // objects, alternative notation - partition>(fn: (a: T) => boolean, obj: U) : [Obj, Obj]; - // partition>: CurriedFunction2<(a: T) => boolean, U, [Partial,Partial]>; - - /** - * Retrieve the value at a given path. - */ - - // fixed-length versions - - // simpler versions, able to deal only with objects, not arrays: - - // in-based - path(path: [T1, T2], obj: {[K1 in T1]: {[K2 in T2]: TResult}}): TResult; - path(path: [T1, T2, T3], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: TResult}}}): TResult; - path(path: [T1, T2, T3, T4], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: TResult}}}}): TResult; - path(path: [T1, T2, T3, T4, T5], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: TResult}}}}}): TResult; - path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: {[K6 in T6]: TResult}}}}}}): TResult; - path(path: [T1, T2, T3, T4, T5, T6, T7], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: {[K6 in T6]: {[K7 in T7]: TResult}}}}}}}): TResult; - path(path: [T1, T2, T3, T4, T5, T6, T7, T8], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: {[K6 in T6]: {[K7 in T7]: {[K8 in T8]: TResult}}}}}}}}): TResult; - path(path: [T1, T2, T3, T4, T5, T6, T7, T8, T9], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: {[K6 in T6]: {[K7 in T7]: {[K8 in T8]: {[K9 in T9]: TResult}}}}}}}}}): TResult; - - // Record-based - path(path: [K1, K2], obj: Record>): TResult; - path(path: [K1, K2, K3], obj: Record>>): TResult; - path(path: [K1, K2, K3, K4], obj: Record>>>): TResult; - path(path: [K1, K2, K3, K4, K5], obj: Record>>>>): TResult; - path(path: [K1, K2, K3, K4, K5, K6], obj: Record>>>>>): TResult; - path(path: [K1, K2, K3, K4, K5, K6, K7], obj: Record>>>>>>): TResult; - path(path: [K1, K2, K3, K4, K5, K6, K7, K8], obj: Record>>>>>>>): TResult; - path(path: [K1, K2, K3, K4, K5, K6, K7, K8, K9], obj: Record>>>>>>>>): TResult; - - // for each path length list all combinations of objects and homogeneous arrays... tuples not supported yet. - - path(path: [T1], obj: {[K1 in T1]: TResult}): TResult; - path(path: [T1], obj: TResult[]): TResult; - path(path: [T1, T2], obj: {[K1 in T1]: {[K2 in T2]: TResult}}): TResult; - path(path: [T1, T2], obj: {[K1 in T1]: TResult[]}): TResult; - path(path: [T1, T2], obj: {[K2 in T2]: TResult}[]): TResult; - path(path: [T1, T2], obj: TResult[][]): TResult; - path(path: [T1, T2, T3], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: TResult}}}): TResult; - path(path: [T1, T2, T3], obj: {[K1 in T1]: {[K2 in T2]: TResult[]}}): TResult; - path(path: [T1, T2, T3], obj: {[K1 in T1]: {[K3 in T3]: TResult}[]}): TResult; - path(path: [T1, T2, T3], obj: {[K1 in T1]: TResult[][]}): TResult; - path(path: [T1, T2, T3], obj: {[K2 in T2]: {[K3 in T3]: TResult}}[]): TResult; - path(path: [T1, T2, T3], obj: {[K2 in T2]: TResult[]}[]): TResult; - path(path: [T1, T2, T3], obj: {[K3 in T3]: TResult}[][]): TResult; - path(path: [T1, T2, T3], obj: TResult[][][]): TResult; - // path(path: [T1, T2, T3, T4], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: TResult}}}}): TResult; - // path(path: [T1, T2, T3, T4], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: TResult[]}}}): TResult; - // path(path: [T1, T2, T3, T4], obj: {[K1 in T1]: {[K2 in T2]: {[K4 in T4]: TResult}[]}}): TResult; - // path(path: [T1, T2, T3, T4], obj: {[K1 in T1]: {[K2 in T2]: TResult[][]}}): TResult; - // path(path: [T1, T2, T3, T4], obj: {[K1 in T1]: {[K3 in T3]: {[K4 in T4]: TResult}}[]}): TResult; - // path(path: [T1, T2, T3, T4], obj: {[K1 in T1]: {[K3 in T3]: TResult[]}[]}): TResult; - // path(path: [T1, T2, T3, T4], obj: {[K1 in T1]: {[K4 in T4]: TResult}[][]}): TResult; - // path(path: [T1, T2, T3, T4], obj: {[K1 in T1]: TResult[][][]}): TResult; - // path(path: [T1, T2, T3, T4], obj: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: TResult}}}[]): TResult; - // path(path: [T1, T2, T3, T4], obj: {[K2 in T2]: {[K3 in T3]: TResult[]}}[]): TResult; - // path(path: [T1, T2, T3, T4], obj: {[K2 in T2]: {[K4 in T4]: TResult}[]}[]): TResult; - // path(path: [T1, T2, T3, T4], obj: {[K2 in T2]: TResult[][]}[]): TResult; - // path(path: [T1, T2, T3, T4], obj: {[K3 in T3]: {[K4 in T4]: TResult}}[][]): TResult; - // path(path: [T1, T2, T3, T4], obj: {[K3 in T3]: TResult[]}[][]): TResult; - // path(path: [T1, T2, T3, T4], obj: {[K4 in T4]: TResult}[][][]): TResult; - // path(path: [T1, T2, T3, T4], obj: TResult[][][][]): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: TResult}}}}}): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: TResult[]}}}}): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K5 in T5]: TResult}[]}}}): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: TResult[][]}}}): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K1 in T1]: {[K2 in T2]: {[K4 in T4]: {[K5 in T5]: TResult}}[]}}): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K1 in T1]: {[K2 in T2]: {[K4 in T4]: TResult[]}[]}}): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K1 in T1]: {[K2 in T2]: {[K5 in T5]: TResult}[][]}}): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K1 in T1]: {[K2 in T2]: TResult[][][]}}): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K1 in T1]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: TResult}}}[]}): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K1 in T1]: {[K3 in T3]: {[K4 in T4]: TResult[]}}[]}): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K1 in T1]: {[K3 in T3]: {[K5 in T5]: TResult}[]}[]}): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K1 in T1]: {[K3 in T3]: TResult[][]}[]}): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K1 in T1]: {[K4 in T4]: {[K5 in T5]: TResult}}[][]}): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K1 in T1]: {[K4 in T4]: TResult[]}[][]}): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K1 in T1]: {[K5 in T5]: TResult}[][][]}): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K1 in T1]: TResult[][][][]}): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: TResult}}}}[]): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: TResult[]}}}[]): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K2 in T2]: {[K3 in T3]: {[K5 in T5]: TResult}[]}}[]): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K2 in T2]: {[K3 in T3]: TResult[][]}}[]): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K2 in T2]: {[K4 in T4]: {[K5 in T5]: TResult}}[]}[]): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K2 in T2]: {[K4 in T4]: TResult[]}[]}[]): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K2 in T2]: {[K5 in T5]: TResult}[][]}[]): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K2 in T2]: TResult[][][]}[]): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: TResult}}}[][]): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K3 in T3]: {[K4 in T4]: TResult[]}}[][]): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K3 in T3]: {[K5 in T5]: TResult}[]}[][]): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K3 in T3]: TResult[][]}[][]): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K4 in T4]: {[K5 in T5]: TResult}}[][][]): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K4 in T4]: TResult[]}[][][]): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: {[K5 in T5]: TResult}[][][][]): TResult; - // path(path: [T1, T2, T3, T4, T5], obj: TResult[][][][][]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: {[K6 in T6]: TResult}}}}}}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: TResult[]}}}}}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: {[K6 in T6]: TResult}[]}}}}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: TResult[][]}}}}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K5 in T5]: {[K6 in T6]: TResult}}[]}}}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K5 in T5]: TResult[]}[]}}}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K6 in T6]: TResult}[][]}}}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: TResult[][][]}}}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K2 in T2]: {[K4 in T4]: {[K5 in T5]: {[K6 in T6]: TResult}}}[]}}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K2 in T2]: {[K4 in T4]: {[K5 in T5]: TResult[]}}[]}}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K2 in T2]: {[K4 in T4]: {[K6 in T6]: TResult}[]}[]}}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K2 in T2]: {[K4 in T4]: TResult[][]}[]}}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K2 in T2]: {[K5 in T5]: {[K6 in T6]: TResult}}[][]}}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K2 in T2]: {[K5 in T5]: TResult[]}[][]}}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K2 in T2]: {[K6 in T6]: TResult}[][][]}}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K2 in T2]: TResult[][][][]}}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: {[K6 in T6]: TResult}}}}[]}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: TResult[]}}}[]}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K3 in T3]: {[K4 in T4]: {[K6 in T6]: TResult}[]}}[]}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K3 in T3]: {[K4 in T4]: TResult[][]}}[]}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K3 in T3]: {[K5 in T5]: {[K6 in T6]: TResult}}[]}[]}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K3 in T3]: {[K5 in T5]: TResult[]}[]}[]}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K3 in T3]: {[K6 in T6]: TResult}[][]}[]}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K3 in T3]: TResult[][][]}[]}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K4 in T4]: {[K5 in T5]: {[K6 in T6]: TResult}}}[][]}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K4 in T4]: {[K5 in T5]: TResult[]}}[][]}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K4 in T4]: {[K6 in T6]: TResult}[]}[][]}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K4 in T4]: TResult[][]}[][]}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K5 in T5]: {[K6 in T6]: TResult}}[][][]}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K5 in T5]: TResult[]}[][][]}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K6 in T6]: TResult}[][][][]}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: TResult[][][][][]}): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: {[K6 in T6]: TResult}}}}}[]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: TResult[]}}}}[]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: {[K6 in T6]: TResult}[]}}}[]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: TResult[][]}}}[]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K2 in T2]: {[K3 in T3]: {[K5 in T5]: {[K6 in T6]: TResult}}[]}}[]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K2 in T2]: {[K3 in T3]: {[K5 in T5]: TResult[]}[]}}[]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K2 in T2]: {[K3 in T3]: {[K6 in T6]: TResult}[][]}}[]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K2 in T2]: {[K3 in T3]: TResult[][][]}}[]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K2 in T2]: {[K4 in T4]: {[K5 in T5]: {[K6 in T6]: TResult}}}[]}[]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K2 in T2]: {[K4 in T4]: {[K5 in T5]: TResult[]}}[]}[]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K2 in T2]: {[K4 in T4]: {[K6 in T6]: TResult}[]}[]}[]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K2 in T2]: {[K4 in T4]: TResult[][]}[]}[]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K2 in T2]: {[K5 in T5]: {[K6 in T6]: TResult}}[][]}[]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K2 in T2]: {[K5 in T5]: TResult[]}[][]}[]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K2 in T2]: {[K6 in T6]: TResult}[][][]}[]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K2 in T2]: TResult[][][][]}[]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: {[K6 in T6]: TResult}}}}[][]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: TResult[]}}}[][]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K3 in T3]: {[K4 in T4]: {[K6 in T6]: TResult}[]}}[][]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K3 in T3]: {[K4 in T4]: TResult[][]}}[][]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K3 in T3]: {[K5 in T5]: {[K6 in T6]: TResult}}[]}[][]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K3 in T3]: {[K5 in T5]: TResult[]}[]}[][]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K3 in T3]: {[K6 in T6]: TResult}[][]}[][]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K3 in T3]: TResult[][][]}[][]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K4 in T4]: {[K5 in T5]: {[K6 in T6]: TResult}}}[][][]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K4 in T4]: {[K5 in T5]: TResult[]}}[][][]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K4 in T4]: {[K6 in T6]: TResult}[]}[][][]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K4 in T4]: TResult[][]}[][][]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K5 in T5]: {[K6 in T6]: TResult}}[][][][]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K5 in T5]: TResult[]}[][][][]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: {[K6 in T6]: TResult}[][][][][]): TResult; - // path(path: [T1, T2, T3, T4, T5, T6], obj: TResult[][][][][][]): TResult; - - // fallback, prevents errors but lacks inference; expected result must be supplied manually. - path(path: Path, obj: Struct): T | undefined; - path(path: Path): (obj: Struct) => T | undefined; - - // path: CurriedFunction2, T>; - // failed attempt at proper typing, see https://github.com/Microsoft/TypeScript/issues/12393 : - // path(keys: [K1, K2], obj: T): U; - // path(keys: [K1, K2], obj: T): T[K1][K2]; - - /** - * Determines whether a nested path on an object has a specific value, - * in `R.equals` terms. Most likely used to filter a list. - */ - // pathEq(path: Path, val: any, obj: Struct): boolean; - // pathEq(path: Path, val: any): (obj: Struct) => boolean; - // pathEq(path: Path): CurriedFunction2, boolean>; - // // pathEq: CurriedFunction3, boolean>; - - // base - pathEq(p: Path, v: any, o: any): boolean; - pathEq(p: Path, v: any): { - (o: any): boolean; - }; - pathEq(p: Path):{ - (v: any, o: any): boolean; - (v: any):{ - (o: any): boolean; - }; - }; - - - /** - * If the given, non-null object has a value at the given path, returns the value at that path. - * Otherwise returns the provided default value. - */ - // pathOr(d: T, p: Path, obj: Struct): T|any; - // pathOr(d: T, p: Path): (obj: Struct) => T|any; - // pathOr(d: T): CurriedFunction2, T|any>; - // // pathOr(d: T, p: Path): (obj: Struct) => T|any; - // // pathOr(d: T): (p: Path, obj: Struct) => T|any; - // // pathOr: CurriedFunction3, T|any>; - - // base - pathOr(d: T, p: Path, obj: Struct): T|any; - pathOr(d: T, p: Path):{ - (obj: Struct): T|any; - }; - pathOr(d: T):{ - (p: Path, obj: Struct): T|any; - (p: Path):{ - (obj: Struct): T|any; - }; - }; - - - /** - * Returns `true` if the specified object property at given path satisfies the given predicate; `false` - * otherwise. - */ - // pathSatisfies(fn: Pred, p: Path, obj: any): boolean; - // pathSatisfies(fn: Pred, p: Path): (obj: any) => boolean; - // pathSatisfies(fn: Pred): CurriedFunction2; - // // pathSatisfies: CurriedFunction3, Path, any, boolean>; - - // base - pathSatisfies(fn: Pred, p: Path, obj: any): boolean; - pathSatisfies(fn: Pred, p: Path):{ - (obj: any): boolean; - }; - pathSatisfies(fn: Pred):{ - (p: Path, obj: any): boolean; - (p: Path):{ - (obj: any): boolean; - }; - }; - - - /** - * Returns a partial copy of an object containing only the keys specified. If the key does not exist, the - * property is ignored. - */ - pick(names: List, obj: T): T; - pick(names: List): (obj: T) => T; - // pick: CurriedFunction2, T, Pick>; - - pick(names: List, obj: T): Partial; - pick(names: List): (obj: T) => Partial; - // pick: CurriedFunction2, T, Partial>; - - /** - * Similar to `pick` except that this one includes a `key: undefined` pair for properties that don't exist. - */ - pickAll(names: List, obj: T): Partial; - pickAll(names: List): (obj: T) => Partial; - // pickAll: CurriedFunction2, T, Partial>; - - - /** - * Returns a partial copy of an object containing only the keys that satisfy the supplied predicate. - */ - pickBy(pred: ObjPred, obj: T): Partial; - pickBy(pred: ObjPred): (obj: T) => Partial; - // pickBy: CurriedFunction2, T, Partial>; - - - /** - * Performs left-to-right function composition. - * The leftmost function may have any arity; the remaining functions must be unary. - * In some libraries this function is named sequence. - * Note: The result of pipe is not automatically curried. - */ - pipe(fn0: (x0: V0) => T1): (x0: V0) => T1; - pipe(fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T1; - pipe(fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T1; - pipe(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1): (x0: V0, x1: V1, x2: V2, x3: V3) => T1; - pipe(fn0: (x0: V0) => T1, fn1: (x: T1) => T2): (x0: V0) => T2; - pipe(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2): (x0: V0, x1: V1) => T2; - pipe(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2): (x0: V0, x1: V1, x2: V2) => T2; - pipe(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1, fn1: (x: T1) => T2): (x0: V0, x1: V1, x2: V2, x3: V3) => T2; - pipe(fn0: (x0: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3): (x0: V0) => T3; - pipe(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3): (x0: V0, x1: V1) => T3; - pipe(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3): (x0: V0, x1: V1, x2: V2) => T3; - pipe(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3): (x0: V0, x1: V1, x2: V2, x3: V3) => T3; - pipe(fn0: (x0: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4): (x0: V0) => T4; - pipe(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4): (x0: V0, x1: V1) => T4; - pipe(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4): (x0: V0, x1: V1, x2: V2) => T4; - pipe(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4): (x0: V0, x1: V1, x2: V2, x3: V3) => T4; - pipe(fn0: (x0: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5): (x0: V0) => T5; - pipe(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5): (x0: V0, x1: V1) => T5; - pipe(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5): (x0: V0, x1: V1, x2: V2) => T5; - pipe(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5): (x0: V0, x1: V1, x2: V2, x3: V3) => T5; - pipe(fn0: (x0: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6): (x0: V0) => T6; - pipe(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6): (x0: V0, x1: V1) => T6; - pipe(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6): (x0: V0, x1: V1, x2: V2) => T6; - pipe(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6): (x0: V0, x1: V1, x2: V2, x3: V3) => T6; - pipe(fn0: (x0: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7): (x0: V0) => T7; - pipe(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7): (x0: V0, x1: V1) => T7; - pipe(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7): (x0: V0, x1: V1, x2: V2) => T7; - pipe(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7): (x0: V0, x1: V1, x2: V2, x3: V3) => T7; - pipe(fn0: (x0: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn7: (x: T7) => T8): (x0: V0) => T8; - pipe(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn7: (x: T7) => T8): (x0: V0, x1: V1) => T8; - pipe(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn7: (x: T7) => T8): (x0: V0, x1: V1, x2: V2) => T8; - pipe(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn7: (x: T7) => T8): (x0: V0, x1: V1, x2: V2, x3: V3) => T8; - pipe(fn0: (x0: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn7: (x: T7) => T8, fn8: (x: T8) => T9): (x0: V0) => T9; - pipe(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn7: (x: T7) => T8, fn8: (x: T8) => T9): (x0: V0, x1: V1) => T9; - pipe(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn7: (x: T7) => T8, fn8: (x: T8) => T9): (x0: V0, x1: V1, x2: V2) => T9; - pipe(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn7: (x: T7) => T8, fn8: (x: T8) => T9): (x0: V0, x1: V1, x2: V2, x3: V3) => T9; - - /** - * Performs left-to-right composition of one or more Promise-returning functions. The leftmost function may have any arity; the remaining functions must be unary. - */ - pipeP(fn0: (x0: V0) => Promise): (x0: V0) => Promise; - pipeP(fn0: (x0: V0, x1: V1) => Promise): (x0: V0, x1: V1) => Promise; - pipeP(fn0: (x0: V0, x1: V1, x2: V2) => Promise): (x0: V0, x1: V1, x2: V2) => Promise; - pipeP(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; - pipeP(fn0: (x0: V0) => Promise, fn1: (x: T1) => Promise|T2): (x0: V0) => Promise; - pipeP(fn0: (x0: V0, x1: V1) => Promise, fn1: (x: T1) => Promise|T2): (x0: V0, x1: V1) => Promise; - pipeP(fn0: (x0: V0, x1: V1, x2: V2) => Promise, fn1: (x: T1) => Promise|T2): (x0: V0, x1: V1, x2: V2) => Promise; - pipeP(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise, fn1: (x: T1) => Promise|T2): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; - pipeP(fn0: (x0: V0) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3): (x0: V0) => Promise; - pipeP(fn0: (x0: V0, x1: V1) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3): (x0: V0, x1: V1) => Promise; - pipeP(fn0: (x0: V0, x1: V1, x2: V2) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3): (x0: V0, x1: V1, x2: V2) => Promise; - pipeP(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; - pipeP(fn0: (x0: V0) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4): (x0: V0) => Promise; - pipeP(fn0: (x0: V0, x1: V1) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4): (x0: V0, x1: V1) => Promise; - pipeP(fn0: (x0: V0, x1: V1, x2: V2) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4): (x0: V0, x1: V1, x2: V2) => Promise; - pipeP(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; - pipeP(fn0: (x0: V0) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5): (x0: V0) => Promise; - pipeP(fn0: (x0: V0, x1: V1) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5): (x0: V0, x1: V1) => Promise; - pipeP(fn0: (x0: V0, x1: V1, x2: V2) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5): (x0: V0, x1: V1, x2: V2) => Promise; - pipeP(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; - pipeP(fn0: (x0: V0) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6): (x0: V0) => Promise; - pipeP(fn0: (x0: V0, x1: V1) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6): (x0: V0, x1: V1) => Promise; - pipeP(fn0: (x0: V0, x1: V1, x2: V2) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6): (x0: V0, x1: V1, x2: V2) => Promise; - pipeP(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; - pipeP(fn0: (x0: V0) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7): (x0: V0) => Promise; - pipeP(fn0: (x0: V0, x1: V1) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7): (x0: V0, x1: V1) => Promise; - pipeP(fn0: (x0: V0, x1: V1, x2: V2) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7): (x0: V0, x1: V1, x2: V2) => Promise; - pipeP(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; - pipeP(fn0: (x0: V0) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7, fn7: (x: T7) => Promise|T8): (x0: V0) => Promise; - pipeP(fn0: (x0: V0, x1: V1) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7, fn7: (x: T7) => Promise|T8): (x0: V0, x1: V1) => Promise; - pipeP(fn0: (x0: V0, x1: V1, x2: V2) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7, fn7: (x: T7) => Promise|T8): (x0: V0, x1: V1, x2: V2) => Promise; - pipeP(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7, fn7: (x: T7) => Promise|T8): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; - pipeP(fn0: (x0: V0) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7, fn7: (x: T7) => Promise|T8, fn8: (x: T8) => Promise|T9): (x0: V0) => Promise; - pipeP(fn0: (x0: V0, x1: V1) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7, fn7: (x: T7) => Promise|T8, fn8: (x: T8) => Promise|T9): (x0: V0, x1: V1) => Promise; - pipeP(fn0: (x0: V0, x1: V1, x2: V2) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7, fn7: (x: T7) => Promise|T8, fn8: (x: T8) => Promise|T9): (x0: V0, x1: V1, x2: V2) => Promise; - pipeP(fn0: (x0: V0, x1: V1, x2: V2, x3: V3) => Promise, fn1: (x: T1) => Promise|T2, fn2: (x: T2) => Promise|T3, fn3: (x: T3) => Promise|T4, fn4: (x: T4) => Promise|T5, fn5: (x: T5) => Promise|T6, fn6: (x: T6) => Promise|T7, fn7: (x: T7) => Promise|T8, fn8: (x: T8) => Promise|T9): (x0: V0, x1: V1, x2: V2, x3: V3) => Promise; - - /** - * Returns the left-to-right Kleisli composition of the provided functions, each of which must return a value of a type supported by chain. - */ - // skipped extra params on fn0 -- not mentioned in the docs! - pipeK(fn0: (v: Chain) => Chain): (v: V) => Chain; - pipeK(fn0: (v: Chain) => Chain, fn1: (x: T1) => Chain): (v: V) => Chain; - pipeK(fn0: (v: Chain) => Chain, fn1: (x: T1) => Chain, fn2: (x: T2) => Chain): (v: V) => Chain; - pipeK(fn0: (v: Chain) => Chain, fn1: (x: T1) => Chain, fn2: (x: T2) => Chain, fn3: (x: T3) => Chain): (v: V) => Chain; - pipeK(fn0: (v: Chain) => Chain, fn1: (x: T1) => Chain, fn2: (x: T2) => Chain, fn3: (x: T3) => Chain, fn4: (x: T4) => Chain): (v: V) => Chain; - pipeK(fn0: (v: Chain) => Chain, fn1: (x: T1) => Chain, fn2: (x: T2) => Chain, fn3: (x: T3) => Chain, fn4: (x: T4) => Chain, fn5: (x: T5) => Chain): (v: V) => Chain; - pipeK(fn0: (v: Chain) => Chain, fn1: (x: T1) => Chain, fn2: (x: T2) => Chain, fn3: (x: T3) => Chain, fn4: (x: T4) => Chain, fn5: (x: T5) => Chain, fn6: (x: T6) => Chain): (v: V) => Chain; - pipeK(fn0: (v: Chain) => Chain, fn1: (x: T1) => Chain, fn2: (x: T2) => Chain, fn3: (x: T3) => Chain, fn4: (x: T4) => Chain, fn5: (x: T5) => Chain, fn6: (x: T6) => Chain, fn7: (x: T7) => Chain): (v: V) => Chain; - pipeK(fn0: (v: Chain) => Chain, fn1: (x: T1) => Chain, fn2: (x: T2) => Chain, fn3: (x: T3) => Chain, fn4: (x: T4) => Chain, fn5: (x: T5) => Chain, fn6: (x: T6) => Chain, fn7: (x: T7) => Chain, fn8: (x: T8) => Chain): (v: V) => Chain; - - /** - * Returns a new list by plucking the same named property off all objects in the list supplied. - */ - // hard to mix cuz different generics - - // array - - // infer - pluck, K extends keyof T>(p: K, list: List): T[K][]; // fails on number keys - // pluck, K extends keyof T>(p: K): (list: List) => T[K][]; // doesn't work, T info late - // pluck, K extends keyof T>: CurriedFunction2, T[K][]>; - - // infer - pluck, K extends keyof T>(p: K, list: List): U[]; // fails on number keys - // pluck, K extends keyof T>(p: K): (list: List) => U[]; // doesn't work, T info late - // pluck, K extends keyof T>: CurriedFunction2, U[]>; - - // supply return object type manually when unable to infer it... - pluck(p: Prop, list: Struct[]): T[]; - pluck(p: Prop): (list: Struct[]) => T[]; - // pluck: CurriedFunction2[], T[]>; - - // object - - // infer - pluck, K extends keyof T>(p: K, list: Obj): Obj; // fails on number keys - // pluck, K extends keyof T>(p: K): (list: Obj) => Obj; // doesn't work, T info late - // pluck, K extends keyof T>: CurriedFunction2, Obj>; - - // infer - pluck, K extends keyof T>(p: K, list: Obj): Obj; // fails on number keys - // pluck, K extends keyof T>(p: K): (list: Obj) => Obj; // doesn't work, T info late - // pluck, K extends keyof T>: CurriedFunction2, Obj>; - - // supply return object type manually when unable to infer it... - pluck(p: Prop, list: Obj>): Obj; - pluck(p: Prop): (list: Obj>) => Obj; - // pluck: CurriedFunction2>, Obj>; - - /** - * Returns a new list with the given element at the front, followed by the contents of the - * list. - */ - prepend(el: T, list: List): T[]; - prepend(el: T): (list: List) => T[]; - // prepend: CurriedFunction2, T[]>; - - /** - * Multiplies together all the elements of a list. - */ - product(list: List): number; - - - /** - * Reasonable analog to SQL `select` statement. - */ - // hard to mix cuz different generics - - // infer (keyof) - project(props: List, objs: List): Pick[]; - // project(props: List): (objs: List) => Pick[]>; // T info probably too late - // project: CurriedFunction2, List, Pick[]>; - - // fallback: presume the original structure is intact - project(props: List, objs: List): T[]; - project(props: List): (objs: List) => T[]; - // project: CurriedFunction2, List, T[]; - - // manually typed: supply return array type by explicit generic - project(props: List, objs: List): T[]; - project(props: List): (objs: List) => T[]; - // project: CurriedFunction2, List, T[]>; - - /** - * Returns a function that when supplied an object returns the indicated property of that object, if it exists. - */ - - // keyof version - prop(p: K, obj: T): T[K]; - // prop(p: K): (obj: T) => T[K]; // T info late - // prop: CurriedFunction2; - // prop(p: K): (obj: T) => T[K]; // K redefined, fails - // prop: CurriedFunction2; - - // Record version, more curry-friendly - prop>(p: K, obj: T): V; // uncurried adds value only for {} from e.g. degeneration - // prop(p: K): >(obj: T) => V; - // prop>: CurriedFunction2; - - // manually type with explicit generic - prop(p: Prop, obj: Struct): T; - // prop(p: Prop): (obj: Struct) => T; - // prop: CurriedFunction2, T>; - - // mixed for currying: - prop(p: K): { - // Record version - >(obj: T): V; - // manually typed - (obj: Struct): T; - }; - - /** - * Determines whether the given property of an object has a specific - * value according to strict equality (`===`). Most likely used to - * filter a list. - */ - // propEq>(name: Prop, val: any, obj: T): boolean; - // propEq>(name: Prop, val: any): (obj: T) => boolean; - // propEq>(name: Prop): CurriedFunction2; - // // propEq>(name: Prop): (val: any, obj: T) => boolean; - // // propEq>(name: Prop): (val: any) => (obj: T) => boolean; - // // propEq>: CurriedFunction3; - - // base - propEq>(name: Prop, val: any, obj: T): boolean; - propEq(name: Prop, val: any):{ - >(obj: T): boolean; - }; - propEq(name: Prop):{ - >(val: any, obj: T): boolean; - (val: any):{ - >(obj: T): boolean; - }; - }; - - - /** - * Returns true if the specified object property is of the given type; false otherwise. - */ - - // Record - propIs>(type: T, name: K, obj: U): obj is (U & Record); - propIs(type: T, name: K): >(obj: U) => obj is (U & Record); - // propIs(type: T): { - // >(name: K, obj: U): obj is (U & Record); - // (name: K): >(obj: U) => obj is (U & Record); - // } - // propIs>: CurriedFunction3)>; // obj is? name unavailable... - - // inference, fails if name and object are supplied separately - // propIs(type: T, name: K, obj: V): obj is (V & Record); - // propIs(type: T, name: K): (obj: V) => obj is (V & Record); // object info not available in time :( - // propIs(type: T): { - // (name: K, obj: V): obj is (V & Record); - // (name: K): (obj: V) => obj is (V & Record); // object info not available in time :( - // } - // propIs: CurriedFunction3)>; // obj is? name unavailable... - - // trying to predict outcome without keyof - propIs(type: T, name: Prop, obj: V): obj is (V & Obj); - - // curry-friendlier fallback - propIs(type: Function, name: Prop, obj: Struct): boolean; // overlap with above? - propIs(type: Function, name: Prop): (obj: Struct) => boolean; - propIs(type: Function): CurriedFunction2, boolean>; - // propIs(type: Function): { - // (name: Prop, obj: Struct): boolean; - // (name: Prop): (obj: Struct) => boolean; - // } - // propIs: CurriedFunction3, boolean>; - - // mixed: - propIs(type: T): { - // record - >(name: K, obj: U): obj is (U & Record); - (name: K): >(obj: U) => obj is (U & Record); - // keyof - (name: K, obj: V): obj is (V & Record); - (name: Prop, obj: V): obj is (V & Obj); - // (name: K): (obj: V) => obj is (V & Record); // object info not available in time :( - }; - - /** - * If the given, non-null object has an own property with the specified name, returns the value of that property. - * Otherwise returns the provided default value. - */ - - // // infer with Record (curry-friendly) -- can't use here: it'd error whenever the default should trigger - // propOr>(val: T, p: K, obj: U): V|T; - // propOr(val: T, p: K): >(obj: U) => V|T; - // propOr>(val: T): CurriedFunction2; - // // propOr>: CurriedFunction3; - - // infer with keyof (not curry-friendly), allowing a default value with a type different from the actual one - propOr(val: T, key: K, obj: U): U[K] | T; - // propOr(val: T, key: K): (obj: U) => U[K] | T; // generics too early? - propOr(val: T): (key: K, obj: U) => U[K] | T; - // propOr: CurriedFunction3; - - // presume the value at the given key matches the type of the default value, bad but less likely to fail with currying - propOr(val: T, p: Prop, obj: Struct): T; // adds value only to protect against {} from e.g. generic degeneration - // propOr(val: T, p: Prop): (obj: Struct) => T; - // // propOr(val: T): (p: Prop, obj: Struct) => T; - // propOr(val: T): CurriedFunction2, T>; - // // propOr: CurriedFunction3, T>; - propOr(val: T, p: Prop): Struct; - propOr(val: T):{ - (p: Prop): Struct; - }; - - - // // useless unbound generics? - // propOr(val: T, p: Prop, obj: U): V; - // propOr(val: T, p: Prop): (obj: U) => V; - // // propOr(val: T): (p: Prop, obj: U) => V; - // propOr(val: T): CurriedFunction2; - // // propOr: CurriedFunction3; - - /** - * Acts as multiple `prop`: array of keys in, array of values out. Preserves order. - */ - - // generic version - props(ps: List, obj: Struct): T[]; - props(ps: List): (obj: Struct) => T[]; - // props: CurriedFunction2, Struct, T[]>; - - // TODO: heterogeneous version - // Record-based? - // props>(ps: List, obj: Struct): ???; - - /** - * Returns true if the specified object property satisfies the given predicate; false otherwise. - */ - - // // Record (curry-friendly) - // propSatisfies>(pred: Pred, name: K, obj: U): boolean; - // propSatisfies(pred: Pred, name: K): >(obj: U) => boolean; - // propSatisfies>(pred: Pred): CurriedFunction2; - // // propSatisfies>: CurriedFunction3, K, U, boolean>; - - // // keyof, info too late on currying - // propSatisfies, K extends keyof U>(pred: Pred, name: Prop, obj: U): boolean; - // propSatisfies(pred: Pred, name: Prop): (obj: U) => boolean; - // propSatisfies(pred: Pred): CurriedFunction2; - // // propSatisfies: CurriedFunction3, Prop, U, boolean>; - - // Record (curry-friendly) - propSatisfies>(pred: Pred, name: K, obj: U): boolean; - propSatisfies(pred: Pred, name: K):{ - >(obj: U): boolean; - }; - propSatisfies(pred: Pred):{ - >(name: K, obj: U): boolean; - (name: K):{ - >(obj: U): boolean; - }; - }; - - // keyof, info too late on currying - propSatisfies(pred: Pred, name: Prop, obj: U): boolean; - propSatisfies(pred: Pred, name: Prop):{ - (obj: U): boolean; - }; - propSatisfies(pred: Pred):{ - (name: Prop, obj: U): boolean; - (name: Prop):{ - (obj: U): boolean; - }; - }; - - - /** - * Returns a list of numbers from `from` (inclusive) to `to` - * (exclusive). In mathematical terms, `range(a, b)` is equivalent to - * the half-open interval `[a, b)`. - */ - range(from: number, to: number): number[]; - range(from: number): (to: number) => number[]; - // range: CurriedFunction2; - - /** - * Returns a single item by iterating through the list, successively calling the iterator - * function and passing it an accumulator value and the current value from the array, and - * then passing the result to the next call. - */ - // reduce>(fn: (acc: TResult, elem: T, idx: Number, list: R) => TResult|Reduced, acc: TResult, list: R): TResult; - // reduce>(fn: (acc: TResult, elem: T, idx: Number, list: R) => TResult|Reduced, acc: TResult): (list: R) => TResult; - // reduce>(fn: (acc: TResult, elem: T, idx: Number, list: R) => TResult|Reduced): CurriedFunction2; - // // reduce>(fn: (acc: TResult, elem: T, idx: Number, list: R) => TResult|Reduced): (acc: TResult, list: R) => TResult; - // // reduce>: CurriedFunction3<(acc: TResult, elem: T, idx: Number, list: R) => TResult|Reduced, TResult, R, TResult>; - // base - reduce>(fn: (acc: TResult, elem: T, idx: number, list: R) => TResult|Reduced, acc: TResult, list: R): TResult; - reduce>(fn: (acc: TResult, elem: T, idx: number, list: R) => TResult|Reduced, acc: TResult):{ - (list: R): TResult; - }; - reduce>(fn: (acc: TResult, elem: T, idx: number, list: R) => TResult|Reduced):{ - (acc: TResult, list: R): TResult; - (acc: TResult):{ - (list: R): TResult; - }; - }; - - - /** - * Groups the elements of the list according to the result of calling the String-returning function keyFn on each - * element and reduces the elements of each group to a single value via the reducer function valueFn. - */ - // // reason for 'any' on acc: somehow empty accumulators like '[]' won't work well when matching - // reduceBy>(valueFn: (acc: TResult, elem: T, idx: number, list: R) => TResult, acc: TResult|any, keyFn: (elem: T) => string, list: R): TResult; - // reduceBy>(valueFn: (acc: TResult, elem: T, idx: number, list: R) => TResult, acc: TResult|any, keyFn: (elem: T) => string): (list: R) => TResult; - // reduceBy>(valueFn: (acc: TResult, elem: T, idx: number, list: R) => TResult, acc: TResult|any): CurriedFunction2<(elem: T) => string, R, TResult>; - // reduceBy>(valueFn: (acc: TResult, elem: T, idx: number, list: R) => TResult): CurriedFunction3 string, R, TResult>; - // // reduceBy>: CurriedFunction4<(acc: TResult, elem: T, idx: number, list: R) => TResult, TResult|any, (elem: T) => string, R, TResult>; - // base - reduceBy>(valueFn: (acc: TResult, elem: T, idx: number, list: R) => TResult, acc: TResult|any, keyFn: (elem: T) => string, list: R): TResult; - reduceBy>(valueFn: (acc: TResult, elem: T, idx: number, list: R) => TResult, acc: TResult|any, keyFn: (elem: T) => string):{ - (list: R): TResult; - }; - reduceBy>(valueFn: (acc: TResult, elem: T, idx: number, list: R) => TResult, acc: TResult|any):{ - (keyFn: (elem: T) => string, list: R): TResult; - (keyFn: (elem: T) => string):{ - (list: R): TResult; - }; - }; - reduceBy>(valueFn: (acc: TResult, elem: T, idx: number, list: R) => TResult):{ - (acc: TResult|any, keyFn: (elem: T) => string, list: R): TResult; - (acc: TResult|any, keyFn: (elem: T) => string):{ - (list: R): TResult; - }; - (acc: TResult|any):{ - (keyFn: (elem: T) => string, list: R): TResult; - (keyFn: (elem: T) => string):{ - (list: R): TResult; - }; - }; - }; - - - /** - * Returns a value wrapped to indicate that it is the final value of the reduce and - * transduce functions. The returned value should be considered a black box: the internal - * structure is not guaranteed to be stable. - */ - reduced(elem: T): Reduced; - - /** - * Returns a single item by iterating through the list, successively calling the iterator - * function and passing it an accumulator value and the current value from the array, and - * then passing the result to the next call. - */ - // // reason for 'any' on acc: somehow empty accumulators like '[]' won't work well when matching - // reduceRight(fn: (elem: T, acc: TResult) => TResult|Reduced, acc: TResult|any, list: List): TResult; - // reduceRight(fn: (elem: T, acc: TResult) => TResult|Reduced, acc: TResult|any): (list: List) => TResult; - // reduceRight(fn: (elem: T, acc: TResult) => TResult|Reduced): CurriedFunction2, TResult>; - // // reduceRight(fn: (elem: T, acc: TResult) => TResult|Reduced): (acc: TResult|any, list: List) => TResult; - // // reduceRight(fn: (elem: T, acc: TResult) => TResult|Reduced): (acc: TResult|any) => (list: List) => TResult; - // // reduceRight: CurriedFunction3<(elem: T, acc: TResult) => TResult|Reduced, TResult|any, List, TResult>; - // base - reduceRight(fn: (elem: T, acc: TResult) => TResult|Reduced, acc: TResult|any, list: List): TResult; - reduceRight(fn: (elem: T, acc: TResult) => TResult|Reduced, acc: TResult|any):{ - (list: List): TResult; - }; - reduceRight(fn: (elem: T, acc: TResult) => TResult|Reduced):{ - (acc: TResult|any, list: List): TResult; - (acc: TResult|any):{ - (list: List): TResult; - }; - }; - - - /** - * Like reduce, reduceWhile returns a single item by iterating through the list, successively calling the iterator function. - * reduceWhile also takes a predicate that is evaluated before each step. If the predicate returns false, it "short-circuits" - * the iteration and returns the current value of the accumulator. - */ - // reduceWhile(pred: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult|Reduced, acc: TResult, list: List): TResult; - // reduceWhile(pred: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult|Reduced, acc: TResult): (list: List) => TResult; - // reduceWhile(pred: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult|Reduced): CurriedFunction2, TResult>; - // reduceWhile(pred: (acc: TResult, elem: T) => boolean): CurriedFunction3<(acc: TResult, elem: T) => TResult|Reduced, TResult, List, TResult>; - // // reduceWhile: CurriedFunction4<(acc: TResult, elem: T) => boolean, (acc: TResult, elem: T) => TResult|Reduced, TResult, List, TResult>; - - // base - reduceWhile(pred: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult|Reduced, acc: TResult, list: List): TResult; - reduceWhile(pred: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult|Reduced, acc: TResult):{ - (list: List): TResult; - }; - reduceWhile(pred: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult|Reduced):{ - (acc: TResult, list: List): TResult; - (acc: TResult):{ - (list: List): TResult; - }; - }; - reduceWhile(pred: (acc: TResult, elem: T) => boolean):{ - (fn: (acc: TResult, elem: T) => TResult|Reduced, acc: TResult, list: List): TResult; - (fn: (acc: TResult, elem: T) => TResult|Reduced, acc: TResult):{ - (list: List): TResult; - }; - (fn: (acc: TResult, elem: T) => TResult|Reduced):{ - (acc: TResult, list: List): TResult; - (acc: TResult):{ - (list: List): TResult; - }; - }; - }; - - - /** - * Similar to `filter`, except that it keeps only values for which the given predicate - * function returns falsy. - */ - // = filter - - // array - reject(pred: Pred, list: List): T[]; - // reject(pred: Pred): (list: List) => T[]; // mix - // reject: CurriedFunction2, List, T[]>; - - // functor to functor - reject(pred: Pred, list: Functor): Functor; - // reject(pred: Pred): (list: Functor) => Functor; // mix - // reject: CurriedFunction2, Functor, Functor>; - - // functor to array - reject(pred: Pred, list: Functor): T[]; - // reject(pred: Pred): (list: Functor) => T[]; // mix - // reject: CurriedFunction2, Functor, T[]>; - - // object - reject>(pred: Pred, obj: U) : U; - // reject(pred: Pred): >(obj: U) => Partial; // mix - // reject>: CurriedFunction2, U, Partial>; - - // mixed - reject(pred: Pred): { - (list: List): T[]; - (list: Functor): Functor; - (list: Functor): T[]; - >(obj: U): U; - }; - - /** - * Removes the sub-list of `list` starting at index `start` and containing `count` elements. - */ - // remove(start: number, count: number, list: List): T[]; - // remove(start: number, count: number): (list: List) => T[]; - // remove(start: number): CurriedFunction2,T[]>; - // // remove: CurriedFunction3, T[]>; - - // base - remove(start: number, count: number, list: List): T[]; - remove(start: number, count: number):{ - (list: List): T[]; - }; - remove(start: number):{ - (count: number, list: List): T[]; - (count: number):{ - (list: List): T[]; - }; - }; - - - /** - * Returns a fixed list of size n containing a specified identical value. - */ - repeat(a: T, n: number): T[]; - repeat(a: T): (n: number) => T[]; - // repeat: CurriedFunction2; - - - /** - * Replace a substring or regex match in a string with a replacement. - */ - // replace(pattern: RegExp|Prop, replacement: Prop, str: string): string; - // replace(pattern: RegExp|Prop, replacement: Prop): (str: string) => string; - // replace(pattern: RegExp|Prop): CurriedFunction2; - // // replace(pattern: RegExp|Prop): (replacement: Prop, str: string) => string; - // // replace(pattern: RegExp|Prop): (replacement: Prop) => (str: string) => string; - // // replace: CurriedFunction3; - - // base - replace(pattern: RegExp|Prop, replacement: Prop, str: string): string; - replace(pattern: RegExp|Prop, replacement: Prop):{ - (str: string): string; - }; - replace(pattern: RegExp|Prop):{ - (replacement: Prop, str: string): string; - (replacement: Prop):{ - (str: string): string; - }; - }; - - - - /** - * Returns a new list with the same elements as the original list, just in the reverse order. - */ - reverse(list: List): T[]; - - /** - * Scan is similar to reduce, but returns a list of successively reduced values from the left. - */ - // scan(fn: (acc: TResult, elem: T) => TResult|Reduced, acc: TResult, list: List): TResult[]; - // scan(fn: (acc: TResult, elem: T) => TResult|Reduced, acc: TResult): (list: List) => TResult[]; - // scan(fn: (acc: TResult, elem: T) => TResult|Reduced): CurriedFunction2, TResult[]>; - // // scan: CurriedFunction3<(acc: TResult, elem: T) => TResult|Reduced, TResult, List, TResult[]>; - - // base - scan(fn: (acc: TResult, elem: T) => TResult|Reduced, acc: TResult, list: List): TResult[]; - scan(fn: (acc: TResult, elem: T) => TResult|Reduced, acc: TResult):{ - (list: List): TResult[]; - }; - scan(fn: (acc: TResult, elem: T) => TResult|Reduced):{ - (acc: TResult, list: List): TResult[]; - (acc: TResult):{ - (list: List): TResult[]; - }; - }; - - - /** - * Transforms a Traversable of Applicative into an Applicative of Traversable. - */ - - // common case of array as traversable: - sequence(f: (v: T) => Applicative, traversable: List>): Applicative>; - // sequence(f: (v: T) => Applicative): (traversable: List>) => Applicative>; // mix - // sequence: CurriedFunction2<(v: T) => Applicative, List>, Applicative>>; - - // general ADT case: - sequence(f: (v: T) => Applicative, traversable: Traversable>): Applicative>; - // sequence(f: (v: T) => Applicative): (traversable: Traversable>) => Applicative>; // mix - // sequence: CurriedFunction2<(v: T) => Applicative, Traversable>, Applicative>>; - - // mixed: - sequence(f: (v: T) => Applicative): { - (traversable: List>): Applicative>; - (traversable: Traversable>): Applicative>; - }; - - - /** - * Returns the result of "setting" the portion of the given data structure focused by the given lens to the - * given value. - */ - // hard to mix cuz different generics - - // // key lens: - // set(lens: KeyLens, a: T[K], obj: T): T; - // set(lens: KeyLens, a: T[K]): (obj: T) => T; - // set(lens: KeyLens): CurriedFunction2; - // // set: CurriedFunction3, T[K], T, T>; - - // regular lenses: - - // // smart approach, unreliable: - // set(lens: Lens, a: U, obj: T): T; - // set(lens: Lens, a: U): (obj: T) => T; - // // set(lens: Lens): (a: U, obj: T) => T; - // set(lens: Lens): CurriedFunction2; - // // set: CurriedFunction3, U, T, T>; - - // // // manually set lens; is this useful? - // // set(lens: ManualLens, a: U, obj: T): T; - // // set(lens: ManualLens, a: U): (obj: T) => T; - // // set(lens: ManualLens): CurriedFunction2; - // // // set: CurriedFunction3, U, T, T>; - - // // assume result type equal to input object: - // set(lens: UnknownLens, a: any, obj: T): T; - // set(lens: UnknownLens, a: any): (obj: T) => T; - // // set(lens: UnknownLens): (a: any, obj: T) => T; - // set(lens: UnknownLens): CurriedFunction2; - // // set: CurriedFunction3; - - // // // old version, with value as an unbound generic; is this useful? - // // set(lens: UnknownLens, a: U, obj: T): T; - // // set(lens: UnknownLens, a: U): (obj: T) => T; - // // set(lens: UnknownLens): CurriedFunction2; - // // // set: CurriedFunction3; - - // lens - set(lens: Lens, a: U, obj: T): T; - set(lens: Lens, a: U): { - (obj: T): T; - }; - set(lens: Lens): { - (a: U, obj: T): T; - (a: U):{ - (obj: T): T; - }; - }; - - // lens - set(lens: ManualLens, a: U, obj: T): T; - set(lens: ManualLens, a: U):{ - (obj: T): T; - }; - set(lens: ManualLens): { - (a: U, obj: T): T; - (a: U):{ - (obj: T): T; - }; - }; - - // unknown - set(lens: UnknownLens, a: any, obj: T): T; - set(lens: UnknownLens, a: any): { - (obj: T): T; - }; - set(lens: UnknownLens): { - (a: any, obj: T): T; - (a: any):{ - (obj: T): T; - }; - }; - - - /** - * Returns the elements from `xs` starting at `a` and ending at `b - 1`. - */ - // slice>(a: number, b: number, list: T): T; - // slice(a: number, b: number): >(list: T) => T; - // slice>(a: number): CurriedFunction2; - // // slice(a: number): >(b: number, list: T) => T; - // // slice(a: number): >(b: number) => (list: T) => T; - // // slice>: CurriedFunction3; - - // base - slice>(a: number, b: number, list: T): T; - slice(a: number, b: number):{ - >(list: T): T; - }; - slice(a: number):{ - >(b: number, list: T): T; - (b: number):{ - >(list: T): T; - }; - }; - - - /** - * Returns a copy of the list, sorted according to the comparator function, which should accept two values at a - * time and return a negative number if the first value is smaller, a positive number if it's larger, and zero - * if they are equal. - */ - sort(fn: (a: T, b: T) => number, list: List): T[]; - sort(fn: (a: T, b: T) => number): (list: List) => T[]; - // sort: CurriedFunction2<(a: T, b: T) => number, List, T[]>; - - - /** - * Sorts the list according to a key generated by the supplied function. - */ - sortBy(fn: (a: T) => Ord, list: List): T[]; - sortBy(fn: (a: T) => Ord): (list: List) => T[]; - // sortBy: CurriedFunction2<(a: T) => Ord, List, T[]>; - - /** - * Sorts a list according to a list of comparators. - */ - sortWith(comparators: List<(a: T, b: T) => number>, list: List): T[]; - sortWith(comparators: List<(a: T, b: T) => number>): (list: List) => T[]; - // sortWith: CurriedFunction2 number>, List, T[]>; - - /** - * Splits a string into an array of strings based on the given - * separator. - */ - split(sep: RegExp|Prop, str: string): string[]; - split(sep: RegExp|Prop): (str: string) => string[]; - // split: CurriedFunction2; - - /** - * Splits a given list or string at a given index. - */ - // string - splitAt(index: number, list: string): [string, string]; - // splitAt(index: number): (list: string) => [string, string]; - // splitAt: CurriedFunction2; - // array - splitAt(index: number, list: List): T[][]; - // splitAt(index: number): (list: List) => T[][]; - // splitAt: CurriedFunction2, T[][]>; - // mixed - splitAt(index: number): { - (list: string): [string, string]; - (list: List): T[][]; - }; - - /** - * Splits a collection into slices of the specified length. - */ - splitEvery>(a: number, list: R): R[]; - splitEvery(a: number): >(list: R) => R[]; - // splitEvery>: CurriedFunction2; - - /** - * Takes a list and a predicate and returns a pair of lists with the following properties: - * - the result of concatenating the two output lists is equivalent to the input list; - * - none of the elements of the first output list satisfies the predicate; and - * - if the second output list is non-empty, its first element satisfies the predicate. - */ - splitWhen>(pred: Pred, list: R): R[]; - splitWhen(pred: Pred): >(list: R) => R[]; - // splitWhen>: CurriedFunction2, R, R[]>; - - /** - * Subtracts two numbers. Equivalent to `a - b` but curried. - */ - subtract(a: number, b: number): number; - subtract(a: number): (b: number) => number; - // subtract: CurriedFunction2; - - /** - * Adds together all the elements of a list. - */ - sum(list: List): number; - - /** - * Finds the set (i.e. no duplicates) of all elements contained in the first or second list, but not both. - */ - symmetricDifference(list1: List, list2: List): T[]; - symmetricDifference(list: List): (list: List) => T[]; - // symmetricDifference: CurriedFunction2, List, T[]>; - - /** - * Finds the set (i.e. no duplicates) of all elements contained in the first or second list, but not both. - * Duplication is determined according to the value returned by applying the supplied predicate to two list elements. - */ - // symmetricDifferenceWith(pred: (a: T, b: T) => boolean, list1: List, list2: List): T[]; - // symmetricDifferenceWith(pred: (a: T, b: T) => boolean): CurriedFunction2, List, T[]>; - // // symmetricDifferenceWith: CurriedFunction3<(a: T, b: T) => boolean, List, List, T[]>; - - // base - symmetricDifferenceWith(pred: (a: T, b: T) => boolean, list1: List, list2: List): T[]; - symmetricDifferenceWith(pred: (a: T, b: T) => boolean, list1: List):{ - (list2: List): T[]; - }; - symmetricDifferenceWith(pred: (a: T, b: T) => boolean):{ - (list1: List, list2: List): T[]; - (list1: List):{ - (list2: List): T[]; - }; - }; - - - /** - * A function that always returns true. Any passed in parameters are ignored. - */ - T(): true; - - /** - * Returns all but the first element of a list. - */ - tail>(list: T): T; - tail(list: string): string; - - /** - * Returns a new list containing the first `n` elements of the given list. If - * `n > * list.length`, returns a list of `list.length` elements. - */ - take>(n: number, xs: T): T; - take(n: number): >(xs: T) => T; - // take>: CurriedFunction2; - - - /** - * Returns a new list containing the last n elements of the given list. If n > list.length, - * returns a list of list.length elements. - */ - // = take - takeLast>(n: number, xs: T): T; - takeLast(n: number): >(xs: T) => T; - // takeLast>: CurriedFunction2; - - /** - * Returns a new list containing the last n elements of a given list, passing each value - * to the supplied predicate function, and terminating when the predicate function returns - * false. Excludes the element that caused the predicate function to fail. The predicate - * function is passed one argument: (value). - */ - // = takeWhile - takeLastWhile>(pred: Pred, list: R): R; - takeLastWhile(pred: Pred): >(list: R) => R; - // takeLastWhile>: CurriedFunction2, R, R>; - - /** - * Returns a new list containing the first `n` elements of a given list, passing each value - * to the supplied predicate function, and terminating when the predicate function returns - * `false`. - */ - takeWhile>(pred: Pred, list: R): R; - takeWhile(pred: Pred): >(list: R) => R; - // takeWhile>: CurriedFunction2, R, R>; - - /** - * The function to call with x. The return value of fn will be thrown away. - */ - tap(fn: (a: T) => any, value: T): T; - tap(fn: (a: T) => any): (value: T) => T; - // tap: CurriedFunction2<(a: T) => any, T, T>; - - /** - * Determines whether a given string matches a given regular expression. - */ - test(regexp: RegExp, str: Prop): boolean; - test(regexp: RegExp): (str: Prop) => boolean; - // test: CurriedFunction2; - - /** - * Calls an input function `n` times, returning an array containing the results of those - * function calls. - */ - times(fn: (i: number) => T, n: number): T[]; - times(fn: (i: number) => T): (n: number) => T[]; - // times: CurriedFunction2<(i: number) => T, number, T[]>; - - - /** - * The lower case version of a string. - */ - toLower(str: string): string; - - /** - * Converts an object into an array of key, value arrays. - * Only the object's own properties are used. - * Note that the order of the output array is not guaranteed to be - * consistent across different JS platforms. - */ - toPairs(obj: Obj): [string,T][]; - - /** - * Converts an object into an array of key, value arrays. - * The object's own properties and prototype properties are used. - * Note that the order of the output array is not guaranteed to be - * consistent across different JS platforms. - */ - toPairsIn(obj: Obj): [string,T][]; - toPairsIn(obj: Object): [string,any][]; - - /** - * Returns the string representation of the given value. eval'ing the output should - * result in a value equivalent to the input value. Many of the built-in toString - * methods do not satisfy this requirement. - * - * If the given value is an [object Object] with a toString method other than - * Object.prototype.toString, this method is invoked with no arguments to produce the - * return value. This means user-defined constructor functions can provide a suitable - * toString method. - */ - toString(val: StringRepresentable | any): string; - - /** - * The upper case version of a string. - */ - toUpper(str: string): string; - - /** - * Initializes a transducer using supplied iterator function. Returns a single item by iterating through the - * list, successively calling the transformed iterator function and passing it an accumulator value and the - * current value from the array, and then passing the result to the next call. - */ - // transduce(xf: (arg: List) => List, fn: (acc: List, val: U) => List, acc: List, list: List): U; - // transduce(xf: (arg: List) => List, fn: (acc: List, val: U) => List, acc: List): (list: List) => U; - // transduce(xf: (arg: List) => List, fn: (acc: List, val: U) => List): CurriedFunction2,List,U>; - // transduce(xf: (arg: List) => List): CurriedFunction3<(acc: List, val: U) => List,List,List,U>; - // // transduce: CurriedFunction4<(arg: List) => List, (acc: List, val: U) => List, List, List, U>; - - // base - transduce(xf: (arg: List) => List, fn: (acc: List, val:U) => List, acc: List, list: List): U; - transduce(xf: (arg: List) => List, fn: (acc: List, val:U) => List, acc: List):{ - (list: List): U; - }; - transduce(xf: (arg: List) => List, fn: (acc: List, val:U) => List):{ - (acc: List, list: List): U; - (acc: List):{ - (list: List): U; - }; - }; - transduce(xf: (arg: List) => List):{ - (fn: (acc: List, val:U) => List, acc: List, list: List): U; - (fn: (acc: List, val:U) => List, acc: List):{ - (list: List): U; - }; - (fn: (acc: List, val:U) => List):{ - (acc: List, list: List): U; - (acc: List):{ - (list: List): U; - }; - }; - }; - - - /** - * Transposes the rows and columns of a 2D list. When passed a list of n lists of length x, returns a list of x lists of length n. - */ - transpose(list: List>): T[][]; - transpose(list: List>): any[][]; - - /** - * Maps an Applicative-returning function over a Traversable, then uses - * `sequence` to transform the resulting Traversable of Applicative into - * an Applicative of Traversable. - */ - - // // common case of array as traversable: - // traverse(ap: (v: T) => Applicative, fn: (v: T) => Applicative, traversable: List): Applicative>; - // // traverse(ap: (v: T) => Applicative, fn: (v: T) => Applicative): (traversable: List) => Applicative>; // mix - // traverse(ap: (v: T) => Applicative): CurriedFunction2<(v: T) => Applicative, List, Applicative>>; - // // traverse: CurriedFunction3<(v: T) => Applicative, (v: T) => Applicative, List, Applicative>>; - - // // general ADT case: - // traverse(ap: (v: T) => Applicative, fn: (v: T) => Applicative, traversable: Traversable): Applicative>; - // // traverse(ap: (v: T) => Applicative, fn: (v: T) => Applicative): (traversable: Traversable) => Applicative>; // mix - // traverse(ap: (v: T) => Applicative): CurriedFunction2<(v: T) => Applicative, Traversable, Applicative>>; - // // traverse: CurriedFunction3<(v: T) => Applicative, (v: T) => Applicative, Traversable, Applicative>>; - - // // mixed: - // traverse(ap: (v: T) => Applicative, fn: (v: T) => Applicative): { - // (traversable: List): Applicative>; - // (traversable: Traversable): Applicative>; - // }; - - // base - traverse(ap: (v: T) => Applicative, fn: (v: T) => Applicative, traversable: List): Applicative>; - traverse(ap: (v: T) => Applicative, fn: (v: T) => Applicative):{ - (traversable: List): Applicative>; - }; - traverse(ap: (v: T) => Applicative):{ - (fn: (v: T) => Applicative, traversable: List): Applicative>; - (fn: (v: T) => Applicative):{ - (traversable: List): Applicative>; - }; - }; - - // general ADT case - traverse(ap: (v: T) => Applicative, fn: (v: T) => Applicative, traversable: List): Applicative>; - traverse(ap: (v: T) => Applicative, fn: (v: T) => Applicative):{ - (traversable: List): Applicative>; - }; - traverse(ap: (v: T) => Applicative):{ - (fn: (v: T) => Applicative, traversable: List): Applicative>; - (fn: (v: T) => Applicative):{ - (traversable: List): Applicative>; - }; - }; - - - /** - * Removes (strips) whitespace from both ends of the string. - */ - trim(str: string): string; - - /** - * tryCatch takes two functions, a tryer and a catcher. The returned function evaluates the tryer; if it does - * not throw, it simply returns the result. If the tryer does throw, the returned function evaluates the catcher - * function and returns its result. Note that for effective composition with this function, both the tryer and - * catcher functions must return the same type of results. - */ - tryCatch(tryer: Variadic, catcher: Variadic): Variadic; - // tryCatch: CurriedFunction2, Variadic, Variadic>; - - /** - * Gives a single-word string description of the (native) type of a value, returning such answers as 'Object', - * 'Number', 'Array', or 'Null'. Does not attempt to distinguish user Object types any further, reporting them - * all as 'Object'. - */ - type(val: any): string; - - /** - * Takes a function fn, which takes a single array argument, and returns a function which: - * - takes any number of positional arguments; - * - passes these arguments to fn as an array; and - * - returns the result. - * In other words, R.unapply derives a variadic function from a function which takes an array. - * R.unapply is the inverse of R.apply. - */ - unapply(fn: (args: any[]) => T): Variadic; - - /** - * Wraps a function of any arity (including nullary) in a function that accepts exactly 1 parameter. - * Any extraneous parameters will not be passed to the supplied function. - */ - unary(fn: (a: T, ...args: any[]) => U): (a: T) => U; - - /** - * Returns a function of arity n from a (manually) curried function. - */ - uncurryN(len: number, fn: (a: any) => any): Variadic; - // uncurryN: CurriedFunction2 any, Variadic>; - - /** - * Builds a list from a seed value. Accepts an iterator function, which returns either false - * to stop iteration or an array of length 2 containing the value to add to the resulting - * list and the seed to be used in the next call to the iterator function. - */ - unfold(fn: (seed: T) => [TResult, T]|false, seed: T): TResult[]; - unfold(fn: (seed: T) => [TResult, T]|false): (seed: T) => TResult[]; - // unfold: CurriedFunction2<(seed: T) => TResult[]|boolean, T, TResult[]>; - - /** - * Combines two lists into a set (i.e. no duplicates) composed of the - * elements of each list. - */ - union(as: List, bs: List): T[]; - union(as: List): (bs: List) => T[]; - // union: CurriedFunction2, List, T[]>; - - /** - * Combines two lists into a set (i.e. no duplicates) composed of the elements of each list. Duplication is - * determined according to the value returned by applying the supplied predicate to two list elements. - */ - // unionWith(pred: (a: T, b: T) => boolean, list1: List, list2: List): T[]; - // unionWith(pred: (a: T, b: T) => boolean, list1: List): (list2: List) => T[]; - // unionWith(pred: (a: T, b: T) => boolean): CurriedFunction2, List, T[]>; - // // unionWith: CurriedFunction3<(a: T, b: T) => boolean, List, List, T[]>; - - // base - unionWith(pred: (a: T, b: T) => boolean, list1: List, list2: List): T[]; - unionWith(pred: (a: T, b: T) => boolean, list1: List):{ - (list2: List): T[]; - }; - unionWith(pred: (a: T, b: T) => boolean):{ - (list1: List, list2: List): T[]; - (list1: List):{ - (list2: List): T[]; - }; - }; - - - /** - * Returns a new list containing only one copy of each element in the original list. - */ - uniq(list: List): T[]; - - /** - * Returns a new list containing only one copy of each element in the original list, based upon the value returned by applying the supplied function to each list element. Prefers the first item if the supplied function produces the same value on two items. R.equals is used for comparison. - */ - uniqBy(fn: (a: T) => U, list: List): T[]; - uniqBy(fn: (a: T) => U): (list: List) => T[]; - // uniqBy: CurriedFunction2<(a: T) => U, List, T[]>; - - /** - * Returns a new list containing only one copy of each element in the original list, based upon the value - * returned by applying the supplied predicate to two list elements. - */ - uniqWith(pred: (x: T, y: T) => boolean, list: List): T[]; - uniqWith(pred: (x: T, y: T) => boolean): (list: List) => T[]; - // uniqWith: CurriedFunction2<(x: T, y: T) => boolean, List, T[]>; - - /** - * Tests the final argument by passing it to the given predicate function. If the predicate is not satisfied, - * the function will return the result of calling the whenFalseFn function with the same argument. If the - * predicate is satisfied, the argument is returned as is. - */ - unless(pred: Pred, whenFalseFn: (a: T) => U, obj: T): U; - unless(pred: Pred, whenFalseFn: (a: T) => U): (obj: T) => U; - // unless: CurriedFunction3, (a: T) => U, T, U>; - - /** - * Returns a new list by pulling every item at the first level of nesting out, and putting - * them in a new array. - */ - unnest(x: List>): T[]; - unnest(x: List): T[]; - - /** - * Takes a predicate, a transformation function, and an initial value, and returns a value of the same type as - * the initial value. It does so by applying the transformation until the predicate is satisfied, at which point - * it returns the satisfactory value. - */ - // until(pred: Pred, fn: (val: T) => U, init: U): U; - // until(pred: Pred, fn: (val: T) => U): (init: U) => U; - // until(pred: Pred): CurriedFunction2<(val: T) => U, U, U>; - // // until: CurriedFunction3, (val: T) => U, U, U>; - - // base - until(pred: Pred, fn: (val: T) => U, init: U): U; - until(pred: Pred, fn: (val: T) => U):{ - (init: U): U; - }; - until(pred: Pred):{ - (fn: (val: T) => U, init: U): U; - (fn: (val: T) => U):{ - (init: U): U; - }; - }; - - - /** - * Returns a new copy of the array with the element at the provided index replaced with the given value. - */ - // update(index: number, value: T, list: List): T[]; - // update(index: number, value: T): (list: List) => T[]; - // update(index: number): CurriedFunction2,T[]>; - // // update: CurriedFunction3, T[]>; - - // base - update(index: number, value: T, list: List): T[]; - update(index: number, value: T):{ - (list: List): T[]; - }; - update(index: number):{ - (value: T, list: List): T[]; - (value: T):{ - (list: List): T[]; - }; - }; - - - /** - * Accepts a function fn and a list of transformer functions and returns a new curried function. - * When the new function is invoked, it calls the function fn with parameters consisting of the - * result of calling each supplied handler on successive arguments to the new function. - * - * If more arguments are passed to the returned function than transformer functions, those arguments - * are passed directly to fn as additional parameters. If you expect additional arguments that don't - * need to be transformed, although you can ignore them, it's best to pass an identity function so - * that the new function reports the correct arity. - */ - useWith(fn: Variadic, transformers: List): Variadic; - useWith(fn: Variadic): (transformers: List) => Variadic; - // useWith: CurriedFunction2, List, Variadic>; - - /** - * Returns a list of all the enumerable own properties of the supplied object. - * Note that the order of the output array is not guaranteed across - * different JS platforms. - */ - values(obj: Struct): T[]; - values(obj: Object): any[]; - - /** - * Returns a list of all the properties, including prototype properties, of the supplied - * object. Note that the order of the output array is not guaranteed to be consistent across different JS platforms. - */ - valuesIn(obj: Struct): T[]; - valuesIn(obj: Object): any[]; - - /** - * Returns a "view" of the given data structure, determined by the given lens. The lens's focus determines which - * portion of the data structure is visible. - */ - // hard to mix cuz different generics - - // // key lens: - // view(lens: KeyLens, obj: T): T[K]; - // view(lens: KeyLens): (obj: T) => T[K]; - // // view: CurriedFunction2, T, T[K]>; - - // regular lenses: - - // smart approach, unreliable: - view(lens: Lens, obj: T): U; - view(lens: Lens): (obj: T) => U; - // view: CurriedFunction2, T, U>; - - // lens with type manually set - view(lens: ManualLens, obj: Struct): T; - view(lens: ManualLens): (obj: Struct) => T; - // view: CurriedFunction2, Struct, T>; - - // unknown lens, manually supply return type. does this add to the above case? - view(lens: UnknownLens, obj: Struct): T; - view(lens: UnknownLens): (obj: Struct) => T; - // view: CurriedFunction2, T>; - - /** - * Tests the final argument by passing it to the given predicate function. If the predicate is satisfied, the function - * will return the result of calling the whenTrueFn function with the same argument. If the predicate is not satisfied, - * the argument is returned as is. - */ - // when(pred: Pred, whenTrueFn: (a: T) => U, obj: T): U; - // when(pred: Pred, whenTrueFn: (a: T) => U): (obj: T) => U; - // when(pred: Pred): CurriedFunction2<(a: T) => U, T, U>; - // // when: CurriedFunction3, (a: T) => U, T, U>; - - // base - when(pred: Pred, whenTrueFn: (a: T) => U, obj: T): U; - when(pred: Pred, whenTrueFn: (a: T) => U):{ - (obj: T): U; - }; - when(pred: Pred):{ - (whenTrueFn: (a: T) => U, obj: T): U; - (whenTrueFn: (a: T) => U):{ - (obj: T): U; - }; - }; - - - - /** - * Takes a spec object and a test object and returns true if the test satisfies the spec. - * Any property on the spec that is not a function is interpreted as an equality - * relation. - * - * If the spec has a property mapped to a function, then `where` evaluates the function, passing in - * the test object's value for the property in question, as well as the whole test object. - * - * `where` is well suited to declarativley expressing constraints for other functions, e.g., - * `filter`, `find`, etc. - */ - // hard to mix cuz different generics - - // // heterogeneous version - // where>(spec: { [P in keyof T]?: Pred; }, testObj: T): boolean; - // where>(spec: { [P in keyof T]?: Pred; }): (testObj: T) => boolean; // generics too early? - // // where>: CurriedFunction2<{ [P in keyof T]?: Pred; }, T, boolean>; - - // homogeneous version - where(spec: Obj>, testObj: Obj): boolean; - where(spec: Obj>): (testObj: Obj) => boolean; - // where: CurriedFunction2>, Obj, boolean>; - - // DIY "fill in the type params yourself" version - where(spec: T, testObj: U): boolean; - where(spec: T): (testObj: U) => boolean; - // where: CurriedFunction2; - - /** - * Takes a spec object and a test object; returns true if the test satisfies the spec, - * false otherwise. An object satisfies the spec if, for each of the spec's own properties, - * accessing that property of the object gives the same value (in R.eq terms) as accessing - * that property of the spec. - */ - // hard to mix cuz different generics - - // // heterogeneous version - // whereEq>(spec: Partial, testObj: T): boolean; - // whereEq>(spec: Partial): (testObj: T) => boolean; - // // whereEq>: CurriedFunction2, T, boolean>; - - // homogeneous version - whereEq(spec: Obj, testObj: Obj): boolean; - whereEq(spec: Obj): (testObj: Obj) => boolean; - // whereEq: CurriedFunction2, Obj, boolean>; - - // DIY "fill in the type params yourself" version - whereEq(spec: T, testObj: U): boolean; - whereEq(spec: T): (testObj: U) => boolean; - // whereEq: CurriedFunction2; - - /** - * Returns a new list without values in the first argument. R.equals is used to determine equality. - * Acts as a transducer if a transformer is given in list position. - */ - without(list1: List, list2: List): T[]; - without(list1: List): (list2: List) => T[]; - // without: CurriedFunction2, List, T[]>; - - /** - * Creates a new list out of the two supplied by creating each possible pair from the lists. - */ - xprod(as: List, bs: List): KeyValuePair[]; - xprod(as: List): (bs: List) => KeyValuePair[]; - // xprod: CurriedFunction2, List, KeyValuePair[]>; - - /** - * Creates a new list out of the two supplied by pairing up equally-positioned items from - * both lists. Note: `zip` is equivalent to `zipWith(function(a, b) { return [a, b] })`. - */ - zip(list1: List, list2: List): KeyValuePair[]; - zip(list1: List): (list2: List) => KeyValuePair[]; - // zip: CurriedFunction2, List, KeyValuePair[]>; - - /** - * Creates a new object out of a list of keys and a list of values. - */ - // TODO: Obj as a return value is to specific, any seems to loose - zipObj(keys: List, values: List): Obj; - zipObj(keys: List): (values: List) => Obj; - // zipObj: CurriedFunction2, List, Obj>; - - - /** - * Creates a new list out of the two supplied by applying the function to each - * equally-positioned pair in the lists. - */ - zipWith(fn: (x: T, y: U) => TResult, list1: List, list2: List): TResult[]; - zipWith(fn: (x: T, y: U) => TResult, list1: List): (list2: List) => TResult[]; - zipWith(fn: (x: T, y: U) => TResult): CurriedFunction2, List, TResult[]>; - // zipWith: CurriedFunction3<(x: T, y: U) => TResult, List, List, TResult[]>; - - } -} - -export = R; -export as namespace R; diff --git a/jest.actual.json b/jest.actual.json new file mode 100644 index 0000000..4043c0f --- /dev/null +++ b/jest.actual.json @@ -0,0 +1,18 @@ +{ + "testEnvironment": "node", + "moduleFileExtensions": ["ts", "js", "json"], + "testRegex": "/tests/ramda-tests\\.ts$", + "transform": {"\\.ts$": "dts-jest/transform-actual"}, + "moduleNameMapper": { + "../ramda/dist": "/node_modules/ramda" + }, + "globals": { + "_dts_jest_": { + "tsconfig": { + "strict": true, + "target": 1, + "module": 1 + } + } + } +} diff --git a/jest.json b/jest.json new file mode 100644 index 0000000..0d57240 --- /dev/null +++ b/jest.json @@ -0,0 +1,15 @@ +{ + "testEnvironment": "node", + "moduleFileExtensions": ["ts", "js", "json"], + "testRegex": "/tests/.+\\.ts$", + "transform": {"/tests/.+\\.ts$": "dts-jest/transform"}, + "globals": { + "_dts_jest_": { + "tsconfig": { + "strict": true, + "target": 5, + "types": [] + } + } + } +} diff --git a/jest.utils.json b/jest.utils.json new file mode 100644 index 0000000..b70975c --- /dev/null +++ b/jest.utils.json @@ -0,0 +1,18 @@ +{ + "testEnvironment": "node", + "moduleFileExtensions": ["ts", "js", "json"], + "testMatch": ["**/__tests__/**/*.ts"], + "transform": {"\\.ts$": "ts-jest/preprocessor"}, + "mapCoverage": true, + "coverageReporters": ["lcov", "text-summary"], + "collectCoverageFrom": ["templates/utils/**/*.ts"], + "coveragePathIgnorePatterns": ["/constants\\.ts$"], + "coverageThreshold": { + "global": { + "branches": 100, + "functions": 100, + "lines": 100, + "statements": 100 + } + } +} diff --git a/package.json b/package.json index 10c0b7d..f21db69 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,64 @@ { "name": "@types/ramda", - "version": "0.23.0-RC1", + "version": "0.24.3", + "description": "TypeScript's type definitions for Ramda", + "keywords": [ + "ramda", + "typescript", + "typescript-declarations" + ], + "repository": "https://github.com/types/npm-ramda", + "homepage": "https://github.com/types/npm-ramda#readme", "scripts": { - "lint": "echo linting... && tslint index.d.ts", - "test": "echo testing errors... && ./node_modules/typescript/bin/tsc --lib \"es2015\" --module commonjs ramda-tests.ts --noEmit", - "types": "echo testing types... && bash test.sh" + "prepublish": "yarn run build", + "lint": "tslint --project ./tsconfig.json", + "test": "jest --config ./jest.json", + "test-actual": "jest --config ./jest.actual.json", + "test-utils": "jest --config ./jest.utils.json", + "build": "gulp build", + "build-watch": "gulp build-watch", + "remap": "gulp remap", + "remap-watch": "gulp remap-watch", + "remap-check": "gulp remap-check", + "jsdoc": "ts-node ./scripts/migrate-jsdoc.ts v0.24.1 ./templates", + "release-tags": "bash ./scripts/release-tags.sh", + "build-check": "tsc -p ./fixtures/build-check/tsconfig.json" }, "devDependencies": { - "ramda": "0.23.0", - "tslint": "^5.6.0", - "tslint-config-typings": "^0.3.1", - "typescript": "^2.4.0-dev.20170529", - "typings-checker": "github:tycho01/typings-checker" - }, - "typings": "index.d.ts" + "@types/del": "3.0.0", + "@types/glob": "5.0.30", + "@types/gulp": "3.8.33", + "@types/gulp-diff": "1.0.0", + "@types/gulp-rename": "0.0.32", + "@types/gulp-util": "3.0.31", + "@types/jest": "20.0.6", + "@types/node": "8.0.20", + "@types/ramda": "ikatyang/types-ramda#v0.24.1-dist", + "@types/run-sequence": "0.0.29", + "@types/through2": "2.0.33", + "@types/yargs": "8.0.2", + "del": "3.0.0", + "dts-element": "2.2.1", + "dts-element-fp": "1.0.2", + "dts-jest": "20.5.1", + "glob": "7.1.2", + "gulp": "3.9.1", + "gulp-diff": "1.0.0", + "gulp-rename": "1.2.2", + "gulp-util": "3.0.8", + "jest": "20.0.4", + "prettier": "1.5.3", + "prettier-config-ikatyang": "1.1.1", + "ramda": "0.24.1", + "run-sequence": "2.1.0", + "through2": "2.0.3", + "ts-jest": "20.0.10", + "ts-node": "3.3.0", + "tslint": "5.6.0", + "tslint-config-ikatyang": "2.2.0", + "tslint-config-prettier-ext": "1.5.0", + "tslint-plugin-prettier": "1.0.0", + "typescript": "2.4.2", + "yargs": "8.0.2" + } } diff --git a/ramda-tests.ts b/ramda-tests.ts deleted file mode 100644 index 616dc2d..0000000 --- a/ramda-tests.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare let require; -require('./tests/test.ts'); diff --git a/scripts.js b/scripts.js deleted file mode 100644 index e0bdde0..0000000 --- a/scripts.js +++ /dev/null @@ -1,2870 +0,0 @@ -// usage: paste this whole file into a console with Ramda available to get generated typings -// import * as R from 'ramda'; - -let letters = (idx) => (n) => R.range(idx, idx + R.clamp(0, 26, n)).map(i => String.fromCharCode(i)); -let upper = letters(65); -let lower = letters(97); -let nm = (cnt, fn) => R.range(0,cnt).map(fn).join(', '); -let bits = (k, i) => { - let rem = 0; - return R.range(1, k+1).map(n => { - let res = i % Math.pow(2, n) - rem; - rem += res; - return res ? 1 : 0; - }) -}; - -function composeDef(i, j) { - let vals = nm(j, n => `V${n}`); - let pars = nm(j, n => `x${n}: V${n}`); - let fns = nm(i-1, n => `fn${i-1-n}: (x: T${i-1-n}) => T${i-n}`); - let types = nm(i, n => `T${n+1}`); - return `compose<${vals}, ${types}>(${fns}${i>1?', ':''}fn0: (${pars}) => T1): (${pars}) => T${i};` -} - -function composePDef(i, j) { - let vals = nm(j, n => `V${n}`); - let pars = nm(j, n => `x${n}: V${n}`); - let fns = nm(i-1, n => `fn${i-1-n}: (x: T${i-1-n}) => Promise|T${i-n}`); - let types = nm(i, n => `T${n+1}`); - return `composeP<${vals}, ${types}>(${fns}${i>1?', ':''}fn0: (${pars}) => Promise): (${pars}) => Promise;` -} - -function pipeDef(i, j) { - let vals = nm(j, n => `V${n}`); - let pars = nm(j, n => `x${n}: V${n}`); - let fns = nm(i-1, n => `fn${n+1}: (x: T${n+1}) => T${n+2}`); - let types = nm(i, n => `T${n+1}`); - return `pipe<${vals}, ${types}>(fn0: (${pars}) => T1${i>1?', ':''}${fns}): (${pars}) => T${i};` -} - -function pipePDef(i, j) { - let vals = nm(j, n => `V${n}`); - let pars = nm(j, n => `x${n}: V${n}`); - let fns = nm(i-1, n => `fn${n+1}: (x: T${n+1}) => Promise|T${n+2}`); - let types = nm(i, n => `T${n+1}`); - return `pipeP<${vals}, ${types}>(fn0: (${pars}) => Promise${i>1?', ':''}${fns}): (${pars}) => Promise;` -} - -function pipeKDef(i) { - let fns = nm(i-1, n => `fn${n+1}: (x: T${n+1}) => Chain`); - let types = nm(i, n => `T${n+1}`); - return `pipeK(fn0: (v: Chain) => Chain${i>1?', ':''}${fns}): (v: V) => Chain;` -} - -function composeKDef(i) { - let fns = nm(i-1, n => `fn${i-1-n}: (x: T${i-1-n}) => Chain`); - let types = nm(i, n => `T${n+1}`); - return `composeK(${fns}${i>1?', ':''}fn0: (v: Chain) => Chain): (v: V) => Chain;` -} - -function curryDef(i) { - let lows = lower(i); - let pars = nm(i, n => `${lows[n]}: T${n+1}`); - let types = nm(i, n => `T${n+1}`); - return `curry<${types}, TResult>(fn: (${pars}) => TResult): CurriedFunction${i}<${types}, TResult>;` -} -R.flatten(R.range(2,10).map(i => curryDef(i))).join('\n') - -function curryDefGen(i) { - // let lows = lower(i); - let pars = nm(i, n => `v${n}: T${n+1}`); // lows[n] - let types = nm(i, n => `T${n+1}`); - let parObj = R.pipe(R.range(0), R.map(n => [`v${n}`, `T${n+1}`]), R.fromPairs)(i); // lows[n] - let curried = genOption([[], parObj, 'TResult'], 2); - return `curry<${types}, TResult>(fn: (${pars}) => TResult): {\n${curried}};` -} -R.flatten(R.range(1,10).map(i => curryDefGen(i))).join('\n') - -function CurriedFunctionDef(i) { - let types = nm(i, n => `T${n+1}`); - let curriedDef = (j) => { // , extraGenerics = false - let pars = nm(j, n => `v${n+1}: T${n+1}`); - let tps = nm(i-j, n => `T${j+n+1}`); - let gens = nm(i, n => `T${n+1}`); - let curried = (i-j > 1) ? `CurriedFunction${i-j}<${tps}, R>` : (i-j == 0) ? 'R' : `(v${i}: T${i}) => R`; - // return (extraGenerics ? `<${gens}, R>` : '') + `(${pars}): ${curried};` - return `(${pars}): ${curried};` - } - let nums = R.range(0,i); - // let defs = [...nums.map(n => curriedDef(n+1)), ...nums.map(n => curriedDef(n+1, true))].join('\n '); - let defs = nums.map(n => curriedDef(n+1)).join('\n '); - return `interface CurriedFunction${i}<${types}, R> { - ${defs} -}`; -} -R.flatten(R.range(2,10).map(i => CurriedFunctionDef(i))).join('\n') - -function CurriedFnDef(i) { - let types = nm(i, n => `T${n+1}`); - let curriedDef = (j) => { - let pars = nm(j, n => `v${n+1}: T${n+1}`); - let tps = nm(i-j, n => `T${j+n+1}`); - let gens = nm(i, n => `T${n+1}`); - let parObj = R.pipe(R.range(j), R.map(n => [`v${n+1}`, `T${n+1}`]), R.fromPairs)(i); - let curried = (i-j > 1) ? `{\n${ - genOption([[], parObj, 'R'], 4) - } }` : - (i-j == 0) ? 'R' : - `(v${i}: T${i}) => R`; - return `(${pars}): ${curried};` - } - let nums = R.range(0,i); - let defs = nums.map(n => curriedDef(i-n)).join('\n '); - return `interface CurriedFn${i}<${types}, R> {\n ${defs}\n}`; -} -R.flatten(R.range(1,10).map(i => CurriedFnDef(i))).join('\n') - -function liftDef(i) { - let pars = nm(i, n => `v${n+1}: T${n+1}`); - let listPars = nm(i, n => `v${n+1}: List`); - let types = nm(i, n => `T${n+1}`); - return `lift<${types}, TResult>(fn: (${pars}) => TResult): (${listPars}) => TResult[];` -} - -function liftNDef(i, together = true) { - let pars = nm(i, n => `v${n+1}: T${n+1}`); - let listPars = nm(i, n => `v${n+1}: List`); - let types = nm(i, n => `T${n+1}`); - return together ? `liftN<${types}, TResult>(n: number, fn: (${pars}) => TResult): (${listPars}) => TResult[];` : - `liftN(n: number): <${types}, TResult>(fn: (${pars}) => TResult) => (${listPars}) => TResult[];`; -} - -function liftNDefSeparate(i) { - let pars = nm(i, n => `v${n+1}: T${n+1}`); - let listPars = nm(i, n => `v${n+1}: List`); - let types = nm(i, n => `T${n+1}`); - return `<${types}, TResult>(fn: (${pars}) => TResult): (${listPars}) => TResult[];`; -} -R.flatten(R.range(2,10).map(i => liftNDefSeparate(i))).join('\n'); - -function pathDef(i) { - let obj = R.range(1,i+1).reduce((str, n) => `{[K${i-n+1} in T${i-n+1}]: ${str}}`, 'TResult'); - let types = nm(i, n => `T${n+1}`); - let typesStr = nm(i, n => `T${n+1} extends string`); - return `path<${typesStr}, TResult>(path: [${types}], obj: ${obj}): TResult;` -} - -function pathDefRecord(i) { - let obj = R.range(1,i+1).reduce((str, n) => `Record`, 'TResult'); - let types = nm(i, n => `K${n+1}`); - let typesStr = nm(i, n => `K${n+1} extends string`); - return `path<${typesStr}, TResult>(path: [${types}], obj: ${obj}): TResult;` -} -R.flatten(R.range(2,10).map(i => pathDefRecord(i))).join('\n') - -function pathDefPoly(i, j) { - let isArrs = bits(i, j); - let obj = R.range(1,i+1).reduce((str, n) => isArrs[n-1] ? `${str}[]` : `{[K${i-n+1} in T${i-n+1}]: ${str}}`, 'TResult'); - let types = nm(i, n => `T${n+1}`); - let typesExt = nm(i, n => `T${n+1} extends ${isArrs[i-n-1] ? 'number' : 'string'}`); - // let typesExt = R.reverse(R.range(0,i).map(n => `T${n+1} extends ${isArrs[n] ? 'number' : 'string'}`)).join(', '); - return `path<${typesExt}, TResult>(path: [${types}], obj: ${obj}): TResult;` -} -R.flatten(R.range(1,7).map(i => R.range(0, Math.pow(2, i)).map(j => pathDefPoly(i, j)))).join('\n') - -// type Option = [/*generics*/ string[], ParamObj, /*retval*/ string | Option[]]; -// type ParamObj = { [name: string]: string }; - -var whitespace = (indentation = 0) => R.repeat(' ', indentation).join(''); -var comment = (s, indent = 0) => `${whitespace(indent)}// ${s}`; - -function genCurried(options /*: { [name: string]: Option }*/, indent = 0, name = false) /*: string */ { - let ws = indent + 2; - let strs = R.pipe( - R.toPairs, - R.chain(([k,o]) => [ - comment(k, ws), - genOption(o, ws), - ]), - R.join('\n'), - )(options); - return `${name ? `${name}: ` : ''}{\n${strs + (name ? '' : '\n')}${whitespace(indent)}}`; -} - -function genOption(option /*: Option*/, indent = 0, skipLeft = 0) /*: string */ { - let ws = R.repeat(' ', indent).join(''); - let [generics, paramObj, returnOrOptions] = option; - let genericNames = generics.map(R.pipe(R.match(/\w+/), R.head)); - let genericObj = R.fromPairs(R.zip(genericNames, generics)); - let params = R.toPairs(paramObj); - let rest = R.is(Object)(returnOrOptions) ? genCurried(returnOrOptions, indent) : returnOrOptions; - let uncurried = R.is(Object)(returnOrOptions) ? R.pipe( - R.toPairs, - R.chain(([k, [gens, parObj, ret]]) => [ - comment(k, indent), - genOption([R.concat(generics, gens), R.merge(paramObj, parObj), ret], indent, R.pipe(R.values, R.length)(paramObj)), - ]), // mergeOptions(v) - R.values, - R.when(R.length, R.append(comment('mixed', indent))), - )(returnOrOptions) : []; - let [paramInfos, retGenerics] = params.reduce(([paramTypes, generics], pair) => { - let [k,v] = pair; - let usedGenerics = R.keys(generics) - .filter(s => R.test(new RegExp(`\\b${s}\\b`), v)); - // TODO: for `keyOf` also check if the generic has been used in other used generics. - // potentially need to recheck for more as long as I've added new ones! - let remainingGenerics = R.omit(usedGenerics, generics); - return [ - R.concat(paramTypes, [[ - [k,v], - usedGenerics.map(k => generics[k]), - ]]), - remainingGenerics, - ]; - }, [[], genericObj]); - let nums = R.range(skipLeft, params.length); // number of params delegated to the right side. for 4: 0, 1, 2, 3. - let current = nums.map((num) => { - let numLeft = params.length - num; - let [left, right] = [R.take(numLeft, paramInfos), R.drop(numLeft, paramInfos)]; - let [leftParams, rightParams] = R.map(R.map(R.prop(0)))([left, right]); - let [leftGenerics, rightGenerics] = R.map(R.chain(R.prop(1)))([left, right]); - let unusedGenerics = R.values(retGenerics); - if (num) { - rightGenerics = rightGenerics.concat(unusedGenerics); - } else { - leftGenerics = leftGenerics.concat(unusedGenerics); - } - const genStr = (gens) => gens.length ? `<${gens.join(', ')}>` : ''; - const parStr = R.pipe(R.map(/*([k,v]) => `${k}: ${v}`*/ R.join(': ')), R.join(', ')); - const fnStr = (gens, pars, retVal, useArrow = false) => - `${genStr(gens)}(${parStr(pars)})${useArrow ? ' =>' : ':'} ${retVal}`; - let returnVal = !num ? rest : - num == 1 ? fnStr(rightGenerics, rightParams, rest, true, false) : - (`{\n${ - genOption([rightGenerics, R.fromPairs(rightParams), rest], indent + 2) - }${ws}}`); - return `${ws}${fnStr(leftGenerics, leftParams, returnVal, false)};\n`; - }).join(''); - return uncurried.concat(current).join('\n'); -} - -const defs = { - -pathEq: [ - [], - { - p: 'Path', - v: 'any', - o: 'any', - }, - 'boolean' -], - -add: [ - [], - { - a: 'number', - b: 'number', - }, - 'number' -], - -adjust: [ - ['T'], - { - fn: '(a: T) => T', - index: 'number', - list: 'List' - }, - 'T[]' -], - -all: [ - ['T'], - { - pred: 'Pred', - list: 'List', - }, - 'boolean' -], - -allPass: [ - ['T'], - { - pred: 'Pred[]', - }, - 'Pred' -], - -always: [ - ['T'], - { - val: 'T', - }, - '() => T' -], - -and: { - base: [ - ['T extends {and?: Function}'], - { - fn1: 'T', - val2: 'boolean+any' - }, - 'boolean' - ], - no_generics: [ - [], - { - v1: 'any', - v2: 'any', - }, - 'boolean', - ] -}, - -any: [ - ['T'], - { - pred: 'Pred', - list: 'List', - }, - 'boolean', -], - -anyPass: [ - ['T'], - { - preds: 'Pred[]', - }, - 'Pred', -], - -ap: [ - ['T', 'U'], - { - fns: '((a: T) => U)[]', - xs: 'List', - }, - 'U[]', -], - -aperture: [ - ['T'], - { - n: 'number', - list: 'List', - }, - 'T[][]' -], - -append: [ - ['T', 'U'], - { - el: 'U', - list: 'List', - }, - '(T & U)[]' -], - -apply: { - // // fails, can't use ... on Args because it only indirectly represents an array... - // capture: [ - // ['Args extends any[]', 'TResult'], - // { - // fn: '(...args: Args) => TResult', - // args: 'Args', - // }, - // 'TResult', - // ], - any: [ - ['TResult'], - { - fn: '(...args: any[]) => TResult', - args: 'any[]', - }, - 'TResult', - ], -}, - -applySpec: [ - ['T'], - { - obj: 'any', - }, - 'Variadic', -], - -ascend: { - base: [ - ['T', 'U extends Struct', 'K extends keyof U'], - { - prop: 'K', - val: 'T', - obj: 'U' - }, - '{[P in K]: T} & U' - ], - 'any object as long as the type remains unchanged': [ - ['T'], - { - prop: 'Prop', - val: 'any', - obj: 'T', - }, - 'T', - ] -}, - -assoc: { - 'extend object with new property': [ - ['T', 'U extends Struct' ,'K extends string'], - { - prop: 'K', - val: 'T', - obj: 'U', - }, - '{[P in K]: T} & U' - ], - 'any object as long as the type remains unchanged': [ - ['T'], - { - prop: 'Prop', - val: 'any', - obj: 'T', - }, - 'T' - ] -}, - -assocPath: [ - ['T', 'U'], - { - path: 'Path', - val: 'T', - obj: 'U', - }, - 'U' -], - -binary: { - base: [ - ['T', 'A', 'B'], - { - fn: '(a: A, b: T, ...args: any[]) => T' - }, - '(a: A, b: B) => T' - ], - 'non generics for return func': [ - ['T'], - { - fn: 'Variadic', - }, - '(a:any, b:any) => T' - ] -}, - -bind: [ - ['T'], - { - fn: 'Variadic', - thisObj: '{}', - }, - 'Variadic' -], - -both: [ - ['T'], - { - pred1: 'Pred', - pred2: 'Pred', - }, - 'Pred', -], - -call: [ - ['T'], - { - fn: 'Variadic', - '...args': 'any[]', - }, - 'T', -], - -chain: { -'list version': [ - ['T', 'U'], - { - fn: '(n: T) => U[]', - list: 'List', - }, - 'U[]', -], -'generic chain version': [ - ['T', 'U'], - { - fn: '(n: T) => Chain', - list: 'Chain', - }, - 'Chain', -], -'function argument': [ - ['T', 'U', 'V'], - { - fn: '(v: V) => (list: List) => U[]', - monad: '(list: List) => V' - }, - '(list: List) => U[]', -] -}, - -clamp: [ - ['T'], - { - min: 'T', - max: 'T', - value: 'T', - }, - 'T', -], - -clone: { -'Objects': [ - ['T'], - { - value: 'T' - }, - 'T' -], -'Arrays': [ - ['T'], - { - value: 'List', - }, - 'T[]', -] -}, - -comparator: [ - ['T'], - { - pred: '(a: T, b: T) => boolean' - }, - '(x: T, y: T) => number' -], - -complement: [ - ['T'], - { - pred: 'Variadic', - }, - 'Variadic', -], - -compose: R.flatten(R.range(1,10).map(i => R.range(1,5).map(j => composeDef(i,j)))).join('\n'), - -composeK: R.flatten(R.range(1,10).map(i => composeKDef(i))).join('\n'), - -composeP: R.flatten(R.range(1,10).map(i => R.range(1,5).map(j => composePDef(i,j)))).join('\n'), - -concat: [ - ['T extends List'], - { - list1: 'T', - list2: 'T', - }, - 'T', -], - -cond: [ - ['T', 'U'], - { - fns: '[Pred, (v: T) => U][]', - }, - '(v: T) => U' -], - -construct: [ - [], - { - fn: 'Function', - }, - 'Function' -], - -constructN: [ - [], - { - n: 'number', - fn: 'Function', - }, - 'Function', -], - -contains: { - base: [ - [], - { - a: 'string', - list: 'string', - }, - 'boolean', - ], - generics: [ - ['T', 'R extends List'], - { - a: 'T', - list: 'R', - }, - 'boolean', - ] -}, - -converge: [ - ['T'], - { - after: 'Variadic', - fns: 'List>', - }, - 'Variadic', -], - -countBy: [ - ['T'], - { - fn: '(a: T) => Prop', - list: 'List', - }, - 'Obj', -], - -// curry - -// curryN - -dec: [ - [], - { - n: 'number', - }, - 'number' -], - -defaultTo: [ - ['T', 'U'], - { - a: 'T', - b: 'U | null | undefined', - }, - 'T|U', -], - -descend: [ - ['T', 'V extends Ord'], - { - comparator: '(val: T) => V', - a: 'T', - b: 'T', - }, - 'number' -], - -differenceWith: [ - ['T'], - { - pred: '(a: T, b: T) => boolean', - list1: 'List', - list2: 'List', - }, - 'T[]' -], - -dissoc: { -accurate: [['T'], { prop: 'keyof T', obj: 'T' }, 'T'], -easier: [['T'], { prop: 'Prop', obj: 'Struct' }, 'T'], -}, - -dissocPath: [ - ['T'], - { - path: 'Path', - obj: 'Struct', - }, - 'T' -], - -divide: [ - [], - { - a: 'number', - b: 'number', - }, - 'number' -], - -drop: [ - ['T extends List'], - { - n: 'number', - xs: 'T' - }, - 'T' -], - -dropLast: [ - ['T extends List'], - { - n: 'number', - xs: 'T', - }, - 'T' -], - -dropLastWhile: [ - ['T', 'R extends List'], - { - pred: 'Pred', - list: 'R' - }, - 'T[]' -], - -dropWhile: [ - ['T', 'R extends List'], - { - pred: 'Pred', - list: 'R' - }, - 'T[]' -], - -either: [ - ['T'], - { - pred1: 'Pred', - pred2: 'Pred', - }, - 'Pred' -], - -empty: [ - ['T'], - { - x: 'T', - }, - 'T' -], - -eqBy: [ - ['T'], - { - fn: '(a: T) => T', - a: 'T', - b: 'T', - }, - 'boolean' -], - -eqProps: { - base: [ - ['T', 'U'], - { - prop: 'Prop', - obj1: 'T', - obj2: 'U' - }, - 'boolean' - ], - 'less generics': [ - [], - { - prop: 'Prop', - obj1: 'any', - obj2: 'any', - }, - 'boolean' - ] -}, - -equals: [ - ['T'], - { - a: 'T', - b: 'T', - }, - 'boolean' -], - -evolve: { - base: [ - ['V'], - { - transformations: 'NestedObj<(v: any) => any>', - obj: 'V', - }, - 'V' - ], - 'no inference': [ - [], - { - transformations: 'Obj', - obj: 'any', - }, - 'T' - ] -}, - -// F - -filter: { - base: [ - ['T'], - { - pred: 'Pred', - list: 'List', - }, - 'T[]' - ], - 'functor to functor': [ - ['T'], - { - pred: 'Pred', - list: 'Functor', - }, - 'Functor[]' - ], - 'functor to array': [ - ['T'], - { - pred: 'Pred', - list: 'Functor', - }, - 'T[]' - ], - 'object': [ - ['T', 'U extends Obj'], - { - pred: 'Pred', - obj: 'U', - }, - 'Partial' - ] -}, - -find: [ - ['T'], - { - fn: '(a: T) => boolean', - list: 'List' - }, - 'T' -], - -findIndex: [ - ['T'], - { - fn: '(a: T) => boolean', - list: 'List', - }, - 'number' -], - -findLast: [ - ['T'], - { - fn: '(a: T) => boolean', - list: 'List', - }, - 'T' -], - -findLastIndex: [ - ['T'], - { - fn: '(a: T) => boolean', - list: 'List', - }, - 'number' -], - -flatten: [ - ['T'], - { - x: 'NestedArray' - }, - 'T[]' -], - -flip: { - base: [ - ['T', 'U', 'TResult'], - { - fn: '(arg0: T, arg1: U) => TResult' - }, - '(arg1:U, arg0?:T) => TResult' - ], - 'rest arguments': [ - ['T', 'U', 'Rest', 'TResult'], - { - fn: '(arg0: T, arg1: U, ...args: Rest[]) => TResult' - }, - '(arg1: U, arg0?: T, ...args: Rest[]) => TResult' - ] -}, - -forEach: [ - ['T'], - { - fn: '(x: T) => void', - list: 'List' - }, - 'T[]' -], - -forEachObjIndexed: [ - ['T', 'Inp extends Struct'], - { - fn: '(val: T, key: string, obj?: Inp) => void', - o: 'Inp', - }, - 'Inp' -], - -fromPairs: [ - ['V'], - { - pairs: 'List>', - }, - 'Obj' -], - -groupBy: [ - ['T'], - { - fn: '(a: T) => prop', - list: 'List', - }, - 'Obj' -], - -groupWith: [ - ['T'], - { - fn: '(a: T) => Prop', - list: 'List', - }, - 'Obj' -], - -gt: [ - [], - { - a: 'number', - b: 'number', - }, - 'boolean' -], - -gte: [ - [], - { - a: 'number', - b: 'number', - }, - 'boolean' -], - -has: [ - [], - { - s: 'Prop', - obj: 'Struct', - }, - 'boolean' -], - -hasIn: [ - [], - { - s: 'Prop', - obj: 'Struct', - }, - 'boolean' -], - -// head - -identical: [ - ['T'], - { - a: 'T', - b: 'T', - }, - 'boolean' -], - -// identity - -ifElse: [ - ['T', 'U', 'V'], - { - fn: 'Pred', - onTrue: '(v: T) => U', - onFalse: '(v: T) => V' - }, - '(v: T) => U|V' -], - -// inc - -indexBy: [ - ['T'], - { - fn: '(a: T) => Prop', - list: 'List', - }, - 'Obj' -], - -indexOf: [ - ['T'], - { - target: 'T', - list: 'List', - }, - 'number' -], - -// init - -insert: [ - ['T'], - { - index: 'number', - elt: 'T', - list: 'List', - }, - 'T[]' -], - -insertAll: [ - ['T', 'U'], - { - index: 'number', - elts: 'List', - list: 'List', - }, - 'Array' -], - -intersection: [ - ['T', 'U'], - { - list1: 'List', - list2: 'List', - }, - 'Array' -], - -intersectionWith: [ - ['T'], - { - pred: '(a: T, b: T) => boolean', - list1: 'List', - list2: 'List', - }, - 'T[]' -], - -intersperse: [ - ['T'], - { - separator: 'T', - list: 'List', - }, - 'T[]' -], - -into: [ - ['T', 'U', 'V extends AccOpts'], - { - acc: 'V', - xf: '(list: List) => U', - list: 'List', - }, - 'U' -], - -// invert - -invoker: [ - ['T', 'R'], - { - len: 'number', - name: 'Prop', - obj: 'T', - }, - 'R' -], - -is: [ - ['T'], - { - ctor: 'Type', - val: 'any', - }, - 'val is T' -], - -// isArrayLike - -// isEmpty - -// isNaN - -// isNil - -join: [ - [], - { - x: 'Prop', - xs: 'Array', - }, - 'string' -], - -juxt: [ - ['T', 'U'], - { - fns: '{(...args: T[]): U}[]' - }, - '(...args: T[]) => U[]' -], - -// keys - -// keysIn - -// last - -lastIndexOf: [ - ['T'], - { - target: 'T', - list: 'List', - }, - 'number' -], - -// length - -lens: { - base: [ - ['V', 'U extends Struct'], - { - getter: '(s: U) => V', - setter: '(a: V, s: U) => U', - }, - 'ManualLens' - ], - 'allows setter to change value type': [ - ['T', 'U', 'V'], - { - getter: '(s: T) => U', - setter: '(a: U, s: T) => V' - }, - 'Lens' - ] -}, - -// lensIndex - -// lensPath - -lift: R.flatten(R.range(0,10).map(i => liftDef(i))).join('\n'), - -liftN: R.flatten(R.range(0,10).map(i => liftNDef(i, true))).join('\n'), // false - -lt: [ - [], - { - a: 'number', - b: 'number', - }, - 'boolean' -], - -lte: [ - [], - { - a: 'number', - b: 'number', - }, - 'boolean' -], - -map: { - base: [['T','U'], { fn: '(value: T) => U' }, { - array: [[], { list: 'List' }, 'U[]'], - obj_keyof: [['M extends Obj'], { obj: 'M' }, '{[K in keyof M]: U}'], - obj_record: [['K extends string'], { obj: 'Record' }, 'Record'], - functor: [[], { obj: 'Functor' }, 'Functor'], - // compose: [['Args extends any[]'], { f1: '(...args: Args) => T' }, '(...args: Args) => U'], - compose: [[], { f1: '(...args: any[]) => T' }, '(...args: any[]) => U'], - }], -}, - -// map: { -// base: [ -// ['T', 'U'], -// { -// fn: '(val: T) => U', -// list: 'List', -// }, -// 'U[]' -// ], -// 'object: keyof version': [ -// ['T', 'U', 'M extends Obj'], -// { -// fn: '(val: T) => U', -// obj: 'M', -// }, -// '{[K in keyof M]: U}' -// ], -// 'object: Record version': [ -// ['T', 'U', 'K extends string'], -// { -// fn: '(val: T) => U', -// obj: 'Record', -// }, -// 'Record' -// ], -// 'functor': [ -// ['T', 'U'], -// { -// fn: '(val: T) => U', -// obj: 'Functor', -// }, -// 'Functor' -// ] -// }, - -mapAccum: [ - ['T', 'U', 'TResult'], - { - fn: '(acc: U, value: T) => [U, TResult]', - acc: 'U', - list: 'List', - }, - '[U, TResult[]]' -], - -mapAccumRight: [ - ['T', 'U', 'TResult'], - { - fn: '(value: T, acc: U) => [TResult, U]', - acc: 'U', - list: 'List', - }, - '[TResult[], U]' -], - -mapIndexed: [ - ['T', 'U', 'V'], - { - fn: '(value: T, acc: U) => [TResult, U]', - acc: 'U', - list: 'List', - }, - '[TResult[], U]', -], - -mapObjIndexed: [ - ['T', 'V', 'M extends Obj'], - { - fn: '(value: T, key: string, obj?:M) => V', - obj: 'M' - }, - '{[K in keyof M]: V}' -], - -match: [ - [], - { - regexp: 'RegExp', - str: 'string' - }, - 'string[]' -], - -mathMod: [ - [], - { - a: 'number', - b: 'number', - }, - 'number' -], - -max: [ - ['T extends Ord'], - { - a: 'T', - b: 'T', - }, - 'T' -], - -maxBy: [ - ['T'], - { - keyFn: '(a: T) => Ord', - a: 'T', - b: 'T', - }, - 'T' -], - -// mean - -// median - -// memoize - -merge: [ - ['V1', 'V2', 'T1 extends Struct', 'T2 extends Struct'], - { - a: 'T1', - b: 'T2', - }, - 'T1 & T2' -], - -mergeAll: [ - ['T'], - { - list: 'List', - }, - 'T' -], - -mergeWith: [ - ['U', 'V'], - { - fn: '(x: any, z: any) => any', - a: 'U', - b: 'V', - }, - 'U & V' -], - -mergeWithKey: { - 'mergeWithKey': [ - ['U', 'V'], - { - fn: '(str: string, x: any, z: any) => any', - a: 'U', - b: 'V', - }, - 'U & V' - ] -}, - -minBy: [ - ['T'], - { - keyFn: '(a: T) => Ord', - a: 'T', - b: 'T' - }, - 'T' -], - -over: { -'Functor version': [ - ['V', 'T extends Functor'], - { - lens: 'Lens|ManualLens|UnknownLens', - fn: '(v: V) => V', - value: 'T', - }, - 'T' -], -'Functor version applied to array': [ - ['V', 'T extends List'], - { - lens: 'Lens|ManualLens|UnknownLens', - fn: '(v: V) => V', - value: 'T', - }, - 'V[]' -], -'unbound value': [ - ['T', 'V'], - { - lens: 'Lens|ManualLens|UnknownLens', - fn: '(v: V) => V', - value: 'T', - }, - 'T' -] -}, - -path: R.flatten(R.range(2,10).map(i => pathDef(i))).join('\n'), - -pathOr: [ - ['T'], - { - d: 'T', - p: 'Path', - obj: 'Struct', - }, - 'T|any' -], - -pathSatisfies: [ - ['T'], - { - fn: 'Pred', - p: 'Path', - obj: 'any', - }, - 'boolean' -], - -pipe: R.flatten(R.range(1,10).map(i => R.range(1,5).map(j => pipeDef(i,j)))).join('\n'), - -pipeK: R.flatten(R.range(1,10).map(i => pipeKDef(i))).join('\n'), - -pipeP: R.flatten(R.range(1,10).map(i => R.range(1,5).map(j => pipePDef(i,j)))).join('\n'), - -propEq: [ - ['T extends Struct'], - { - name: 'Prop', - val: 'any', - obj: 'T', - }, - 'boolean' -], - -propOr: [['T'], { val: 'T' }, { - record: [['K extends string', 'V', 'U extends Record'], { p: 'K', obj: 'U' }, 'V|T'], - keyof: [['U', 'K extends keyof U'], { p: 'K', obj: 'U' }, 'U[K]|T'], - same: [[], { p: 'Prop', obj: 'Struct' }, 'T'], - unbound: [['U', 'V'], { p: 'Prop', obj: 'U' }, 'V'], -}], - -propStatisfies: { -'Record (curry-friendly)': [ - ['V', 'K extends string', 'U extends Record'], - { - pred: 'Pred', - name: 'K', - obj: 'U', - }, - 'boolean' -], -'keyof, info too late on currying': [ - ['T', 'U'], - { - pred: 'Pred', - name: 'Prop', - obj: 'U' - }, - 'boolean' -] -}, - -reduce: [ - ['T', 'TResult', 'R extends List'], - { - fn: '(acc: TResult, elem: T, idx: number, list: R) => TResult|Reduced', - acc: 'TResult', - list: 'R', - }, - 'TResult' -], - -reduceBy: [ - ['T', 'TResult', 'R extends List'], - { - valueFn: '(acc: TResult, elem: T, idx: number, list: R) => TResult', - acc: 'TResult|any', - keyFn: '(elem: T) => string', - list: 'R', - }, - 'TResult' -], - -reduceRight: [ - ['T', 'TResult'], - { - fn: '(elem: T, acc: TResult) => TResult|Reduced', - acc: 'TResult|any', - list: 'List', - }, - 'TResult' -], - -reduceWhile: [ - ['T', 'TResult'], - { - pred: '(acc: TResult, elem: T) => boolean', - fn: '(acc: TResult, elem: T) => TResult|Reduced', - acc: 'TResult', - list: 'List', - }, - 'TResult' -], - -remove: [ - ['T'], - { - start: 'number', - count: 'number', - list: 'List', - }, - 'T[]' -], - -replace: [ - [], - { - pattern: 'RegExp|Prop', - replacement: 'Prop', - str: 'string', - }, - 'string' -], - -scan: [ - ['T', 'TResult'], - { - fn: '(acc: TResult, elem: T) => TResult|Reduced', - acc: 'TResult', - list: 'List' - }, - 'TResult[]' -], - -set: { - base: [ - ['T', 'U'], - { - lens: 'Lens', - a: 'U', - obj: 'T' - }, - 'T' - ], - unknown: [ - ['T'], - { - lens: 'UnknownLens', - a: 'any', - obj: 'T', - }, - 'T' - ] -}, - -slice: [ - ['T extends List'], - { - a: 'number', - b: 'number', - list: 'T', - }, - 'T' -], - -symmetricDifferenceWith: [ - ['T'], - { - pred: '(a: T, b: T) => boolean', - list1: 'List', - list2: 'List', - }, - 'T[]' -], - -transduce: [ - ['T', 'U'], - { - xf: '(arg: List) => List', - fn: '(acc: List, val:U) => List', - acc: 'List', - list: 'List' - }, - 'U' -], - -traverse: { - base: [ - ['T', 'U'], - { - ap: '(v: T) => Applicative', - fn: '(v: T) => Applicative', - traversable: 'List', - }, - 'Applicative>' - ], - 'general ADT case': [ - ['T', 'U'], - { - ap: '(v: T) => Applicative', - fn: '(v: T) => Applicative', - traversable: 'List', - }, - 'Applicative>' - ] -}, - -unionWith: [ - ['T'], - { - pred: '(a: T, b: T) => boolean', - list1: 'List', - list2: 'List', - }, - 'T[]' -], - -until: [ - ['T', 'U'], - { - pred: 'Pred', - fn: '(val: T) => U', - init: 'U', - }, - 'U' -], - -update: [ - ['T'], - { - index: 'number', - value: 'T', - list: 'List' - }, - 'T[]' -], - -when: [ - ['T', 'U'], - { - pred: 'Pred', - whenTrueFn: '(a: T) => U', - obj: 'T', - }, - 'U' -], - -and: { - 'dispatch to some `and` method:': [ - ['T extends {and?: Function}'], - { - fn1: 'T', - val2: 'boolean|any' - }, - 'boolean' - ], - 'no generics': [ - [], - { - v1: 'any', - v2: 'any', - }, - 'boolean' - ] -}, - -difference: [ - ['T'], - { - list1: 'List', - list2: 'List', - }, - 'T[]', -], - -// dropRepeats - -// dropRepeatsWith - -identity: [ - ['T'], - { - a: 'T' - }, - 'T' -], - -inc: [ - [], - { - n: 'number', - }, - 'number', -], - -init: [ - ['T extends List'], - { - list: 'T', - }, - 'T' -], - -invert: [ - [], - { - obj: 'Struct' - }, - 'Obj>' -], - -invertObj: [ - [], - { - obj: 'Struct' - }, - 'Obj' -], - -isArrayLike: [ - [], - { - val: 'any', - }, - 'val in List' -], - -isEmpty: [ - [], - { - val: 'any', - }, - 'boolean' -], - -isNil: [ - [], - { - val: 'any', - }, - 'boolean', -], - -keys: [ - [], - { - x: 'Struct', - }, - 'string[]' -], - -keysIn: [ - [], - { - obj: 'Struct', - }, - 'string[]' -], - -last: [ - ['T', 'R extends List'], - { - list: 'R', - }, - 'T' -], - -length: [ - [], - { - list: 'List', - }, - 'number' -], - -lensIndex: { - 'generics': [ - ['T'], - { - n: 'number' - }, - 'ManualLens' - ], - 'non-generic': [ - [], - { - n: 'number', - }, - 'UnknownLens' - ], -}, - -lensPath: { - 'generics': [ - ['T'], - { - path: 'Path' - }, - 'ManualLens' - ], - 'non-generic': [ - [], - { - path: 'Path', - }, - 'UnknownLens' - ], -}, - -lensProp: { - 'generics': [ - ['T'], - { - prop: 'Prop' - }, - 'ManualLens' - ], - 'non-generic': [ - [], - { - prop: 'Prop', - }, - 'UnknownLens' - ], -}, - -mean: [ - [], - { - list: 'List', - }, - 'number' -], - -median: [ - [], - { - list: 'List', - }, - 'number' -], - -memoize: [ - ['T'], - { - fn: 'Variadic' - }, - 'Variadic' -], - -min: [ - ['T extends Ord'], - { - a: 'T', - b: 'T', - }, - 'T' -], - -modulo: [ - [], - { - a: 'number', - b: 'number', - }, - 'number' -], - -multiply: [ - [], - { - a: 'number', - b: 'number', - }, - 'number' -], - -nAry: [ - ['T'], - { - n: 'number', - fn: 'Variadic', - }, - 'Variadic' -], - -negate: [ - [], - { - n: 'number', - }, - 'number', -], - -none: [ - ['T'], - { - fn: '(a: T) => boolean', - list: 'List', - }, - 'boolean' -], - -not: [ - [], - { - value: 'any', - }, - 'boolean', -], - -nth: [ - ['T'], - { - n: 'number', - list: 'list' - }, -], - -nthArg: [ - [], - { - n: 'number', - }, - '(...a : T[]) => T' -], - -objOf: [ - ['K extends string', 'V', 'T extends Record'], - { - key: 'K', - value: 'V', - }, - 'T' -], - -of: [ - ['T'], - { - x: 'T' - }, - 'T[]' -], - -omit: [ - ['T'], - { - names: 'List', - obj: 'T', - }, - 'T' -], - -once: [ - ['T'], - { - fn: 'Variadic', - }, - 'Variadic' -], - -or: { - 'dispatch to some `or` method': [ - ['T extends {or?: (alt: U) => T|U}', 'U'], - { - fn1: 'T', - val2: 'U' - }, - 'T|U' - ], - 'values': [ - ['T', 'U'], - { - a: 'T', - b: 'U', - }, - 'T|U' - ], -}, - -pair: [ - ['F', 'S'], - { - fst: 'F', - snd: 'S', - }, - '[F, S]' -], - -partial: [ - ['T'], - { - fn: 'Variadic', - args: 'any[]', - }, - 'Variadic', -], - -partialRight: [ - ['T'], - { - fn: 'Variadic', - args: 'any[]', - }, - 'Variadic', -], - -partition: { - 'arrays': [ - ['T'], - { - fn: '(a: T) => boolean', - list: 'List', - }, - '[T[], T[]]' - ], - 'objects': [ - ['T extends Obj', 'U extends Obj', 'V'], - { - fn: '(a: V) => boolean', - obj: 'T & U' - }, - '[T, U]' - ], - 'objects, alternative notation': [ - ['T', 'U extends Obj'], - { - fn: '(a: T) => boolean', - obj: 'U', - }, - '[Partial, Partial]' - ], -}, - -pick: { - 'generic 1': [ - ['T', 'K extends keyof T'], - { - names: 'List', - obj: 'T' - }, - 'Pick' - ], - 'generic 2': [ - ['T'], - { - names: 'List', - obj: 'T', - }, - 'Partial' - ], -}, - -pickAll: [ - ['T', 'K'], - { - names: 'List', - obj: 'T', - }, - 'Partial' -], - -pickBy: [ - ['T'], - { - pred: 'ObjPred', - obj: 'T', - }, - 'Partial' -], - -pluck: { - 'infer': [ - ['T extends Struct', 'K extends keyof T'], - { - p: 'K', - list: 'List' - }, - 'T[K][]' - ], - 'supply return object type manually when unable to infer it...': [ - ['T'], - { - p: 'Prop', - list: 'Struct[]', - }, - 'T[]', - ], -}, - -prepend: [ - ['T'], - { - el: 'T', - list: 'List', - }, - 'T[]' -], - -product: [ - [], - { - list: 'List', - }, - 'number' -], - -project: { - 'infer': [ - ['T', 'K extends keyof T'], - { - props: 'List', - objs: 'List', - }, - 'Pick[]' - ], - 'supply return object type manually when unable to infer it...': [ - ['T', 'U'], - { - props: 'List', - objs: 'List', - }, - 'U[]' - ], -}, - -prop: { - 'keyof version': [ - ['T', 'K extends keyof T'], - { - p: 'K', - obj: 'T', - }, - 'T[K]', - ], - 'Record version, more curry-friendly': [ - ['K extends string', 'V', 'T extends Record'], - { - p: 'K', - obj: 'T', - }, - 'V', - ], -}, - -propIs: { - 'Record': [ - ['T extends Function', 'K extends string', 'V', 'U extends Record'], - { - type: 'T', - name: 'K', - obj: 'U', - }, - 'obj is (U & Record)' - ], - 'curry-friendlier fallback': [ - [], - { - type: 'Function', - name: 'Prop', - obj: 'Struct' - }, - 'boolean' - ], - // unsure - // 'mixed': -}, - -propSatisfies: { - 'Record': [ - ['V', 'K extends string', 'U extends Record'], - { - pred: 'Pred', - name: 'K', - obj: 'U', - }, - 'boolean', - ], - 'keyof, info too late on currying': [ - ['T', 'U'], - { - pred: 'Pred', - name: 'Pred', - obj: 'U', - }, - 'boolean' - ], -}, - -props: [ - ['T'], - { - ps: 'List', - obj: 'Struct', - }, - 'T[]' -], - -range: [ - [], - { - from: 'number', - to: 'number', - }, - 'number[]', -], - -reduced: [ - ['T'], - { - el: 'T' - }, - 'Reduced' -], - -reject: { - 'array': [ - ['T'], - { - pred: 'Pred', - list: 'List', - }, - 'T[]', - ], - 'functor to functor': [ - ['T'], - { - pred: 'Pred', - list: 'Functor', - }, - 'Functor', - ], - 'functor to array': [ - ['T'], - { - pred: 'Pred', - list: 'Functor', - }, - 'T[]' - ], - 'object': [ - ['T', 'U extends Obj'], - { - pred: 'Pred', - obj: 'U', - }, - 'Partial' - ], - // mixed -}, - -repeat: [ - ['T'], - { - a: 'T', - n: 'number', - }, - 'T[]', -], - -reverse: [ - ['T'], - { - list: 'List', - }, - 'T[]' -], - -sequence: { - 'common case of array as traversable': [ - ['T'], - { - fn: '(v: T) => Applicative', - traversable: 'List>', - }, - 'Applicative>' - ], - 'general ADT case:': [ - ['T'], - { - fn: '(v: T) => Applicative', - traversable: 'Traversable >', - }, - 'Applicative>' - ], - // mixed -}, - -sort: [ - ['T'], - { - fn: '(a: T, b: T) => number', - list: 'List' - }, - 'T[]' -], - -sortBy: [ - ['T'], - { - fn: '(a: T) => string', - list: 'List' - }, - 'T[]' -], - -sortWith: [ - ['T'], - { - comparators: 'List<(a: T, b: T) => number>', - list: 'List' - }, - 'T[]', -], - -split: [ - [], - { - sep: 'RegExp|Prop', - str: 'string', - }, - 'string[]', -], - -splitAt: { - 'string': [ - [], - { - index: 'number', - list: 'string', - }, - 'string[]' - ], - 'array': [ - ['T'], - { - index: 'number', - list: 'List', - }, - 'T[][]' - ], - // mixed -}, - -splitEvery: [ - ['T', 'R extends List'], - { - a: 'number', - list: 'R', - }, - 'R[]', -], - -splitWhen: [ - ['T', 'R extends List'], - { - pred: 'Pred', - list: 'R', - }, - 'R[]', -], - -subtract: [ - [], - { - a: 'number', - b: 'number', - }, - 'number', -], - -sum: [ - [], - { - list: 'List', - }, - 'number' -], - -symmetricDifference: [ - ['T'], - { - list1: 'List', - list2: 'List', - }, - 'T[]' -], - -tail: [ - ['T exetnds List'], - { - list: 'T' - }, - 'T' -], - -take: [ - ['T extends List'], - { - n: 'number', - xs: 'T', - }, - 'T' -], - -takeLast: [ - ['T extends List'], - { - n: 'number', - xs: 'T', - }, - 'T' -], - -takeLastWhile: [ - ['T', 'R extends List'], - { - pred: 'Pred', - list: 'R', - }, - 'R' -], - -takeWhile: [ - ['T', 'R extends List'], - { - pred: 'Pred', - list: 'R', - }, - 'R' -], - -tap: [ - ['T'], - { - fn: '(a: T) => any', - value: 'T' - }, - 'T' -], - -test: [ - [], - { - regexp: 'RegExp', - str: 'Prop', - }, - 'boolean' -], - -times: [ - ['T'], - { - fn: '(i: number) => T', - n: 'number', - }, - 'T[]' -], - -toLower: [ - [], - { - str: 'string', - }, - 'string' -], - -toPairs: [ - ['T'], - { - obj: 'Obj', - }, - '[string, T][]' -], - -toPairsIn: { - 'generics': [ - ['T'], - { - obj: 'Obj', - }, - '[string, T][]' - ], - 'non-generic': [ - [], - { - obj: 'Object', - }, - '[string, any][]' - ], -}, - -toString: [ - [], - { - val: 'StringRepresentable | any' - }, - 'string' -], - -toUpper: [ - [], - { - str: 'string', - }, - 'string' -], - -transpose: { - 'generics 1': [ - ['T'], - { - list: 'List>' - }, - 'T[][]' - ], - 'generics 2': [ - [], - { - list: 'List>', - }, - 'any[][]' - ], -}, - -trim: [ - [], - { - str: 'string', - }, - 'string' -], - -tryCatch: [ - ['T'], - { - tryer: 'Variadic', - catcher: 'Variadic', - }, - 'Variadic' -], - -type: [ - [], - { - val: 'any', - }, - 'string' -], - -unapply: [ - ['T'], - { - fn: '(args: any[]) => T', - }, - 'Variadic' -], - -unary: [ - ['T', 'U'], - { - fn: '(a: T, ...args: any[]) => U', - }, - '(a: T) => U' -], - -uncurryN: [ - ['T'], - { - len: 'number', - fn: '(a: any) => any', - }, - 'Variadic' -], - -unfold: [ - ['T', 'TResult'], - { - fn: '(seed: T) => [TResult, T] | false', - seed: 'T', - }, - 'TResult[]' -], - -union: [ - ['T'], - { - as: 'List', - bs: 'List', - }, - 'T[]' -], - -uniq: [ - ['T'], - { - list: 'List', - }, - 'T[]' -], - -uniqBy: [ - ['T', 'U'], - { - fn: '(a: T) => U', - list: 'List', - }, - 'T[]' -], - -uniqWith: [ - ['T', 'U'], - { - pred: '(x: T, y: T) => boolean', - list: 'List', - }, - 'T[]' -], - -unless: [ - ['T', 'U'], - { - pred: 'Pred', - whenFalseFn: '(a: T) => U', - obj: 'T', - }, - 'U' -], - -unnest: [ - ['T'], - { - x: 'List>', - }, - 'T[]' -], - -useWith: [ - ['T'], - { - fn: 'Variadic', - transformers: 'List', - }, - 'Variadic' -], - -values: { - 'Struct': [ - ['T'], - { - obj: 'Struct', - }, - 'T[]' - ], - 'Object': [ - ['T'], - { - obj: 'Object', - }, - 'any[]' - ] -}, - -valuesIn: { - 'Struct': [ - ['T'], - { - obj: 'Struct', - }, - 'T[]' - ], - 'Object': [ - ['T'], - { - obj: 'Object', - }, - 'any[]' - ] -}, - -view: { - 'smart approach, unreliable': [ - ['T', 'U'], - { - lens: 'Lens', - obj: 'T', - }, - 'U' - ], - 'lens with type manually set': [ - ['T'], - { - lens: 'ManualLens', - obj: 'Struct', - }, - 'T' - ], - 'unknown lens, manually supply return type. does this add to the above case?': [ - ['T'], - { - lens: 'UnknownLens', - obj: 'Struct', - }, - 'any' - ], -}, - -where: { - 'heterogeneous version': [ - ['T extends Obj'], - { - spec: '{[P in keyof K]?: Pred}', - testObj: 'T', - }, - 'boolean' - ], - 'homogeneous version': [ - ['T'], - { - spec: 'Obj>', - testObj: 'Obj' - }, - 'boolean' - ], - 'DIY "fill in the type params yourself" version': [ - ['T', 'U'], - { - spec: 'T', - testObj: 'U' - }, - 'boolean' - ], -}, - -whereEq: { - 'heterogeneous version': [ - ['T extends Obj'], - { - spec: 'Partial', - testObj: 'T', - }, - 'boolean' - ], - 'homogeneous version': [ - ['T'], - { - spec: 'Obj', - testObj: 'Obj' - }, - 'boolean' - ], - 'DIY "fill in the type params yourself" version': [ - ['T', 'U'], - { - spec: 'T', - testObj: 'U', - }, - 'boolean' - ], -}, - -without: [ - ['T'], - { - list1: 'List', - list2: 'List', - }, - 'T[]' -], - -xprod: [ - ['K', 'V'], - { - as: 'List', - bs: 'List', - }, - 'KeyValuePair[]' -], - -zip: [ - ['K', 'V'], - { - list1: 'List', - list2: 'List', - }, - 'KeyValuePair[]' -], - -zipObj: [ - ['T'], - { - keys: 'List', - values: 'List', - }, - 'Obj' -], - -zipWith: [ - ['T', 'U', 'TResult'], - { - fn: '(x: T, y: U) => TResult', - list1: 'List', - list2: 'List', - }, - 'TResult[]' -], - -F: 'F(): false;', - -T: 'T(): true;', - -head: { - 'triple': [ - ['T0', 'T1', 'T2'], - { - list: '[T0, T1, T2]', - }, - 'T0', - ], - 'tuple': [ - ['T0', 'T1'], - { - list: '[T0, T1]', - }, - 'T0', - ], - 'single': [ - ['T'], - { - list: '[T]', - }, - 'T' - ], - 'any': [ - ['T extends List'], - { - list: 'T' - }, - 'any' - ] -}, - -curryN: [ - ['T'], - { - length: 'number', - fn: 'Variadic' - }, - 'Variadic', -], - -}; - -let defStrs = R.mapObjIndexed((v, k) => - !R.is(Object, v) ? v : // string - Array.isArray(v) ? - // genOption(v, 0) : // array - genCurried({ sole: v }, 0, k) : // array - genCurried(v, 0, k) // object -)(defs); - -R.pipe(R.values, R.join('\n\n'))(defStrs); - diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100644 index 0000000..7f2bc37 --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +yarn run build -- --kind +yarn run build -- --kind selectable +yarn run build -- --kind placeholder + +git config --global user.name ikatyang-bot +git config --global user.email ikatyang+bot@gmail.com +git config --global push.default simple + +function deploy_branch() { + local branch_name=$1 + + git clone --depth=1 --branch "$branch_name" "https://github.com/$TRAVIS_REPO_SLUG.git" ./$branch_name + + rm -rf ./$branch_name/* + cp -rf ./package.json ./README.md ./CHANGELOG.md ./LICENSE ./ramda/$branch_name/* ./$branch_name + + cd ./$branch_name + + git add --all + git commit -m "deploy($branch_name): $TRAVIS_COMMIT" + git push -qf "https://$GH_TOKEN@github.com/$TRAVIS_REPO_SLUG.git" + + cd .. +} + +deploy_branch "dist" +deploy_branch "dist-simple" +deploy_branch "dist-selectable" +deploy_branch "dist-placeholder" diff --git a/scripts/migrate-jsdoc.ts b/scripts/migrate-jsdoc.ts new file mode 100644 index 0000000..897d251 --- /dev/null +++ b/scripts/migrate-jsdoc.ts @@ -0,0 +1,43 @@ +import * as child_process from 'child_process'; +import * as fs from 'fs'; +import * as path from 'path'; + +const args = process.argv.slice(2); + +if (args.length < 2) { + throw new Error( + `Usage: ts-node path/to/migrate-jsdoc.ts `, + ); +} + +const ramda_tag = args[0]; +const output_dir = path.resolve(process.cwd(), args[1]); + +if (!fs.existsSync(output_dir)) { + child_process.execSync(`mkdir -p ${output_dir}`); +} else if (!fs.statSync(output_dir).isDirectory()) { + throw new Error(`output-dir should be a directory: ${output_dir}`); +} + +const temp_dir = `${__dirname}/temp`; +child_process.execSync( + `git clone https://github.com/ramda/ramda.git ${temp_dir} --branch ${ramda_tag} --depth=1`, +); + +const src_dir = `${temp_dir}/src`; +const src_filenames = fs + .readdirSync(src_dir) + .filter(filename => filename.endsWith('.js')); + +src_filenames.forEach(filename => { + const content = fs.readFileSync(`${src_dir}/${filename}`, 'utf8'); + const jsdoc = content.match(/\/\*\*([\s\S]+?)\*\//)![1] + .replace(/^ \* ?/gm, '') + .trim(); + + const basename = path.basename(filename, '.js'); + const output_filename = `${output_dir}/${basename}.md`; + fs.writeFileSync(output_filename, `${jsdoc}\n`, { encoding: 'utf8' }); +}); + +child_process.execSync(`rm -rf ${temp_dir}`); diff --git a/scripts/release-tags.sh b/scripts/release-tags.sh new file mode 100644 index 0000000..3379a67 --- /dev/null +++ b/scripts/release-tags.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +git fetch --all + +git tag "v$npm_package_version-dist" origin/dist +git tag "v$npm_package_version-dist-simple" origin/dist-simple +git tag "v$npm_package_version-dist-selectable" origin/dist-selectable +git tag "v$npm_package_version-dist-placeholder" origin/dist-placeholder + +git push --tags diff --git a/snapshots/F.ts b/snapshots/F.ts new file mode 100644 index 0000000..24367f2 --- /dev/null +++ b/snapshots/F.ts @@ -0,0 +1,4 @@ +import * as R_F from '../ramda/dist/src/F'; + +// @dts-jest:pass -> false +R_F(); diff --git a/snapshots/T.ts b/snapshots/T.ts new file mode 100644 index 0000000..a8b0fe7 --- /dev/null +++ b/snapshots/T.ts @@ -0,0 +1,4 @@ +import * as R_T from '../ramda/dist/src/T'; + +// @dts-jest:pass -> true +R_T(); diff --git a/snapshots/__.ts b/snapshots/__.ts new file mode 100644 index 0000000..18e781b --- /dev/null +++ b/snapshots/__.ts @@ -0,0 +1,25 @@ +import { CurriedFunction3 } from '../ramda/dist/src/$curriedFunctions'; +import * as R___ from '../ramda/dist/src/__'; + +declare const boolean: boolean; +declare const number: number; +declare const string: string; +declare const curried_string_boolean_number_to_object: CurriedFunction3< + string, + boolean, + number, + object +>; + +// @dts-jest:pass -> object +curried_string_boolean_number_to_object(string)(boolean)(number); +// @dts-jest:pass -> object +curried_string_boolean_number_to_object(string, boolean, number); +// @dts-jest:pass -> CurriedFunction1 +curried_string_boolean_number_to_object(R___, boolean, number); +// @dts-jest:pass -> CurriedFunction1 +curried_string_boolean_number_to_object(string, R___, number); +// @dts-jest:pass -> CurriedFunction2 +curried_string_boolean_number_to_object(R___, R___, number); +// @dts-jest:pass -> CurriedFunction1 +curried_string_boolean_number_to_object(string)(R___, number); diff --git a/snapshots/add.ts b/snapshots/add.ts new file mode 100644 index 0000000..84d7f2b --- /dev/null +++ b/snapshots/add.ts @@ -0,0 +1,8 @@ +import * as R_add from '../ramda/dist/src/add'; + +declare const number: number; + +// @dts-jest:pass -> number +R_add(number, number); +// @dts-jest:pass -> number +R_add(number)(number); diff --git a/snapshots/addIndex.ts b/snapshots/addIndex.ts new file mode 100644 index 0000000..4a73adb --- /dev/null +++ b/snapshots/addIndex.ts @@ -0,0 +1,27 @@ +import { ListMapper, Morphism, ObjectMapper } from '../ramda/dist/src/$types'; +import * as R_addIndex from '../ramda/dist/src/addIndex'; + +declare const string_to_number_list_mapper: ListMapper; +declare const string_to_number_object_mapper: ObjectMapper< + string, + number, + string +>; + +declare const string_to_number: Morphism; +declare const string_array: string[]; +declare const string_object: Record; + +// @dts-jest:pass -> CurriedFunction2<(v1: string, index: number, target: string[] | ArrayLike) => number, string[] | ArrayLike, number[]> +R_addIndex(string_to_number_list_mapper); +// @dts-jest:pass -> CurriedFunction1, number[]> +R_addIndex(string_to_number_list_mapper)(string_to_number); +// @dts-jest:pass -> number[] +R_addIndex(string_to_number_list_mapper)(string_to_number, string_array); + +// @dts-jest:pass -> CurriedFunction2<(v1: string, index: number, target: Record) => number, Record, Record> +R_addIndex(string_to_number_object_mapper); +// @dts-jest:pass -> CurriedFunction1, Record> +R_addIndex(string_to_number_object_mapper)(string_to_number); +// @dts-jest:pass -> Record +R_addIndex(string_to_number_object_mapper)(string_to_number, string_object); diff --git a/snapshots/adjust.ts b/snapshots/adjust.ts new file mode 100644 index 0000000..972ebe9 --- /dev/null +++ b/snapshots/adjust.ts @@ -0,0 +1,20 @@ +import { Morphism } from '../ramda/dist/src/$types'; +import * as R_adjust from '../ramda/dist/src/adjust'; + +declare const string_to_string: Morphism; +declare const string_to_number: Morphism; +declare const string_array: string[]; +declare const number: number; + +// @dts-jest:pass -> (string | number)[] +R_adjust(string_to_number)(number, string_array); +// @dts-jest:pass -> (string | number)[] +R_adjust(string_to_number, number)(string_array); +// @dts-jest:pass -> (string | number)[] +R_adjust(string_to_number, number, string_array); +// @dts-jest:pass -> string[] +R_adjust(string_to_string)(number, string_array); +// @dts-jest:pass -> string[] +R_adjust(string_to_string, number)(string_array); +// @dts-jest:pass -> string[] +R_adjust(string_to_string, number, string_array); diff --git a/snapshots/all.ts b/snapshots/all.ts new file mode 100644 index 0000000..e37751a --- /dev/null +++ b/snapshots/all.ts @@ -0,0 +1,10 @@ +import { Predicate } from '../ramda/dist/src/$types'; +import * as R_all from '../ramda/dist/src/all'; + +declare const string_predicate: Predicate; +declare const string_array: string[]; + +// @dts-jest:pass -> boolean +R_all(string_predicate)(string_array); +// @dts-jest:pass -> boolean +R_all(string_predicate, string_array); diff --git a/snapshots/allPass.ts b/snapshots/allPass.ts new file mode 100644 index 0000000..c7e0b33 --- /dev/null +++ b/snapshots/allPass.ts @@ -0,0 +1,10 @@ +import { Predicate } from '../ramda/dist/src/$types'; +import * as R_allPass from '../ramda/dist/src/allPass'; + +declare const string_predicate: Predicate; +declare const string_number_preficate: (x: string, y: number) => boolean; + +// @dts-jest:pass -> (value: string) => boolean +R_allPass([string_predicate, string_predicate]); +// @dts-jest:pass -> (x: string, y: number) => boolean +R_allPass([string_predicate, string_number_preficate]); diff --git a/snapshots/always.ts b/snapshots/always.ts new file mode 100644 index 0000000..e512afe --- /dev/null +++ b/snapshots/always.ts @@ -0,0 +1,8 @@ +import * as R_always from '../ramda/dist/src/always'; + +declare const string: string; + +// @dts-jest:pass -> () => string +R_always(string); +// @dts-jest:pass -> string +R_always(string)(); diff --git a/snapshots/and.ts b/snapshots/and.ts new file mode 100644 index 0000000..9c430da --- /dev/null +++ b/snapshots/and.ts @@ -0,0 +1,9 @@ +import * as R_and from '../ramda/dist/src/and'; + +declare const string: string; +declare const number: number; + +// @dts-jest:pass -> string | number +R_and(string)(number); +// @dts-jest:pass -> string | number +R_and(string, number); diff --git a/snapshots/any.ts b/snapshots/any.ts new file mode 100644 index 0000000..c534450 --- /dev/null +++ b/snapshots/any.ts @@ -0,0 +1,10 @@ +import { Predicate } from '../ramda/dist/src/$types'; +import * as R_any from '../ramda/dist/src/any'; + +declare const string_predicate: Predicate; +declare const string_array: string[]; + +// @dts-jest:pass -> boolean +R_any(string_predicate)(string_array); +// @dts-jest:pass -> boolean +R_any(string_predicate, string_array); diff --git a/snapshots/anyPass.ts b/snapshots/anyPass.ts new file mode 100644 index 0000000..4c35b93 --- /dev/null +++ b/snapshots/anyPass.ts @@ -0,0 +1,10 @@ +import { Predicate } from '../ramda/dist/src/$types'; +import * as R_anyPass from '../ramda/dist/src/anyPass'; + +declare const string_predicate: Predicate; +declare const string_number_preficate: (x: string, y: number) => boolean; + +// @dts-jest:pass -> (value: string) => boolean +R_anyPass([string_predicate, string_predicate]); +// @dts-jest:pass -> (x: string, y: number) => boolean +R_anyPass([string_predicate, string_number_preficate]); diff --git a/snapshots/ap.ts b/snapshots/ap.ts new file mode 100644 index 0000000..709a78e --- /dev/null +++ b/snapshots/ap.ts @@ -0,0 +1,10 @@ +import { Morphism } from '../ramda/dist/src/$types'; +import * as R_ap from '../ramda/dist/src/ap'; + +declare const string_to_number: Morphism; +declare const string_array: string[]; + +// @dts-jest:pass -> number[] +R_ap([string_to_number])(string_array); +// @dts-jest:pass -> number[] +R_ap([string_to_number], string_array); diff --git a/snapshots/aperture.ts b/snapshots/aperture.ts new file mode 100644 index 0000000..2b6ad21 --- /dev/null +++ b/snapshots/aperture.ts @@ -0,0 +1,9 @@ +import * as R_aperture from '../ramda/dist/src/aperture'; + +declare const number: number; +declare const string_array: string[]; + +// @dts-jest:pass -> string[][] +R_aperture(number)(string_array); +// @dts-jest:pass -> string[][] +R_aperture(number, string_array); diff --git a/snapshots/append.ts b/snapshots/append.ts new file mode 100644 index 0000000..ff3ba83 --- /dev/null +++ b/snapshots/append.ts @@ -0,0 +1,14 @@ +import * as R_append from '../ramda/dist/src/append'; + +declare const string: string; +declare const number: number; +declare const number_array: number[]; + +// @dts-jest:pass -> (string | number)[] +R_append(string)(number_array); +// @dts-jest:pass -> (string | number)[] +R_append(string, number_array); +// @dts-jest:pass -> number[] +R_append(number)(number_array); +// @dts-jest:pass -> number[] +R_append(number, number_array); diff --git a/snapshots/apply.ts b/snapshots/apply.ts new file mode 100644 index 0000000..cf8247e --- /dev/null +++ b/snapshots/apply.ts @@ -0,0 +1,9 @@ +import * as R_apply from '../ramda/dist/src/apply'; + +declare const number_and_string_to_boolean: (a: number, b: string) => boolean; +declare const number_and_string: [number, string]; + +// @dts-jest:pass -> boolean +R_apply(number_and_string_to_boolean)(number_and_string); +// @dts-jest:pass -> boolean +R_apply(number_and_string_to_boolean, number_and_string); diff --git a/snapshots/applySpec.ts b/snapshots/applySpec.ts new file mode 100644 index 0000000..2c8a3b2 --- /dev/null +++ b/snapshots/applySpec.ts @@ -0,0 +1,20 @@ +import * as R_applySpec from '../ramda/dist/src/applySpec'; + +interface Name { + firstname: string; + lastname: string; +} + +declare const name_spec: { [K in keyof Name]: (fullname: string) => Name[K] }; + +declare const fullname: string; + +// @dts-jest:pass -> (...args: any[]) => {} +R_applySpec(name_spec); +// @dts-jest:pass -> {} +R_applySpec(name_spec)(fullname); + +// @dts-jest:pass -> (...args: any[]) => Name +R_applySpec(name_spec); +// @dts-jest:pass -> Name +R_applySpec(name_spec)(fullname); diff --git a/snapshots/ascend.ts b/snapshots/ascend.ts new file mode 100644 index 0000000..376f5b4 --- /dev/null +++ b/snapshots/ascend.ts @@ -0,0 +1,13 @@ +import { Morphism, Ordered } from '../ramda/dist/src/$types'; +import * as R_ascend from '../ramda/dist/src/ascend'; + +declare const get_order_from_object: Morphism; +declare const object_a: object; +declare const object_b: object; + +// @dts-jest:pass -> number +R_ascend(get_order_from_object)(object_a)(object_b); +// @dts-jest:pass -> number +R_ascend(get_order_from_object, object_a)(object_b); +// @dts-jest:pass -> number +R_ascend(get_order_from_object, object_a, object_b); diff --git a/snapshots/assoc.ts b/snapshots/assoc.ts new file mode 100644 index 0000000..c362426 --- /dev/null +++ b/snapshots/assoc.ts @@ -0,0 +1,16 @@ +import * as R_assoc from '../ramda/dist/src/assoc'; + +declare const symbol_property: symbol; +declare const string_property: string; +declare const number_value: number; +declare const object: object; + +// @dts-jest:pass -> object +R_assoc(symbol_property, number_value, object); +// @dts-jest:pass -> object +R_assoc(symbol_property)(number_value)(object); + +// @dts-jest:pass -> object & Record +R_assoc(string_property, number_value, object); +// @dts-jest:pass -> object & Record +R_assoc(string_property)(number_value)(object); diff --git a/snapshots/assocPath.ts b/snapshots/assocPath.ts new file mode 100644 index 0000000..6ffdd1a --- /dev/null +++ b/snapshots/assocPath.ts @@ -0,0 +1,11 @@ +import { Path } from '../ramda/dist/src/$types'; +import * as R_assocPath from '../ramda/dist/src/assocPath'; + +declare const path: Path; +declare const number_value: number; +declare const object: object; + +// @dts-jest:pass -> object +R_assocPath(path, number_value, object); +// @dts-jest:pass -> object +R_assocPath(path)(number_value)(object); diff --git a/snapshots/binary.ts b/snapshots/binary.ts new file mode 100644 index 0000000..db843e5 --- /dev/null +++ b/snapshots/binary.ts @@ -0,0 +1,14 @@ +import { Variadic } from '../ramda/dist/src/$types'; +import * as R_binary from '../ramda/dist/src/binary'; + +declare const string_number_symbol_to_boolean: ( + a: string, + b: number, + c: symbol, +) => boolean; +declare const object_variadic: Variadic; + +// @dts-jest:pass -> (a: string, b: number) => boolean +R_binary(string_number_symbol_to_boolean); +// @dts-jest:pass -> (a: any, b: any) => object +R_binary(object_variadic); diff --git a/snapshots/bind.ts b/snapshots/bind.ts new file mode 100644 index 0000000..2f315d8 --- /dev/null +++ b/snapshots/bind.ts @@ -0,0 +1,20 @@ +import { Variadic } from '../ramda/dist/src/$types'; +import * as R_bind from '../ramda/dist/src/bind'; + +declare const object: object; +declare const string_number_symbol_to_boolean: ( + a: string, + b: number, + c: symbol, +) => boolean; +declare const object_variadic: Variadic; + +// @dts-jest:pass -> (context: any) => (a: string, b: number, c: symbol) => boolean +R_bind(string_number_symbol_to_boolean); +// @dts-jest:pass -> (a: string, b: number, c: symbol) => boolean +R_bind(string_number_symbol_to_boolean, object); + +// @dts-jest:pass -> (context: any) => Variadic +R_bind(object_variadic); +// @dts-jest:pass -> Variadic +R_bind(object_variadic, object); diff --git a/snapshots/both.ts b/snapshots/both.ts new file mode 100644 index 0000000..bd39f9d --- /dev/null +++ b/snapshots/both.ts @@ -0,0 +1,9 @@ +import { Predicate } from '../ramda/dist/src/$types'; +import * as R_both from '../ramda/dist/src/both'; + +declare const string_predicate: Predicate; + +// @dts-jest:pass -> (fn2: (value: string) => boolean) => (value: string) => boolean +R_both(string_predicate); +// @dts-jest:pass -> (value: string) => boolean +R_both(string_predicate, string_predicate); diff --git a/snapshots/call.ts b/snapshots/call.ts new file mode 100644 index 0000000..37c7f06 --- /dev/null +++ b/snapshots/call.ts @@ -0,0 +1,7 @@ +import * as R_call from '../ramda/dist/src/call'; + +declare const number_and_string_to_boolean: (a: number, b: string) => boolean; +declare const number_and_string: [number, string]; + +// @dts-jest:pass -> boolean +R_call(number_and_string_to_boolean, ...number_and_string); diff --git a/snapshots/chain.ts b/snapshots/chain.ts new file mode 100644 index 0000000..f17a288 --- /dev/null +++ b/snapshots/chain.ts @@ -0,0 +1,32 @@ +import { Chain, List } from '../ramda/dist/src/$types'; +import * as R_chain from '../ramda/dist/src/chain'; + +declare const number_array: number[]; +declare const number_to_string_string_tuple: (x: number) => [string, string]; +declare const number_chain: Chain; +declare const number_chain_to_string_chain: (x: number) => Chain; +declare const string_to_number_list_to_object: ( + x: string, +) => (list: List) => object; +declare const number_list_to_string: (list: List) => string; + +// @dts-jest:pass -> (list: List) => string[] +R_chain(number_to_string_string_tuple); +// @dts-jest:pass -> string[] +R_chain(number_to_string_string_tuple)(number_array); +// @dts-jest:pass -> string[] +R_chain(number_to_string_string_tuple, number_array); + +// @dts-jest:pass -> (list: Chain) => Chain +R_chain(number_chain_to_string_chain); +// @dts-jest:pass -> Chain +R_chain(number_chain_to_string_chain)(number_chain); +// @dts-jest:pass -> Chain +R_chain(number_chain_to_string_chain, number_chain); + +// @dts-jest:pass -> (monad: (value: List) => string) => (value: List) => object +R_chain(string_to_number_list_to_object); +// @dts-jest:pass -> (value: List) => object +R_chain(string_to_number_list_to_object)(number_list_to_string); +// @dts-jest:pass -> (value: List) => object +R_chain(string_to_number_list_to_object, number_list_to_string); diff --git a/snapshots/clamp.ts b/snapshots/clamp.ts new file mode 100644 index 0000000..8e73fae --- /dev/null +++ b/snapshots/clamp.ts @@ -0,0 +1,10 @@ +import * as R_clamp from '../ramda/dist/src/clamp'; + +declare const number: number; + +// @dts-jest:pass -> (value: number) => number +R_clamp(number, number); +// @dts-jest:pass -> (value: number) => number +R_clamp(number)(number); +// @dts-jest:pass -> number +R_clamp(number, number, number); diff --git a/snapshots/clone.ts b/snapshots/clone.ts new file mode 100644 index 0000000..906d7e9 --- /dev/null +++ b/snapshots/clone.ts @@ -0,0 +1,10 @@ +import { List } from '../ramda/dist/src/$types'; +import * as R_clone from '../ramda/dist/src/clone'; + +declare const number: number; +declare const string_list: List; + +// @dts-jest:pass -> number +R_clone(number); +// @dts-jest:pass -> List +R_clone(string_list); diff --git a/snapshots/comparator.ts b/snapshots/comparator.ts new file mode 100644 index 0000000..26ce754 --- /dev/null +++ b/snapshots/comparator.ts @@ -0,0 +1,6 @@ +import * as R_comparator from '../ramda/dist/src/comparator'; + +declare const string_string_to_boolean: (a: string, b: string) => boolean; + +// @dts-jest:pass -> (a: string, b: string) => number +R_comparator(string_string_to_boolean); diff --git a/snapshots/complement.ts b/snapshots/complement.ts new file mode 100644 index 0000000..eb7a59d --- /dev/null +++ b/snapshots/complement.ts @@ -0,0 +1,9 @@ +import * as R_complement from '../ramda/dist/src/complement'; + +declare const string: string; +declare const string_string_to_boolean: (a: string, b: string) => boolean; + +// @dts-jest:pass -> (...args: any[]) => boolean +R_complement(string_string_to_boolean); +// @dts-jest:pass -> boolean +R_complement(string_string_to_boolean)(string, string); diff --git a/snapshots/compose.ts b/snapshots/compose.ts new file mode 100644 index 0000000..bea922a --- /dev/null +++ b/snapshots/compose.ts @@ -0,0 +1,83 @@ +import * as R_compose from '../ramda/dist/src/compose'; + +declare const boolean_to_number: (x: boolean) => number; +declare const boolean_to_string: (x: boolean) => string; +declare const number_to_boolean: (x: number) => boolean; +declare const number_to_string: (x: number) => string; +declare const string_to_boolean: (x: string) => boolean; +declare const string_to_number: (x: string) => number; + +declare const a_b_c_d_e_f_to_any: ( + a: null, + b: undefined, + c: boolean, + d: number, + e: string, + f: object, +) => any; + +// @dts-jest:pass -> (v1: boolean) => number +R_compose(boolean_to_number); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => any +R_compose(a_b_c_d_e_f_to_any); + +// @dts-jest:pass -> (v1: string) => number +R_compose(boolean_to_number, string_to_boolean); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => number +R_compose(boolean_to_number, a_b_c_d_e_f_to_any); + +// @dts-jest:pass -> (v1: number) => number +R_compose(boolean_to_number, string_to_boolean, number_to_string); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => number +R_compose(boolean_to_number, string_to_boolean, a_b_c_d_e_f_to_any); + +// @dts-jest:pass -> (v1: string) => number +R_compose( + boolean_to_number, + string_to_boolean, + number_to_string, + string_to_number, +); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => number +R_compose( + boolean_to_number, + string_to_boolean, + number_to_string, + a_b_c_d_e_f_to_any, +); + +// @dts-jest:pass -> (v1: boolean) => number +R_compose( + boolean_to_number, + string_to_boolean, + number_to_string, + string_to_number, + boolean_to_string, +); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => number +R_compose( + boolean_to_number, + string_to_boolean, + number_to_string, + string_to_number, + a_b_c_d_e_f_to_any, +); + +// @dts-jest:pass -> (v1: number) => number +R_compose( + boolean_to_number, + string_to_boolean, + number_to_string, + string_to_number, + boolean_to_string, + number_to_boolean, +); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => number +R_compose( + boolean_to_number, + string_to_boolean, + number_to_string, + string_to_number, + boolean_to_string, + a_b_c_d_e_f_to_any, +); diff --git a/snapshots/composeK.ts b/snapshots/composeK.ts new file mode 100644 index 0000000..b75749d --- /dev/null +++ b/snapshots/composeK.ts @@ -0,0 +1,52 @@ +import { Chain } from '../ramda/dist/src/$types'; +import * as R_composeK from '../ramda/dist/src/composeK'; + +declare const chain_boolean_to_chain_number: ( + x: Chain, +) => Chain; +declare const chain_boolean_to_chain_string: ( + x: Chain, +) => Chain; +declare const chain_number_to_chain_boolean: ( + x: Chain, +) => Chain; +declare const chain_number_to_chain_string: (x: Chain) => Chain; +declare const chain_string_to_chain_boolean: ( + x: Chain, +) => Chain; +declare const chain_string_to_chain_number: (x: Chain) => Chain; + +// @dts-jest:pass -> (v1: Chain) => Chain +R_composeK(chain_boolean_to_chain_number); +// @dts-jest:pass -> (v1: Chain) => Chain +R_composeK(chain_boolean_to_chain_number, chain_string_to_chain_boolean); +// @dts-jest:pass -> (v1: Chain) => Chain +R_composeK( + chain_boolean_to_chain_number, + chain_string_to_chain_boolean, + chain_number_to_chain_string, +); +// @dts-jest:pass -> (v1: Chain) => Chain +R_composeK( + chain_boolean_to_chain_number, + chain_string_to_chain_boolean, + chain_number_to_chain_string, + chain_string_to_chain_number, +); +// @dts-jest:pass -> (v1: Chain) => Chain +R_composeK( + chain_boolean_to_chain_number, + chain_string_to_chain_boolean, + chain_number_to_chain_string, + chain_string_to_chain_number, + chain_boolean_to_chain_string, +); +// @dts-jest:pass -> (v1: Chain) => Chain +R_composeK( + chain_boolean_to_chain_number, + chain_string_to_chain_boolean, + chain_number_to_chain_string, + chain_string_to_chain_number, + chain_boolean_to_chain_string, + chain_number_to_chain_boolean, +); diff --git a/snapshots/composeP.ts b/snapshots/composeP.ts new file mode 100644 index 0000000..fc1f100 --- /dev/null +++ b/snapshots/composeP.ts @@ -0,0 +1,91 @@ +import * as R_composeP from '../ramda/dist/src/composeP'; + +declare const boolean_to_number_promise: (x: boolean) => Promise; +declare const boolean_to_string_promise: (x: boolean) => Promise; +declare const number_to_boolean_promise: (x: number) => Promise; +declare const number_to_string_promise: (x: number) => Promise; +declare const string_to_boolean_promise: (x: string) => Promise; +declare const string_to_number_promise: (x: string) => Promise; + +declare const a_b_c_d_e_f_to_any_promise: ( + a: null, + b: undefined, + c: boolean, + d: number, + e: string, + f: object, +) => Promise; + +// @dts-jest:pass -> (v1: boolean) => PromiseLike +R_composeP(boolean_to_number_promise); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike +R_composeP(a_b_c_d_e_f_to_any_promise); + +// @dts-jest:pass -> (v1: string) => PromiseLike +R_composeP(boolean_to_number_promise, string_to_boolean_promise); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike +R_composeP(boolean_to_number_promise, a_b_c_d_e_f_to_any_promise); + +// @dts-jest:pass -> (v1: number) => PromiseLike +R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + number_to_string_promise, +); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike +R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + a_b_c_d_e_f_to_any_promise, +); + +// @dts-jest:pass -> (v1: string) => PromiseLike +R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + number_to_string_promise, + string_to_number_promise, +); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike +R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + number_to_string_promise, + a_b_c_d_e_f_to_any_promise, +); + +// @dts-jest:pass -> (v1: boolean) => PromiseLike +R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + number_to_string_promise, + string_to_number_promise, + boolean_to_string_promise, +); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike +R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + number_to_string_promise, + string_to_number_promise, + a_b_c_d_e_f_to_any_promise, +); + +// @dts-jest:pass -> (v1: number) => PromiseLike +R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + number_to_string_promise, + string_to_number_promise, + boolean_to_string_promise, + number_to_boolean_promise, +); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike +R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + number_to_string_promise, + string_to_number_promise, + boolean_to_string_promise, + a_b_c_d_e_f_to_any_promise, +); diff --git a/snapshots/concat.ts b/snapshots/concat.ts new file mode 100644 index 0000000..be532ae --- /dev/null +++ b/snapshots/concat.ts @@ -0,0 +1,16 @@ +import { List } from '../ramda/dist/src/$types'; +import * as R_concat from '../ramda/dist/src/concat'; + +declare const string: string; +declare const object_array: object[]; +declare const number_array: number[]; +declare const number_list: List; + +// @dts-jest:pass -> string +R_concat(string, string); +// @dts-jest:pass -> number[] +R_concat(number_array, number_array); +// @dts-jest:pass -> (number | object)[] +R_concat(object_array, number_array); +// @dts-jest:fail -> Argument of type 'List' is not assignable to parameter of type 'string | number[]'. +R_concat(number_list, number_list); diff --git a/snapshots/cond.ts b/snapshots/cond.ts new file mode 100644 index 0000000..a73a033 --- /dev/null +++ b/snapshots/cond.ts @@ -0,0 +1,25 @@ +import { Morphism } from '../ramda/dist/src/$types'; +import * as R_cond from '../ramda/dist/src/cond'; + +declare const string_number_to_boolean: (a: string, b: number) => boolean; +declare const string_to_boolean: Morphism; +declare const string_to_number: Morphism; +declare const string_boolean_to_number: (a: string, b: boolean) => number; + +// @dts-jest:pass -> (v1: string) => number +R_cond([ + [string_to_boolean, string_to_number], + [string_to_boolean, string_to_number], +]); + +// @dts-jest:pass -> (v1: string, v2: number) => number +R_cond([ + [string_to_boolean, string_to_number], + [string_number_to_boolean, string_to_number], +]); + +// @dts-jest:fail -> Argument of type '([(a: string, b: number) => boolean, Morphism] | [Morphism, (a: ...' is not assignable to parameter of type '[(v1: string, v2: number, v3: {}, v4: {}, v5: {}, v6: {}) => boolean, (v1: string, v2: number, v3...'. +R_cond([ + [string_to_boolean, string_boolean_to_number], + [string_number_to_boolean, string_to_number], +]); diff --git a/snapshots/construct.ts b/snapshots/construct.ts new file mode 100644 index 0000000..436d4e0 --- /dev/null +++ b/snapshots/construct.ts @@ -0,0 +1,26 @@ +import * as R_construct from '../ramda/dist/src/construct'; + +declare const new_string_to_object: new (x: string) => object; +declare const new_number_boolean_to_string: new ( + x: number, + y: boolean, +) => string; +declare const new_number_args_to_boolean: new (...args: number[]) => boolean; +declare const new_7_string_to_number: new ( + v1: string, + v2: string, + v3: string, + v4: string, + v5: string, + v6: string, + v7: string, +) => number; + +// @dts-jest:pass -> CurriedFunction1 +R_construct(new_string_to_object); +// @dts-jest:pass -> CurriedFunction2 +R_construct(new_number_boolean_to_string); +// @dts-jest:pass -> () => boolean +R_construct(new_number_args_to_boolean); +// @dts-jest:pass -> (...args: any[]) => number +R_construct(new_7_string_to_number); diff --git a/snapshots/constructN.ts b/snapshots/constructN.ts new file mode 100644 index 0000000..7081036 --- /dev/null +++ b/snapshots/constructN.ts @@ -0,0 +1,26 @@ +import * as R_constructN from '../ramda/dist/src/constructN'; + +declare const new_string_to_object: new (x: string) => object; +declare const new_number_boolean_to_string: new ( + x: number, + y: boolean, +) => string; +declare const new_number_args_to_boolean: new (...args: number[]) => boolean; +declare const new_7_string_to_number: new ( + v1: string, + v2: string, + v3: string, + v4: string, + v5: string, + v6: string, + v7: string, +) => number; + +// @dts-jest:pass -> () => object +R_constructN(0, new_string_to_object); +// @dts-jest:pass -> CurriedFunction1 +R_constructN(1, new_number_boolean_to_string); +// @dts-jest:pass -> CurriedFunction4 +R_constructN(4, new_number_args_to_boolean); +// @dts-jest:pass -> (...args: any[]) => number +R_constructN(7, new_7_string_to_number); diff --git a/snapshots/contains.ts b/snapshots/contains.ts new file mode 100644 index 0000000..b54bebc --- /dev/null +++ b/snapshots/contains.ts @@ -0,0 +1,11 @@ +import * as R_contains from '../ramda/dist/src/contains'; + +declare const string: string; +declare const string_array: string[]; + +// @dts-jest:pass -> (list: string[] | ArrayLike) => boolean +R_contains(string); +// @dts-jest:pass -> boolean +R_contains(string, string); +// @dts-jest:pass -> boolean +R_contains(string, string_array); diff --git a/snapshots/converge.ts b/snapshots/converge.ts new file mode 100644 index 0000000..5df47b9 --- /dev/null +++ b/snapshots/converge.ts @@ -0,0 +1,33 @@ +import * as R_converge from '../ramda/dist/src/converge'; + +declare const any_args_to_object: (...args: any[]) => object; +declare const string_number_boolean_to_object: ( + x: string, + y: number, + z: boolean, +) => object; +declare const string_to_boolean: (x: string) => boolean; +declare const string_to_number: (x: string) => number; +declare const string_to_string: (x: string) => string; + +// @dts-jest:pass -> (fns: [(v1: T1) => string, (v1: T1) => number, (v1: T1) => boolean]) => CurriedFunction1 +R_converge(string_number_boolean_to_object); +// @dts-jest:pass -> CurriedFunction1 +R_converge(string_number_boolean_to_object)([ + string_to_string, + string_to_number, + string_to_boolean, +]); +// @dts-jest:pass -> CurriedFunction1 +R_converge(string_number_boolean_to_object, [ + string_to_string, + string_to_number, + string_to_boolean, +]); + +// @dts-jest:pass -> (fns: [(v1: T1) => any]) => CurriedFunction1 +R_converge(any_args_to_object); +// @dts-jest:pass -> (fns: [(v1: T1, v2: T2) => any, (v1: T1, v2: T2) => any]) => CurriedFunction2 +R_converge<'1', 'i2f2'>()(any_args_to_object); +// @dts-jest:pass -> (fns: ((...args: any[]) => any)[] | ArrayLike<(...args: any[]) => any>) => (...args: any[]) => object +R_converge<'1', 'variadic'>()(any_args_to_object); diff --git a/snapshots/countBy.ts b/snapshots/countBy.ts new file mode 100644 index 0000000..dda46a5 --- /dev/null +++ b/snapshots/countBy.ts @@ -0,0 +1,10 @@ +import { Morphism } from '../ramda/dist/src/$types'; +import * as R_countBy from '../ramda/dist/src/countBy'; + +declare const object_to_string: Morphism; +declare const object_array: object[]; + +// @dts-jest:pass -> (list: object[] | ArrayLike) => Dictionary +R_countBy(object_to_string); +// @dts-jest:pass -> Dictionary +R_countBy(object_to_string, object_array); diff --git a/snapshots/curry.ts b/snapshots/curry.ts new file mode 100644 index 0000000..cc1a718 --- /dev/null +++ b/snapshots/curry.ts @@ -0,0 +1,23 @@ +import * as R_curry from '../ramda/dist/src/curry'; + +declare const string_to_object: (x: string) => object; +declare const number_boolean_to_string: (x: number, y: boolean) => string; +declare const number_args_to_boolean: (...args: number[]) => boolean; +declare const seven_string_to_number: ( + v1: string, + v2: string, + v3: string, + v4: string, + v5: string, + v6: string, + v7: string, +) => number; + +// @dts-jest:pass -> CurriedFunction1 +R_curry(string_to_object); +// @dts-jest:pass -> CurriedFunction2 +R_curry(number_boolean_to_string); +// @dts-jest:pass -> () => boolean +R_curry(number_args_to_boolean); +// @dts-jest:pass -> (...args: any[]) => number +R_curry(seven_string_to_number); diff --git a/snapshots/curryN.ts b/snapshots/curryN.ts new file mode 100644 index 0000000..d186f52 --- /dev/null +++ b/snapshots/curryN.ts @@ -0,0 +1,23 @@ +import * as R_curryN from '../ramda/dist/src/curryN'; + +declare const string_to_object: (x: string) => object; +declare const number_boolean_to_string: (x: number, y: boolean) => string; +declare const number_args_to_boolean: (...args: number[]) => boolean; +declare const seven_string_to_number: ( + v1: string, + v2: string, + v3: string, + v4: string, + v5: string, + v6: string, + v7: string, +) => number; + +// @dts-jest:pass -> () => object +R_curryN(0, string_to_object); +// @dts-jest:pass -> CurriedFunction1 +R_curryN(1, number_boolean_to_string); +// @dts-jest:pass -> CurriedFunction4 +R_curryN(4, number_args_to_boolean); +// @dts-jest:pass -> (...args: any[]) => number +R_curryN(7, seven_string_to_number); diff --git a/snapshots/dec.ts b/snapshots/dec.ts new file mode 100644 index 0000000..1005a6d --- /dev/null +++ b/snapshots/dec.ts @@ -0,0 +1,6 @@ +import * as R_dec from '../ramda/dist/src/dec'; + +declare const number: number; + +// @dts-jest:pass -> number +R_dec(number); diff --git a/snapshots/defaultTo.ts b/snapshots/defaultTo.ts new file mode 100644 index 0000000..1169e8e --- /dev/null +++ b/snapshots/defaultTo.ts @@ -0,0 +1,13 @@ +import * as R_defaultTo from '../ramda/dist/src/defaultTo'; + +declare const string: string; +declare const number_or_undefined: number | undefined; + +// @dts-jest:pass -> string +R_defaultTo(string)(undefined); +// @dts-jest:pass -> string +R_defaultTo(string, undefined); +// @dts-jest:pass -> string | number +R_defaultTo(string)(number_or_undefined); +// @dts-jest:pass -> string | number +R_defaultTo(string, number_or_undefined); diff --git a/snapshots/descend.ts b/snapshots/descend.ts new file mode 100644 index 0000000..f6ea1af --- /dev/null +++ b/snapshots/descend.ts @@ -0,0 +1,13 @@ +import { Morphism, Ordered } from '../ramda/dist/src/$types'; +import * as R_descend from '../ramda/dist/src/descend'; + +declare const get_order_from_object: Morphism; +declare const object_a: object; +declare const object_b: object; + +// @dts-jest:pass -> number +R_descend(get_order_from_object)(object_a)(object_b); +// @dts-jest:pass -> number +R_descend(get_order_from_object, object_a)(object_b); +// @dts-jest:pass -> number +R_descend(get_order_from_object, object_a, object_b); diff --git a/snapshots/difference.ts b/snapshots/difference.ts new file mode 100644 index 0000000..7ee1d9d --- /dev/null +++ b/snapshots/difference.ts @@ -0,0 +1,8 @@ +import * as R_difference from '../ramda/dist/src/difference'; + +declare const number_array: number[]; + +// @dts-jest:pass -> (b: number[] | ArrayLike) => number[] +R_difference(number_array); +// @dts-jest:pass -> number[] +R_difference(number_array, number_array); diff --git a/snapshots/differenceWith.ts b/snapshots/differenceWith.ts new file mode 100644 index 0000000..c254e9b --- /dev/null +++ b/snapshots/differenceWith.ts @@ -0,0 +1,9 @@ +import * as R_differenceWith from '../ramda/dist/src/differenceWith'; + +declare const number_number_to_boolean: (a: number, b: number) => boolean; +declare const number_array: number[]; + +// @dts-jest:pass -> (b: number[] | ArrayLike) => number[] +R_differenceWith(number_number_to_boolean, number_array); +// @dts-jest:pass -> number[] +R_differenceWith(number_number_to_boolean, number_array, number_array); diff --git a/snapshots/dissoc.ts b/snapshots/dissoc.ts new file mode 100644 index 0000000..8807688 --- /dev/null +++ b/snapshots/dissoc.ts @@ -0,0 +1,19 @@ +import * as R_dissoc from '../ramda/dist/src/dissoc'; + +declare const string_property: string; +declare const object: object; +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; + +// @dts-jest:pass -> Pick +R_dissoc(string_property, object); +// @dts-jest:pass -> Pick +R_dissoc(string_property)(object); + +// @dts-jest:pass -> Pick<{ a: 1; b: 2; c: 3; }, "b" | "c"> +R_dissoc('a', a_1_b_2_c_3); +// @dts-jest:pass -> Pick<{ a: 1; b: 2; c: 3; }, "b" | "c"> +R_dissoc('a')(a_1_b_2_c_3); diff --git a/snapshots/dissocPath.ts b/snapshots/dissocPath.ts new file mode 100644 index 0000000..b2fa6ee --- /dev/null +++ b/snapshots/dissocPath.ts @@ -0,0 +1,16 @@ +import { Path } from '../ramda/dist/src/$types'; +import * as R_dissocPath from '../ramda/dist/src/dissocPath'; + +declare const path: Path; +declare const object: object; +declare const a_b_c_d_e: { a: { b: { c: { d: { e: number } } } } }; + +// @dts-jest:pass -> object +R_dissocPath(path, object); +// @dts-jest:pass -> object +R_dissocPath(path)(object); + +// @dts-jest:pass -> { a?: DeepPartial | undefined; } +R_dissocPath(path, a_b_c_d_e); +// @dts-jest:pass -> { a?: DeepPartial | undefined; } +R_dissocPath(path)(a_b_c_d_e); diff --git a/snapshots/divide.ts b/snapshots/divide.ts new file mode 100644 index 0000000..b54a74e --- /dev/null +++ b/snapshots/divide.ts @@ -0,0 +1,8 @@ +import * as R_divide from '../ramda/dist/src/divide'; + +declare const number: number; + +// @dts-jest:pass -> number +R_divide(number, number); +// @dts-jest:pass -> number +R_divide(number)(number); diff --git a/snapshots/drop.ts b/snapshots/drop.ts new file mode 100644 index 0000000..6e3ebe4 --- /dev/null +++ b/snapshots/drop.ts @@ -0,0 +1,10 @@ +import * as R_drop from '../ramda/dist/src/drop'; + +declare const number: number; +declare const string: string; +declare const boolean_array: boolean[]; + +// @dts-jest:pass -> string +R_drop(number, string); +// @dts-jest:pass -> boolean[] +R_drop(number, boolean_array); diff --git a/snapshots/dropLast.ts b/snapshots/dropLast.ts new file mode 100644 index 0000000..e024706 --- /dev/null +++ b/snapshots/dropLast.ts @@ -0,0 +1,10 @@ +import * as R_dropLast from '../ramda/dist/src/dropLast'; + +declare const number: number; +declare const string: string; +declare const boolean_array: boolean[]; + +// @dts-jest:pass -> string +R_dropLast(number, string); +// @dts-jest:pass -> boolean[] +R_dropLast(number, boolean_array); diff --git a/snapshots/dropLastWhile.ts b/snapshots/dropLastWhile.ts new file mode 100644 index 0000000..e1dd274 --- /dev/null +++ b/snapshots/dropLastWhile.ts @@ -0,0 +1,9 @@ +import * as R_dropLastWhile from '../ramda/dist/src/dropLastWhile'; + +declare const string_to_boolean: (x: string) => boolean; +declare const string_array: string[]; + +// @dts-jest:pass -> (list: string[] | ArrayLike) => string[] +R_dropLastWhile(string_to_boolean); +// @dts-jest:pass -> string[] +R_dropLastWhile(string_to_boolean, string_array); diff --git a/snapshots/dropRepeats.ts b/snapshots/dropRepeats.ts new file mode 100644 index 0000000..25b709b --- /dev/null +++ b/snapshots/dropRepeats.ts @@ -0,0 +1,6 @@ +import * as R_dropRepeats from '../ramda/dist/src/dropRepeats'; + +declare const string_array: string[]; + +// @dts-jest:pass -> string[] +R_dropRepeats(string_array); diff --git a/snapshots/dropRepeatsWith.ts b/snapshots/dropRepeatsWith.ts new file mode 100644 index 0000000..379e497 --- /dev/null +++ b/snapshots/dropRepeatsWith.ts @@ -0,0 +1,11 @@ +import * as R_dropRepeatsWith from '../ramda/dist/src/dropRepeatsWith'; + +declare const string_to_number: (x: string) => number; +declare const string_array: string[]; + +// @dts-jest:pass -> (list: string[] | ArrayLike) => string[] +R_dropRepeatsWith(string_to_number); +// @dts-jest:pass -> string[] +R_dropRepeatsWith(string_to_number)(string_array); +// @dts-jest:pass -> string[] +R_dropRepeatsWith(string_to_number, string_array); diff --git a/snapshots/dropWhile.ts b/snapshots/dropWhile.ts new file mode 100644 index 0000000..e9946e2 --- /dev/null +++ b/snapshots/dropWhile.ts @@ -0,0 +1,9 @@ +import * as R_dropWhile from '../ramda/dist/src/dropWhile'; + +declare const string_to_boolean: (x: string) => boolean; +declare const string_array: string[]; + +// @dts-jest:pass -> (list: string[] | ArrayLike) => string[] +R_dropWhile(string_to_boolean); +// @dts-jest:pass -> string[] +R_dropWhile(string_to_boolean, string_array); diff --git a/snapshots/either.ts b/snapshots/either.ts new file mode 100644 index 0000000..e700a96 --- /dev/null +++ b/snapshots/either.ts @@ -0,0 +1,9 @@ +import { Predicate } from '../ramda/dist/src/$types'; +import * as R_either from '../ramda/dist/src/either'; + +declare const string_predicate: Predicate; + +// @dts-jest:pass -> (fn2: (value: string) => boolean) => (value: string) => boolean +R_either(string_predicate); +// @dts-jest:pass -> (value: string) => boolean +R_either(string_predicate, string_predicate); diff --git a/snapshots/empty.ts b/snapshots/empty.ts new file mode 100644 index 0000000..4cfac59 --- /dev/null +++ b/snapshots/empty.ts @@ -0,0 +1,12 @@ +import * as R_empty from '../ramda/dist/src/empty'; + +declare const object: object; +declare const string: string; +declare const string_array: string[]; + +// @dts-jest:pass -> {} +R_empty(object); +// @dts-jest:pass -> string +R_empty(string); +// @dts-jest:pass -> string[] +R_empty(string_array); diff --git a/snapshots/endsWith.ts b/snapshots/endsWith.ts new file mode 100644 index 0000000..5345197 --- /dev/null +++ b/snapshots/endsWith.ts @@ -0,0 +1,13 @@ +import * as R_endsWith from '../ramda/dist/src/endsWith'; + +declare const string: string; +declare const boolean_array: boolean[]; + +// @dts-jest:pass -> (list: string) => boolean +R_endsWith(string); +// @dts-jest:pass -> boolean +R_endsWith(string, string); +// @dts-jest:pass -> (list: boolean[]) => boolean +R_endsWith(boolean_array); +// @dts-jest:pass -> boolean +R_endsWith(boolean_array, boolean_array); diff --git a/snapshots/eqBy.ts b/snapshots/eqBy.ts new file mode 100644 index 0000000..313f9b2 --- /dev/null +++ b/snapshots/eqBy.ts @@ -0,0 +1,11 @@ +import * as R_eqBy from '../ramda/dist/src/eqBy'; + +declare const string_to_number: (x: string) => number; +declare const string: string; + +// @dts-jest:pass -> (b: string) => boolean +R_eqBy(string_to_number, string); +// @dts-jest:pass -> boolean +R_eqBy(string_to_number)(string)(string); +// @dts-jest:pass -> boolean +R_eqBy(string_to_number, string, string); diff --git a/snapshots/eqProps.ts b/snapshots/eqProps.ts new file mode 100644 index 0000000..afd264d --- /dev/null +++ b/snapshots/eqProps.ts @@ -0,0 +1,12 @@ +import { Property } from '../ramda/dist/src/$types'; +import * as R_eqProps from '../ramda/dist/src/eqProps'; + +declare const property: Property; +declare const string: string; + +// @dts-jest:pass -> (b: string) => boolean +R_eqProps(property, string); +// @dts-jest:pass -> boolean +R_eqProps(property)(string, string); +// @dts-jest:pass -> boolean +R_eqProps(property, string, string); diff --git a/snapshots/equals.ts b/snapshots/equals.ts new file mode 100644 index 0000000..e03ff71 --- /dev/null +++ b/snapshots/equals.ts @@ -0,0 +1,10 @@ +import * as R_equals from '../ramda/dist/src/equals'; + +declare const string: string; + +// @dts-jest:pass -> (b: string) => boolean +R_equals(string); +// @dts-jest:pass -> boolean +R_equals(string)(string); +// @dts-jest:pass -> boolean +R_equals(string, string); diff --git a/snapshots/evolve.ts b/snapshots/evolve.ts new file mode 100644 index 0000000..cb4b23f --- /dev/null +++ b/snapshots/evolve.ts @@ -0,0 +1,13 @@ +import { Morphism } from '../ramda/dist/src/$types'; +import * as R_evolve from '../ramda/dist/src/evolve'; + +declare const a_1_b_2_c_3: { a: 1; b: 2; c: 3 }; +declare const a_b_number_to_number: { + a: Morphism; + b: Morphism; +}; + +// @dts-jest:pass -> { a: 1; b: 2; c: 3; } +R_evolve(a_b_number_to_number)(a_1_b_2_c_3); +// @dts-jest:pass -> { a: 1; b: 2; c: 3; } +R_evolve(a_b_number_to_number, a_1_b_2_c_3); diff --git a/snapshots/filter.ts b/snapshots/filter.ts new file mode 100644 index 0000000..794ee07 --- /dev/null +++ b/snapshots/filter.ts @@ -0,0 +1,22 @@ +import { Dictionary, Filterable, Predicate } from '../ramda/dist/src/$types'; +import * as R_filter from '../ramda/dist/src/filter'; + +declare const string_predicate: Predicate; +declare const string_array: string[]; +declare const string_dictionary: Dictionary; +declare const string_filterable: Filterable; + +// @dts-jest:pass -> string[] +R_filter(string_predicate, string_array); +// @dts-jest:pass -> string[] +R_filter(string_predicate)(string_array); + +// @dts-jest:pass -> Partial> +R_filter(string_predicate, string_dictionary); +// @dts-jest:pass -> Partial> +R_filter(string_predicate)(string_dictionary); + +// @dts-jest:pass -> Filterable +R_filter(string_predicate, string_filterable); +// @dts-jest:pass -> Filterable +R_filter(string_predicate)(string_filterable); diff --git a/snapshots/find.ts b/snapshots/find.ts new file mode 100644 index 0000000..9c7c6ab --- /dev/null +++ b/snapshots/find.ts @@ -0,0 +1,12 @@ +import { Predicate } from '../ramda/dist/src/$types'; +import * as R_find from '../ramda/dist/src/find'; + +declare const string_predicate: Predicate; +declare const string_array: string[]; + +// @dts-jest:pass -> (list: string[] | ArrayLike) => string | undefined +R_find(string_predicate); +// @dts-jest:pass -> string | undefined +R_find(string_predicate)(string_array); +// @dts-jest:pass -> string | undefined +R_find(string_predicate, string_array); diff --git a/snapshots/findIndex.ts b/snapshots/findIndex.ts new file mode 100644 index 0000000..682c5a4 --- /dev/null +++ b/snapshots/findIndex.ts @@ -0,0 +1,12 @@ +import { Predicate } from '../ramda/dist/src/$types'; +import * as R_findIndex from '../ramda/dist/src/findIndex'; + +declare const string_predicate: Predicate; +declare const string_array: string[]; + +// @dts-jest:pass -> (list: string[] | ArrayLike) => number +R_findIndex(string_predicate); +// @dts-jest:pass -> number +R_findIndex(string_predicate)(string_array); +// @dts-jest:pass -> number +R_findIndex(string_predicate, string_array); diff --git a/snapshots/findLast.ts b/snapshots/findLast.ts new file mode 100644 index 0000000..3968ba1 --- /dev/null +++ b/snapshots/findLast.ts @@ -0,0 +1,12 @@ +import { Predicate } from '../ramda/dist/src/$types'; +import * as R_findLast from '../ramda/dist/src/findLast'; + +declare const string_predicate: Predicate; +declare const string_array: string[]; + +// @dts-jest:pass -> (list: string[] | ArrayLike) => string | undefined +R_findLast(string_predicate); +// @dts-jest:pass -> string | undefined +R_findLast(string_predicate)(string_array); +// @dts-jest:pass -> string | undefined +R_findLast(string_predicate, string_array); diff --git a/snapshots/findLastIndex.ts b/snapshots/findLastIndex.ts new file mode 100644 index 0000000..35d7c37 --- /dev/null +++ b/snapshots/findLastIndex.ts @@ -0,0 +1,12 @@ +import { Predicate } from '../ramda/dist/src/$types'; +import * as R_findLastIndex from '../ramda/dist/src/findLastIndex'; + +declare const string_predicate: Predicate; +declare const string_array: string[]; + +// @dts-jest:pass -> (list: string[] | ArrayLike) => number +R_findLastIndex(string_predicate); +// @dts-jest:pass -> number +R_findLastIndex(string_predicate)(string_array); +// @dts-jest:pass -> number +R_findLastIndex(string_predicate, string_array); diff --git a/snapshots/flatten.ts b/snapshots/flatten.ts new file mode 100644 index 0000000..b3532e3 --- /dev/null +++ b/snapshots/flatten.ts @@ -0,0 +1,10 @@ +import { NestedList } from '../ramda/dist/src/$types'; +import * as R_flatten from '../ramda/dist/src/flatten'; + +declare const string_array: string[]; +declare const nested_object_list: NestedList; + +// @dts-jest:pass -> string[] +R_flatten(string_array); +// @dts-jest:pass -> object[] +R_flatten(nested_object_list); diff --git a/snapshots/flip.ts b/snapshots/flip.ts new file mode 100644 index 0000000..bb0d417 --- /dev/null +++ b/snapshots/flip.ts @@ -0,0 +1,23 @@ +import * as R_flip from '../ramda/dist/src/flip'; + +declare const string_number_to_object: (x: string, y: number) => object; +declare const number_boolean_to_string: (x: number, y: boolean) => string; +declare const number_args_to_boolean: (...args: number[]) => boolean; +declare const seven_string_to_number: ( + v1: string, + v2: string, + v3: string, + v4: string, + v5: string, + v6: string, + v7: string, +) => number; + +// @dts-jest:pass -> CurriedFunction2 +R_flip(string_number_to_object); +// @dts-jest:pass -> CurriedFunction2 +R_flip(number_boolean_to_string); +// @dts-jest:pass -> CurriedFunction2 +R_flip(number_args_to_boolean); +// @dts-jest:pass -> (v2: string, v1: string, ...args: any[]) => number +R_flip(seven_string_to_number); diff --git a/snapshots/forEach.ts b/snapshots/forEach.ts new file mode 100644 index 0000000..a24e95e --- /dev/null +++ b/snapshots/forEach.ts @@ -0,0 +1,12 @@ +import { List, Tap } from '../ramda/dist/src/$types'; +import * as R_forEach from '../ramda/dist/src/forEach'; + +declare const number_list: List; +declare const number_tap: Tap; + +// @dts-jest:pass -> >(list: U) => U +R_forEach(number_tap); +// @dts-jest:pass -> List +R_forEach(number_tap)(number_list); +// @dts-jest:pass -> List +R_forEach(number_tap, number_list); diff --git a/snapshots/forEachObjIndexed.ts b/snapshots/forEachObjIndexed.ts new file mode 100644 index 0000000..091316a --- /dev/null +++ b/snapshots/forEachObjIndexed.ts @@ -0,0 +1,15 @@ +import { Dictionary, KeyedObjectTap } from '../ramda/dist/src/$types'; +import * as R_forEachObjIndexed from '../ramda/dist/src/forEachObjIndexed'; + +declare const number_dictionary: Dictionary; +declare const keyed_number_dictionary_tap: KeyedObjectTap< + number, + Dictionary +>; + +// @dts-jest:pass -> (list: Dictionary) => Dictionary +R_forEachObjIndexed(keyed_number_dictionary_tap); +// @dts-jest:pass -> Dictionary +R_forEachObjIndexed(keyed_number_dictionary_tap)(number_dictionary); +// @dts-jest:pass -> Dictionary +R_forEachObjIndexed(keyed_number_dictionary_tap, number_dictionary); diff --git a/snapshots/fromPairs.ts b/snapshots/fromPairs.ts new file mode 100644 index 0000000..3fe4397 --- /dev/null +++ b/snapshots/fromPairs.ts @@ -0,0 +1,6 @@ +import * as R_fromPairs from '../ramda/dist/src/fromPairs'; + +declare const number_object_tuple: [number, object]; + +// @dts-jest:pass -> Dictionary +R_fromPairs([number_object_tuple]); diff --git a/snapshots/groupBy.ts b/snapshots/groupBy.ts new file mode 100644 index 0000000..cae96ad --- /dev/null +++ b/snapshots/groupBy.ts @@ -0,0 +1,11 @@ +import * as R_groupBy from '../ramda/dist/src/groupBy'; + +declare const object_to_string: (x: object) => string; +declare const object_array: object[]; + +// @dts-jest:pass -> (list: object[] | ArrayLike) => Dictionary +R_groupBy(object_to_string); +// @dts-jest:pass -> Dictionary +R_groupBy(object_to_string)(object_array); +// @dts-jest:pass -> Dictionary +R_groupBy(object_to_string, object_array); diff --git a/snapshots/groupWith.ts b/snapshots/groupWith.ts new file mode 100644 index 0000000..8819b50 --- /dev/null +++ b/snapshots/groupWith.ts @@ -0,0 +1,12 @@ +import * as R_groupWith from '../ramda/dist/src/groupWith'; + +declare const string_to_boolean: (x: string) => boolean; +declare const string_array: string[]; +declare const string: string; + +// @dts-jest:pass -> >(list: U) => U[] +R_groupWith(string_to_boolean); +// @dts-jest:pass -> string[] +R_groupWith(string_to_boolean, string); +// @dts-jest:pass -> string[][] +R_groupWith(string_to_boolean, string_array); diff --git a/snapshots/gt.ts b/snapshots/gt.ts new file mode 100644 index 0000000..169a2b7 --- /dev/null +++ b/snapshots/gt.ts @@ -0,0 +1,11 @@ +import * as R_gt from '../ramda/dist/src/gt'; + +declare const string: string; +declare const number: number; + +// @dts-jest:pass -> (b: string) => boolean +R_gt(string); +// @dts-jest:pass -> boolean +R_gt(string, string); +// @dts-jest:pass -> boolean +R_gt(number, number); diff --git a/snapshots/gte.ts b/snapshots/gte.ts new file mode 100644 index 0000000..0be12db --- /dev/null +++ b/snapshots/gte.ts @@ -0,0 +1,11 @@ +import * as R_gte from '../ramda/dist/src/gte'; + +declare const string: string; +declare const number: number; + +// @dts-jest:pass -> (b: string) => boolean +R_gte(string); +// @dts-jest:pass -> boolean +R_gte(string, string); +// @dts-jest:pass -> boolean +R_gte(number, number); diff --git a/snapshots/has.ts b/snapshots/has.ts new file mode 100644 index 0000000..e3d6f93 --- /dev/null +++ b/snapshots/has.ts @@ -0,0 +1,12 @@ +import { Property } from '../ramda/dist/src/$types'; +import * as R_has from '../ramda/dist/src/has'; + +declare const property: Property; +declare const object: object; + +// @dts-jest:pass -> (object: {}) => boolean +R_has(property); +// @dts-jest:pass -> boolean +R_has(property)(object); +// @dts-jest:pass -> boolean +R_has(property, object); diff --git a/snapshots/hasIn.ts b/snapshots/hasIn.ts new file mode 100644 index 0000000..8c23158 --- /dev/null +++ b/snapshots/hasIn.ts @@ -0,0 +1,12 @@ +import { Property } from '../ramda/dist/src/$types'; +import * as R_hasIn from '../ramda/dist/src/hasIn'; + +declare const property: Property; +declare const object: object; + +// @dts-jest:pass -> (object: {}) => boolean +R_hasIn(property); +// @dts-jest:pass -> boolean +R_hasIn(property)(object); +// @dts-jest:pass -> boolean +R_hasIn(property, object); diff --git a/snapshots/head.ts b/snapshots/head.ts new file mode 100644 index 0000000..3c1bb07 --- /dev/null +++ b/snapshots/head.ts @@ -0,0 +1,18 @@ +import * as R_head from '../ramda/dist/src/head'; + +declare const string: string; +declare const string_array: string[]; +declare const number_array: number[]; +declare const string_number_tuple: [string, number]; +declare const number_boolean_object_tuple: [number, boolean, object]; + +// @dts-jest:pass -> string +R_head(string); +// @dts-jest:pass -> string | undefined +R_head(string_array); +// @dts-jest:pass -> number | undefined +R_head(number_array); +// @dts-jest:pass -> string +R_head(string_number_tuple); +// @dts-jest:pass -> number +R_head(number_boolean_object_tuple); diff --git a/snapshots/identical.ts b/snapshots/identical.ts new file mode 100644 index 0000000..ec754fb --- /dev/null +++ b/snapshots/identical.ts @@ -0,0 +1,10 @@ +import * as R_identical from '../ramda/dist/src/identical'; + +declare const string: string; + +// @dts-jest:pass -> (b: string) => boolean +R_identical(string); +// @dts-jest:pass -> boolean +R_identical(string)(string); +// @dts-jest:pass -> boolean +R_identical(string, string); diff --git a/snapshots/identity.ts b/snapshots/identity.ts new file mode 100644 index 0000000..3260bf1 --- /dev/null +++ b/snapshots/identity.ts @@ -0,0 +1,9 @@ +import * as R_identity from '../ramda/dist/src/identity'; + +declare const string: string; +declare const number: number; + +// @dts-jest:pass -> string +R_identity(string); +// @dts-jest:pass -> number +R_identity(number); diff --git a/snapshots/ifElse.ts b/snapshots/ifElse.ts new file mode 100644 index 0000000..4d961cc --- /dev/null +++ b/snapshots/ifElse.ts @@ -0,0 +1,12 @@ +import * as R_ifElse from '../ramda/dist/src/ifElse'; + +declare const string_to_boolean: (x: string) => boolean; +declare const string_to_number: (x: string) => number; +declare const string_to_object: (x: string) => object; + +// @dts-jest:pass -> (onFalse: (value: string) => V) => (value: string) => number | V +R_ifElse(string_to_boolean, string_to_number); +// @dts-jest:pass -> (value: string) => number | object +R_ifElse(string_to_boolean, string_to_number, string_to_object); +// @dts-jest:pass -> (value: string) => number | object +R_ifElse(string_to_boolean)(string_to_number)(string_to_object); diff --git a/snapshots/inc.ts b/snapshots/inc.ts new file mode 100644 index 0000000..fb95d1a --- /dev/null +++ b/snapshots/inc.ts @@ -0,0 +1,6 @@ +import * as R_inc from '../ramda/dist/src/inc'; + +declare const number: number; + +// @dts-jest:pass -> number +R_inc(number); diff --git a/snapshots/indexBy.ts b/snapshots/indexBy.ts new file mode 100644 index 0000000..22cdce9 --- /dev/null +++ b/snapshots/indexBy.ts @@ -0,0 +1,11 @@ +import * as R_indexBy from '../ramda/dist/src/indexBy'; + +declare const object_to_string: (x: object) => string; +declare const object_array: object[]; + +// @dts-jest:pass -> (list: object[] | ArrayLike) => Dictionary +R_indexBy(object_to_string); +// @dts-jest:pass -> Dictionary +R_indexBy(object_to_string)(object_array); +// @dts-jest:pass -> Dictionary +R_indexBy(object_to_string, object_array); diff --git a/snapshots/indexOf.ts b/snapshots/indexOf.ts new file mode 100644 index 0000000..9ccc925 --- /dev/null +++ b/snapshots/indexOf.ts @@ -0,0 +1,11 @@ +import * as R_indexOf from '../ramda/dist/src/indexOf'; + +declare const string: string; +declare const string_array: string[]; + +// @dts-jest:pass -> (list: string[] | ArrayLike) => number +R_indexOf(string); +// @dts-jest:pass -> number +R_indexOf(string, string); +// @dts-jest:pass -> number +R_indexOf(string, string_array); diff --git a/snapshots/init.ts b/snapshots/init.ts new file mode 100644 index 0000000..f950f3f --- /dev/null +++ b/snapshots/init.ts @@ -0,0 +1,9 @@ +import * as R_init from '../ramda/dist/src/init'; + +declare const string: string; +declare const string_array: string[]; + +// @dts-jest:pass -> string +R_init(string); +// @dts-jest:pass -> string[] +R_init(string_array); diff --git a/snapshots/innerJoin.ts b/snapshots/innerJoin.ts new file mode 100644 index 0000000..a3f8f7f --- /dev/null +++ b/snapshots/innerJoin.ts @@ -0,0 +1,12 @@ +import * as R_innerJoin from '../ramda/dist/src/innerJoin'; + +declare const object_number_to_boolean: (x: object, y: number) => boolean; +declare const object_array: object[]; +declare const number_array: number[]; + +// @dts-jest:pass -> (ys: number[] | ArrayLike) => object[] +R_innerJoin(object_number_to_boolean, object_array); +// @dts-jest:pass -> object[] +R_innerJoin(object_number_to_boolean, object_array, number_array); +// @dts-jest:pass -> object[] +R_innerJoin(object_number_to_boolean)(object_array)(number_array); diff --git a/snapshots/insert.ts b/snapshots/insert.ts new file mode 100644 index 0000000..171ec0f --- /dev/null +++ b/snapshots/insert.ts @@ -0,0 +1,20 @@ +import * as R_insert from '../ramda/dist/src/insert'; + +declare const object: object; +declare const object_array: object[]; +declare const string: string; +declare const number: number; + +// @dts-jest:pass -> (list: U[] | ArrayLike) => (string | U)[] +R_insert(number, string); +// @dts-jest:pass -> (string | object)[] +R_insert(number, string, object_array); +// @dts-jest:pass -> (string | object)[] +R_insert(number)(string)(object_array); + +// @dts-jest:pass -> (list: U[] | ArrayLike) => (object | U)[] +R_insert(number, object); +// @dts-jest:pass -> object[] +R_insert(number, object, object_array); +// @dts-jest:pass -> object[] +R_insert(number)(object)(object_array); diff --git a/snapshots/insertAll.ts b/snapshots/insertAll.ts new file mode 100644 index 0000000..2b88ec3 --- /dev/null +++ b/snapshots/insertAll.ts @@ -0,0 +1,16 @@ +import * as R_insertAll from '../ramda/dist/src/insertAll'; + +declare const object_array: object[]; +declare const string_array: string[]; +declare const number: number; + +// @dts-jest:pass -> (list: U[] | ArrayLike) => (string | U)[] +R_insertAll(number, string_array); +// @dts-jest:pass -> (string | object)[] +R_insertAll(number, string_array, object_array); +// @dts-jest:pass -> (string | object)[] +R_insertAll(number)(string_array)(object_array); +// @dts-jest:pass -> string[] +R_insertAll(number, string_array, string_array); +// @dts-jest:pass -> string[] +R_insertAll(number)(string_array)(string_array); diff --git a/snapshots/intersection.ts b/snapshots/intersection.ts new file mode 100644 index 0000000..6dcedff --- /dev/null +++ b/snapshots/intersection.ts @@ -0,0 +1,8 @@ +import * as R_intersection from '../ramda/dist/src/intersection'; + +declare const number_array: number[]; + +// @dts-jest:pass -> (b: number[] | ArrayLike) => number[] +R_intersection(number_array); +// @dts-jest:pass -> number[] +R_intersection(number_array, number_array); diff --git a/snapshots/intersectionWith.ts b/snapshots/intersectionWith.ts new file mode 100644 index 0000000..8839b4b --- /dev/null +++ b/snapshots/intersectionWith.ts @@ -0,0 +1,9 @@ +import * as R_intersectionWith from '../ramda/dist/src/intersectionWith'; + +declare const number_number_to_boolean: (a: number, b: number) => boolean; +declare const number_array: number[]; + +// @dts-jest:pass -> (b: number[] | ArrayLike) => number[] +R_intersectionWith(number_number_to_boolean, number_array); +// @dts-jest:pass -> number[] +R_intersectionWith(number_number_to_boolean, number_array, number_array); diff --git a/snapshots/intersperse.ts b/snapshots/intersperse.ts new file mode 100644 index 0000000..f93104b --- /dev/null +++ b/snapshots/intersperse.ts @@ -0,0 +1,11 @@ +import * as R_intersperse from '../ramda/dist/src/intersperse'; + +declare const object_array: object[]; +declare const string: string; + +// @dts-jest:pass -> (list: U[] | ArrayLike) => (string | U)[] +R_intersperse(string); +// @dts-jest:pass -> (string | object)[] +R_intersperse(string, object_array); +// @dts-jest:pass -> (string | object)[] +R_intersperse(string)(object_array); diff --git a/snapshots/into.ts b/snapshots/into.ts new file mode 100644 index 0000000..d0fe415 --- /dev/null +++ b/snapshots/into.ts @@ -0,0 +1,32 @@ +import { Transformer } from '../ramda/dist/src/$types'; +import * as R_into from '../ramda/dist/src/into'; + +declare const object: object; +declare const str_obj_transformer: Transformer; +declare const str_obj_transformer_to_obj_str_to_obj: ( + x: Transformer, +) => (x: object, y: string) => object; + +declare const string: string; +declare const num_str_transformer: Transformer; +declare const num_str_transformer_to_str_num_to_str: ( + x: Transformer, +) => (x: string, y: number) => string; + +// @dts-jest:pass -> (values: string[]) => object +R_into(object, str_obj_transformer_to_obj_str_to_obj); +// @dts-jest:pass -> (values: string[]) => object +R_into(object)(str_obj_transformer_to_obj_str_to_obj); +// @dts-jest:pass -> (values: string[]) => object +R_into(str_obj_transformer, str_obj_transformer_to_obj_str_to_obj); +// @dts-jest:pass -> (values: string[]) => object +R_into(str_obj_transformer)(str_obj_transformer_to_obj_str_to_obj); + +// @dts-jest:skip -> (values: number[]) => string +R_into(string, num_str_transformer_to_str_num_to_str); +// @dts-jest:pass -> (values: number[]) => string +R_into(string)(num_str_transformer_to_str_num_to_str); +// @dts-jest:skip -> (values: number[]) => string +R_into(num_str_transformer, num_str_transformer_to_str_num_to_str); +// @dts-jest:pass -> (values: number[]) => string +R_into(num_str_transformer)(num_str_transformer_to_str_num_to_str); diff --git a/snapshots/invert.ts b/snapshots/invert.ts new file mode 100644 index 0000000..4926f06 --- /dev/null +++ b/snapshots/invert.ts @@ -0,0 +1,6 @@ +import * as R_invert from '../ramda/dist/src/invert'; + +declare const number_object_record: { [number: number]: object }; + +// @dts-jest:pass -> Dictionary +R_invert(number_object_record); diff --git a/snapshots/invertObj.ts b/snapshots/invertObj.ts new file mode 100644 index 0000000..bfbcfe1 --- /dev/null +++ b/snapshots/invertObj.ts @@ -0,0 +1,6 @@ +import * as R_invertObj from '../ramda/dist/src/invertObj'; + +declare const number_object_record: { [number: number]: object }; + +// @dts-jest:pass -> Dictionary +R_invertObj(number_object_record); diff --git a/snapshots/invoker.ts b/snapshots/invoker.ts new file mode 100644 index 0000000..d54c328 --- /dev/null +++ b/snapshots/invoker.ts @@ -0,0 +1,14 @@ +import * as R_invoker from '../ramda/dist/src/invoker'; + +// @dts-jest:pass -> , R>(method: N) => CurriedFunction1 +R_invoker(0); +// @dts-jest:pass -> , T1, R>(method: N) => CurriedFunction2 +R_invoker(1); +// @dts-jest:pass -> , T1, T2, R>(method: N) => CurriedFunction3 +R_invoker(2); +// @dts-jest:pass -> , T1, T2, T3, T4, T5, R>(method: N) => CurriedFunction6 +R_invoker(5); +// @dts-jest:pass -> (method: N) => (...args: any[]) => R +R_invoker(6); +// @dts-jest:pass -> (method: N) => (...args: any[]) => R +R_invoker(7); diff --git a/snapshots/is.ts b/snapshots/is.ts new file mode 100644 index 0000000..8a0f5a2 --- /dev/null +++ b/snapshots/is.ts @@ -0,0 +1,10 @@ +import * as R_is from '../ramda/dist/src/is'; + +declare const string: string; + +// @dts-jest:pass -> (value: any) => value is String +R_is(String); +// @dts-jest:pass -> boolean +R_is(String)(string); +// @dts-jest:pass -> boolean +R_is(String, string); diff --git a/snapshots/isEmpty.ts b/snapshots/isEmpty.ts new file mode 100644 index 0000000..8a0f007 --- /dev/null +++ b/snapshots/isEmpty.ts @@ -0,0 +1,6 @@ +import * as R_isEmpty from '../ramda/dist/src/isEmpty'; + +declare const string: string; + +// @dts-jest:pass -> boolean +R_isEmpty(string); diff --git a/snapshots/isNil.ts b/snapshots/isNil.ts new file mode 100644 index 0000000..fb390cb --- /dev/null +++ b/snapshots/isNil.ts @@ -0,0 +1,9 @@ +import * as R_isNil from '../ramda/dist/src/isNil'; + +declare const string: string; + +// @dts-jest:pass -> (value: any) => value is null | undefined +R_isNil; + +// @dts-jest:pass -> boolean +R_isNil(string); diff --git a/snapshots/join.ts b/snapshots/join.ts new file mode 100644 index 0000000..bef15eb --- /dev/null +++ b/snapshots/join.ts @@ -0,0 +1,11 @@ +import * as R_join from '../ramda/dist/src/join'; + +declare const string: string; +declare const number_array: string[]; + +// @dts-jest:pass -> (list: any[]) => string +R_join(string); +// @dts-jest:pass -> string +R_join(string)(number_array); +// @dts-jest:pass -> string +R_join(string, number_array); diff --git a/snapshots/juxt.ts b/snapshots/juxt.ts new file mode 100644 index 0000000..ab3cf01 --- /dev/null +++ b/snapshots/juxt.ts @@ -0,0 +1,9 @@ +import * as R_juxt from '../ramda/dist/src/juxt'; + +declare const string_string_to_number: (x: string, y: string) => number; +declare const string: string; + +// @dts-jest:pass -> (...args: string[]) => number[] +R_juxt([string_string_to_number]); +// @dts-jest:pass -> number[] +R_juxt([string_string_to_number])(string, string); diff --git a/snapshots/keys.ts b/snapshots/keys.ts new file mode 100644 index 0000000..d9cdb8e --- /dev/null +++ b/snapshots/keys.ts @@ -0,0 +1,13 @@ +import * as R_keys from '../ramda/dist/src/keys'; + +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; +declare const string_number_record: Record; + +// @dts-jest:pass -> ("a" | "b" | "c")[] +R_keys(a_1_b_2_c_3); +// @dts-jest:pass -> string[] +R_keys(string_number_record); diff --git a/snapshots/keysIn.ts b/snapshots/keysIn.ts new file mode 100644 index 0000000..1b59e23 --- /dev/null +++ b/snapshots/keysIn.ts @@ -0,0 +1,13 @@ +import * as R_keysIn from '../ramda/dist/src/keysIn'; + +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; +declare const string_number_record: Record; + +// @dts-jest:pass -> ("a" | "b" | "c")[] +R_keysIn(a_1_b_2_c_3); +// @dts-jest:pass -> string[] +R_keysIn(string_number_record); diff --git a/snapshots/last.ts b/snapshots/last.ts new file mode 100644 index 0000000..6d809f3 --- /dev/null +++ b/snapshots/last.ts @@ -0,0 +1,12 @@ +import * as R_last from '../ramda/dist/src/last'; + +declare const string: string; +declare const string_array: string[]; +declare const number_array: number[]; + +// @dts-jest:pass -> string +R_last(string); +// @dts-jest:pass -> string | undefined +R_last(string_array); +// @dts-jest:pass -> number | undefined +R_last(number_array); diff --git a/snapshots/lastIndexOf.ts b/snapshots/lastIndexOf.ts new file mode 100644 index 0000000..d722175 --- /dev/null +++ b/snapshots/lastIndexOf.ts @@ -0,0 +1,11 @@ +import * as R_lastIndexOf from '../ramda/dist/src/lastIndexOf'; + +declare const string: string; +declare const string_array: string[]; + +// @dts-jest:pass -> (list: string[] | ArrayLike) => number +R_lastIndexOf(string); +// @dts-jest:pass -> number +R_lastIndexOf(string, string); +// @dts-jest:pass -> number +R_lastIndexOf(string, string_array); diff --git a/snapshots/length.ts b/snapshots/length.ts new file mode 100644 index 0000000..d33189a --- /dev/null +++ b/snapshots/length.ts @@ -0,0 +1,9 @@ +import * as R_length from '../ramda/dist/src/length'; + +declare const string: string; +declare const string_array: string[]; + +// @dts-jest:pass -> number +R_length(string); +// @dts-jest:pass -> number +R_length(string_array); diff --git a/snapshots/lens.ts b/snapshots/lens.ts new file mode 100644 index 0000000..7869892 --- /dev/null +++ b/snapshots/lens.ts @@ -0,0 +1,11 @@ +import * as R_lens from '../ramda/dist/src/lens'; + +declare const object_to_string: (x: object) => string; +declare const string_object_to_object: (x: string, y: object) => object; + +// @dts-jest:pass -> (setter: (focus: string, target: object) => object) => ManualLens +R_lens(object_to_string); +// @dts-jest:pass -> ManualLens +R_lens(object_to_string)(string_object_to_object); +// @dts-jest:pass -> ManualLens +R_lens(object_to_string, string_object_to_object); diff --git a/snapshots/lensIndex.ts b/snapshots/lensIndex.ts new file mode 100644 index 0000000..e8b3a07 --- /dev/null +++ b/snapshots/lensIndex.ts @@ -0,0 +1,8 @@ +import * as R_lensIndex from '../ramda/dist/src/lensIndex'; + +declare const number: number; + +// @dts-jest:pass -> PseudoLens<0> +R_lensIndex(0); +// @dts-jest:pass -> PseudoLens +R_lensIndex(number); diff --git a/snapshots/lensPath.ts b/snapshots/lensPath.ts new file mode 100644 index 0000000..1011eb5 --- /dev/null +++ b/snapshots/lensPath.ts @@ -0,0 +1,9 @@ +import { Path } from '../ramda/dist/src/$types'; +import * as R_lensPath from '../ramda/dist/src/lensPath'; + +declare const path: Path; + +// @dts-jest:pass -> ManualLens<{}, {}> +R_lensPath(path); +// @dts-jest:pass -> ManualLens +R_lensPath(path); diff --git a/snapshots/lensProp.ts b/snapshots/lensProp.ts new file mode 100644 index 0000000..5e69f97 --- /dev/null +++ b/snapshots/lensProp.ts @@ -0,0 +1,13 @@ +import { Property } from '../ramda/dist/src/$types'; +import * as R_lensProp from '../ramda/dist/src/lensProp'; + +declare const property: Property; + +// @dts-jest:pass -> PseudoLens<1> +R_lensProp(1); +// @dts-jest:pass -> PseudoLens<"x"> +R_lensProp('x'); +// @dts-jest:pass -> ManualLens<{}, {}> +R_lensProp(property); +// @dts-jest:pass -> ManualLens +R_lensProp(property); diff --git a/snapshots/lift.ts b/snapshots/lift.ts new file mode 100644 index 0000000..ee1e66a --- /dev/null +++ b/snapshots/lift.ts @@ -0,0 +1,23 @@ +import * as R_lift from '../ramda/dist/src/lift'; + +declare const string_to_object: (x: string) => object; +declare const number_boolean_to_string: (x: number, y: boolean) => string; +declare const number_args_to_boolean: (...args: number[]) => boolean; +declare const seven_string_to_number: ( + v1: string, + v2: string, + v3: string, + v4: string, + v5: string, + v6: string, + v7: string, +) => number; + +// @dts-jest:pass -> CurriedFunction1, object[]> +R_lift(string_to_object); +// @dts-jest:pass -> CurriedFunction2, boolean[] | ArrayLike, string[]> +R_lift(number_boolean_to_string); +// @dts-jest:pass -> () => boolean[] +R_lift(number_args_to_boolean); +// @dts-jest:pass -> (...args: any[]) => number[] +R_lift(seven_string_to_number); diff --git a/snapshots/liftN.ts b/snapshots/liftN.ts new file mode 100644 index 0000000..aa600b6 --- /dev/null +++ b/snapshots/liftN.ts @@ -0,0 +1,23 @@ +import * as R_liftN from '../ramda/dist/src/liftN'; + +declare const string_to_object: (x: string) => object; +declare const number_boolean_to_string: (x: number, y: boolean) => string; +declare const number_args_to_boolean: (...args: number[]) => boolean; +declare const seven_string_to_number: ( + v1: string, + v2: string, + v3: string, + v4: string, + v5: string, + v6: string, + v7: string, +) => number; + +// @dts-jest:pass -> () => object[] +R_liftN(0, string_to_object); +// @dts-jest:pass -> CurriedFunction1, string[]> +R_liftN(1, number_boolean_to_string); +// @dts-jest:pass -> CurriedFunction4, number[] | ArrayLike, number[] | ArrayLike, number[] | ArrayLike, boolean[]> +R_liftN(4, number_args_to_boolean); +// @dts-jest:pass -> (...args: any[]) => number[] +R_liftN(7, seven_string_to_number); diff --git a/snapshots/lt.ts b/snapshots/lt.ts new file mode 100644 index 0000000..f0b284e --- /dev/null +++ b/snapshots/lt.ts @@ -0,0 +1,11 @@ +import * as R_lt from '../ramda/dist/src/lt'; + +declare const string: string; +declare const number: number; + +// @dts-jest:pass -> (b: string) => boolean +R_lt(string); +// @dts-jest:pass -> boolean +R_lt(string, string); +// @dts-jest:pass -> boolean +R_lt(number, number); diff --git a/snapshots/lte.ts b/snapshots/lte.ts new file mode 100644 index 0000000..004796d --- /dev/null +++ b/snapshots/lte.ts @@ -0,0 +1,11 @@ +import * as R_lte from '../ramda/dist/src/lte'; + +declare const string: string; +declare const number: number; + +// @dts-jest:pass -> (b: string) => boolean +R_lte(string); +// @dts-jest:pass -> boolean +R_lte(string, string); +// @dts-jest:pass -> boolean +R_lte(number, number); diff --git a/snapshots/map.ts b/snapshots/map.ts new file mode 100644 index 0000000..2694f28 --- /dev/null +++ b/snapshots/map.ts @@ -0,0 +1,22 @@ +import { Functor, Morphism } from '../ramda/dist/src/$types'; +import * as R_map from '../ramda/dist/src/map'; + +declare const string_to_number: Morphism; +declare const string_array: string[]; +declare const string_object: Record; +declare const string_functor: Functor; + +// @dts-jest:pass -> number[] +R_map(string_to_number, string_array); +// @dts-jest:pass -> number[] +R_map(string_to_number)(string_array); + +// @dts-jest:pass -> Record +R_map(string_to_number, string_object); +// @dts-jest:pass -> Record +R_map(string_to_number)(string_object); + +// @dts-jest:pass -> Functor +R_map(string_to_number, string_functor); +// @dts-jest:pass -> Functor +R_map(string_to_number)(string_functor); diff --git a/snapshots/mapAccum.ts b/snapshots/mapAccum.ts new file mode 100644 index 0000000..c1a7c7d --- /dev/null +++ b/snapshots/mapAccum.ts @@ -0,0 +1,15 @@ +import * as R_mapAccum from '../ramda/dist/src/mapAccum'; + +declare const number: number; +declare const number_string_to_number_string_tuple: ( + x: number, + y: string, +) => [number, string]; +declare const string_array: string[]; + +// @dts-jest:pass -> (list: string[] | ArrayLike) => [number, string[]] +R_mapAccum(number_string_to_number_string_tuple, number); +// @dts-jest:pass -> [number, string[]] +R_mapAccum(number_string_to_number_string_tuple)(number)(string_array); +// @dts-jest:pass -> [number, string[]] +R_mapAccum(number_string_to_number_string_tuple, number, string_array); diff --git a/snapshots/mapAccumRight.ts b/snapshots/mapAccumRight.ts new file mode 100644 index 0000000..14bcea2 --- /dev/null +++ b/snapshots/mapAccumRight.ts @@ -0,0 +1,15 @@ +import * as R_mapAccumRight from '../ramda/dist/src/mapAccumRight'; + +declare const number: number; +declare const string_number_to_string_number_tuple: ( + x: string, + y: number, +) => [string, number]; +declare const string_array: string[]; + +// @dts-jest:pass -> (list: string[] | ArrayLike) => [string[], number] +R_mapAccumRight(string_number_to_string_number_tuple, number); +// @dts-jest:pass -> [string[], number] +R_mapAccumRight(string_number_to_string_number_tuple)(number)(string_array); +// @dts-jest:pass -> [string[], number] +R_mapAccumRight(string_number_to_string_number_tuple, number, string_array); diff --git a/snapshots/mapObjIndexed.ts b/snapshots/mapObjIndexed.ts new file mode 100644 index 0000000..db00dca --- /dev/null +++ b/snapshots/mapObjIndexed.ts @@ -0,0 +1,25 @@ +import { Placeholder } from '../ramda/dist/src/$placeholder'; +import * as R_mapObjIndexed from '../ramda/dist/src/mapObjIndexed'; + +declare const placeholder: Placeholder; +declare const number_string_object_to_boolean: ( + a: number, + b: string, + c: object, +) => boolean; + +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; +declare const string_number_record: Record; + +// @dts-jest:pass -> (object: Record) => Record +R_mapObjIndexed(number_string_object_to_boolean); +// @dts-jest:pass -> Record +R_mapObjIndexed(number_string_object_to_boolean, string_number_record); +// @dts-jest:pass -> Record +R_mapObjIndexed(number_string_object_to_boolean, a_1_b_2_c_3); +// @dts-jest:pass -> Record<"a" | "b" | "c", boolean> +R_mapObjIndexed(placeholder, a_1_b_2_c_3)(number_string_object_to_boolean); diff --git a/snapshots/match.ts b/snapshots/match.ts new file mode 100644 index 0000000..8becf9d --- /dev/null +++ b/snapshots/match.ts @@ -0,0 +1,11 @@ +import * as R_match from '../ramda/dist/src/match'; + +declare const regex: RegExp; +declare const string: string; + +// @dts-jest:pass -> (str: string) => string[] +R_match(regex); +// @dts-jest:pass -> string[] +R_match(regex)(string); +// @dts-jest:pass -> string[] +R_match(regex, string); diff --git a/snapshots/mathMod.ts b/snapshots/mathMod.ts new file mode 100644 index 0000000..5472848 --- /dev/null +++ b/snapshots/mathMod.ts @@ -0,0 +1,8 @@ +import * as R_mathMod from '../ramda/dist/src/mathMod'; + +declare const number: number; + +// @dts-jest:pass -> number +R_mathMod(number, number); +// @dts-jest:pass -> number +R_mathMod(number)(number); diff --git a/snapshots/max.ts b/snapshots/max.ts new file mode 100644 index 0000000..86e2f3d --- /dev/null +++ b/snapshots/max.ts @@ -0,0 +1,11 @@ +import * as R_max from '../ramda/dist/src/max'; + +declare const number: number; +declare const string: string; + +// @dts-jest:pass -> (b: string) => string +R_max(string); +// @dts-jest:pass -> (b: number) => number +R_max(number); +// @dts-jest:pass -> number +R_max(number, number); diff --git a/snapshots/maxBy.ts b/snapshots/maxBy.ts new file mode 100644 index 0000000..1ddd1f0 --- /dev/null +++ b/snapshots/maxBy.ts @@ -0,0 +1,11 @@ +import * as R_maxBy from '../ramda/dist/src/maxBy'; + +declare const object_to_number: (x: object) => number; +declare const object: object; + +// @dts-jest:pass -> (b: object) => object +R_maxBy(object_to_number, object); +// @dts-jest:pass -> object +R_maxBy(object_to_number)(object)(object); +// @dts-jest:pass -> object +R_maxBy(object_to_number, object, object); diff --git a/snapshots/mean.ts b/snapshots/mean.ts new file mode 100644 index 0000000..2d10029 --- /dev/null +++ b/snapshots/mean.ts @@ -0,0 +1,6 @@ +import * as R_mean from '../ramda/dist/src/mean'; + +declare const number_array: number[]; + +// @dts-jest:pass -> number +R_mean(number_array); diff --git a/snapshots/median.ts b/snapshots/median.ts new file mode 100644 index 0000000..7764f4a --- /dev/null +++ b/snapshots/median.ts @@ -0,0 +1,6 @@ +import * as R_median from '../ramda/dist/src/median'; + +declare const number_array: number[]; + +// @dts-jest:pass -> number +R_median(number_array); diff --git a/snapshots/memoize.ts b/snapshots/memoize.ts new file mode 100644 index 0000000..5cf1414 --- /dev/null +++ b/snapshots/memoize.ts @@ -0,0 +1,6 @@ +import * as R_memoize from '../ramda/dist/src/memoize'; + +declare const T_to_T: (value: T) => T; + +// @dts-jest:pass -> (value: T) => T +R_memoize(T_to_T); diff --git a/snapshots/memoizeWith.ts b/snapshots/memoizeWith.ts new file mode 100644 index 0000000..85a1cd3 --- /dev/null +++ b/snapshots/memoizeWith.ts @@ -0,0 +1,11 @@ +import * as R_memoizeWith from '../ramda/dist/src/memoizeWith'; + +declare const any_to_string: (x: any) => string; +declare const T_to_T: (value: T) => T; + +// @dts-jest:pass -> (fn: T) => T +R_memoizeWith(any_to_string); +// @dts-jest:pass -> (value: T) => T +R_memoizeWith(any_to_string)(T_to_T); +// @dts-jest:pass -> (value: T) => T +R_memoizeWith(any_to_string, T_to_T); diff --git a/snapshots/merge.ts b/snapshots/merge.ts new file mode 100644 index 0000000..6e9bf2d --- /dev/null +++ b/snapshots/merge.ts @@ -0,0 +1,15 @@ +import * as R_merge from '../ramda/dist/src/merge'; + +declare const a_1: { a: 1 }; +declare const b_2: { b: 2 }; +declare const a_1_c_1: { a: 1; c: 1 }; +declare const b_2_c_2: { b: 2; c: 2 }; + +// @dts-jest:pass -> Pick<{ a: 1; }, "a"> & { b: 2; } +R_merge(a_1)(b_2); +// @dts-jest:pass -> Pick<{ a: 1; }, "a"> & { b: 2; } +R_merge(a_1, b_2); +// @dts-jest:pass -> Pick<{ a: 1; c: 1; }, "a"> & { b: 2; c: 2; } +R_merge(a_1_c_1)(b_2_c_2); +// @dts-jest:pass -> Pick<{ a: 1; c: 1; }, "a"> & { b: 2; c: 2; } +R_merge(a_1_c_1, b_2_c_2); diff --git a/snapshots/mergeAll.ts b/snapshots/mergeAll.ts new file mode 100644 index 0000000..4a99b1a --- /dev/null +++ b/snapshots/mergeAll.ts @@ -0,0 +1,7 @@ +import * as R_mergeAll from '../ramda/dist/src/mergeAll'; + +declare const a_1: { a: 1 }; +declare const b_2: { b: 2 }; + +// @dts-jest:pass -> object +R_mergeAll([a_1, b_2]); diff --git a/snapshots/mergeDeepLeft.ts b/snapshots/mergeDeepLeft.ts new file mode 100644 index 0000000..9e67f00 --- /dev/null +++ b/snapshots/mergeDeepLeft.ts @@ -0,0 +1,12 @@ +import * as R_mergeDeepLeft from '../ramda/dist/src/mergeDeepLeft'; + +declare const a_1: { a: 1 }; +declare const b_2: { b: 2 }; + +// @dts-jest:pass -> (right: object) => object +R_mergeDeepLeft(a_1); + +// @dts-jest:pass -> object +R_mergeDeepLeft(a_1)(b_2); +// @dts-jest:pass -> object +R_mergeDeepLeft(a_1, b_2); diff --git a/snapshots/mergeDeepRight.ts b/snapshots/mergeDeepRight.ts new file mode 100644 index 0000000..0f5a5bf --- /dev/null +++ b/snapshots/mergeDeepRight.ts @@ -0,0 +1,12 @@ +import * as R_mergeDeepRight from '../ramda/dist/src/mergeDeepRight'; + +declare const a_1: { a: 1 }; +declare const b_2: { b: 2 }; + +// @dts-jest:pass -> (right: object) => object +R_mergeDeepRight(a_1); + +// @dts-jest:pass -> object +R_mergeDeepRight(a_1)(b_2); +// @dts-jest:pass -> object +R_mergeDeepRight(a_1, b_2); diff --git a/snapshots/mergeDeepWith.ts b/snapshots/mergeDeepWith.ts new file mode 100644 index 0000000..c1e7c60 --- /dev/null +++ b/snapshots/mergeDeepWith.ts @@ -0,0 +1,13 @@ +import * as R_mergeDeepWith from '../ramda/dist/src/mergeDeepWith'; + +declare const string_string_to_number: (a: string, b: string) => number; +declare const a_1: { a: 1 }; +declare const b_2: { b: 2 }; + +// @dts-jest:pass -> (right: object) => object +R_mergeDeepWith(string_string_to_number, a_1); + +// @dts-jest:pass -> object +R_mergeDeepWith(string_string_to_number, a_1)(b_2); +// @dts-jest:pass -> object +R_mergeDeepWith(string_string_to_number, a_1, b_2); diff --git a/snapshots/mergeDeepWithKey.ts b/snapshots/mergeDeepWithKey.ts new file mode 100644 index 0000000..deb1639 --- /dev/null +++ b/snapshots/mergeDeepWithKey.ts @@ -0,0 +1,17 @@ +import * as R_mergeDeepWithKey from '../ramda/dist/src/mergeDeepWithKey'; + +declare const string_string_string_to_number: ( + key: string, + a: string, + b: string, +) => number; +declare const a_1: { a: 1 }; +declare const b_2: { b: 2 }; + +// @dts-jest:pass -> (right: object) => object +R_mergeDeepWithKey(string_string_string_to_number, a_1); + +// @dts-jest:pass -> object +R_mergeDeepWithKey(string_string_string_to_number, a_1)(b_2); +// @dts-jest:pass -> object +R_mergeDeepWithKey(string_string_string_to_number, a_1, b_2); diff --git a/snapshots/mergeWith.ts b/snapshots/mergeWith.ts new file mode 100644 index 0000000..6271319 --- /dev/null +++ b/snapshots/mergeWith.ts @@ -0,0 +1,10 @@ +import * as R_mergeWith from '../ramda/dist/src/mergeWith'; + +declare const number_number_to_string: (a: number, b: number) => string; +declare const a_1_c_1: { a: 1; c: 1 }; +declare const b_2_c_2: { b: 2; c: 2 }; + +// @dts-jest:pass -> Pick<{ a: 1; c: 1; }, "a"> & Pick<{ b: 2; c: 2; }, "b"> & Record<"c", string> +R_mergeWith(number_number_to_string)(a_1_c_1)(b_2_c_2); +// @dts-jest:pass -> Pick<{ a: 1; c: 1; }, "a"> & Pick<{ b: 2; c: 2; }, "b"> & Record<"c", string> +R_mergeWith(number_number_to_string, a_1_c_1, b_2_c_2); diff --git a/snapshots/mergeWithKey.ts b/snapshots/mergeWithKey.ts new file mode 100644 index 0000000..04b8023 --- /dev/null +++ b/snapshots/mergeWithKey.ts @@ -0,0 +1,14 @@ +import * as R_mergeWithKey from '../ramda/dist/src/mergeWithKey'; + +declare const string_number_number_to_string: ( + key: string, + a: number, + b: number, +) => string; +declare const a_1_c_1: { a: 1; c: 1 }; +declare const b_2_c_2: { b: 2; c: 2 }; + +// @dts-jest:pass -> Pick<{ a: 1; c: 1; }, "a"> & Pick<{ b: 2; c: 2; }, "b"> & Record<"c", string> +R_mergeWithKey(string_number_number_to_string)(a_1_c_1)(b_2_c_2); +// @dts-jest:pass -> Pick<{ a: 1; c: 1; }, "a"> & Pick<{ b: 2; c: 2; }, "b"> & Record<"c", string> +R_mergeWithKey(string_number_number_to_string, a_1_c_1, b_2_c_2); diff --git a/snapshots/min.ts b/snapshots/min.ts new file mode 100644 index 0000000..9a98a27 --- /dev/null +++ b/snapshots/min.ts @@ -0,0 +1,11 @@ +import * as R_min from '../ramda/dist/src/min'; + +declare const number: number; +declare const string: string; + +// @dts-jest:pass -> (b: string) => string +R_min(string); +// @dts-jest:pass -> (b: number) => number +R_min(number); +// @dts-jest:pass -> number +R_min(number, number); diff --git a/snapshots/minBy.ts b/snapshots/minBy.ts new file mode 100644 index 0000000..77f2ad2 --- /dev/null +++ b/snapshots/minBy.ts @@ -0,0 +1,11 @@ +import * as R_minBy from '../ramda/dist/src/minBy'; + +declare const object_to_number: (x: object) => number; +declare const object: object; + +// @dts-jest:pass -> (b: object) => object +R_minBy(object_to_number, object); +// @dts-jest:pass -> object +R_minBy(object_to_number)(object)(object); +// @dts-jest:pass -> object +R_minBy(object_to_number, object, object); diff --git a/snapshots/modulo.ts b/snapshots/modulo.ts new file mode 100644 index 0000000..e1fc3c3 --- /dev/null +++ b/snapshots/modulo.ts @@ -0,0 +1,8 @@ +import * as R_modulo from '../ramda/dist/src/modulo'; + +declare const number: number; + +// @dts-jest:pass -> number +R_modulo(number, number); +// @dts-jest:pass -> number +R_modulo(number)(number); diff --git a/snapshots/multiply.ts b/snapshots/multiply.ts new file mode 100644 index 0000000..8b7f3cb --- /dev/null +++ b/snapshots/multiply.ts @@ -0,0 +1,8 @@ +import * as R_multiply from '../ramda/dist/src/multiply'; + +declare const number: number; + +// @dts-jest:pass -> number +R_multiply(number, number); +// @dts-jest:pass -> number +R_multiply(number)(number); diff --git a/snapshots/nAry.ts b/snapshots/nAry.ts new file mode 100644 index 0000000..1ef7d1b --- /dev/null +++ b/snapshots/nAry.ts @@ -0,0 +1,20 @@ +import { Variadic } from '../ramda/dist/src/$types'; +import * as R_nAry from '../ramda/dist/src/nAry'; + +declare const number: number; +declare const string_number_symbol_to_boolean: ( + a: string, + b: number, + c: symbol, +) => boolean; +declare const object_variadic: Variadic; + +// @dts-jest:pass -> (v1: string) => boolean +R_nAry(1, string_number_symbol_to_boolean); +// @dts-jest:pass -> (v1: any) => object +R_nAry(1, object_variadic); + +// @dts-jest:pass -> Variadic +R_nAry(number, string_number_symbol_to_boolean); +// @dts-jest:pass -> Variadic +R_nAry(number, object_variadic); diff --git a/snapshots/negate.ts b/snapshots/negate.ts new file mode 100644 index 0000000..5bfb899 --- /dev/null +++ b/snapshots/negate.ts @@ -0,0 +1,6 @@ +import * as R_negate from '../ramda/dist/src/negate'; + +declare const number: number; + +// @dts-jest:pass -> number +R_negate(number); diff --git a/snapshots/none.ts b/snapshots/none.ts new file mode 100644 index 0000000..6da0c2c --- /dev/null +++ b/snapshots/none.ts @@ -0,0 +1,10 @@ +import { Predicate } from '../ramda/dist/src/$types'; +import * as R_none from '../ramda/dist/src/none'; + +declare const string_predicate: Predicate; +declare const string_array: string[]; + +// @dts-jest:pass -> boolean +R_none(string_predicate)(string_array); +// @dts-jest:pass -> boolean +R_none(string_predicate, string_array); diff --git a/snapshots/not.ts b/snapshots/not.ts new file mode 100644 index 0000000..a7adb79 --- /dev/null +++ b/snapshots/not.ts @@ -0,0 +1,6 @@ +import * as R_not from '../ramda/dist/src/not'; + +declare const string: string; + +// @dts-jest:pass -> boolean +R_not(string); diff --git a/snapshots/nth.ts b/snapshots/nth.ts new file mode 100644 index 0000000..62bdc2b --- /dev/null +++ b/snapshots/nth.ts @@ -0,0 +1,15 @@ +import * as R_nth from '../ramda/dist/src/nth'; + +declare const number: number; +declare const string: string; +declare const object_array: object[]; + +// @dts-jest:pass -> string +R_nth(number)(string); +// @dts-jest:pass -> string +R_nth(number, string); + +// @dts-jest:pass -> object | undefined +R_nth(number)(object_array); +// @dts-jest:pass -> object | undefined +R_nth(number, object_array); diff --git a/snapshots/nthArg.ts b/snapshots/nthArg.ts new file mode 100644 index 0000000..3808389 --- /dev/null +++ b/snapshots/nthArg.ts @@ -0,0 +1,7 @@ +import * as R_nthArg from '../ramda/dist/src/nthArg'; + +declare const number: number; +declare const object_array: object[]; + +// @dts-jest:pass -> object +R_nthArg(number)(...object_array); diff --git a/snapshots/o.ts b/snapshots/o.ts new file mode 100644 index 0000000..a7acf34 --- /dev/null +++ b/snapshots/o.ts @@ -0,0 +1,12 @@ +import * as R_o from '../ramda/dist/src/o'; + +declare const number_to_string: (x: number) => string; +declare const boolean_to_number: (x: boolean) => number; +declare const boolean: boolean; + +// @dts-jest:pass -> (value: boolean) => string +R_o(number_to_string, boolean_to_number); +// @dts-jest:pass -> string +R_o(number_to_string)(boolean_to_number)(boolean); +// @dts-jest:pass -> string +R_o(number_to_string, boolean_to_number, boolean); diff --git a/snapshots/objOf.ts b/snapshots/objOf.ts new file mode 100644 index 0000000..b76428a --- /dev/null +++ b/snapshots/objOf.ts @@ -0,0 +1,13 @@ +import * as R_objOf from '../ramda/dist/src/objOf'; + +declare const string: string; +declare const object: object; + +// @dts-jest:pass -> (value: V) => Record +R_objOf(string); +// @dts-jest:pass -> Record +R_objOf(string, object); +// @dts-jest:pass -> (value: V) => Record<"key", V> +R_objOf('key'); +// @dts-jest:pass -> Record<"key", object> +R_objOf('key', object); diff --git a/snapshots/of.ts b/snapshots/of.ts new file mode 100644 index 0000000..66b2ad5 --- /dev/null +++ b/snapshots/of.ts @@ -0,0 +1,6 @@ +import * as R_of from '../ramda/dist/src/of'; + +declare const object: object; + +// @dts-jest:pass -> object[] +R_of(object); diff --git a/snapshots/omit.ts b/snapshots/omit.ts new file mode 100644 index 0000000..9cebf02 --- /dev/null +++ b/snapshots/omit.ts @@ -0,0 +1,14 @@ +import * as R_omit from '../ramda/dist/src/omit'; + +declare const object: object; +declare const string: string; + +// @dts-jest:pass -> object +R_omit([string])(object); +// @dts-jest:pass -> object +R_omit([string], object); + +// @dts-jest:pass -> object +R_omit([string])(object); +// @dts-jest:pass -> object +R_omit([string], object); diff --git a/snapshots/once.ts b/snapshots/once.ts new file mode 100644 index 0000000..2b59d16 --- /dev/null +++ b/snapshots/once.ts @@ -0,0 +1,6 @@ +import * as R_once from '../ramda/dist/src/once'; + +declare const T_to_T: (value: T) => T; + +// @dts-jest:pass -> (value: T) => T +R_once(T_to_T); diff --git a/snapshots/or.ts b/snapshots/or.ts new file mode 100644 index 0000000..fdf0c4a --- /dev/null +++ b/snapshots/or.ts @@ -0,0 +1,9 @@ +import * as R_or from '../ramda/dist/src/or'; + +declare const string: string; +declare const number: number; + +// @dts-jest:pass -> string | number +R_or(string)(number); +// @dts-jest:pass -> string | number +R_or(string, number); diff --git a/snapshots/over.ts b/snapshots/over.ts new file mode 100644 index 0000000..dc1b8e4 --- /dev/null +++ b/snapshots/over.ts @@ -0,0 +1,37 @@ +import { ManualLens, PseudoLens } from '../ramda/dist/src/$types'; +import * as R_over from '../ramda/dist/src/over'; + +declare const menual_lens_number_object: ManualLens; +declare const pseudo_lens_a: PseudoLens<'a'>; +declare const pseudo_lens_1: PseudoLens<1>; + +declare const number_to_number: (x: number) => number; +declare const object: object; +declare const a_1_b_2_c_3: { a: 1; b: 2; c: 3 }; +declare const number_array: number[]; +declare const string_number_tuple: [string, number]; + +// @dts-jest:pass -> (target: object) => object +R_over(menual_lens_number_object, number_to_number); +// @dts-jest:pass -> object +R_over(menual_lens_number_object)(number_to_number)(object); +// @dts-jest:pass -> object +R_over(menual_lens_number_object, number_to_number, object); + +// @dts-jest:pass -> (target: Record<"a", any>) => Record<"a", any> +R_over(pseudo_lens_a, number_to_number); +// @dts-jest:pass -> Record<"a", any> +R_over(pseudo_lens_a)(number_to_number)(a_1_b_2_c_3); +// @dts-jest:pass -> { a: 1; b: 2; c: 3; } +R_over(pseudo_lens_a, number_to_number, a_1_b_2_c_3); + +// @dts-jest:pass -> (target: {}) => {} +R_over(pseudo_lens_1, number_to_number); +// @dts-jest:pass -> {} +R_over(pseudo_lens_1)(number_to_number)(string_number_tuple); +// @dts-jest:pass -> [string, number] +R_over(pseudo_lens_1, number_to_number, string_number_tuple); +// @dts-jest:pass -> {} +R_over(pseudo_lens_1)(number_to_number)(number_array); +// @dts-jest:pass -> number[] +R_over(pseudo_lens_1, number_to_number, number_array); diff --git a/snapshots/pair.ts b/snapshots/pair.ts new file mode 100644 index 0000000..0fcea4c --- /dev/null +++ b/snapshots/pair.ts @@ -0,0 +1,11 @@ +import * as R_pair from '../ramda/dist/src/pair'; + +declare const number: number; +declare const object: object; + +// @dts-jest:pass -> (value: V) => KeyValuePair +R_pair(number); +// @dts-jest:pass -> KeyValuePair +R_pair(number)(object); +// @dts-jest:pass -> KeyValuePair +R_pair(number, object); diff --git a/snapshots/partial.ts b/snapshots/partial.ts new file mode 100644 index 0000000..d8af577 --- /dev/null +++ b/snapshots/partial.ts @@ -0,0 +1,12 @@ +import * as R_partial from '../ramda/dist/src/partial'; + +declare const number_string_to_object: (a: number, b: string) => object; +declare const number: number; +declare const string: string; + +// @dts-jest:pass -> (args: any[]) => (...args: any[]) => object +R_partial(number_string_to_object); +// @dts-jest:pass -> (...args: any[]) => object +R_partial(number_string_to_object, [number]); +// @dts-jest:pass -> object +R_partial(number_string_to_object, [number])(string); diff --git a/snapshots/partialRight.ts b/snapshots/partialRight.ts new file mode 100644 index 0000000..6484096 --- /dev/null +++ b/snapshots/partialRight.ts @@ -0,0 +1,12 @@ +import * as R_partialRight from '../ramda/dist/src/partialRight'; + +declare const number_string_to_object: (a: number, b: string) => object; +declare const number: number; +declare const string: string; + +// @dts-jest:pass -> (args: any[]) => (...args: any[]) => object +R_partialRight(number_string_to_object); +// @dts-jest:pass -> (...args: any[]) => object +R_partialRight(number_string_to_object, [string]); +// @dts-jest:pass -> object +R_partialRight(number_string_to_object, [string])(number); diff --git a/snapshots/partition.ts b/snapshots/partition.ts new file mode 100644 index 0000000..b8368fc --- /dev/null +++ b/snapshots/partition.ts @@ -0,0 +1,19 @@ +import * as R_partition from '../ramda/dist/src/partition'; + +declare const number_to_boolean: (x: number) => boolean; +declare const number_array: number[]; +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; + +// @dts-jest:pass -> [number[], number[]] +R_partition(number_to_boolean)(number_array); +// @dts-jest:pass -> [number[], number[]] +R_partition(number_to_boolean, number_array); + +// @dts-jest:pass -> [Partial<{ a: 1; b: 2; c: 3; }>, Partial<{ a: 1; b: 2; c: 3; }>] +R_partition(number_to_boolean)(a_1_b_2_c_3); +// @dts-jest:pass -> [Partial<{ a: 1; b: 2; c: 3; }>, Partial<{ a: 1; b: 2; c: 3; }>] +R_partition(number_to_boolean, a_1_b_2_c_3); diff --git a/snapshots/path.ts b/snapshots/path.ts new file mode 100644 index 0000000..62cb09a --- /dev/null +++ b/snapshots/path.ts @@ -0,0 +1,23 @@ +import { Path } from '../ramda/dist/src/$types'; +import * as R_path from '../ramda/dist/src/path'; + +declare const path: Path; +declare const object: object; +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; + +// @dts-jest:pass -> (object: {}) => T | undefined +R_path(path); + +// @dts-jest:pass -> {} | undefined +R_path(path)(object); +// @dts-jest:pass -> {} | undefined +R_path(path, object); + +// @dts-jest:pass -> {} | undefined +R_path(['a', 'b', 'c'])(a_1_b_2_c_3); +// @dts-jest:pass -> {} | undefined +R_path(['a', 'b', 'c'], a_1_b_2_c_3); diff --git a/snapshots/pathEq.ts b/snapshots/pathEq.ts new file mode 100644 index 0000000..e5b887a --- /dev/null +++ b/snapshots/pathEq.ts @@ -0,0 +1,13 @@ +import { Path } from '../ramda/dist/src/$types'; +import * as R_pathEq from '../ramda/dist/src/pathEq'; + +declare const path: Path; +declare const number: number; +declare const object: object; + +// @dts-jest:pass -> (object: {}) => boolean +R_pathEq(path, number); +// @dts-jest:pass -> boolean +R_pathEq(path)(number)(object); +// @dts-jest:pass -> boolean +R_pathEq(path, number, object); diff --git a/snapshots/pathOr.ts b/snapshots/pathOr.ts new file mode 100644 index 0000000..20c15c8 --- /dev/null +++ b/snapshots/pathOr.ts @@ -0,0 +1,14 @@ +import { Path } from '../ramda/dist/src/$types'; +import * as R_pathOr from '../ramda/dist/src/pathOr'; + +declare const path: Path; +declare const number: number; +declare const object: object; + +// @dts-jest:pass -> (object: {}) => number | U +R_pathOr(number, path); + +// @dts-jest:pass -> number | {} +R_pathOr(number)(path)(object); +// @dts-jest:pass -> number | {} +R_pathOr(number, path, object); diff --git a/snapshots/pathSatisfies.ts b/snapshots/pathSatisfies.ts new file mode 100644 index 0000000..b470262 --- /dev/null +++ b/snapshots/pathSatisfies.ts @@ -0,0 +1,13 @@ +import { Path } from '../ramda/dist/src/$types'; +import * as R_pathSatisfies from '../ramda/dist/src/pathSatisfies'; + +declare const string_to_boolean: (x: string) => boolean; +declare const path: Path; +declare const object: object; + +// @dts-jest:pass -> (object: {}) => boolean +R_pathSatisfies(string_to_boolean, path); +// @dts-jest:pass -> boolean +R_pathSatisfies(string_to_boolean)(path)(object); +// @dts-jest:pass -> boolean +R_pathSatisfies(string_to_boolean, path, object); diff --git a/snapshots/pick.ts b/snapshots/pick.ts new file mode 100644 index 0000000..482ae4c --- /dev/null +++ b/snapshots/pick.ts @@ -0,0 +1,19 @@ +import * as R_pick from '../ramda/dist/src/pick'; + +declare const object: object; +declare const string: string; +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; + +// @dts-jest:pass -> Pick +R_pick([string])(object); +// @dts-jest:pass -> Pick +R_pick([string], object); + +// @dts-jest:pass -> Pick<{ a: 1; b: 2; c: 3; }, "a" | "c"> +R_pick(['a', 'c'])(a_1_b_2_c_3); +// @dts-jest:pass -> Pick<{ a: 1; b: 2; c: 3; }, "a" | "c"> +R_pick(['a', 'c'], a_1_b_2_c_3); diff --git a/snapshots/pickAll.ts b/snapshots/pickAll.ts new file mode 100644 index 0000000..c7a6a4d --- /dev/null +++ b/snapshots/pickAll.ts @@ -0,0 +1,24 @@ +import * as R_pickAll from '../ramda/dist/src/pickAll'; + +declare const object: object; +declare const string: string; +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; + +// @dts-jest:pass -> object +R_pickAll([string])(object); +// @dts-jest:pass -> object +R_pickAll([string], object); + +// @dts-jest:pass -> Partial<{ a: 1; b: 2; c: 3; }> +R_pickAll(['a', 'c'])(a_1_b_2_c_3); +// @dts-jest:pass -> Pick<{ a: 1; b: 2; c: 3; }, "a" | "c"> +R_pickAll(['a', 'c'], a_1_b_2_c_3); + +// @dts-jest:pass -> Partial<{ a: 1; b: 2; c: 3; }> +R_pickAll(['a', 'c', 'f'])(a_1_b_2_c_3); +// @dts-jest:pass -> Partial<{ a: 1; b: 2; c: 3; }> +R_pickAll(['a', 'c', 'f'], a_1_b_2_c_3); diff --git a/snapshots/pickBy.ts b/snapshots/pickBy.ts new file mode 100644 index 0000000..9d8f81a --- /dev/null +++ b/snapshots/pickBy.ts @@ -0,0 +1,38 @@ +import * as R_pickBy from '../ramda/dist/src/pickBy'; + +declare const number_string_object_to_boolean: ( + x: number, + k: string, + o: object, +) => boolean; +declare const string_string_object_to_boolean: ( + x: string, + k: string, + o: object, +) => boolean; +declare const string_number_record: Record; +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; + +// @dts-jest:fail -> Argument of type 'Record' is not assignable to parameter of type 'Dictionary'. +R_pickBy(string_string_object_to_boolean)(string_number_record); +// @dts-jest:fail -> Argument of type 'Record' is not assignable to parameter of type 'Dictionary'. +R_pickBy(string_string_object_to_boolean, string_number_record); + +// @dts-jest:fail -> Argument of type '{ a: 1; b: 2; c: 3; }' is not assignable to parameter of type 'Dictionary'. +R_pickBy(string_string_object_to_boolean)(a_1_b_2_c_3); +// @dts-jest:fail -> Argument of type '{ a: 1; b: 2; c: 3; }' is not assignable to parameter of type 'Dictionary'. +R_pickBy(string_string_object_to_boolean, a_1_b_2_c_3); + +// @dts-jest:pass -> Partial> +R_pickBy(number_string_object_to_boolean)(string_number_record); +// @dts-jest:pass -> Partial> +R_pickBy(number_string_object_to_boolean, string_number_record); + +// @dts-jest:pass -> Partial> +R_pickBy(number_string_object_to_boolean)(a_1_b_2_c_3); +// @dts-jest:pass -> Partial<{ a: 1; b: 2; c: 3; }> +R_pickBy(number_string_object_to_boolean, a_1_b_2_c_3); diff --git a/snapshots/pipe.ts b/snapshots/pipe.ts new file mode 100644 index 0000000..cd43117 --- /dev/null +++ b/snapshots/pipe.ts @@ -0,0 +1,83 @@ +import * as R_pipe from '../ramda/dist/src/pipe'; + +declare const boolean_to_number: (x: boolean) => number; +declare const boolean_to_string: (x: boolean) => string; +declare const number_to_boolean: (x: number) => boolean; +declare const number_to_string: (x: number) => string; +declare const string_to_boolean: (x: string) => boolean; +declare const string_to_number: (x: string) => number; + +declare const a_b_c_d_e_f_to_any: ( + a: null, + b: undefined, + c: boolean, + d: number, + e: string, + f: object, +) => any; + +// @dts-jest:pass -> (v1: boolean) => number +R_pipe(boolean_to_number); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => any +R_pipe(a_b_c_d_e_f_to_any); + +// @dts-jest:pass -> (v1: string) => number +R_pipe(string_to_boolean, boolean_to_number); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => number +R_pipe(a_b_c_d_e_f_to_any, boolean_to_number); + +// @dts-jest:pass -> (v1: number) => number +R_pipe(number_to_string, string_to_boolean, boolean_to_number); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => number +R_pipe(a_b_c_d_e_f_to_any, string_to_boolean, boolean_to_number); + +// @dts-jest:pass -> (v1: string) => number +R_pipe( + string_to_number, + number_to_string, + string_to_boolean, + boolean_to_number, +); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => number +R_pipe( + a_b_c_d_e_f_to_any, + number_to_string, + string_to_boolean, + boolean_to_number, +); + +// @dts-jest:pass -> (v1: boolean) => number +R_pipe( + boolean_to_string, + string_to_number, + number_to_string, + string_to_boolean, + boolean_to_number, +); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => number +R_pipe( + a_b_c_d_e_f_to_any, + string_to_number, + number_to_string, + string_to_boolean, + boolean_to_number, +); + +// @dts-jest:pass -> (v1: number) => number +R_pipe( + number_to_boolean, + boolean_to_string, + string_to_number, + number_to_string, + string_to_boolean, + boolean_to_number, +); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => number +R_pipe( + a_b_c_d_e_f_to_any, + boolean_to_string, + string_to_number, + number_to_string, + string_to_boolean, + boolean_to_number, +); diff --git a/snapshots/pipeK.ts b/snapshots/pipeK.ts new file mode 100644 index 0000000..b78f7d5 --- /dev/null +++ b/snapshots/pipeK.ts @@ -0,0 +1,52 @@ +import { Chain } from '../ramda/dist/src/$types'; +import * as R_pipeK from '../ramda/dist/src/pipeK'; + +declare const chain_boolean_to_chain_number: ( + x: Chain, +) => Chain; +declare const chain_boolean_to_chain_string: ( + x: Chain, +) => Chain; +declare const chain_number_to_chain_boolean: ( + x: Chain, +) => Chain; +declare const chain_number_to_chain_string: (x: Chain) => Chain; +declare const chain_string_to_chain_boolean: ( + x: Chain, +) => Chain; +declare const chain_string_to_chain_number: (x: Chain) => Chain; + +// @dts-jest:pass -> (v1: Chain) => Chain +R_pipeK(chain_boolean_to_chain_number); +// @dts-jest:pass -> (v1: Chain) => Chain +R_pipeK(chain_string_to_chain_boolean, chain_boolean_to_chain_number); +// @dts-jest:pass -> (v1: Chain) => Chain +R_pipeK( + chain_number_to_chain_string, + chain_string_to_chain_boolean, + chain_boolean_to_chain_number, +); +// @dts-jest:pass -> (v1: Chain) => Chain +R_pipeK( + chain_string_to_chain_number, + chain_number_to_chain_string, + chain_string_to_chain_boolean, + chain_boolean_to_chain_number, +); +// @dts-jest:pass -> (v1: Chain) => Chain +R_pipeK( + chain_boolean_to_chain_string, + chain_string_to_chain_number, + chain_number_to_chain_string, + chain_string_to_chain_boolean, + chain_boolean_to_chain_number, +); +// @dts-jest:pass -> (v1: Chain) => Chain +R_pipeK( + chain_number_to_chain_boolean, + chain_boolean_to_chain_string, + chain_string_to_chain_number, + chain_number_to_chain_string, + chain_string_to_chain_boolean, + chain_boolean_to_chain_number, +); diff --git a/snapshots/pipeP.ts b/snapshots/pipeP.ts new file mode 100644 index 0000000..63e1fed --- /dev/null +++ b/snapshots/pipeP.ts @@ -0,0 +1,91 @@ +import * as R_pipeP from '../ramda/dist/src/pipeP'; + +declare const boolean_to_number_promise: (x: boolean) => Promise; +declare const boolean_to_string_promise: (x: boolean) => Promise; +declare const number_to_boolean_promise: (x: number) => Promise; +declare const number_to_string_promise: (x: number) => Promise; +declare const string_to_boolean_promise: (x: string) => Promise; +declare const string_to_number_promise: (x: string) => Promise; + +declare const a_b_c_d_e_f_to_any_promise: ( + a: null, + b: undefined, + c: boolean, + d: number, + e: string, + f: object, +) => Promise; + +// @dts-jest:pass -> (v1: boolean) => PromiseLike +R_pipeP(boolean_to_number_promise); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike +R_pipeP(a_b_c_d_e_f_to_any_promise); + +// @dts-jest:pass -> (v1: string) => PromiseLike +R_pipeP(string_to_boolean_promise, boolean_to_number_promise); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike +R_pipeP(a_b_c_d_e_f_to_any_promise, boolean_to_number_promise); + +// @dts-jest:pass -> (v1: number) => PromiseLike +R_pipeP( + number_to_string_promise, + string_to_boolean_promise, + boolean_to_number_promise, +); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike +R_pipeP( + a_b_c_d_e_f_to_any_promise, + string_to_boolean_promise, + boolean_to_number_promise, +); + +// @dts-jest:pass -> (v1: string) => PromiseLike +R_pipeP( + string_to_number_promise, + number_to_string_promise, + string_to_boolean_promise, + boolean_to_number_promise, +); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike +R_pipeP( + a_b_c_d_e_f_to_any_promise, + number_to_string_promise, + string_to_boolean_promise, + boolean_to_number_promise, +); + +// @dts-jest:pass -> (v1: boolean) => PromiseLike +R_pipeP( + boolean_to_string_promise, + string_to_number_promise, + number_to_string_promise, + string_to_boolean_promise, + boolean_to_number_promise, +); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike +R_pipeP( + a_b_c_d_e_f_to_any_promise, + string_to_number_promise, + number_to_string_promise, + string_to_boolean_promise, + boolean_to_number_promise, +); + +// @dts-jest:pass -> (v1: number) => PromiseLike +R_pipeP( + number_to_boolean_promise, + boolean_to_string_promise, + string_to_number_promise, + number_to_string_promise, + string_to_boolean_promise, + boolean_to_number_promise, +); +// @dts-jest:pass -> (v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike +R_pipeP( + a_b_c_d_e_f_to_any_promise, + boolean_to_string_promise, + string_to_number_promise, + number_to_string_promise, + string_to_boolean_promise, + boolean_to_number_promise, +); diff --git a/snapshots/pluck.ts b/snapshots/pluck.ts new file mode 100644 index 0000000..e9132f3 --- /dev/null +++ b/snapshots/pluck.ts @@ -0,0 +1,22 @@ +import { Placeholder } from '../ramda/dist/src/$placeholder'; +import * as R_pluck from '../ramda/dist/src/pluck'; + +declare const placeholder: Placeholder; +declare const a_number_record: Record<'a', number>; +declare const string_array: string[]; + +// @dts-jest:pass -> >(list: T[] | ArrayLike) => T["a"][] +R_pluck('a'); +// @dts-jest:pass -> number[] +R_pluck('a')([a_number_record, a_number_record]); + +// @dts-jest:pass -> number[] +R_pluck('a', [a_number_record, a_number_record]); + +// @dts-jest:pass -> (key: K) => Record<"a", number>[K][] +R_pluck(placeholder, [a_number_record, a_number_record]); +// @dts-jest:pass -> number[] +R_pluck(placeholder, [a_number_record, a_number_record])('a'); + +// @dts-jest:pass -> string[] +R_pluck(0, [string_array]); diff --git a/snapshots/prepend.ts b/snapshots/prepend.ts new file mode 100644 index 0000000..4003f11 --- /dev/null +++ b/snapshots/prepend.ts @@ -0,0 +1,14 @@ +import * as R_prepend from '../ramda/dist/src/prepend'; + +declare const string: string; +declare const number: number; +declare const number_array: number[]; + +// @dts-jest:pass -> (string | number)[] +R_prepend(string)(number_array); +// @dts-jest:pass -> (string | number)[] +R_prepend(string, number_array); +// @dts-jest:pass -> number[] +R_prepend(number)(number_array); +// @dts-jest:pass -> number[] +R_prepend(number, number_array); diff --git a/snapshots/product.ts b/snapshots/product.ts new file mode 100644 index 0000000..84d81f4 --- /dev/null +++ b/snapshots/product.ts @@ -0,0 +1,6 @@ +import * as R_product from '../ramda/dist/src/product'; + +declare const number_array: number[]; + +// @dts-jest:pass -> number +R_product(number_array); diff --git a/snapshots/project.ts b/snapshots/project.ts new file mode 100644 index 0000000..7c0d66c --- /dev/null +++ b/snapshots/project.ts @@ -0,0 +1,18 @@ +import { Placeholder } from '../ramda/dist/src/$placeholder'; +import * as R_project from '../ramda/dist/src/project'; + +declare const placeholder: Placeholder; +declare const a_b_number_record: Record<'a' | 'b', number>; + +// @dts-jest:pass -> >(list: T[] | ArrayLike) => Pick[] +R_project(['a']); +// @dts-jest:pass -> Pick, "a">[] +R_project(['a'])([a_b_number_record, a_b_number_record]); + +// @dts-jest:pass -> Pick, "a">[] +R_project(['a'], [a_b_number_record, a_b_number_record]); + +// @dts-jest:pass -> (keys: K[] | ArrayLike) => Pick, K>[] +R_project(placeholder, [a_b_number_record, a_b_number_record]); +// @dts-jest:pass -> Pick, "a">[] +R_project(placeholder, [a_b_number_record, a_b_number_record])(['a']); diff --git a/snapshots/prop.ts b/snapshots/prop.ts new file mode 100644 index 0000000..0c06b4d --- /dev/null +++ b/snapshots/prop.ts @@ -0,0 +1,18 @@ +import { Placeholder } from '../ramda/dist/src/$placeholder'; +import * as R_prop from '../ramda/dist/src/prop'; + +declare const placeholder: Placeholder; +declare const a_b_number_record: Record<'a' | 'b', number>; + +// @dts-jest:pass -> >(object: T) => T["a"] +R_prop('a'); +// @dts-jest:pass -> number +R_prop('a')(a_b_number_record); + +// @dts-jest:pass -> number +R_prop('a', a_b_number_record); + +// @dts-jest:pass -> (key: K) => Record<"a" | "b", number>[K] +R_prop(placeholder, a_b_number_record); +// @dts-jest:pass -> number +R_prop(placeholder, a_b_number_record)('a'); diff --git a/snapshots/propEq.ts b/snapshots/propEq.ts new file mode 100644 index 0000000..bd29df5 --- /dev/null +++ b/snapshots/propEq.ts @@ -0,0 +1,11 @@ +import * as R_propEq from '../ramda/dist/src/propEq'; + +declare const string: string; +declare const object: object; + +// @dts-jest:pass -> (object: {}) => boolean +R_propEq(string, string); +// @dts-jest:pass -> boolean +R_propEq(string)(string)(object); +// @dts-jest:pass -> boolean +R_propEq(string, string, object); diff --git a/snapshots/propIs.ts b/snapshots/propIs.ts new file mode 100644 index 0000000..e4d7073 --- /dev/null +++ b/snapshots/propIs.ts @@ -0,0 +1,12 @@ +import * as R_propIs from '../ramda/dist/src/propIs'; + +declare const object: object; + +// @dts-jest:pass -> (object: U) => object is U & Record<"a", Number> +R_propIs(Number)('a'); +// @dts-jest:pass -> (object: U) => object is U & Record<"a", Number> +R_propIs(Number, 'a'); +// @dts-jest:pass -> boolean +R_propIs(Number)('a')(object); +// @dts-jest:pass -> boolean +R_propIs(Number, 'a', object); diff --git a/snapshots/propOr.ts b/snapshots/propOr.ts new file mode 100644 index 0000000..05f8fe9 --- /dev/null +++ b/snapshots/propOr.ts @@ -0,0 +1,19 @@ +import { Placeholder } from '../ramda/dist/src/$placeholder'; +import * as R_propOr from '../ramda/dist/src/propOr'; + +declare const placeholder: Placeholder; +declare const a_b_number_record: Record<'a' | 'b', number>; +declare const defaults: 'defaults'; + +// @dts-jest:pass -> >(object: T) => "defaults" | T["a"] +R_propOr(defaults, 'a'); +// @dts-jest:pass -> number | "defaults" +R_propOr(defaults, 'a')(a_b_number_record); + +// @dts-jest:pass -> number | "defaults" +R_propOr(defaults, 'a', a_b_number_record); + +// @dts-jest:pass -> (key: K) => "defaults" | Record<"a" | "b", number>[K] +R_propOr(defaults, placeholder, a_b_number_record); +// @dts-jest:pass -> number | "defaults" +R_propOr(defaults, placeholder, a_b_number_record)('a'); diff --git a/snapshots/propSatisfies.ts b/snapshots/propSatisfies.ts new file mode 100644 index 0000000..329e065 --- /dev/null +++ b/snapshots/propSatisfies.ts @@ -0,0 +1,19 @@ +import { Placeholder } from '../ramda/dist/src/$placeholder'; +import * as R_propSatisfies from '../ramda/dist/src/propSatisfies'; + +declare const number_to_boolean: (x: number) => boolean; +declare const placeholder: Placeholder; +declare const a_b_number_record: Record<'a' | 'b', number>; + +// @dts-jest:pass -> (object: Record<"a", any>) => boolean +R_propSatisfies(number_to_boolean, 'a'); +// @dts-jest:pass -> boolean +R_propSatisfies(number_to_boolean, 'a')(a_b_number_record); + +// @dts-jest:pass -> boolean +R_propSatisfies(number_to_boolean, 'a', a_b_number_record); + +// @dts-jest:pass -> (key: "a" | "b") => boolean +R_propSatisfies(number_to_boolean, placeholder, a_b_number_record); +// @dts-jest:pass -> boolean +R_propSatisfies(number_to_boolean, placeholder, a_b_number_record)('a'); diff --git a/snapshots/props.ts b/snapshots/props.ts new file mode 100644 index 0000000..ceec2cf --- /dev/null +++ b/snapshots/props.ts @@ -0,0 +1,18 @@ +import { Placeholder } from '../ramda/dist/src/$placeholder'; +import * as R_props from '../ramda/dist/src/props'; + +declare const placeholder: Placeholder; +declare const a_b_c_number_record: Record<'a' | 'b' | 'c', number>; + +// @dts-jest:pass -> >(object: T) => T["a" | "b"][] +R_props(['a', 'b']); +// @dts-jest:pass -> number[] +R_props(['a', 'b'])(a_b_c_number_record); + +// @dts-jest:pass -> number[] +R_props(['a', 'b'], a_b_c_number_record); + +// @dts-jest:pass -> (keys: K[] | ArrayLike) => Record<"a" | "b" | "c", number>[K][] +R_props(placeholder, a_b_c_number_record); +// @dts-jest:pass -> number[] +R_props(placeholder, a_b_c_number_record)(['a', 'b']); diff --git a/snapshots/ramda-tests.ts b/snapshots/ramda-tests.ts new file mode 100644 index 0000000..20a0d2c --- /dev/null +++ b/snapshots/ramda-tests.ts @@ -0,0 +1,3295 @@ +import * as R from '../ramda/dist/index'; + +// https://github.com/types/npm-ramda/blob/master/tests/test.ts + +// tslint:disable max-file-line-count comment-format naming-convention + +// @dts-jest:group __ +(() => { + const greet = R.replace('{name}', R.__, 'Hello, {name}!'); + // @dts-jest:pass -> string + greet('Alice'); //=> 'Hello, Alice!' +})(); + +// @dts-jest:group add +(() => { + // @dts-jest:pass -> number + R.add(2, 3); //=> 5 + // @dts-jest:pass -> number + R.add(7)(10); //=> 17 +})(); + +// @dts-jest:group addIndex +(() => { + (() => { + const lastTwo = (_val: number, idx: number, list: number[]) => + list.length - idx <= 2; + const filterIndexed = R.addIndex( + R.filter, + ); + + // @dts-jest:pass -> number[] + filterIndexed(lastTwo, [8, 6, 7, 5, 3, 0, 9]); //=> [0, 9] + // @dts-jest:pass -> number[] + filterIndexed(lastTwo)([8, 6, 7, 5, 3, 0, 9]); //=> [0, 9] + })(); + (() => { + const plusFive = (num: number, idx: number, list: number[]) => { + list[idx] = num + 5; + }; + + // @dts-jest:pass -> number[] + R.addIndex(R.forEach)(plusFive)([ + 1, + 2, + 3, + ]); //=> [6, 7, 8] + })(); + (() => { + const squareEnds = (elt: number, idx: number, list: number[]) => + idx === 0 || idx === list.length - 1 ? elt * elt : elt; + + // @dts-jest:pass -> number[] + R.addIndex(R.map)(squareEnds, [ + 8, + 5, + 3, + 0, + 9, + ]); //=> [64, 5, 3, 0, 81] + // @dts-jest:pass -> number[] + R.addIndex(R.map)(squareEnds)([ + 8, + 5, + 3, + 0, + 9, + ]); //=> [64, 5, 3, 0, 81] + })(); + (() => { + const reduceIndexed = R.addIndex< + Record, + string, + Record, + Record, + string[], + Record + >(R.reduce); + const objectify = ( + accObject: Record, + elem: string, + idx: number, + _list: string[], + ) => { + accObject[elem] = idx; + return accObject; + }; + + // @dts-jest:pass -> Record + reduceIndexed(objectify, {}, ['a', 'b', 'c']); //=> {a: 0, b: 1, c: 2} + // @dts-jest:pass -> Record + reduceIndexed(objectify)({}, ['a', 'b', 'c']); //=> {a: 0, b: 1, c: 2} + // @dts-jest:pass -> Record + reduceIndexed(objectify, {})(['a', 'b', 'c']); //=> {a: 0, b: 1, c: 2} + })(); + (() => { + const reduceIndexed = R.addIndex<'1', 'v2x1'>()(R.reduce); + + // @dts-jest:pass -> any + reduceIndexed( + (acc: string, val: string, idx: number) => `${acc},${idx}-${val}`, + '', + ['f', 'o', 'o', 'b', 'a', 'r'], + ); //=> ',0-f,1-o,2-o,3-b,4-a,5-r' + })(); +})(); + +// @dts-jest:group adjust +(() => { + // @dts-jest:pass -> number[] + R.adjust(R.add(10), 1, [1, 2, 3]); //=> [1, 12, 3] + // @dts-jest:pass -> number[] + R.adjust(R.add(10))(1)([1, 2, 3]); //=> [1, 12, 3] +})(); + +// @dts-jest:group all +(() => { + const lessThan2 = R.flip(R.lt)(2); + const lessThan3 = R.flip(R.lt)(3); + + // @dts-jest:pass -> boolean + R.all(lessThan2)([1, 2]); //=> false + // @dts-jest:pass -> boolean + R.all(lessThan3)([1, 2]); //=> true +})(); + +// @dts-jest:group allPass +(() => { + const gt10 = (x: number) => x > 10; + const even = (x: number) => x % 2 === 0; + + // @dts-jest:pass -> boolean + R.allPass([gt10, even])(11); //=> false + // @dts-jest:pass -> boolean + R.allPass([gt10, even])(12); //=> true +})(); + +// @dts-jest:group always +(() => { + // @dts-jest:pass -> string + R.always('Tee')(); //=> 'Tee' +})(); + +// @dts-jest:group and +(() => { + // @dts-jest:pass -> boolean + R.and(false, true); //=> false + // @dts-jest:pass -> 0 | never[] + R.and(0, []); //=> 0 + // @dts-jest:pass -> number | never[] + R.and(0)([]); //=> 0 + // @dts-jest:pass -> "" | null + R.and(null, ''); //=> null +})(); + +// @dts-jest:group any +(() => { + const lessThan0 = R.flip(R.lt)(0); + const lessThan2 = R.flip(R.lt)(2); + + // @dts-jest:pass -> boolean + R.any(lessThan0)([1, 2]); //=> false + // @dts-jest:pass -> boolean + R.any(lessThan2)([1, 2]); //=> true +})(); + +// @dts-jest:group anyPass +(() => { + const gt10 = (x: number) => x > 10; + const even = (x: number) => x % 2 === 0; + + // @dts-jest:pass -> boolean + R.anyPass([gt10, even])(11); //=> true + // @dts-jest:pass -> boolean + R.anyPass([gt10, even])(8); //=> true + // @dts-jest:pass -> boolean + R.anyPass([gt10, even])(9); //=> false +})(); + +// @dts-jest:group ap +(() => { + // @dts-jest:pass -> number[] + R.ap([R.multiply(2), R.add(3)], [1, 2, 3]); //=> [2, 4, 6, 4, 5, 6] + // @dts-jest:pass -> number[] + R.ap([R.multiply(2), R.add(3)])([1, 2, 3]); //=> [2, 4, 6, 4, 5, 6] +})(); + +// @dts-jest:group aperture +(() => { + // @dts-jest:pass -> number[][] + R.aperture(2, [1, 2, 3, 4, 5]); //=> [[1, 2], [2, 3], [3, 4], [4, 5]] + // @dts-jest:pass -> number[][] + R.aperture(3, [1, 2, 3, 4, 5]); //=> [[1, 2, 3], [2, 3, 4], [3, 4, 5]] + // @dts-jest:pass -> number[][] + R.aperture(7, [1, 2, 3, 4, 5]); //=> [] + // @dts-jest:pass -> number[][] + R.aperture(7)([1, 2, 3, 4, 5]); //=> [] +})(); + +// @dts-jest:group append +(() => { + // @dts-jest:pass -> string[] + R.append('tests', ['write', 'more']); //=> ['write', 'more', 'tests'] + // @dts-jest:pass -> string[] + R.append('tests')(['write', 'more']); //=> ['write', 'more', 'tests'] + // @dts-jest:pass -> string[] + R.append('tests', []); //=> ['tests'] + // @dts-jest:pass -> (string | string[])[] + R.append(['tests'], ['write', 'more']); //=> ['write', 'more', ['tests']] + // @dts-jest:pass -> (string | string[])[] + R.append(['tests'])(['write', 'more']); //=> ['write', 'more', ['tests']] +})(); + +// @dts-jest:group apply +(() => { + const nums = [1, 2, 3, -99, 42, 6, 7]; + + // @dts-jest:pass -> number + R.apply(Math.max, nums); //=> 42 + // @dts-jest:pass -> number + R.apply(Math.max)(nums); //=> 42 +})(); + +// @dts-jest:group applySpec +(() => { + interface T { + sum: number; + nested: { + mul: number; + }; + } + const getMetrics = R.applySpec({ + sum: R.add, + nested: { + mul: R.multiply, + }, + }); + // @dts-jest:pass -> T + getMetrics(2, 4); //=> {sum: 6, nested: {mul: 8}} +})(); + +// @dts-jest:group ascend +(() => { + const byAge = R.ascend(R.prop('age')); + const alice = { + name: 'ALICE', + age: 101, + }; + const bob = { + name: 'Bob', + age: -10, + }; + const clara = { + name: 'clara', + age: 314.159, + }; + const people = [clara, bob, alice]; + + // @dts-jest:pass -> {}[] + R.sort(byAge, people); + // @dts-jest:pass -> { name: string; age: number; }[] + R.sort(R.__, people)(byAge); +})(); + +// @dts-jest:group assoc +(() => { + // @dts-jest:pass -> { a: number; b: number; } & Record<"c", number> + R.assoc('c', 3, { a: 1, b: 2 }); //=> {a: 1, b: 2, c: 3} + // @dts-jest:pass -> { a: number; b: number; } & Record<"c", number> + R.assoc('c')(3, { a: 1, b: 2 }); //=> {a: 1, b: 2, c: 3} + // @dts-jest:pass -> { a: number; b: number; } & Record<"c", number> + R.assoc('c', 3)({ a: 1, b: 2 }); //=> {a: 1, b: 2, c: 3} +})(); + +// @dts-jest:group assocPath +(() => { + // @dts-jest:pass -> { a: { b: { c: number; }; }; } + R.assocPath(['a', 'b', 'c'], 42, { a: { b: { c: 0 } } }); //=> {a: {b: {c: 42}}} + // @dts-jest:pass -> { a: { b: { c: number; }; }; } + R.assocPath(['a', 'b', 'c'])(42, { a: { b: { c: 0 } } }); //=> {a: {b: {c: 42}}} + // @dts-jest:pass -> { a: { b: { c: number; }; }; } + R.assocPath(['a', 'b', 'c'], 42)({ a: { b: { c: 0 } } }); //=> {a: {b: {c: 42}}} +})(); + +// @dts-jest:group binary +(() => { + const takesThreeArgs = (a: number, b: number, c: number) => [a, b, c]; + const takesTwoArgs = R.binary(takesThreeArgs); + + // @dts-jest:pass -> number + takesThreeArgs.length; //=> 3 + // @dts-jest:pass -> number[] + takesThreeArgs(1, 2, 3); //=> [1, 2, 3] + + // @dts-jest:pass -> number + takesTwoArgs.length; //=> 2 + // @dts-jest:fail -> Expected 2 arguments, but got 3. + takesTwoArgs(1, 2, 3); +})(); + +// @dts-jest:group bind +(() => { + // @dts-jest:pass -> (message?: any, ...optionalParams: any[]) => void + R.bind(console.log, console); +})(); + +// @dts-jest:group both +(() => { + const gt10 = (x: number) => x > 10; + const even = (x: number) => x % 2 === 0; + + // @dts-jest:pass -> boolean + R.both(gt10, even)(100); //=> true + // @dts-jest:pass -> boolean + R.both(gt10)(even)(101); //=> false +})(); + +// @dts-jest:group call +(() => { + // @dts-jest:pass -> number + R.call(R.add<'11'>(), 1, 2); //=> 3 +})(); + +// @dts-jest:group chain +(() => { + const duplicate = (n: number) => [n, n]; + + // @dts-jest:pass -> number[] + R.chain(duplicate, [1, 2, 3]); //=> [1, 1, 2, 2, 3, 3] + // @dts-jest:pass -> number[] + R.chain(duplicate)([1, 2, 3]); //=> [1, 1, 2, 2, 3, 3] + // @dts-jest:pass -> number[] + R.chain(R.append, R.head)([1, 2, 3]); //=> [1, 2, 3, 1] + // @dts-jest:pass -> number[] + R.chain(R.append)(R.head)([1, 2, 3]); //=> [1, 2, 3, 1] +})(); + +// @dts-jest:group clamp +(() => { + // @dts-jest:pass -> 1 | 10 | -1 + R.clamp(1, 10, -1); //=> 1 + // @dts-jest:pass -> number + R.clamp(1)(10)(-1); //=> 1 + // @dts-jest:pass -> number + R.clamp(1, 10)(11); //=> 10 + // @dts-jest:pass -> number + R.clamp(1)(10, 4); //=> 4 + // @dts-jest:pass -> "a" | "d" | "e" + R.clamp('a', 'd', 'e'); //=> 'd' + // @dts-jest:pass -> string + R.clamp('a')('d')('e'); //=> 'd' + // @dts-jest:fail -> Argument of type '"str"' is not assignable to parameter of type '1'. + R.clamp(1, 'str', true); + // @dts-jest:fail -> Argument of type '"str"' is not assignable to parameter of type 'number'. + R.clamp(1)('str')(true); + // @dts-jest:pass -> Date + R.clamp(new Date(0), new Date(1), new Date(2)); //=> new Date(1) + // @dts-jest:pass -> Date + R.clamp(new Date(0))(new Date(1))(new Date(2)); //=> new Date(1) +})(); + +// @dts-jest:group clone +(() => { + const obj1 = [{}, {}, {}]; + const obj2 = [{ a: 1 }, { a: 2 }, { a: 3 }]; + + // @dts-jest:pass -> {}[] + R.clone(obj1); + // @dts-jest:pass -> { a: number; }[] + R.clone(obj2); + + // @dts-jest:pass -> {}[] + R.clone([{}, {}, {}]); + // @dts-jest:pass -> number[] + R.clone([1, 2, 3]); + // @dts-jest:pass -> {} + R.clone({}); + // @dts-jest:pass -> 10 + R.clone(10); + // @dts-jest:pass -> "foo" + R.clone('foo'); + // @dts-jest:pass -> number + R.clone(Date.now()); +})(); + +// @dts-jest:group comparator +(() => { + interface Person { + age: number; + name: string; + } + const people = [ + { name: 'Agy', age: 33 }, + { name: 'Bib', age: 15 }, + { name: 'Cari', age: 16 }, + ]; + + // @dts-jest:pass -> { name: string; age: number; }[] + R.sort(R.comparator((a: Person, b: Person) => a.age < b.age), people); +})(); + +// @dts-jest:group complement +(() => { + const isEven = (n: number) => n % 2 === 0; + + // @dts-jest:pass -> boolean + R.complement(isEven)(21); //=> true + // @dts-jest:pass -> boolean + R.complement(isEven)(42); //=> false +})(); + +// @dts-jest:group compose +(() => { + const double = (x: number): number => x + x; + (() => { + const f0 = R.compose(Math.pow); + const f1 = R.compose(R.negate, Math.pow); + const f2 = R.compose(R.inc, R.negate, Math.pow); + const f3 = R.compose(R.inc, R.inc, R.negate, Math.pow); + const f4 = R.compose(R.inc, R.inc, R.inc, R.negate, Math.pow); + const f5 = R.compose(R.inc, R.inc, R.inc, R.inc, R.negate, Math.pow); + + // @dts-jest:pass -> number + f0(3, 4); // -(3^4) + 1 + // @dts-jest:pass -> number + f1(3, 4); // -(3^4) + 1 + // @dts-jest:pass -> number + f2(3, 4); // -(3^4) + 1 + // @dts-jest:pass -> number + f3(3, 4); // -(3^4) + 1 + // @dts-jest:pass -> number + f4(3, 4); // -(3^4) + 1 + // @dts-jest:pass -> number + f5(3, 4); // -(3^4) + 1 + })(); + (() => { + // @dts-jest:pass -> (v1: number) => number + R.compose(double, R.identity); + })(); + (() => { + const fn = (a: string, b: number, c: string) => [a, b, c]; + const gn = R.compose(R.length, fn); + + // @dts-jest:pass -> number + gn('Hello', 4, 'world'); + })(); + (() => { + const limit10 = (x: number): boolean => x >= 10; + // @dts-jest:pass -> (v1: number) => boolean + R.compose(limit10, double); + // @dts-jest:pass -> boolean + R.compose(limit10, double)(10); + + // akward example that bounces types between number and string + const g0 = (list: number[]) => R.map(R.inc, list); + const g1 = R.dropWhile(R.gt(10)); + const g2 = R.map((i: number) => (i > 5 ? 'bigger' : 'smaller')); + const g3 = R.all((i: string) => i === 'smaller'); + const g = R.compose( + g3, + g2, + g1, + g0, + ); + + // @dts-jest:pass -> (v1: number[]) => boolean + g; + // @dts-jest:pass -> boolean + g([1, 2, 10, 13]); + })(); +})(); + +// @dts-jest:group:skip composeK +(() => { + // TODO +})(); + +// @dts-jest:group composeP +(() => { + interface User { + name: string; + followers: string[]; + } + interface DateBase { + users: { + [userId: string]: User; + }; + } + const db: DateBase = { + users: { + JOE: { + name: 'Joe', + followers: ['STEVE', 'SUZY'], + }, + }, + }; + + const lookupUser = (userId: string) => Promise.resolve(db.users[userId]); + const lookupFollowers = (user: User) => Promise.resolve(user.followers); + + // @dts-jest:pass -> (v1: string) => PromiseLike + R.composeP(lookupFollowers, lookupUser); + // @dts-jest:pass -> PromiseLike + R.composeP(lookupFollowers, lookupUser)('JOE'); +})(); + +// @dts-jest:group concat +(() => { + // @dts-jest:pass -> never[] + R.concat([], []); //=> [] + // @dts-jest:pass -> number[] + R.concat([4, 5, 6], [1, 2, 3]); //=> [4, 5, 6, 1, 2, 3] + // @dts-jest:pass -> number[] + R.concat([4, 5, 6])([1, 2, 3]); //=> [4, 5, 6, 1, 2, 3] + // @dts-jest:pass -> string + R.concat('ABC')('DEF'); // 'ABCDEF' +})(); + +// @dts-jest:group cond +(() => { + const fn = R.cond([ + [R.equals(0), R.always('water freezes at 0°C')], + [R.equals(100), R.always('water boils at 100°C')], + [R.T, (temp: number) => `nothing special happens at ${temp}°C`], + ]); + + // @dts-jest:pass -> string + fn(0); //=> 'water freezes at 0°C' + // @dts-jest:pass -> string + fn(50); //=> 'nothing special happens at 50°C' + // @dts-jest:pass -> string + fn(100); //=> 'water boils at 100°C' +})(); + +(() => { + class Circle { + public r: number; + public colors: string[]; + constructor(r: number, ...colors: string[]) { + this.r = r; + this.colors = colors; + } + public area() { + return Math.PI * Math.pow(this.r, 2); + } + } + // @dts-jest:group construct + (() => { + // @dts-jest:pass -> Circle + R.construct<'1', 'variadic'>()(Circle)(1, 'red'); + })(); + // @dts-jest:group constructN + (() => { + // @dts-jest:pass -> Circle + R.constructN(2, Circle)(1, 'red'); + })(); +})(); + +// @dts-jest:group contains +(() => { + const obj = {}; + + // @dts-jest:pass -> boolean + R.contains(obj)([{}, obj, {}]); //=> true + // @dts-jest:pass -> boolean + R.contains(3)([1, 2, 3]); //=> true + // @dts-jest:pass -> boolean + R.contains(3, [1, 2, 3]); //=> true + // @dts-jest:pass -> boolean + R.contains(4)([1, 2, 3]); //=> false + // @dts-jest:pass -> boolean + R.contains({})([{}, {}]); //=> true +})(); + +// @dts-jest:group converge +(() => { + const add = (a: number, b: number) => a + b; + const add3 = (a: number, b: number, c: number) => a + b + c; + + const subtract = (a: number, b: number) => a - b; + const multiply = (a: number, b: number) => a * b; + + // @dts-jest:pass -> number + R.converge(multiply, [add, subtract])(1, 2); //=> -3 + + // @dts-jest:pass -> number + R.converge(add3, [multiply, add, subtract])(1, 2); //=> 4 +})(); + +// @dts-jest:group countBy +(() => { + const numbers = [1, 1.1, 1.2, 2, 3, 2.2]; + const letters = R.split('', 'abcABCaaaBBc'); + // @dts-jest:pass -> Dictionary + R.countBy(Math.floor)(numbers); //=> {'1': 3, '2': 2, '3': 1} + // @dts-jest:pass -> Dictionary + R.countBy(R.toLower)(letters); //=> {'a': 5, 'b': 4, 'c': 3} +})(); + +// @dts-jest:group curry +(() => { + const addTwo = R.curry((x: number, y: number) => x + y); + // @dts-jest:pass -> CurriedFunction1 + addTwo(3); + // @dts-jest:pass -> number + addTwo(3)(1); + + const addThree = R.curry((x: number, y: number, z: number) => x + y + z); + // @dts-jest:pass -> number + addThree(3, 2, 1); + // @dts-jest:pass -> number + addThree(3)(2)(1); + // @dts-jest:pass -> CurriedFunction1 + addThree(3, 2); + // @dts-jest:pass -> CurriedFunction1 + addThree(3)(2); + // @dts-jest:pass -> CurriedFunction2 + addThree(3); + + const xy = R.curry((x: X, y: Y) => ({ x, y })); + + // @dts-jest:skip (v2: Y) => { x: number; y: Y; } + xy(3); + // @dts-jest:skip { x: number; y: number; } + xy(3)(1); + + const xyz = R.curry((x: X, y: Y, z: Z) => ({ x, y, z })); + // @dts-jest:skip { x: number; y: number; z: number; } + xyz(3, 2, 1); + // @dts-jest:skip { x: number; y: number; z: number; } + xyz(3)(2)(1); + // @dts-jest:skip (v3: Z) => ({ x: number; y: number; z: Z; }) + xyz(3, 2); + // @dts-jest:skip (v3: Z) => ({ x: number; y: number; z: Z; }) + xyz(3)(2); + // @dts-jest:skip (v2: Y, v3: Z) => ({ x: number; y: Y; z: Z; }) + xyz(3); +})(); + +// @dts-jest:group curryN +(() => { + const sumArgs = (...args: number[]) => R.sum(args); + const curriedAddFourNumbers = R.curryN(4, sumArgs); + + // @dts-jest:pass -> CurriedFunction4 + curriedAddFourNumbers; + // @dts-jest:pass -> number + curriedAddFourNumbers(1, 2)(3)(4); //=> 10 +})(); + +// @dts-jest:group dec +(() => { + // @dts-jest:pass -> number + R.dec(42); //=> 41 +})(); + +// @dts-jest:group defaultTo +(() => { + const defaultTo42 = R.defaultTo(42); + // @dts-jest:pass -> number + defaultTo42(null); //=> 42 + // @dts-jest:pass -> number + defaultTo42(undefined); //=> 42 + // @dts-jest:pass -> number | "Ramda" + defaultTo42('Ramda'); //=> 'Ramda' +})(); + +// @dts-jest:group descend +(() => { + const byAge = R.descend(R.prop('age')); + const alice = { + name: 'ALICE', + age: 101, + }; + const bob = { + name: 'Bob', + age: -10, + }; + const clara = { + name: 'clara', + age: 314.159, + }; + const people = [clara, bob, alice]; + // @dts-jest:pass -> {}[] + R.sort(byAge, people); + // @dts-jest:pass -> { name: string; age: number; }[] + R.sort(R.__, people)(byAge); +})(); + +// @dts-jest:group difference +(() => { + // @dts-jest:pass -> number[] + R.difference([1, 2, 3, 4], [7, 6, 5, 4, 3]); //=> [1,2] + // @dts-jest:pass -> number[] + R.difference([7, 6, 5, 4, 3], [1, 2, 3, 4]); //=> [7,6,5] +})(); + +// @dts-jest:group differenceWith +(() => { + function cmp(x: { a: number }, y: { a: number }) { + return x.a === y.a; + } + const l1 = [{ a: 1 }, { a: 2 }, { a: 3 }]; + const l2 = [{ a: 3 }, { a: 4 }]; + // @dts-jest:pass -> { a: number; }[] + R.differenceWith(cmp, l1, l2); //=> [{a: 1}, {a: 2}] + // @dts-jest:pass -> { a: number; }[] + R.differenceWith(cmp)(l1, l2); //=> [{a: 1}, {a: 2}] + // @dts-jest:pass -> { a: number; }[] + R.differenceWith(cmp)(l1)(l2); //=> [{a: 1}, {a: 2}] +})(); + +// @dts-jest:group dissoc +(() => { + // @dts-jest:pass -> Pick<{ a: number; b: number; c: number; }, "a" | "c"> + R.dissoc('b', { a: 1, b: 2, c: 3 }); //=> {a: 1, c: 3} + // @dts-jest:pass -> Pick<{ a: number; b: number; c: number; }, "a" | "c"> + R.dissoc('b')({ a: 1, b: 2, c: 3 }); //=> {a: 1, c: 3} +})(); + +// @dts-jest:group dissocPath +(() => { + // @dts-jest:pass -> { a?: DeepPartial | undefined; } + R.dissocPath(['a', 'b', 'c'], { a: { b: { c: 42 } } }); //=> {a: {b: {}}} + // @dts-jest:pass -> { a?: DeepPartial | undefined; } + R.dissocPath(['a', 'b', 'c'])({ a: { b: { c: 42 } } }); //=> {a: {b: {}}} +})(); + +// @dts-jest:group divide +(() => { + // @dts-jest:pass -> number + R.divide(71, 100); //=> 0.71 + // @dts-jest:pass -> number + R.flip(R.divide)(2)(42); //=> 21 + // @dts-jest:pass -> number + R.divide(1)(4); //=> 0.25 +})(); + +// @dts-jest:group drop +(() => { + // @dts-jest:pass -> number[] + R.drop(3, [1, 2, 3, 4, 5, 6, 7]); //=> [4,5,6,7] + // @dts-jest:pass -> number[] + R.drop(3)([1, 2, 3, 4, 5, 6, 7]); //=> [4,5,6,7] + // @dts-jest:pass -> string + R.drop(3, 'ramda'); //=> 'da' + // @dts-jest:pass -> string + R.drop(3)('ramda'); //=> 'da' +})(); + +// @dts-jest:group dropLast +(() => { + // @dts-jest:pass -> string[] + R.dropLast(1, ['foo', 'bar', 'baz']); //=> ['foo', 'bar'] + // @dts-jest:pass -> string[] + R.dropLast(2)(['foo', 'bar', 'baz']); //=> ['foo'] + // @dts-jest:pass -> string + R.dropLast(3, 'ramda'); //=> 'ra' + // @dts-jest:pass -> string + R.dropLast(3)('ramda'); //=> 'ra' +})(); + +// @dts-jest:group dropLastWhile +(() => { + const lteThree = (x: number) => x <= 3; + // @dts-jest:pass -> number[] + R.dropLastWhile(lteThree, [1, 2, 3, 4, 3, 2, 1]); //=> [1, 2, 3, 4] +})(); + +// @dts-jest:group dropRepeats +(() => { + // @dts-jest:pass -> number[] + R.dropRepeats([1, 1, 1, 2, 3, 4, 4, 2, 2]); //=> [1, 2, 3, 4, 2] +})(); + +// @dts-jest:group dropRepeatsWith +(() => { + const l = [1, -1, 1, 3, 4, -4, -4, -5, 5, 3, 3]; + // @dts-jest:pass -> number[] + R.dropRepeatsWith(R.eqBy(Math.abs), l); //=> [1, 3, 4, -5, 3] +})(); + +// @dts-jest:group dropWhile +(() => { + const lteTwo = (x: number) => x <= 2; + // @dts-jest:pass -> number[] + R.dropWhile(lteTwo, [1, 2, 3, 4]); //=> [3, 4] + // @dts-jest:pass -> number[] + R.dropWhile(lteTwo)([1, 2, 3, 4]); //=> [3, 4] +})(); + +// @dts-jest:group either +(() => { + const gt10 = (x: number) => x > 10; + const even = (x: number) => x % 2 === 0; + // @dts-jest:pass -> boolean + R.either(gt10, even)(101); //=> true + // @dts-jest:pass -> boolean + R.either(gt10)(even)(8); //=> true +})(); + +// @dts-jest:group empty +(() => { + // @dts-jest:pass -> number[] + R.empty([1, 2, 3, 4, 5]); //=> [] + // @dts-jest:pass -> number[] + R.empty([1, 2, 3]); //=> [] + // @dts-jest:pass -> string + R.empty('unicorns'); //=> '' + // @dts-jest:pass -> {} + R.empty({ x: 1, y: 2 }); //=> {} +})(); + +// @dts-jest:group endsWith +(() => { + // @dts-jest:pass -> boolean + R.endsWith('c', 'abc'); //=> true + // @dts-jest:pass -> boolean + R.endsWith('b', 'abc'); //=> false + // @dts-jest:pass -> boolean + R.endsWith(['c'], ['a', 'b', 'c']); //=> true + // @dts-jest:pass -> boolean + R.endsWith(['b'], ['a', 'b', 'c']); //=> false +})(); + +// @dts-jest:group eqBy +(() => { + // @dts-jest:pass -> boolean + R.eqBy(Math.abs, 5, -5); //=> true + // @dts-jest:pass -> boolean + R.eqBy(Math.abs)(5, -5); //=> true + // @dts-jest:pass -> boolean + R.eqBy(Math.abs, 5)(-5); //=> true +})(); + +// @dts-jest:group eqProps +(() => { + const o1 = { a: 1, b: 2, c: 3, d: 4 }; + const o2 = { a: 10, b: 20, c: 3, d: 40 }; + // @dts-jest:pass -> boolean + R.eqProps('a', o1, o2); //=> false + // @dts-jest:pass -> boolean + R.eqProps('c', o1, o2); //=> true + // @dts-jest:pass -> (b: { a: number; b: number; c: number; d: number; }) => boolean + R.eqProps('c')(o1); + // @dts-jest:pass -> (b: { a: number; b: number; c: number; d: number; }) => boolean + R.eqProps('c', o1); +})(); + +// @dts-jest:group equals +(() => { + // @dts-jest:pass -> boolean + R.equals(1, 1); //=> true + // @dts-jest:pass -> boolean + R.equals('2', '1'); //=> false + // @dts-jest:pass -> boolean + R.equals([1, 2, 3], [1, 2, 3]); //=> true + + const a: any = {}; + a.v = a; + const b: any = {}; + b.v = b; + // @dts-jest:pass -> boolean + R.equals(a, b); //=> true +})(); + +// @dts-jest:group evolve +(() => { + const tomato = { + firstName: 'Tomato ', + data: { elapsed: 100, remaining: 1400 }, + id: 123, + }; + const transformations = { + firstName: R.trim, + data: { elapsed: R.add(1), remaining: R.add(-1) }, + }; + // @dts-jest:pass -> { firstName: string; data: { elapsed: number; remaining: number; }; id: number; } + R.evolve(transformations, tomato); //=> {firstName: 'Tomato', data: {elapsed: 101, remaining: 1399}, id: 123} + // @dts-jest:pass -> { firstName: string; data: { elapsed: number; remaining: number; }; id: number; } + R.evolve(transformations)(tomato); //=> {firstName: 'Tomato', data: {elapsed: 101, remaining: 1399}, id: 123} +})(); + +// @dts-jest:group F +(() => { + // @dts-jest:pass -> false + R.F(); +})(); + +// @dts-jest:group filter +(() => { + const isEven = (n: number) => n % 2 === 0; + + // @dts-jest:pass -> number[] + R.filter(isEven, [1, 2, 3, 4]); //=> [2, 4] + // @dts-jest:pass -> number[] + R.filter(isEven)([1, 2, 3, 4]); + // @dts-jest:pass -> Partial<{ a: number; b: number; c: number; d: number; }> + R.filter(isEven, { a: 1, b: 2, c: 3, d: 4 }); //=> {b: 2, d: 4} + // @dts-jest:pass -> Partial<{ a: number; b: number; c: number; d: number; }> + R.filter(isEven)({ a: 1, b: 2, c: 3, d: 4 }); +})(); + +// @dts-jest:group find +(() => { + interface Task { + id: number; + } + const tasks: Task[] = []; + + // @dts-jest:pass -> Task | undefined + R.find((task: Task) => task.id === 1)(tasks); +})(); + +// @dts-jest:group findIndex +(() => { + interface Task { + a: number; + } + const xs = [{ a: 1 }, { a: 2 }, { a: 3 }]; + const a: (list: Task[]) => number = R.findIndex(R.propEq('a', 2)); + // @dts-jest:pass -> number + a(xs); //=> 1 + // @dts-jest:pass -> number + R.findIndex(R.propEq('a', 4))(xs); //=> -1 + + // @dts-jest:pass -> number + R.findIndex((x: number) => x === 1, [1, 2, 3]); +})(); + +// @dts-jest:group findLast +(() => { + const xs = [{ a: 1, b: 0 }, { a: 1, b: 1 }]; + // @dts-jest:pass -> { a: number; b: number; } | undefined + R.findLast(R.propEq('a', 1))(xs); //=> {a: 1, b: 1} + // @dts-jest:pass -> { a: number; b: number; } | undefined + R.findLast(R.__, xs)(R.propEq('a', 4)); //=> undefined +})(); + +// @dts-jest:group findLastIndex +(() => { + const xs = [{ a: 1, b: 0 }, { a: 1, b: 1 }]; + // @dts-jest:pass -> number + R.findLastIndex(R.propEq('a', 1))(xs); //=> 1 + // @dts-jest:pass -> number + R.findLastIndex(R.propEq('a', 4))(xs); //=> -1 + // @dts-jest:pass -> number + R.findLastIndex((x: number) => x === 1, [1, 2, 3]); +})(); + +// @dts-jest:group flatten +(() => { + // @dts-jest:pass -> number[] + R.flatten([1, 2, [3, 4], 5]); //=> [1, 2, 3, 4, 5] + // @dts-jest:pass -> number[] + R.flatten([1, 2, [3, 4], 5, [6, [7, 8, [9, [10, 11], 12]]]]) as number[]; //=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] +})(); + +// @dts-jest:group flip +(() => { + const mergeThree = ( + a: boolean, + b: number, + c: string, + ): [boolean, number, string] => [a, b, c]; + + // @dts-jest:pass -> [boolean, number, string] + mergeThree(true, 1, 'str'); //=> [true, 1, 'str'] + + // @dts-jest:pass -> [boolean, number, string] + R.flip(mergeThree)(1, true, 'str'); //=> [true, 1, 'str'] +})(); + +// @dts-jest:group forEach +(() => { + const printXPlusFive = (_x: number) => { + /* console.log(x + 5); */ + }; + // @dts-jest:pass -> number[] + R.forEach(printXPlusFive, [1, 2, 3]); //=> [1, 2, 3] + // @dts-jest:pass -> number[] + R.forEach(printXPlusFive)([1, 2, 3]); //=> [1, 2, 3] +})(); + +// @dts-jest:group forEachObjIndexed +(() => { + const printKeyConcatValue = (_value: number, _key: string) => { + /* console.log(`${key}:${value}`); */ + }; + // @dts-jest:pass -> { x: number; y: number; } + R.forEachObjIndexed(printKeyConcatValue, { x: 1, y: 2 }); + // @dts-jest:pass -> Dictionary + R.forEachObjIndexed(printKeyConcatValue)({ x: 1, y: 2 }); +})(); + +// @dts-jest:group fromPairs +(() => { + // @dts-jest:pass -> Dictionary + R.fromPairs([['a', 1], ['b', 2], ['c', 3]]); //=> {a: 1, b: 2, c: 3} +})(); + +// @dts-jest:group groupBy +(() => { + const byGrade = R.groupBy((student: { score: number; name: string }) => { + const score = student.score; + return score < 65 + ? 'F' + : score < 70 ? 'D' : score < 80 ? 'C' : score < 90 ? 'B' : 'A'; + }); + const students = [ + { name: 'Abby', score: 84 }, + { name: 'Eddy', score: 58 }, + { name: 'Jack', score: 69 }, + ]; + // @dts-jest:pass -> Dictionary<{ score: number; name: string; }[]> + byGrade(students); +})(); + +// @dts-jest:group groupWith +(() => { + // @dts-jest:pass -> number[][] + R.groupWith(R.equals, [0, 1, 1, 2, 3, 5, 8, 13, 21]); + // [[0], [1, 1], [2, 3, 5, 8, 13, 21]] + + // @dts-jest:pass -> number[][] + R.groupWith((a: number, b: number) => a % 2 === b % 2, [ + 0, + 1, + 1, + 2, + 3, + 5, + 8, + 13, + 21, + ]); + // [[0], [1, 1], [2], [3, 5], [8], [13, 21]] + + const isVowel = (a: string) => (R.contains(a, 'aeiou') ? a : ''); + // @dts-jest:pass -> string[] + R.groupWith(R.eqBy(isVowel), 'aestiou'); + // ['ae', 'st', 'iou'] +})(); + +// @dts-jest:group gt +(() => { + // @dts-jest:pass -> boolean + R.gt(2, 6); //=> false + // @dts-jest:pass -> boolean + R.gt(2, 0); //=> true + // @dts-jest:pass -> boolean + R.gt(2, 2); //=> false + // @dts-jest:pass -> boolean + R.flip(R.gt)(2)(10); //=> true + // @dts-jest:pass -> boolean + R.gt(2)(10); //=> false +})(); + +// @dts-jest:group gte +(() => { + // @dts-jest:pass -> boolean + R.gte(2, 6); //=> false + // @dts-jest:pass -> boolean + R.gte(2, 0); //=> true + // @dts-jest:pass -> boolean + R.gte(2, 2); //=> true + // @dts-jest:pass -> boolean + R.flip(R.gte)(2)(10); //=> true + // @dts-jest:pass -> boolean + R.gte(2)(10); //=> false +})(); + +// @dts-jest:group has +(() => { + const hasName = R.has('name'); + // @dts-jest:pass -> boolean + hasName({ name: 'alice' }); //=> true + // @dts-jest:pass -> boolean + hasName({ name: 'bob' }); //=> true + // @dts-jest:pass -> boolean + hasName({}); //=> false + + const point = { x: 0, y: 0 }; + const pointHas = R.flip(R.has)(point); + // @dts-jest:pass -> boolean + pointHas('x'); //=> true + // @dts-jest:pass -> boolean + pointHas('y'); //=> true + // @dts-jest:pass -> boolean + pointHas('z'); //=> false +})(); + +// @dts-jest:group hasIn +(() => { + class Rectangle { + public width: number; + public height: number; + constructor(width: number, height: number) { + this.width = width; + this.height = height; + } + public area(): number { + return this.width * this.height; + } + } + const square = new Rectangle(2, 2); + // @dts-jest:pass -> boolean + R.hasIn('width', square); //=> true + // @dts-jest:pass -> boolean + R.hasIn('area', square); //=> true + // @dts-jest:pass -> boolean + R.flip(R.hasIn)(square)('area'); //=> true +})(); + +// @dts-jest:group head +(() => { + // @dts-jest:pass -> string + R.head(['fi', 'fo', 'fum']); //=> 'fi' + // @dts-jest:pass -> number + R.head([10, 'ten']); //=> 10 + // @dts-jest:pass -> string + R.head(['10', 10]); //=> '10' + + const ids = ['id1', 'id2', 'id3']; + // @dts-jest:pass -> string | undefined + R.head(ids); //=> 'id1' +})(); + +// @dts-jest:group identical +(() => { + const o = {}; + // @dts-jest:pass -> boolean + R.identical(o, o); //=> true + // @dts-jest:pass -> boolean + R.identical(1, 1); //=> true + // @dts-jest:pass -> boolean + R.identical('2', '1'); //=> false + // @dts-jest:pass -> boolean + R.identical([], []); //=> false + // @dts-jest:pass -> boolean + R.identical(0, -0); //=> false + // @dts-jest:pass -> boolean + R.identical(NaN, NaN); //=> true +})(); + +// @dts-jest:group identity +(() => { + const obj = {}; + + // @dts-jest:pass -> boolean + R.identity(obj) === obj; //=> true + // @dts-jest:pass -> 1 + R.identity(1); //=> 1 + // @dts-jest:pass -> number[] + R.identity([1, 2, 3]); + // @dts-jest:pass -> string[] + R.identity(['a', 'b', 'c']); +})(); + +// @dts-jest:group ifElse +(() => { + // Flatten all arrays in the list but leave other values alone. + const flattenArrays = R.map(R.ifElse(Array.isArray, R.flatten, R.identity)); + + // @dts-jest:pass -> any[] + flattenArrays([[0], [[10], [8]], 1234, {}]); //=> [[0], [10, 8], 1234, {}] + // @dts-jest:pass -> any[] + flattenArrays([[[10], 123], [8, [10]], 'hello']); //=> [[10, 123], [8, 10], 'hello'] +})(); + +// @dts-jest:group inc +(() => { + const f = R.pipe(Math.pow, R.negate, R.inc); + // @dts-jest:pass -> number + f(3, 4); // -(3^4) + 1 +})(); + +// @dts-jest:group indexBy +(() => { + const list = [{ id: 'xyz', title: 'A' }, { id: 'abc', title: 'B' }]; + // @dts-jest:pass -> Dictionary<{}> + R.indexBy(R.prop('id'), list); + // @dts-jest:pass -> Dictionary<{}> + R.indexBy(R.prop('id'))(list); + // @dts-jest:pass -> Dictionary<{ id: string; }> + R.indexBy<{ id: string }>(R.prop('id'))(list); +})(); + +// @dts-jest:group indexOf +(() => { + // @dts-jest:pass -> number + R.indexOf(3, [1, 2, 3, 4]); //=> 2 + // @dts-jest:pass -> number + R.indexOf(10)([1, 2, 3, 4]); //=> -1 +})(); + +// @dts-jest:group init +(() => { + // @dts-jest:pass -> string[] + R.init(['fi', 'fo', 'fum']); //=> ['fi', 'fo'] +})(); + +// @dts-jest:group innerJoin +(() => { + interface Data { + id: number; + name: string; + } + // @dts-jest:pass -> { id: number; name: string; }[] + R.innerJoin( + (data: Data, id: number) => data.id === id, + [ + { id: 824, name: 'Richie Furay' }, + { id: 956, name: 'Dewey Martin' }, + { id: 313, name: 'Bruce Palmer' }, + { id: 456, name: 'Stephen Stills' }, + { id: 177, name: 'Neil Young' }, + ], + [177, 456, 999], + ); //=> [{id: 456, name: 'Stephen Stills'}, {id: 177, name: 'Neil Young'}] +})(); + +// @dts-jest:group insert +(() => { + // @dts-jest:pass -> number[] + R.insert(2, 5, [1, 2, 3, 4]); //=> [1,2,5,3,4] + // @dts-jest:pass -> number[] + R.insert(2)(5, [1, 2, 3, 4]); //=> [1,2,5,3,4] + // @dts-jest:pass -> number[] + R.insert(2, 5)([1, 2, 3, 4]); //=> [1,2,5,3,4] + // @dts-jest:pass -> number[] + R.insert(2)(5)([1, 2, 3, 4]); //=> [1,2,5,3,4] +})(); + +// @dts-jest:group insertAll +(() => { + // @dts-jest:pass -> number[] + R.insertAll(2, [10, 11, 12], [1, 2, 3, 4]); + // @dts-jest:pass -> number[] + R.insertAll(2)([10, 11, 12], [1, 2, 3, 4]); + // @dts-jest:pass -> number[] + R.insertAll(2, [10, 11, 12])([1, 2, 3, 4]); + // @dts-jest:pass -> number[] + R.insertAll(2)([10, 11, 12])([1, 2, 3, 4]); +})(); + +// @dts-jest:group intersection +(() => { + // @dts-jest:pass -> number[] + R.intersection([1, 2, 3, 4], [7, 6, 5, 4, 3]); //=> [3, 4] + // @dts-jest:pass -> number[] + R.intersection([1, 2, 3, 4])([7, 6, 5, 4, 3]); //=> [3, 4] + // @dts-jest:pass -> number[] + R.intersection([1, 2, 4], [1, 2, 3]); //=> [1,2] + // @dts-jest:pass -> number[] + R.intersection([1, 2, 4])([1, 2, 3]); //=> [1,2] +})(); + +// @dts-jest:group intersectionWith +(() => { + interface Field { + id: number; + name: string; + } + const buffaloSpringfield = [ + { id: 824, name: 'Richie Furay' }, + { id: 956, name: 'Dewey Martin' }, + { id: 313, name: 'Bruce Palmer' }, + { id: 456, name: 'Stephen Stills' }, + { id: 177, name: 'Neil Young' }, + ]; + const csny = [ + { id: 204, name: 'David Crosby' }, + { id: 456, name: 'Stephen Stills' }, + { id: 539, name: 'Graham Nash' }, + { id: 177, name: 'Neil Young' }, + ]; + + // @dts-jest:pass -> Field[] + R.intersectionWith(R.eqBy(R.prop('id')), buffaloSpringfield, csny); + // @dts-jest:pass -> Field[] + R.intersectionWith(R.eqBy(R.prop('id')))(buffaloSpringfield, csny); + // @dts-jest:pass -> Field[] + R.intersectionWith(R.eqBy(R.prop('id')))(buffaloSpringfield)(csny); //=> [{id: 456, name: 'Stephen Stills'}, {id: 177, name: 'Neil Young'}] +})(); + +// @dts-jest:group intersperse +(() => { + // @dts-jest:pass -> string[] + R.intersperse(',', ['foo', 'bar']); //=> ['foo', ',', 'bar'] + // @dts-jest:pass -> number[] + R.intersperse(0, [1, 2]); //=> [1, 0, 2] + // @dts-jest:pass -> number[] + R.intersperse(0, [1]); //=> [1] +})(); + +// @dts-jest:group into +(() => { + const numbers = [1, 2, 3, 4]; + const transducer = R.compose( + R.map(R.add(1))<'1', 'list'>(), + R.take(2), + ); + + // @dts-jest:pass -> number[] + R.into([], transducer, numbers); //=> [2, 3] + // @dts-jest:pass -> number[] + R.into([])(transducer, numbers); //=> [2, 3] + // @dts-jest:pass -> number[] + R.into([], transducer)(numbers); //=> [2, 3] + + const intoArray = R.into([]); + // @dts-jest:pass -> number[] + intoArray(transducer, numbers); //=> [2, 3] + // @dts-jest:pass -> number[] + intoArray(transducer)(numbers); //=> [2, 3] +})(); + +// @dts-jest:group invert +(() => { + const raceResultsByFirstName = { + first: 'alice', + second: 'jake', + third: 'alice', + }; + // @dts-jest:pass -> Dictionary + R.invert(raceResultsByFirstName); //=> { 'alice': ['first', 'third'], 'jake': ['second'] } +})(); + +// @dts-jest:group invertObj +(() => { + const raceResults0 = { + first: 'alice', + second: 'jake', + }; + // @dts-jest:pass -> Dictionary + R.invertObj(raceResults0); //=> { 'alice': 'first', 'jake': 'second' } + + // Alternatively: + const raceResults1 = ['alice', 'jake']; + // @dts-jest:pass -> Dictionary + R.invertObj(raceResults1); //=> { 'alice': '0', 'jake': '1' } +})(); + +// @dts-jest:group invoker +(() => { + // @dts-jest:pass -> string + R.invoker<'toUpperCase', string, string>(0, 'toUpperCase')('foo'); //=> 'FOO' + // @dts-jest:pass -> string + R.invoker<'charAt', string, number, string>(1, 'charAt')(1, 'foo'); //=> 'o' +})(); + +// @dts-jest:group is +(() => { + // @dts-jest:pass -> boolean + R.is(Object, {}); //=> true + // @dts-jest:pass -> boolean + R.is(Object)({}); //=> true + // @dts-jest:pass -> boolean + R.is(Number, 1); //=> true + // @dts-jest:pass -> boolean + R.is(Number)(1); //=> true + // @dts-jest:pass -> boolean + R.is(Object, 1); //=> false + // @dts-jest:pass -> boolean + R.is(Object)(1); //=> false + // @dts-jest:pass -> boolean + R.is(String, 's'); //=> true + // @dts-jest:pass -> boolean + R.is(String)('s'); //=> true + // @dts-jest:pass -> boolean + R.is(String, ''); //=> true + // @dts-jest:pass -> boolean + R.is(String)(''); //=> true + // @dts-jest:pass -> boolean + R.is(Object, new Object()); //=> true + // @dts-jest:pass -> boolean + R.is(Object)(new Object()); //=> true + // @dts-jest:pass -> boolean + R.is(Object, 's'); //=> false + // @dts-jest:pass -> boolean + R.is(Object)('s'); //=> false + // @dts-jest:pass -> boolean + R.is(Number, {}); //=> false + // @dts-jest:pass -> boolean + R.is(Number)({}); //=> false +})(); + +// @dts-jest:group isEmpty +(() => { + // @dts-jest:pass -> boolean + R.isEmpty([1, 2, 3]); //=> false + // @dts-jest:pass -> boolean + R.isEmpty([]); //=> true + // @dts-jest:pass -> boolean + R.isEmpty(''); //=> true + // @dts-jest:pass -> boolean + R.isEmpty(null); //=> false + // @dts-jest:pass -> boolean + R.isEmpty({}); //=>true + // @dts-jest:pass -> boolean + R.isEmpty({ a: 1 }); //=> false +})(); + +// @dts-jest:group isNil +(() => { + // @dts-jest:pass -> boolean + R.isNil(null); //=> true + // @dts-jest:pass -> boolean + R.isNil(undefined); //=> true + // @dts-jest:pass -> boolean + R.isNil(0); //=> false + // @dts-jest:pass -> boolean + R.isNil([]); //=> false +})(); + +// @dts-jest:group join +(() => { + const spacer = R.join(' '); + // @dts-jest:pass -> string + spacer(['a', 2, 3.4]); //=> 'a 2 3.4' + // @dts-jest:pass -> string + R.join('|', [1, 2, 3]); //=> '1|2|3' +})(); + +// @dts-jest:group juxt +(() => { + const range = R.juxt([Math.min, Math.max]); + // @dts-jest:pass -> number[] + range(3, 4, 9, -3); //=> [-3, 9] + + const chopped = R.juxt([R.head, R.last]); + // @dts-jest:pass -> string[] + chopped('longstring'); //=> ['l', 'g'] +})(); + +// @dts-jest:group keys +(() => { + // @dts-jest:pass -> ("a" | "b" | "c")[] + R.keys({ a: 1, b: 2, c: 3 }); //=> ['a', 'b', 'c'] +})(); + +// @dts-jest:group keysIn +(() => { + class F { + public x = 'x'; + public y = 'y'; + } + const f = new F(); + // @dts-jest:pass -> ("x" | "y")[] + R.keysIn(f); //=> ['x', 'y'] +})(); + +// @dts-jest:group last +(() => { + // @dts-jest:pass -> string | undefined + R.last(['fi', 'fo', 'fum']); //=> 'fum' +})(); + +// @dts-jest:group lastIndexOf +(() => { + // @dts-jest:pass -> number + R.lastIndexOf(3, [-1, 3, 3, 0, 1, 2, 3, 4]); //=> 6 + // @dts-jest:pass -> number + R.lastIndexOf(10, [1, 2, 3, 4]); //=> -1 + // @dts-jest:pass -> number + R.lastIndexOf(10)([1, 2, 3, 4]); //=> -1 +})(); + +// @dts-jest:group length +(() => { + // @dts-jest:pass -> number + R.length([]); //=> 0 + // @dts-jest:pass -> number + R.length([1, 2, 3]); //=> 3 +})(); + +// @dts-jest:group lens +(() => { + interface XY { + x: number; + y: number; + } + const xLens = R.lens(R.prop('x'))(R.assoc('x')); + + // @dts-jest:pass -> number + R.view(xLens, { x: 1, y: 2 }); //=> 1 + // @dts-jest:pass -> { x: number; y: number; } + R.set(xLens, 4, { x: 1, y: 2 }); //=> {x: 4, y: 2} + // @dts-jest:pass -> XY + R.set(xLens)(4, { x: 1, y: 2 }); //=> {x: 4, y: 2} + // @dts-jest:pass -> XY + R.set(xLens, 4)({ x: 1, y: 2 }); //=> {x: 4, y: 2} + // @dts-jest:pass -> { x: number; y: number; } + R.over(xLens, R.negate, { x: 1, y: 2 }); //=> {x: -1, y: 2} + // @dts-jest:pass -> XY + R.over(xLens, R.negate)({ x: 1, y: 2 }); //=> {x: -1, y: 2} + // @dts-jest:pass -> XY + R.over(xLens)(R.negate, { x: 1, y: 2 }); //=> {x: -1, y: 2} +})(); + +// @dts-jest:group lensIndex +(() => { + const headLens = R.lensIndex(0); + // @dts-jest:pass -> any + R.view(headLens, ['a', 'b', 'c']); //=> 'a' + + // @dts-jest:pass -> string[] + R.set(headLens, 'x', ['a', 'b', 'c']); //=> ['x', 'b', 'c'] + // @dts-jest:pass -> string[] + R.set(R.__, 'x', ['a', 'b', 'c'])(headLens); //=> ['x', 'b', 'c'] + + // @dts-jest:pass -> string[] + R.over(headLens, R.toUpper, ['a', 'b', 'c']); //=> ['A', 'b', 'c'] + // @dts-jest:pass -> string[] + R.over(R.__, R.toUpper, ['a', 'b', 'c'])(headLens); //=> ['A', 'b', 'c'] +})(); + +// @dts-jest:group lensPath +(() => { + interface XYZ { + x: { + y: number; + z: number; + }; + } + const xyLens = R.lensPath(['x', 'y']); + // @dts-jest:pass -> number + R.view(xyLens, { x: { y: 2, z: 3 } }); //=> 2 + // @dts-jest:pass -> { x: { y: number; z: number; }; } + R.set(xyLens, 4, { x: { y: 2, z: 3 } }); //=> {x: {y: 4, z: 3}} + // @dts-jest:pass -> { x: { y: number; z: number; }; } + R.over(xyLens, R.negate, { x: { y: 2, z: 3 } }); //=> {x: {y: -2, z: 3}} +})(); + +// @dts-jest:group lensProp +(() => { + const phraseLens = R.lensProp('phrase'); + const obj1 = { phrase: 'Absolute filth . . . and I LOVED it!' }; + const obj2 = { phrase: "What's all this, then?" }; + // @dts-jest:pass -> string + R.view(phraseLens, obj1); //=> 'Absolute filth . . . and I LOVED it!' + // @dts-jest:pass -> string + R.view(phraseLens, obj2); //=> "What's all this, then?" + // @dts-jest:pass -> { phrase: string; } + R.set(phraseLens, 'Ooh Betty', obj1); //=> { phrase: 'Ooh Betty'} +})(); + +// @dts-jest:group lift +(() => { + const madd3 = R.lift((a: number, b: number, c: number) => a + b + c); + const madd5 = R.lift( + (a: number, b: number, c: number, d: number, e: number) => + a + b + c + d + e, + ); + + // @dts-jest:pass -> number[] + madd3([1, 2, 3], [1, 2, 3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7] + // @dts-jest:pass -> number[] + madd5([1, 2], [3], [4, 5], [6], [7, 8]); //=> [21, 22, 22, 23, 22, 23, 23, 24] +})(); + +// @dts-jest:group liftN +(() => { + const madd3 = R.liftN(3, (...args: number[]) => R.sum(args)); + // @dts-jest:pass -> number[] + madd3([1, 2, 3], [1, 2, 3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7] +})(); + +// @dts-jest:group lt +(() => { + // @dts-jest:pass -> boolean + R.lt(2, 6); //=> true + // @dts-jest:pass -> boolean + R.lt(2, 0); //=> false + // @dts-jest:pass -> boolean + R.lt(2, 2); //=> false + // @dts-jest:pass -> boolean + R.lt(5)(10); //=> true + // @dts-jest:pass -> boolean + R.flip(R.lt)(5)(10); //=> false +})(); + +// @dts-jest:group lte +(() => { + // @dts-jest:pass -> boolean + R.lte(2, 6); //=> true + // @dts-jest:pass -> boolean + R.lte(2, 0); //=> false + // @dts-jest:pass -> boolean + R.lte(2, 2); //=> true + // @dts-jest:pass -> boolean + R.lte(2)(10); //=> true + // @dts-jest:pass -> boolean + R.flip(R.lte)(2)(1); //=> true +})(); + +// @dts-jest:group map +(() => { + const double = (x: number): number => x + x; + const arrayify = (v: T): T[] => [v]; + // homogeneous array + // @dts-jest:pass -> number[] + R.map(double, [1, 2, 3]); //=> [2, 4, 6] + // @dts-jest:pass -> number[] + R.map(double)([1, 2, 3]); //=> [2, 4, 6] + // homogeneous object + // @dts-jest:pass -> Record<"a" | "b" | "c", number> + R.map(double, { a: 1, b: 2, c: 3 }); //=> { a: 2, b: 4, c: 6 } + // @dts-jest:pass -> Record<"a" | "b" | "c", number> + R.map(double)({ a: 1, b: 2, c: 3 }); //=> { a: 2, b: 4, c: 6 } + + // heterogeneous array + // @dts-jest:skip [number[], string[]] + R.map(arrayify, [1, 'a']); //=> [[1], ['a']] + // @dts-jest:skip [number[], string[]] + R.map(arrayify)([1, 'a']); //=> [[1], ['a']] + // heterogeneous object + // @dts-jest:skip { a: number[], b: string[] } + R.map(arrayify, { a: 1, b: 'c' }); //=> { a: [1], b: ['c'] } + // @dts-jest:skip { a: number[], b: string[] } + R.map(arrayify)({ a: 1, b: 'c' }); //=> { a: [1], b: ['c'] } +})(); + +// @dts-jest:group mapAccum +(() => { + const digits = ['1', '2', '3', '4']; + const append = (a: string, b: string): [string, string] => [a + b, a + b]; + // @dts-jest:pass -> [string, string[]] + R.mapAccum(append, '0', digits); //=> ['01234', ['01', '012', '0123', '01234']] + // @dts-jest:pass -> [string, string[]] + R.mapAccum(append)('0', digits); //=> ['01234', ['01', '012', '0123', '01234']] + // @dts-jest:pass -> [string, string[]] + R.mapAccum(append, '0')(digits); //=> ['01234', ['01', '012', '0123', '01234']] + // @dts-jest:pass -> [string, string[]] + R.mapAccum(append)('0')(digits); //=> ['01234', ['01', '012', '0123', '01234']] +})(); + +// @dts-jest:group mapAccumRight +(() => { + const digits = ['1', '2', '3', '4']; + const append = (a: string, b: string): [string, string] => [a + b, a + b]; + // @dts-jest:pass -> [string[], string] + R.mapAccumRight(append, '0', digits); //=> [["12340", "2340", "340", "40"], "12340"] + // @dts-jest:pass -> [string[], string] + R.mapAccumRight(append)('0', digits); //=> [["12340", "2340", "340", "40"], "12340"] + // @dts-jest:pass -> [string[], string] + R.mapAccumRight(append, '0')(digits); //=> [["12340", "2340", "340", "40"], "12340"] + // @dts-jest:pass -> [string[], string] + R.mapAccumRight(append)('0')(digits); //=> [["12340", "2340", "340", "40"], "12340"] +})(); + +// @dts-jest:group mapObjIndexed +(() => { + const values = { x: 1, y: 2, z: 3 }; + const prependKeyAndDouble = (num: number, key: string, _obj: any) => + key + (num * 2).toString(); + // @dts-jest:pass -> Record + R.mapObjIndexed(prependKeyAndDouble, values); //=> { x: 'x2', y: 'y4', z: 'z6' } +})(); + +// @dts-jest:group match +(() => { + // @dts-jest:pass -> string[] + R.match(/([a-z]a)/g, 'bananas'); //=> ['ba', 'na', 'na'] + // @dts-jest:pass -> string[] + R.match(/a/, 'b'); //=> [] + // @dts-jest:fail -> Argument of type 'null' is not assignable to parameter of type 'string'. + R.match(/a/, null); //=> error with strict null checks +})(); + +// @dts-jest:group mathMod +(() => { + // @dts-jest:pass -> number + R.mathMod(-17, 5); //=> 3 + // @dts-jest:pass -> number + R.mathMod(17, 5); //=> 2 + // @dts-jest:pass -> number + R.mathMod(17, -5); //=> NaN + // @dts-jest:pass -> number + R.mathMod(17, 0); //=> NaN + // @dts-jest:pass -> number + R.mathMod(17.2, 5); //=> NaN + // @dts-jest:pass -> number + R.mathMod(17, 5.3); //=> NaN + + const clock = R.flip(R.mathMod)(12); + // @dts-jest:pass -> number + clock(15); //=> 3 + // @dts-jest:pass -> number + clock(24); //=> 0 + + const seventeenMod = R.mathMod(17); + // @dts-jest:pass -> number + seventeenMod(3); //=> 2 +})(); + +// @dts-jest:group max +(() => { + // @dts-jest:pass -> 3 | 7 + R.max(7, 3); //=> 7 + // @dts-jest:pass -> "a" | "z" + R.max('a', 'z'); //=> 'z' +})(); + +// @dts-jest:group maxBy +(() => { + function cmp(obj: { x: number }) { + return obj.x; + } + const a = { x: 1 }; + const b = { x: 2 }; + const c = { x: 3 }; + const d = { x: 'a' }; + const e = { x: 'z' }; + // @dts-jest:pass -> { x: number; } + R.maxBy(cmp, a, c); //=> {x: 3} + // @dts-jest:pass -> { x: number; } + R.maxBy(cmp)(a, c); //=> {x: 3} + // @dts-jest:pass -> { x: number; } + R.maxBy(cmp)(a)(b); + // @dts-jest:fail -> Argument of type '{ x: string; }' is not assignable to parameter of type '{ x: number; }'. + R.maxBy(cmp)(d)(e); +})(); + +// @dts-jest:group mean +(() => { + // @dts-jest:pass -> number + R.mean([2, 7, 9]); //=> 6 + // @dts-jest:pass -> number + R.mean([]); //=> NaN +})(); + +// @dts-jest:group median +(() => { + // @dts-jest:pass -> number + R.median([7, 2, 10, 9]); //=> 8 + // @dts-jest:pass -> number + R.median([]); //=> NaN +})(); + +// @dts-jest:group memoize +(() => { + // tslint:disable-next-line:no-unused + let numberOfCalls = 0; + const trackedAdd = (a: number, b: number) => { + numberOfCalls += 1; + return a + b; + }; + const memoTrackedAdd = R.memoize(trackedAdd); + + // @dts-jest:pass -> number + memoTrackedAdd(1, 2); //=> 3 + // @dts-jest:pass -> number + numberOfCalls; //=> 1 + // @dts-jest:pass -> number + memoTrackedAdd(1, 2); //=> 3 + // @dts-jest:pass -> number + numberOfCalls; //=> 1 + // @dts-jest:pass -> number + memoTrackedAdd(2, 3); //=> 5 + // @dts-jest:pass -> number + numberOfCalls; //=> 2 + + // Note that argument order matters + // @dts-jest:pass -> number + memoTrackedAdd(2, 1); //=> 3 + // @dts-jest:pass -> number + numberOfCalls; //=> 3 +})(); + +// @dts-jest:group memoizeWith +(() => { + // tslint:disable-next-line:no-unused + let count = 0; + const factorial = R.memoizeWith(R.identity, (n: number) => { + count += 1; + return R.product(R.range(1, n + 1)); + }); + // @dts-jest:pass -> number + factorial(5); //=> 120 + // @dts-jest:pass -> number + factorial(5); //=> 120 + // @dts-jest:pass -> number + factorial(5); //=> 120 + // @dts-jest:pass -> number + count; //=> 1 +})(); + +// @dts-jest:group merge +(() => { + // @dts-jest:pass -> Pick<{ name: string; age: number; }, "name"> & { age: number; } + R.merge({ name: 'fred', age: 10 }, { age: 40 }); //=> { 'name': 'fred', 'age': 40 } + + const resetToDefault = R.flip(R.merge)({ x: 0 }); + // @dts-jest:skip Dictionary + resetToDefault({ x: 5, y: 2 }); //=> {x: 0, y: 2} +})(); + +// @dts-jest:group mergeAll +(() => { + // @dts-jest:pass -> object + R.mergeAll([{ foo: 1 }, { bar: 2 }, { baz: 3 }]); //=> {foo: 1,bar: 2,baz: 3} + // @dts-jest:pass -> object + R.mergeAll([{ foo: 1 }, { foo: 2 }, { bar: 2 }]); //=> {foo: 2,bar: 2} +})(); + +// @dts-jest:group mergeDeepLeft +(() => { + // @dts-jest:pass -> object + R.mergeDeepLeft( + { name: 'fred', age: 10, contact: { email: 'moo@example.com' } }, + { age: 40, contact: { email: 'baa@example.com' } }, + ); //=> { name: 'fred', age: 10, contact: { email: 'moo@example.com' }} +})(); + +// @dts-jest:group mergeDeepRight +(() => { + // @dts-jest:pass -> object + R.mergeDeepRight( + { name: 'fred', age: 10, contact: { email: 'moo@example.com' } }, + { age: 40, contact: { email: 'baa@example.com' } }, + ); //=> { name: 'fred', age: 40, contact: { email: 'baa@example.com' }} +})(); + +// @dts-jest:group mergeDeepWith +(() => { + // @dts-jest:pass -> object + R.mergeDeepWith( + R.concat, + { a: true, c: { values: [10, 20] } }, + { b: true, c: { values: [15, 35] } }, + ); //=> { a: true, b: true, c: { values: [10, 20, 15, 35] }} +})(); + +// @dts-jest:group mergeDeepWithKey +(() => { + const concatValues = (k: string, l: number[], r: number[]) => + k === 'values' ? R.concat(l, r) : r; + // @dts-jest:pass -> object + R.mergeDeepWithKey( + concatValues, + { a: true, c: { thing: 'foo', values: [10, 20] } }, + { b: true, c: { thing: 'bar', values: [15, 35] } }, + ); //=> { a: true, b: true, c: { thing: 'bar', values: [10, 20, 15, 35] }} +})(); + +// @dts-jest:group mergeWith +(() => { + // @dts-jest:pass -> Pick<{ a: boolean; values: number[]; }, "a"> & Pick<{ b: boolean; values: number[]; }, "b"> & Record<"values", string | any[]> + R.mergeWith( + R.concat, + { a: true, values: [10, 20] }, + { b: true, values: [15, 35] }, + ); //=> { a: true, b: true, values: [10, 20, 15, 35] } +})(); + +// @dts-jest:group mergeWithKey +(() => { + const concatValues = ( + k: string, + l: string | number[], + r: string | number[], + ) => (k === 'values' ? R.concat(l, r) : r); + // @dts-jest:pass -> Pick<{ a: boolean; thing: string; values: number[]; }, "a"> & Pick<{ b: boolean; thing: string; values: number[]; }, "b"> & Record<"values" | "thing", string | number[]> + R.mergeWithKey( + concatValues, + { a: true, thing: 'foo', values: [10, 20] }, + { b: true, thing: 'bar', values: [15, 35] }, + ); //=> { a: true, b: true, values: [10, 20, 15, 35], thing: 'bar' } + // @dts-jest:pass -> Pick<{ a: boolean; thing: string; values: number[]; }, "a"> & Pick<{ b: boolean; thing: string; values: number[]; }, "b"> & Record<"values" | "thing", string | number[]> + R.mergeWithKey(concatValues)( + { a: true, thing: 'foo', values: [10, 20] }, + { b: true, thing: 'bar', values: [15, 35] }, + ); //=> { a: true, b: true, values: [10, 20, 15, 35], thing: 'bar' } +})(); + +// @dts-jest:group min +(() => { + // @dts-jest:pass -> 3 | 9 + R.min(9, 3); //=> 3 + // @dts-jest:pass -> "a" | "z" + R.min('a', 'z'); //=> 'a' +})(); + +// @dts-jest:group minBy +(() => { + function cmp(obj: { x: number }) { + return obj.x; + } + const a = { x: 1 }; + const b = { x: 2 }; + const c = { x: 3 }; + const d = { x: 'a' }; + const e = { x: 'z' }; + // @dts-jest:pass -> { x: number; } + R.minBy(cmp, a, b); //=> {x: 1} + // @dts-jest:pass -> { x: number; } + R.minBy(cmp)(a, b); //=> {x: 1} + // @dts-jest:pass -> { x: number; } + R.minBy(cmp)(a)(c); + // @dts-jest:fail -> Argument of type '{ x: string; }' is not assignable to parameter of type '{ x: number; }'. + R.minBy(cmp, d, e); +})(); + +// @dts-jest:group modulo +(() => { + // @dts-jest:pass -> number + R.modulo(17, 3); //=> 2 + // JS behavior: + // @dts-jest:pass -> number + R.modulo(-17, 3); //=> -2 + // @dts-jest:pass -> number + R.modulo(17, -3); //=> 2 + + const isOdd = R.flip(R.modulo)(2); + // @dts-jest:pass -> number + isOdd(42); //=> 0 + // @dts-jest:pass -> number + isOdd(21); //=> 1 +})(); + +// @dts-jest:group multiply +(() => { + // @dts-jest:pass -> number + R.multiply(2)(3); //=> 6 + // @dts-jest:pass -> number + R.multiply(3)(4); //=> 12 + // @dts-jest:pass -> number + R.multiply(2, 5); //=> 10 +})(); + +// @dts-jest:group nAry +(() => { + const takesNoArg = () => true; + const takesOneArg = (a: number) => [a]; + const takesTwoArgs = (a: number, b: number) => [a, b]; + const takesThreeArgs = (a: number, b: number, c: number) => [a, b, c]; + + // @dts-jest:pass -> () => boolean + R.nAry(0, takesNoArg); + // @dts-jest:pass -> () => number[] + R.nAry(0, takesOneArg); + // @dts-jest:pass -> (v1: number) => number[] + R.nAry(1, takesTwoArgs); + // @dts-jest:pass -> (v1: number) => number[] + R.nAry(1, takesThreeArgs); +})(); + +// @dts-jest:group negate +(() => { + // @dts-jest:pass -> number + R.negate(42); //=> -42 +})(); + +// @dts-jest:group none +(() => { + // @dts-jest:pass boolean -> boolean + R.none(isNaN, [1, 2, 3]); //=> true + // @dts-jest:pass boolean -> boolean + R.none(isNaN, [1, 2, 3, NaN]); //=> false + // @dts-jest:pass boolean -> boolean + R.none(isNaN)([1, 2, 3, NaN]); //=> false +})(); + +// @dts-jest:group not +(() => { + // @dts-jest:pass -> boolean + R.not(true); //=> false + // @dts-jest:pass -> boolean + R.not(false); //=> true + // @dts-jest:pass -> boolean + R.not(0); //=> true + // @dts-jest:pass -> boolean + R.not(1); //=> false +})(); + +// @dts-jest:group nth +(() => { + const list = ['foo', 'bar', 'baz', 'quux']; + // @dts-jest:pass -> string | undefined + R.nth(1, list); //=> 'bar' + // @dts-jest:pass -> string | undefined + R.nth(-1, list); //=> 'quux' + // @dts-jest:pass -> string | undefined + R.nth(-99, list); //=> undefined + // @dts-jest:pass -> string | undefined + R.nth(-99)(list); //=> undefined +})(); + +// @dts-jest:group nthArg +(() => { + // @dts-jest:pass -> "a" | "b" | "c" + R.nthArg(1)('a', 'b', 'c'); //=> 'b' + // @dts-jest:pass -> "a" | "b" | "c" + R.nthArg(-1)('a', 'b', 'c'); //=> 'c' +})(); + +// @dts-jest:group o +(() => { + interface Name { + first: string; + last: string; + } + const classyGreeting = (name: Name) => + `The name's ${name.last}, ${name.first} ${name.last}`; + const yellGreeting = R.o(R.toUpper, classyGreeting); + + // @dts-jest:pass -> string + yellGreeting({ first: 'James', last: 'Bond' }); //=> "THE NAME'S BOND, JAMES BOND" + // @dts-jest:pass -> number + R.o(R.multiply(10), R.add(10))(-4); //=> 60 +})(); + +// @dts-jest:group objOf +(() => { + const matchPhrases = R.compose( + R.objOf('must'), + R.map(R.objOf('match_phrase')), + ); + // @dts-jest:pass -> Record<"must", {}> + matchPhrases(['foo', 'bar', 'baz']); +})(); + +// @dts-jest:group of +(() => { + // @dts-jest:pass -> number[][] + R.of([1]); //=> [[1]] + // @dts-jest:pass -> number[] + R.of(1); +})(); + +// @dts-jest:group omit +(() => { + // @dts-jest:pass -> Partial<{ a: number; b: number; c: number; d: number; }> + R.omit(['a', 'd'], { a: 1, b: 2, c: 3, d: 4 }); //=> {b: 2, c: 3} + // @dts-jest:pass -> Partial<{ a: number; b: number; c: number; d: number; }> + R.omit(['a', 'd'])({ a: 1, b: 2, c: 3, d: 4 }); //=> {b: 2, c: 3} +})(); + +// @dts-jest:group once +(() => { + const addOneOnce = R.once((x: number) => x + 1); + // @dts-jest:pass -> number + addOneOnce(10); //=> 11 + // @dts-jest:pass -> number + addOneOnce(addOneOnce(50)); //=> 11 +})(); + +// @dts-jest:group or +(() => { + // @dts-jest:pass -> boolean + R.or(false, true); //=> true + // @dts-jest:pass -> 0 | never[] + R.or(0, []); //=> [] + // @dts-jest:pass -> number | never[] + R.or(0)([]); //=> [] + // @dts-jest:pass -> "" | null + R.or(null, ''); //=> '' +})(); + +// @dts-jest:group over +(() => { + const headLens = R.lensIndex(0); + // @dts-jest:pass -> string[] + R.over(headLens, R.toUpper, ['a', 'b', 'c']); //=> ['A', 'b', 'c'] +})(); + +// @dts-jest:group pair +(() => { + // @dts-jest:pass -> KeyValuePair<"foo", string> + R.pair('foo', 'bar'); //=> ['foo', 'bar'] + + const p = R.pair('foo', 1); + // @dts-jest:pass -> "foo" + p[0]; //=> 'foo' + // @dts-jest:pass -> number + p[1]; //=> 1 +})(); + +// @dts-jest:group partial +(() => { + const multiply = (a: number, b: number) => a * b; + + // @dts-jest:pass -> number + R.partial(multiply, [2])(2); //=> 4 + + const greet = ( + salutation: string, + title: string, + firstName: string, + lastName: string, + ) => `${salutation}, ${title} ${firstName} ${lastName}!`; + const sayHello = R.partial(greet, ['Hello']); + const sayHelloToMs = R.partial(sayHello, ['Ms.']); + + // @dts-jest:pass -> string + sayHelloToMs('Jane', 'Jones'); //=> 'Hello, Ms. Jane Jones!' +})(); + +// @dts-jest:group partialRight +(() => { + const greet = ( + salutation: string, + title: string, + firstName: string, + lastName: string, + ) => `${salutation}, ${title} ${firstName} ${lastName}!`; + const greetMsJaneJones = R.partialRight(greet, ['Ms.', 'Jane', 'Jones']); + + // @dts-jest:pass -> string + greetMsJaneJones('Hello'); //=> 'Hello, Ms. Jane Jones!' +})(); + +// @dts-jest:group partition +(() => { + // @dts-jest:pass -> [(string[] | ArrayLike)[], (string[] | ArrayLike)[]] + R.partition(R.contains('s'), ['sss', 'ttt', 'foo', 'bars']); + // @dts-jest:pass -> [(string[] | ArrayLike)[], (string[] | ArrayLike)[]] + R.partition(R.contains('s'))(['sss', 'ttt', 'foo', 'bars']); + // @dts-jest:pass -> [number[], number[]] + R.partition((x: number) => x > 2, [1, 2, 3, 4]); + // @dts-jest:pass -> [number[], number[]] + R.partition((x: number) => x > 2)([1, 2, 3, 4]); + // @dts-jest:pass -> [Partial<{ a: string; b: string; foo: string; }>, Partial<{ a: string; b: string; foo: string; }>] + R.partition(R.contains('s'), { a: 'sss', b: 'ttt', foo: 'bars' }); //=> [ { a: 'sss', foo: 'bars' }, { b: 'ttt' } ] +})(); + +// @dts-jest:group path +(() => { + // @dts-jest:pass -> number + R.path(['a', 'b'], { a: { b: 2 } }); //=> 2 + // @dts-jest:pass -> {} | undefined + R.path(['a', 'b'])({ a: { b: 2 } }); //=> 2 +})(); + +// @dts-jest:group pathEq +(() => { + interface User { + address?: { zipCode: number }; + name?: string; + } + const user1 = { address: { zipCode: 90210 } }; + const user2 = { address: { zipCode: 55555 } }; + const user3 = { name: 'Bob' }; + const users = [user1, user2, user3]; + const isFamous = R.pathEq(['address', 'zipCode'], 90210); + // @dts-jest:pass -> User[] + R.filter(isFamous, users); //=> [ user1 ] +})(); + +// @dts-jest:group pathOr +(() => { + // @dts-jest:pass -> string | {} + R.pathOr('N/A', ['a', 'b'])({ a: { b: 2 } }); //=> 2 + // @dts-jest:pass -> string | {} + R.pathOr('N/A')(['a', 'b'], { a: { b: 2 } }); //=> 2 +})(); + +// @dts-jest:group pathSatisfies +(() => { + // @dts-jest:pass -> boolean + R.pathSatisfies((a: any) => a === 'foo', ['a', 'b', 'c'], { + a: { b: { c: 'foo' } }, + }); //=> true + // @dts-jest:pass -> boolean + R.pathSatisfies((a: any) => a === 'bar', ['a', 'b', 'c'], { + a: { b: { c: 'foo' } }, + }); //=> false + // @dts-jest:pass -> boolean + R.pathSatisfies((a: any) => a === 1, ['a', 'b', 'c'], { a: { b: { c: 1 } } }); //=> true + // @dts-jest:pass -> boolean + R.pathSatisfies((a: any) => a !== 1, ['a', 'b', 'c'], { a: { b: { c: 2 } } }); //=> true + // @dts-jest:pass -> boolean + R.pathSatisfies((a: any) => a === 1)(['a', 'b', 'c'], { a: { b: { c: 1 } } }); //=> true + // @dts-jest:pass -> boolean + R.pathSatisfies((a: any) => a === 1, ['a', 'b', 'c'])({ a: { b: { c: 1 } } }); //=> true + // @dts-jest:pass -> boolean + R.pathSatisfies((a: any) => a === 1)(['a', 'b', 'c'])({ a: { b: { c: 1 } } }); //=> true +})(); + +// @dts-jest:group pick +(() => { + // @dts-jest:pass -> Partial<{ a: number; b: number; c: number; d: number; }> + R.pick(['a', 'e', 'f'], { a: 1, b: 2, c: 3, d: 4 }); //=> {a: 1} + // @dts-jest:fail -> Argument of type '{ a: number; b: number; c: number; d: number; }' is not assignable to parameter of type 'Record<"a" | "e" | "f", any>'. + R.pick(['a', 'e', 'f'])({ a: 1, b: 2, c: 3, d: 4 }); // runtime correct but type error => {a: 1} + // @dts-jest:pass -> Partial + R.pick(['a', 'e', 'f'], [1, 2, 3, 4]); //=> {} + // @dts-jest:pass -> Pick<{ a: number; b: number; c: number; d: number; }, "a" | "c" | "d"> + R.pick(['a', 'c', 'd'], { a: 1, b: 2, c: 3, d: 4 }); //=> {a: 1, c: 3, d: 4} + // @dts-jest:pass -> Pick, "2" | "0" | "3"> + R.pick(['0', '2', '3'], [1, 2, 3, 4]); //=> {0: 1, 2: 3, 3: 4} +})(); + +// @dts-jest:group pickAll +(() => { + // @dts-jest:pass -> Pick<{ a: number; b: number; c: number; d: number; }, "a" | "d"> + R.pickAll(['a', 'd'], { a: 1, b: 2, c: 3, d: 4 }); //=> {a: 1, d: 4} + // @dts-jest:pass -> Partial<{ a: number; b: number; c: number; d: number; }> + R.pickAll(['a', 'd'])({ a: 1, b: 2, c: 3, d: 4 }); //=> {a: 1, d: 4} + // @dts-jest:pass -> Partial<{ a: number; b: number; c: number; d: number; }> + R.pickAll(['a', 'e', 'f'], { a: 1, b: 2, c: 3, d: 4 }); //=> {a: 1, e: undefined, f: undefined} + // @dts-jest:pass -> Partial<{ a: number; b: number; c: number; d: number; }> + R.pickAll(['a', 'e', 'f'])({ a: 1, b: 2, c: 3, d: 4 }); //=> {a: 1, e: undefined, f: undefined} +})(); + +// @dts-jest:group pickBy +(() => { + const colors = { + 1: { color: 'read' }, + 2: { color: 'black', bgcolor: 'yellow' }, + }; + const isPositive = (n: number) => n > 0; + const containsBackground = (val: any) => val.bgcolor; + const isUpperCase = (_val: number, key: string) => key.toUpperCase() === key; + + // @dts-jest:pass -> Partial<{ a: number; b: number; c: number; d: number; e: number; }> + R.pickBy(isPositive, { a: 1, b: 2, c: -1, d: 0, e: 5 }); //=> {a: 1, b: 2, e: 5} + // @dts-jest:pass -> Partial<{ 1: { color: string; }; 2: { color: string; bgcolor: string; }; }> + R.pickBy(containsBackground, colors); //=> {2: {color: 'black', bgcolor: 'yellow'}} + // @dts-jest:pass -> Partial<{ a: number; b: number; A: number; B: number; }> + R.pickBy(isUpperCase, { a: 1, b: 2, A: 3, B: 4 }); //=> {A: 3, B: 4} +})(); + +// @dts-jest:group pipe +(() => { + (() => { + const shout = (x: number): string => (x >= 10 ? 'big' : 'small'); + const double = (x: number): number => x + x; + // @dts-jest:pass -> (v1: number) => string + R.pipe(double, double, shout); + // @dts-jest:pass -> string + R.pipe(double, double, shout)(10); + + // @dts-jest:pass -> string + R.pipe(R.split(''), R.adjust(R.toUpper, 0), R.join(''))('str'); + + const f = R.pipe(Math.pow, R.negate, R.inc); + // @dts-jest:pass -> number + f(3, 4); // -(3^4) + 1 + + // test for type degeneration if the first function has generics + // @dts-jest:skip (x0: number) => number + R.pipe(R.identity, double); + })(); + (() => { + const double = (x: number): number => x + x; + const triple = (x: number): number => x * 3; + const square = (x: number): number => x * x; + const squareThenDoubleThenTriple = R.pipe(square, double, triple); + // @dts-jest:pass -> number + squareThenDoubleThenTriple(5); //=> 150 + })(); +})(); + +// @dts-jest:group:skip pipeK +(() => { + // TODO +})(); + +// @dts-jest:group pipeP +(() => { + // @dts-jest:pass -> PromiseLike + R.pipeP( + (m: number) => Promise.resolve(R.multiply(2, m)), + (m: number) => Promise.resolve(m / 2), + )(10); + // @dts-jest:pass -> PromiseLike + R.pipeP( + (m: number) => Promise.resolve(R.multiply(2, m)), + (m: number) => Promise.resolve(m / 2), + R.multiply(5), + )(10); +})(); + +// @dts-jest:group pluck +(() => { + // @dts-jest:pass -> number[] + R.pluck('a', [{ a: 1 }, { a: 2 }]); //=> [1, 2] + // @dts-jest:pass -> number[] + R.pluck(0, [[1, 2], [3, 4]]); //=> [1, 3] + // @dts-jest:pass -> number[] + R.pluck('a')([{ a: 1 }, { a: 2 }]); //=> [1, 2] + // @dts-jest:pass -> number[] + R.pluck(0)([[1, 2], [3, 4]]); //=> [1, 3] +})(); + +// @dts-jest:group prepend +(() => { + // @dts-jest:pass -> string[] + R.prepend('fee', ['fi', 'fo', 'fum']); //=> ['fee', 'fi', 'fo', 'fum'] + // @dts-jest:pass -> string[] + R.prepend('fee')(['fi', 'fo', 'fum']); //=> ['fee', 'fi', 'fo', 'fum'] +})(); + +// @dts-jest:group product +(() => { + // @dts-jest:pass -> number + R.product([2, 4, 6, 8, 100, 1]); //=> 38400 +})(); + +// @dts-jest:group project +(() => { + const abby = { name: 'Abby', age: 7, hair: 'blond', grade: 2 }; + const fred = { name: 'Fred', age: 12, hair: 'brown', grade: 7 }; + const kids = [abby, fred]; + // @dts-jest:pass -> Pick<{ name: string; age: number; hair: string; grade: number; }, "name" | "grade">[] + R.project(['name', 'grade'], kids); //=> [{name: 'Abby', grade: 2}, {name: 'Fred', grade: 7}] +})(); + +// @dts-jest:group prop +(() => { + // @dts-jest:pass -> number + R.prop('x', { x: 100 }); //=> 100 + // @dts-jest:pass -> {} | undefined + R.prop('x', {}); //=> undefined +})(); + +// @dts-jest:group propEq +(() => { + (() => { + const xs: { [key: string]: string } = { a: '1', b: '0' }; + // @dts-jest:pass -> boolean + R.propEq('a', '1', xs); //=> true + // @dts-jest:pass -> boolean + R.propEq('a', '4', xs); //=> false + })(); + (() => { + const xs: { [key: string]: number } = { a: 1, b: 0 }; + // @dts-jest:pass -> boolean + R.propEq('a', 1, xs); //=> true + // @dts-jest:pass -> boolean + R.propEq('a', 4, xs); //=> false + })(); + (() => { + const xs = { a: '1', b: '0' }; + // @dts-jest:pass -> boolean + R.propEq('a', '1', xs); //=> true + // @dts-jest:pass -> boolean + R.propEq('a', '4', xs); //=> false + })(); + (() => { + const xs = { a: 1, b: 0 }; + // @dts-jest:pass -> boolean + R.propEq('a', 1, xs); //=> true + // @dts-jest:pass -> boolean + R.propEq('a', 4, xs); //=> false + })(); + (() => { + interface Obj { + a: number; + b: number; + } + const xs: Obj = { a: 1, b: 0 }; + // @dts-jest:pass -> boolean + R.propEq('a', 1, xs); //=> true + // @dts-jest:pass -> boolean + R.propEq('a', 4, xs); //=> false + })(); +})(); + +// @dts-jest:group propIs +(() => { + // @dts-jest:pass -> boolean + R.propIs(Number, 'x', { x: 1, y: 2 }); //=> true + // @dts-jest:pass -> boolean + R.propIs(Number, 'x')({ x: 1, y: 2 }); //=> true + // @dts-jest:pass -> boolean + R.propIs(Number)('x', { x: 1, y: 2 }); //=> true + // @dts-jest:pass -> boolean + R.propIs(Number)('x')({ x: 1, y: 2 }); //=> true + // @dts-jest:pass -> boolean + R.propIs(Number, 'x', { x: 'foo' }); //=> false + // @dts-jest:pass -> boolean + R.propIs(Number, 'x', {}); //=> false +})(); + +// @dts-jest:group propOr +(() => { + interface Person { + name: string; + age: number; + favoriteLibrary?: string; + } + const alice: Person = { + name: 'ALICE', + age: 101, + }; + + // @dts-jest:pass -> string | undefined + R.prop('favoriteLibrary', alice); //=> undefined + // @dts-jest:skip string + R.propOr('Ramda', 'favoriteLibrary', alice); //=> 'Ramda' +})(); + +// @dts-jest:group propSatisfies +(() => { + interface XY { + x: number; + y: number; + } + + // @dts-jest:pass -> boolean + R.propSatisfies((x: number) => x > 0, 'x', { x: 1, y: 2 }); //=> true + // @dts-jest:pass -> boolean + R.propSatisfies<'x', XY>((x: number) => x > 0, 'x')({ x: 1, y: 2 }); //=> true + // @dts-jest:pass -> boolean + R.propSatisfies<'x', XY>((x: number) => x > 0)('x')({ x: 1, y: 2 }); //=> true +})(); + +// @dts-jest:group props +(() => { + // @dts-jest:pass -> number[] + R.props(['x', 'y'], { x: 1, y: 2 }); //=> [1, 2] + // @dts-jest:pass -> any[] + R.props(['c', 'a', 'b'], { b: 2, a: 1 }); //=> [undefined, 1, 2] + + const fullName = R.compose(R.join(' '), R.props(['first', 'last'])); + // @dts-jest:pass -> string + fullName({ last: 'Bullet-Tooth', age: 33, first: 'Tony' }); //=> 'Tony Bullet-Tooth' +})(); + +// @dts-jest:group range +(() => { + // @dts-jest:pass -> number[] + R.range(1, 5); //=> [1, 2, 3, 4] + // @dts-jest:pass -> number[] + R.range(50)(53); //=> [50, 51, 52] +})(); + +// @dts-jest:group reduce +(() => { + const numbers = [1, 2, 3]; + const add = (a: number, b: number) => a + b; + // @dts-jest:pass -> number + R.reduce(add, 10, numbers); //=> 16 +})(); + +// @dts-jest:group reduce +(() => { + const numbers = [1, 2, 3]; + const add = (a: number, b: number) => a + b; + // @dts-jest:pass -> number + R.reduce(add, 10, numbers); //=> 16 + // @dts-jest:pass -> number + R.reduce(add)(10, numbers); //=> 16 + // @dts-jest:pass -> number + R.reduce(add, 10)(numbers); //=> 16 +})(); + +// @dts-jest:group reduceBy +(() => { + interface Student { + name: string; + score: number; + } + const reduceToNamesBy = R.reduceBy( + (acc: string[], student: Student) => acc.concat(student.name), + [], + ); + const namesByGrade = reduceToNamesBy((student: Student) => { + const score = student.score; + return score < 65 + ? 'F' + : score < 70 ? 'D' : score < 80 ? 'C' : score < 90 ? 'B' : 'A'; + }); + const students = [ + { name: 'Lucy', score: 92 }, + { name: 'Drew', score: 85 }, + { name: 'Bart', score: 62 }, + ]; + // @dts-jest:pass -> Partial> + namesByGrade(students); + // { + // 'A': ['Lucy'], + // 'B': ['Drew'] + // 'F': ['Bart'] + // } +})(); + +// @dts-jest:group reduced +(() => { + // @dts-jest:pass -> Reduced + R.reduced(123); +})(); + +// @dts-jest:group reduceRight +(() => { + interface KeyValuePair extends Array { + 0: K; + 1: V; + } + type Pair = KeyValuePair; + const pairs: Pair[] = [['a', 1], ['b', 2], ['c', 3]]; + const flattenPairs = (pair: Pair, acc: Pair[]): Pair[] => acc.concat(pair); + // @dts-jest:pass -> KeyValuePair[] + R.reduceRight(flattenPairs, [], pairs); //=> [ 'c', 3, 'b', 2, 'a', 1 ] + // @dts-jest:pass -> KeyValuePair[] + R.reduceRight(flattenPairs, [])(pairs); //=> [ 'c', 3, 'b', 2, 'a', 1 ] + // @dts-jest:pass -> KeyValuePair[] + R.reduceRight(flattenPairs)([], pairs); //=> [ 'c', 3, 'b', 2, 'a', 1 ] +})(); + +// @dts-jest:group reduceWhile +(() => { + const isOdd = (_acc: number, x: number) => x % 2 === 1; + const xs = [1, 3, 5, 60, 777, 800]; + // @dts-jest:pass -> number + R.reduceWhile(isOdd, R.add, 0, xs); //=> 9 + + const ys = [2, 4, 6]; + // @dts-jest:pass -> number + R.reduceWhile(isOdd, R.add, 111, ys); //=> 111 +})(); + +// @dts-jest:group reject +(() => { + const isOdd = (n: number) => n % 2 === 1; + // @dts-jest:pass -> number[] + R.reject(isOdd, [1, 2, 3, 4]); //=> [2, 4] + // @dts-jest:pass -> number[] + R.reject(isOdd)([1, 2, 3, 4]); //=> [2, 4] + + const lastTwo = (_val: number, idx: number, list: number[]) => + list.length - idx <= 2; + const rejectIndexed = R.addIndex( + R.reject<'11', 'list'>(), + ); + // @dts-jest:pass -> number[] + rejectIndexed(lastTwo, [8, 6, 7, 5, 3, 0, 9]); //=> [8, 6, 7, 5, 3] + // @dts-jest:pass -> number[] + rejectIndexed(lastTwo)([8, 6, 7, 5, 3, 0, 9]); //=> [8, 6, 7, 5, 3] +})(); + +// @dts-jest:group remove +(() => { + // @dts-jest:pass -> number[] + R.remove(2, 3, [1, 2, 3, 4, 5, 6, 7, 8]); //=> [1,2,6,7,8] + // @dts-jest:pass -> number[] + R.remove(2, 3)([1, 2, 3, 4, 5, 6, 7, 8]); //=> [1,2,6,7,8] + // @dts-jest:pass -> number[] + R.remove(2)(3, [1, 2, 3, 4, 5, 6, 7, 8]); //=> [1,2,6,7,8] +})(); + +// @dts-jest:group repeat +(() => { + // @dts-jest:pass -> string[] + R.repeat('hi', 5); //=> ['hi', 'hi', 'hi', 'hi', 'hi'] + const obj = {}; + const repeatedObjs = R.repeat(obj, 5); + // @dts-jest:pass -> {}[] + repeatedObjs; //=> [{}, {}, {}, {}, {}] + // @dts-jest:pass -> boolean + repeatedObjs[0] === repeatedObjs[1]; //=> true +})(); + +// @dts-jest:group replace +(() => { + // @dts-jest:pass -> string + R.replace('foo', 'bar', 'foo foo foo'); //=> 'bar foo foo' + // @dts-jest:pass -> string + R.replace('foo', 'bar')('foo foo foo'); //=> 'bar foo foo' + // @dts-jest:pass -> string + R.replace('foo')('bar')('foo foo foo'); //=> 'bar foo foo' + // @dts-jest:pass -> string + R.replace(/foo/, 'bar', 'foo foo foo'); //=> 'bar foo foo' + + // Use the 'g' (global) flag to replace all occurrences: + // @dts-jest:pass -> string + R.replace(/foo/g, 'bar', 'foo foo foo'); //=> 'bar bar bar' + // @dts-jest:pass -> string + R.replace(/foo/g, 'bar')('foo foo foo'); //=> 'bar bar bar' + // @dts-jest:pass -> string + R.replace(/foo/g)('bar')('foo foo foo'); //=> 'bar bar bar' +})(); + +// @dts-jest:group reverse +(() => { + // @dts-jest:pass -> number[] + R.reverse([1, 2, 3]); //=> [3, 2, 1] + // @dts-jest:pass -> number[] + R.reverse([1, 2]); //=> [2, 1] + // @dts-jest:pass -> number[] + R.reverse([1]); //=> [1] + // @dts-jest:pass -> never[] + R.reverse([]); //=> [] +})(); + +// @dts-jest:group scan +(() => { + const numbers = [1, 2, 3, 4]; + // @dts-jest:pass -> number[] + R.scan(R.multiply, 1, numbers); //=> [1, 1, 2, 6, 24] + // @dts-jest:pass -> number[] + R.scan(R.multiply, 1)(numbers); //=> [1, 1, 2, 6, 24] + // @dts-jest:pass -> number[] + R.scan(R.multiply)(1, numbers); //=> [1, 1, 2, 6, 24] +})(); + +// @dts-jest:group:skip sequence +(() => { + // TODO +})(); + +// @dts-jest:group set +(() => { + const headLens = R.lensIndex(0); + // @dts-jest:pass -> string[] + R.set(headLens, 'x', ['a', 'b', 'c']); //=> ['x', 'b', 'c'] +})(); + +// @dts-jest:group slice +(() => { + const xs = R.range(0, 10); + // @dts-jest:pass -> number[] + R.slice(2, 5, xs); //=> [2, 3, 4] + // @dts-jest:pass -> number[] + R.slice(2, 5)(xs); //=> [2, 3, 4] + // @dts-jest:pass -> number[] + R.slice(2)(5, xs); //=> [2, 3, 4] + + const str = 'Hello World'; + // @dts-jest:pass -> string + R.slice(2, 5, str); //=> 'llo' + // @dts-jest:pass -> string + R.slice(2, 5)(str); //=> 'llo' + // @dts-jest:pass -> string + R.slice(2)(5, str); //=> 'llo' +})(); + +// @dts-jest:group sort +(() => { + const diff = (a: number, b: number) => a - b; + // @dts-jest:pass -> number[] + R.sort(diff, [4, 2, 7, 5]); //=> [2, 4, 5, 7] + // @dts-jest:pass -> number[] + R.sort(diff)([4, 2, 7, 5]); //=> [2, 4, 5, 7] +})(); + +// @dts-jest:group sortBy +(() => { + interface Person { + name: string; + age: number; + } + const sortByNameCaseInsensitive = R.sortBy( + R.compose(R.toLower, R.prop('name')), + ); + const sortByAgeDescending = R.sortBy( + R.compose(R.negate, R.prop('age')), + ); + const sortByAgeAscending = R.sortBy(R.prop('age')); + const alice = { + name: 'ALICE', + age: 101, + }; + const bob = { + name: 'Bob', + age: -10, + }; + const clara = { + name: 'clara', + age: 314.159, + }; + const people = [clara, bob, alice]; + // @dts-jest:pass -> Person[] + sortByAgeDescending(people); //=> [clara, alice, bob] + // @dts-jest:pass -> Person[] + sortByNameCaseInsensitive(people); //=> [alice, bob, clara] + // @dts-jest:pass -> Person[] + sortByAgeAscending(people); //=> [bob, alice, clara] +})(); + +// @dts-jest:group sortWith +(() => { + interface Person { + name: string; + age: number; + } + const alice = { + name: 'alice', + age: 40, + }; + const bob = { + name: 'bob', + age: 30, + }; + const clara = { + name: 'clara', + age: 40, + }; + const people = [clara, bob, alice]; + // @dts-jest:pass -> Person[] + R.sortWith( + [R.descend(R.prop('age')), R.ascend(R.prop('name'))], + people, + ); + const ageNameSort = R.sortWith([ + R.descend(R.prop('age')), + R.ascend(R.prop('name')), + ]); + // @dts-jest:pass -> Person[] + ageNameSort(people); //=> [alice, clara, bob] +})(); + +// @dts-jest:group split +(() => { + const pathComponents = R.split('/'); + + // @dts-jest:pass -> string[] + R.tail(pathComponents('/usr/local/bin/node')); //=> ['usr', 'local', 'bin', 'node'] + // @dts-jest:pass -> string[] + R.split('.', 'a.b.c.xyz.d'); //=> ['a', 'b', 'c', 'xyz', 'd'] +})(); + +// @dts-jest:group splitAt +(() => { + // @dts-jest:pass -> [number[], number[]] + R.splitAt(1, [1, 2, 3]); //=> [[1], [2, 3]] + // @dts-jest:pass -> [number[], number[]] + R.splitAt(1)([1, 2, 3]); //=> [[1], [2, 3]] + // @dts-jest:pass -> [string, string] + R.splitAt(5, 'hello world'); //=> ['hello', ' world'] + // @dts-jest:pass -> [string, string] + R.splitAt(-1, 'foobar'); //=> ['fooba', 'r'] +})(); + +// @dts-jest:group splitEvery +(() => { + // @dts-jest:pass -> number[][] + R.splitEvery(3, [1, 2, 3, 4, 5, 6, 7]); //=> [[1, 2, 3], [4, 5, 6], [7]] + // @dts-jest:pass -> string[] + R.splitEvery(3, 'foobarbaz'); //=> ['foo', 'bar', 'baz'] +})(); + +// @dts-jest:group splitWhen +(() => { + // @dts-jest:pass -> [number[], number[]] + R.splitWhen(R.equals(2), [1, 2, 3, 1, 2, 3]); //=> [[1], [2, 3, 1, 2, 3]] + // @dts-jest:pass -> [number[], number[]] + R.splitWhen(R.equals(2))([1, 2, 3, 1, 2, 3]); //=> [[1], [2, 3, 1, 2, 3]] +})(); + +// @dts-jest:group startsWith +(() => { + // @dts-jest:pass -> boolean + R.startsWith('a', 'abc'); //=> true + // @dts-jest:pass -> boolean + R.startsWith('b', 'abc'); //=> false + // @dts-jest:pass -> boolean + R.startsWith(['a'], ['a', 'b', 'c']); //=> true + // @dts-jest:pass -> boolean + R.startsWith(['b'], ['a', 'b', 'c']); //=> false +})(); + +// @dts-jest:group subtract +(() => { + // @dts-jest:pass -> number + R.subtract(10, 8); //=> 2 + + const minus5 = R.flip(R.subtract)(5); + // @dts-jest:pass -> number + minus5(17); //=> 12 + + const complementaryAngle = R.subtract(90); + // @dts-jest:pass -> number + complementaryAngle(30); //=> 60 + // @dts-jest:pass -> number + complementaryAngle(72); //=> 18 +})(); + +// @dts-jest:group sum +(() => { + // @dts-jest:pass -> number + R.sum([2, 4, 6, 8, 100, 1]); //=> 121 +})(); + +// @dts-jest:group symmetricDifference +(() => { + // @dts-jest:pass -> number[] + R.symmetricDifference([1, 2, 3, 4], [7, 6, 5, 4, 3]); //=> [1,2,7,6,5] + // @dts-jest:pass -> number[] + R.symmetricDifference([7, 6, 5, 4, 3])([1, 2, 3, 4]); //=> [7,6,5,1,2] +})(); + +// @dts-jest:group symmetricDifferenceWith +(() => { + interface A { + a: number; + } + const eqA = R.eqBy(R.prop('a')); + const l1 = [{ a: 1 }, { a: 2 }, { a: 3 }, { a: 4 }]; + const l2 = [{ a: 3 }, { a: 4 }, { a: 5 }, { a: 6 }]; + // @dts-jest:pass -> A[] + R.symmetricDifferenceWith(eqA, l1, l2); //=> [{a: 1}, {a: 2}, {a: 5}, {a: 6}] + // @dts-jest:pass -> A[] + R.symmetricDifferenceWith(eqA)(l1, l2); //=> [{a: 1}, {a: 2}, {a: 5}, {a: 6}] + // @dts-jest:pass -> A[] + R.symmetricDifferenceWith(eqA)(l1)(l2); //=> [{a: 1}, {a: 2}, {a: 5}, {a: 6}] +})(); + +// @dts-jest:group T +(() => { + // @dts-jest:pass -> true + R.T(); +})(); + +// @dts-jest:group tail +(() => { + // @dts-jest:pass -> string[] + R.tail(['fi', 'fo', 'fum']); //=> ['fo', 'fum'] + // @dts-jest:pass -> number[] + R.tail([1, 2, 3]); //=> [2, 3] +})(); + +// @dts-jest:group take +(() => { + // @dts-jest:pass -> number[] + R.take(3, [1, 2, 3, 4, 5]); //=> [1,2,3] + + const members = [ + 'Paul Desmond', + 'Bob Bates', + 'Joe Dodge', + 'Ron Crotty', + 'Lloyd Davis', + 'Joe Morello', + 'Norman Bates', + 'Eugene Wright', + 'Gerry Mulligan', + 'Jack Six', + 'Alan Dawson', + 'Darius Brubeck', + 'Chris Brubeck', + 'Dan Brubeck', + 'Bobby Militello', + 'Michael Moore', + 'Randy Jones', + ]; + const takeFive = R.take(5); + // @dts-jest:pass -> string[] + takeFive(members); //=> ['Paul Desmond','Bob Bates','Joe Dodge','Ron Crotty','Lloyd Davis'] + + // @dts-jest:pass -> string + R.take(3, 'Example'); //=> 'Exa' + + const takeThree = R.take(3); + // @dts-jest:pass -> string + takeThree('Example'); //=> 'Exa' +})(); + +// @dts-jest:group takeLast +(() => { + // @dts-jest:pass -> string[] + R.takeLast(1, ['foo', 'bar', 'baz']); //=> ['baz'] + // @dts-jest:pass -> string[] + R.takeLast(2)(['foo', 'bar', 'baz']); //=> ['bar', 'baz'] + // @dts-jest:pass -> string + R.takeLast(3, 'ramda'); //=> 'mda' + // @dts-jest:pass -> string + R.takeLast(3)('ramda'); //=> 'mda' +})(); + +// @dts-jest:group takeLastWhile +(() => { + const isNotOne = (x: number) => x !== 1; + // @dts-jest:pass -> number[] + R.takeLastWhile(isNotOne, [1, 2, 3, 4]); //=> [2, 3, 4] + // @dts-jest:pass -> number[] + R.takeLastWhile(isNotOne)([1, 2, 3, 4]); //=> [2, 3, 4] +})(); + +// @dts-jest:group takeWhile +(() => { + const isNotFour = (x: number) => !(x === 4); + // @dts-jest:pass -> number[] + R.takeWhile(isNotFour, [1, 2, 3, 4]); //=> [1, 2, 3] + // @dts-jest:pass -> number[] + R.takeWhile(isNotFour)([1, 2, 3, 4]); //=> [1, 2, 3] +})(); + +// @dts-jest:group tap +(() => { + const sayX = (_x: number) => { + /* console.log(`x is ${x}` */ + }; + // @dts-jest:pass -> number + R.tap(sayX, 100); //=> 100 +})(); + +// @dts-jest:group test +(() => { + // @dts-jest:pass -> boolean + R.test(/^x/, 'xyz'); //=> true + // @dts-jest:pass -> boolean + R.test(/^y/)('xyz'); //=> false +})(); + +// @dts-jest:group times +(() => { + const i = (x: number) => x; + // @dts-jest:pass -> number[] + R.times(i, 5); + // @dts-jest:pass -> number[] + R.times(R.identity, 5); //=> [0, 1, 2, 3, 4] + // @dts-jest:pass -> number[] + R.times(R.identity)(5); //=> [0, 1, 2, 3, 4] +})(); + +// @dts-jest:group toLower +(() => { + // @dts-jest:pass -> string + R.toLower('XYZ'); //=> 'xyz' +})(); + +// @dts-jest:group toPairs +(() => { + // @dts-jest:pass -> ["a" | "b" | "c", number][] + R.toPairs({ a: 1, b: 2, c: 3 }); //=> [['a', 1], ['b', 2], ['c', 3]] +})(); + +// @dts-jest:group toPairsIn +(() => { + class F { + public x = 'X'; + public y = 'Y'; + } + const f = new F(); + // @dts-jest:pass -> ["x" | "y", string][] + R.toPairsIn(f); //=> [['x','X'], ['y','Y']] + // @dts-jest:pass -> ["x" | "y", string][] + R.toPairsIn(f); //=> [['x','X'], ['y','Y']] +})(); + +// @dts-jest:group toString +(() => { + class Point { + public x: number; + public y: number; + constructor(x: number, y: number) { + this.x = x; + this.y = y; + } + public toString() { + return `new Point(${this.x}, ${this.y})`; + } + } + // @dts-jest:pass -> string + R.toString(new Point(1, 2)); //=> 'new Point(1, 2)' + // @dts-jest:pass -> string + R.toString(42); //=> '42' + // @dts-jest:pass -> string + R.toString('abc'); //=> 'abc' + // @dts-jest:pass -> string + R.toString([1, 2, 3]); //=> '[1, 2, 3]' + // @dts-jest:pass -> string + R.toString({ foo: 1, bar: 2, baz: 3 }); //=> '{"bar": 2, "baz": 3, "foo": 1}' + // @dts-jest:pass -> string + R.toString(new Date('2001-02-03T04: 05: 06Z')); //=> "new Date('2001-02-03T04: 05: 06.000Z')"" +})(); + +// @dts-jest:group toUpper +(() => { + // @dts-jest:pass -> string + R.toUpper('abc'); //=> 'ABC' +})(); + +// @dts-jest:group transduce +(() => { + const numbers = [1, 2, 3, 4]; + const transducer = R.compose( + R.map(R.add(1)), + R.take(2), + ); + const fn = R.flip(R.append); + // @dts-jest:pass -> number[] + R.transduce(transducer, fn, [] as number[], numbers); //=> [2, 3] // strictNullChecks: must annotate empty array type + // @dts-jest:pass -> number[] + R.transduce(transducer, fn, [] as number[])(numbers); //=> [2, 3] + // @dts-jest:pass -> number[] + R.transduce(transducer, fn)([] as number[], numbers); //=> [2, 3] + // @dts-jest:pass -> number[] + R.transduce(transducer)(fn, [] as number[], numbers); //=> [2, 3] +})(); + +// @dts-jest:group transpose +(() => { + // @dts-jest:pass -> (string | number)[][] + R.transpose([[1, 'a'], [2, 'b'], [3, 'c']]); //=> [[1, 2, 3], ['a', 'b', 'c']] + // @dts-jest:pass -> (string | number)[][] + R.transpose([[1, 2, 3], ['a', 'b', 'c']]); //=> [[1, 'a'], [2, 'b'], [3, 'c']] + // @dts-jest:pass -> number[][] + R.transpose([[10, 11], [20], [], [30, 31, 32]]); //=> [[10, 20, 30], [11, 31], [32]] +})(); + +// @dts-jest:group:skip traverse +(() => { + // TODO +})(); + +// @dts-jest:group trim +(() => { + // @dts-jest:pass -> string + R.trim(' xyz '); //=> 'xyz' + // @dts-jest:pass -> string[] + R.map(R.trim, R.split(',', 'x, y, z')); //=> ['x', 'y', 'z'] +})(); + +// @dts-jest:group tryCatch +(() => { + // @dts-jest:pass -> boolean + R.tryCatch(R.prop('x'), R.F)({ x: true }); //=> true + // @dts-jest:pass -> any + R.tryCatch(R.prop('x'), R.F)(null); //=> false +})(); + +// @dts-jest:group type +(() => { + // @dts-jest:pass -> string + R.type({}); //=> 'Object' + // @dts-jest:pass -> "Number" + R.type(1); //=> 'Number' + // @dts-jest:pass -> "Boolean" + R.type(false); //=> 'Boolean' + // @dts-jest:pass -> "String" + R.type('s'); //=> 'String' + // @dts-jest:pass -> "Null" + R.type(null); //=> 'Null' + // @dts-jest:pass -> string + R.type([]); //=> 'Array' + // @dts-jest:pass -> string + R.type(/[A-z]/); //=> 'RegExp' +})(); + +// @dts-jest:group unapply +(() => { + // @dts-jest:pass -> (...args: any[]) => string + R.unapply(JSON.stringify); + // @dts-jest:pass -> string + R.unapply(JSON.stringify)(1, 2, 3); //=> '[1,2,3]' +})(); + +// @dts-jest:group unary +(() => { + const takesOneArg = (a: number) => [a]; + const takesTwoArgs = (a: number, b: number) => [a, b]; + const takesThreeArgs = (a: number, b: number, c: number) => [a, b, c]; + + // @dts-jest:pass -> (a: number) => number[] + R.unary(takesOneArg); + // @dts-jest:pass -> (a: number) => number[] + R.unary(takesTwoArgs); + // @dts-jest:pass -> (a: number) => number[] + R.unary(takesThreeArgs); +})(); + +// @dts-jest:group uncurryN +(() => { + const addFour = (a: number) => (b: number) => (c: number) => (d: number) => + a + b + c + d; + const uncurriedAddFour = R.uncurryN(4, addFour); + // @dts-jest:pass -> number + uncurriedAddFour(1, 2, 3, 4); //=> 10 +})(); + +// @dts-jest:group unfold +(() => { + const f = (n: number) => (n > 50 ? false : [-n, n + 10] as [number, number]); + // @dts-jest:pass -> number[] + R.unfold(f, 10); //=> [-10, -20, -30, -40, -50] + const b = R.unfold(f); + // @dts-jest:pass -> (initial: number) => number[] + b; //=> [-10, -20, -30, -40, -50] + // @dts-jest:pass -> number[] + b(10); +})(); + +// @dts-jest:group union +(() => { + // @dts-jest:pass -> number[] + R.union([1, 2, 3], [2, 3, 4]); //=> [1, 2, 3, 4] +})(); + +// @dts-jest:group unionWith +(() => { + interface A { + a: number; + } + const l1 = [{ a: 1 }, { a: 2 }]; + const l2 = [{ a: 1 }, { a: 4 }]; + // @dts-jest:pass -> A[] + R.unionWith(R.eqBy(R.prop('a')), l1, l2); //=> [{a: 1}, {a: 2}, {a: 4}] +})(); + +// @dts-jest:group uniq +(() => { + // @dts-jest:pass -> number[] + R.uniq([1, 1, 2, 1]); //=> [1, 2] + // @dts-jest:pass -> {}[] + R.uniq([{}, {}]); //=> [{}, {}] + // @dts-jest:pass -> (string | number)[] + R.uniq([1, '1']); //=> [1, '1'] +})(); + +// @dts-jest:group uniqBy +(() => { + // @dts-jest:pass -> number[] + R.uniqBy(Math.abs, [-1, -5, 2, 10, 1, 2]); //=> [-1, -5, 2, 10] +})(); + +// @dts-jest:group uniqWith +(() => { + const strEq = (a: any, b: any) => String(a) === String(b); + // @dts-jest:pass -> (string | number)[] + R.uniqWith(strEq, [1, '1', 2, 1]); //=> [1, 2] + // @dts-jest:pass -> (string | number)[] + R.uniqWith(strEq)([1, '1', 2, 1]); //=> [1, 2] + // @dts-jest:pass -> {}[] + R.uniqWith<{}>(strEq)([{}, {}]); //=> [{}] + // @dts-jest:pass -> (string | number)[] + R.uniqWith(strEq)([1, '1', 1]); //=> [1] + // @dts-jest:pass -> (string | number)[] + R.uniqWith(strEq)(['1', 1, 1]); //=> ['1'] +})(); + +// @dts-jest:group unless +(() => { + // @dts-jest:pass -> number + R.unless(R.gt(R.__, 100), R.multiply(2))(1); //=> 2 + + function isArrayLike(x: any): x is R.List { + return x && typeof x.length === 'number'; + } + + const coerceArray = R.unless(isArrayLike, R.of); + // @dts-jest:pass -> any[] | ArrayLike + coerceArray([1, 2, 3]); //=> [1, 2, 3] + // @dts-jest:pass -> any[] | ArrayLike + coerceArray(1); //=> [1] +})(); + +// @dts-jest:group unnest +(() => { + // @dts-jest:pass -> boolean + R.equals(R.unnest([1, [2], [[3]]]), [1, 2, [3]]); //=> true + // @dts-jest:pass -> boolean + R.equals(R.unnest([[1, 2], [3, 4], [5, 6]]), [1, 2, 3, 4, 5, 6]); //=> true +})(); + +// @dts-jest:group until +(() => { + // @dts-jest:pass -> number + R.until(R.gt(R.__, 100), R.multiply(2))(1); //=> 128 +})(); + +// @dts-jest:group update +(() => { + // @dts-jest:pass -> number[] + R.update(1, 11, [0, 1, 2]); //=> [0, 11, 2] + // @dts-jest:pass -> number[] + R.update(1)(11)([0, 1, 2]); //=> [0, 11, 2] +})(); + +// @dts-jest:group useWith +(() => { + // @dts-jest:pass -> number + R.useWith(Math.pow, [R.identity, R.identity])(3, 4); //=> 81 + // @dts-jest:pass -> number + R.useWith<'11', '2arity'>()(Math.pow, [R.identity, R.identity])(3)(4); //=> 81 + // @dts-jest:pass -> number + R.useWith(Math.pow, [R.dec, R.inc])(3, 4); //=> 32 + // @dts-jest:pass -> number + R.useWith(Math.pow, [R.dec, R.inc])(3)(4); //=> 32 +})(); + +// @dts-jest:group values +(() => { + // @dts-jest:pass -> number[] + R.values({ a: 1, b: 2, c: 3 }); //=> [1, 2, 3] +})(); + +// @dts-jest:group valuesIn +(() => { + class F { + public x = 'X'; + public y = 'Y'; + } + const f = new F(); + // @dts-jest:pass -> string[] + R.valuesIn(f); //=> ['X', 'Y'] +})(); + +// @dts-jest:group view +(() => { + const headLens = R.lensIndex(0); + // @dts-jest:pass -> any + R.view(headLens, ['a', 'b', 'c']); //=> 'a' +})(); + +// @dts-jest:group when +(() => { + const truncate = R.when( + R.propSatisfies(R.gt(R.__, 10), 'length'), + R.pipe(R.take(10), R.append('…'), R.join('')), + ); + // @dts-jest:pass -> string + truncate('12345'); //=> '12345' + // @dts-jest:pass -> string + truncate('0123456789ABC'); //=> '0123456789…' +})(); + +// @dts-jest:group where +(() => { + const spec = { x: R.equals(2) }; + // @dts-jest:pass -> boolean + R.where(spec, { w: 10, x: 2, y: 300 }); //=> true + // @dts-jest:pass -> boolean + R.where(spec, { x: 1, y: 'moo', z: true }); //=> false + // @dts-jest:pass -> boolean + R.where(spec)({ w: 10, x: 2, y: 300 }); //=> true + // @dts-jest:pass -> boolean + R.where(spec)({ x: 1, y: 'moo', z: true }); //=> false + + const spec2 = { x: (val: number) => val > 10 }; + // @dts-jest:pass -> boolean + R.where(spec2, { x: 2, y: 7 }); //=> false + // @dts-jest:pass -> boolean + R.where(spec2, { x: 3, y: 8 }); //=> true + + const xs = [{ x: 2, y: 1 }, { x: 10, y: 2 }, { x: 8, y: 3 }, { x: 10, y: 4 }]; + // @dts-jest:pass -> Dictionary[] + R.filter(R.where({ x: R.equals(10) }), xs); // ==> [{x: 10, y: 2}, {x: 10, y: 4}] + // @dts-jest:pass -> Dictionary[] + R.filter(R.where({ x: R.equals(10) }))(xs); // ==> [{x: 10, y: 2}, {x: 10, y: 4}] +})(); + +// @dts-jest:group whereEq +(() => { + const pred = R.whereEq({ a: 1, b: 2 }); + // @dts-jest:pass -> (object: Dictionary) => boolean + pred; + // @dts-jest:pass -> boolean + pred({ a: 1 }); //=> false + // @dts-jest:pass -> boolean + pred({ a: 1, b: 2 }); //=> true + // @dts-jest:pass -> boolean + pred({ a: 1, b: 2, c: 3 }); //=> true + // @dts-jest:pass -> boolean + pred({ a: 1, b: 1 }); //=> false + // @dts-jest:pass -> boolean + R.whereEq({ a: 'one' }, { a: 'one' }); //=> true +})(); + +// @dts-jest:group without +(() => { + // @dts-jest:pass -> number[] + R.without([1, 2], [1, 2, 1, 3, 4]); //=> [3, 4] +})(); + +// @dts-jest:group xprod +(() => { + // @dts-jest:pass -> [number, string][] + R.xprod([1, 2], ['a', 'b']); //=> [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']] + // @dts-jest:pass -> [number, string][] + R.xprod([1, 2])(['a', 'b']); //=> [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']] +})(); + +// @dts-jest:group zip +(() => { + // @dts-jest:pass -> [number, string][] + R.zip([1, 2, 3], ['a', 'b', 'c']); //=> [[1, 'a'], [2, 'b'], [3, 'c']] + // @dts-jest:pass -> [number, string][] + R.zip([1, 2, 3])(['a', 'b', 'c']); //=> [[1, 'a'], [2, 'b'], [3, 'c']] +})(); + +// @dts-jest:group zipObj +(() => { + // @dts-jest:pass -> Record<"a" | "b" | "c", number> + R.zipObj(['a', 'b', 'c'], [1, 2, 3]); //=> {a: 1, b: 2, c: 3} + // @dts-jest:pass -> Record<"a" | "b" | "c", number> + R.zipObj(['a', 'b', 'c'])([1, 2, 3]); //=> {a: 1, b: 2, c: 3} +})(); + +// @dts-jest:group zipWith +(() => { + const f = (_x: number, _y: string) => { + /* ... */ + }; + // @dts-jest:pass -> void[] + R.zipWith(f, [1, 2, 3], ['a', 'b', 'c']); //=> [f(1, 'a'), f(2, 'b'), f(3, 'c')] + // @dts-jest:pass -> void[] + R.zipWith(f)([1, 2, 3], ['a', 'b', 'c']); //=> [f(1, 'a'), f(2, 'b'), f(3, 'c')] + // @dts-jest:pass -> void[] + R.zipWith(f, [1, 2, 3])(['a', 'b', 'c']); //=> [f(1, 'a'), f(2, 'b'), f(3, 'c')] +})(); diff --git a/snapshots/range.ts b/snapshots/range.ts new file mode 100644 index 0000000..20e668d --- /dev/null +++ b/snapshots/range.ts @@ -0,0 +1,10 @@ +import * as R_range from '../ramda/dist/src/range'; + +declare const number: number; + +// @dts-jest:pass -> (to: number) => number[] +R_range(number); +// @dts-jest:pass -> number[] +R_range(number)(number); +// @dts-jest:pass -> number[] +R_range(number, number); diff --git a/snapshots/reduce.ts b/snapshots/reduce.ts new file mode 100644 index 0000000..a44f976 --- /dev/null +++ b/snapshots/reduce.ts @@ -0,0 +1,12 @@ +import * as R_reduce from '../ramda/dist/src/reduce'; + +declare const number_array: number[]; +declare const object: object; +declare const object_number_to_object: (acc: object, val: number) => object; + +// @dts-jest:pass -> (values: number[] | ArrayLike) => object +R_reduce(object_number_to_object, object); +// @dts-jest:pass -> object +R_reduce(object_number_to_object)(object)(number_array); +// @dts-jest:pass -> object +R_reduce(object_number_to_object, object, number_array); diff --git a/snapshots/reduceBy.ts b/snapshots/reduceBy.ts new file mode 100644 index 0000000..fdabc73 --- /dev/null +++ b/snapshots/reduceBy.ts @@ -0,0 +1,21 @@ +import * as R_reduceBy from '../ramda/dist/src/reduceBy'; + +declare const number_array: number[]; +declare const object: object; +declare const object_number_to_object: (acc: object, val: number) => object; +declare const number_to_string: (x: number) => string; +declare const number_to_a_b_c: (x: number) => 'a' | 'b' | 'c'; + +// @dts-jest:pass -> (values: number[] | ArrayLike) => Partial> +R_reduceBy(object_number_to_object, object, number_to_string); +// @dts-jest:pass -> Partial> +R_reduceBy(object_number_to_object)(object)(number_to_string)(number_array); +// @dts-jest:pass -> Partial> +R_reduceBy(object_number_to_object, object, number_to_string, number_array); + +// @dts-jest:pass -> (values: number[] | ArrayLike) => Partial> +R_reduceBy(object_number_to_object, object, number_to_a_b_c); +// @dts-jest:pass -> Partial> +R_reduceBy(object_number_to_object)(object)(number_to_a_b_c)(number_array); +// @dts-jest:pass -> Partial> +R_reduceBy(object_number_to_object, object, number_to_a_b_c, number_array); diff --git a/snapshots/reduceRight.ts b/snapshots/reduceRight.ts new file mode 100644 index 0000000..70dd124 --- /dev/null +++ b/snapshots/reduceRight.ts @@ -0,0 +1,12 @@ +import * as R_reduceRight from '../ramda/dist/src/reduceRight'; + +declare const number_array: number[]; +declare const object: object; +declare const number_object_to_object: (val: number, acc: object) => object; + +// @dts-jest:pass -> (values: number[] | ArrayLike) => object +R_reduceRight(number_object_to_object, object); +// @dts-jest:pass -> object +R_reduceRight(number_object_to_object)(object)(number_array); +// @dts-jest:pass -> object +R_reduceRight(number_object_to_object, object, number_array); diff --git a/snapshots/reduceWhile.ts b/snapshots/reduceWhile.ts new file mode 100644 index 0000000..e9361c9 --- /dev/null +++ b/snapshots/reduceWhile.ts @@ -0,0 +1,20 @@ +import * as R_reduceWhile from '../ramda/dist/src/reduceWhile'; + +declare const number_array: number[]; +declare const object: object; +declare const object_number_to_object: (acc: object, val: number) => object; +declare const object_number_to_boolean: (acc: object, val: number) => boolean; + +// @dts-jest:pass -> (values: number[] | ArrayLike) => object +R_reduceWhile(object_number_to_boolean, object_number_to_object, object); +// @dts-jest:pass -> object +R_reduceWhile(object_number_to_boolean)(object_number_to_object)(object)( + number_array, +); +// @dts-jest:pass -> object +R_reduceWhile( + object_number_to_boolean, + object_number_to_object, + object, + number_array, +); diff --git a/snapshots/reduced.ts b/snapshots/reduced.ts new file mode 100644 index 0000000..9deeaec --- /dev/null +++ b/snapshots/reduced.ts @@ -0,0 +1,10 @@ +import { Reduced } from '../ramda/dist/src/$types'; +import * as R_reduced from '../ramda/dist/src/reduced'; + +declare const object: object; +declare const reduced_object: Reduced; + +// @dts-jest:pass -> Reduced +R_reduced(object); +// @dts-jest:pass -> Reduced +R_reduced(reduced_object); diff --git a/snapshots/reject.ts b/snapshots/reject.ts new file mode 100644 index 0000000..2419768 --- /dev/null +++ b/snapshots/reject.ts @@ -0,0 +1,22 @@ +import { Dictionary, Filterable, Predicate } from '../ramda/dist/src/$types'; +import * as R_reject from '../ramda/dist/src/reject'; + +declare const string_predicate: Predicate; +declare const string_array: string[]; +declare const string_dictionary: Dictionary; +declare const string_filterable: Filterable; + +// @dts-jest:pass -> string[] +R_reject(string_predicate, string_array); +// @dts-jest:pass -> string[] +R_reject(string_predicate)(string_array); + +// @dts-jest:pass -> Partial> +R_reject(string_predicate, string_dictionary); +// @dts-jest:pass -> Partial> +R_reject(string_predicate)(string_dictionary); + +// @dts-jest:pass -> Filterable +R_reject(string_predicate, string_filterable); +// @dts-jest:pass -> Filterable +R_reject(string_predicate)(string_filterable); diff --git a/snapshots/remove.ts b/snapshots/remove.ts new file mode 100644 index 0000000..b2587bd --- /dev/null +++ b/snapshots/remove.ts @@ -0,0 +1,11 @@ +import * as R_remove from '../ramda/dist/src/remove'; + +declare const boolean_array: boolean[]; +declare const number: number; + +// @dts-jest:pass -> (list: T[]) => T[] +R_remove(number, number); +// @dts-jest:pass -> boolean[] +R_remove(number)(number)(boolean_array); +// @dts-jest:pass -> boolean[] +R_remove(number, number, boolean_array); diff --git a/snapshots/repeat.ts b/snapshots/repeat.ts new file mode 100644 index 0000000..7525ea2 --- /dev/null +++ b/snapshots/repeat.ts @@ -0,0 +1,11 @@ +import * as R_repeat from '../ramda/dist/src/repeat'; + +declare const string: string; +declare const number: number; + +// @dts-jest:pass -> (count: number) => string[] +R_repeat(string); +// @dts-jest:pass -> string[] +R_repeat(string)(number); +// @dts-jest:pass -> string[] +R_repeat(string, number); diff --git a/snapshots/replace.ts b/snapshots/replace.ts new file mode 100644 index 0000000..168dbe1 --- /dev/null +++ b/snapshots/replace.ts @@ -0,0 +1,11 @@ +import * as R_replace from '../ramda/dist/src/replace'; + +declare const regex: RegExp; +declare const string: string; + +// @dts-jest:pass -> (str: string) => string +R_replace(regex, string); +// @dts-jest:pass -> string +R_replace(regex)(string)(string); +// @dts-jest:pass -> string +R_replace(regex, string, string); diff --git a/snapshots/reverse.ts b/snapshots/reverse.ts new file mode 100644 index 0000000..94f8c16 --- /dev/null +++ b/snapshots/reverse.ts @@ -0,0 +1,10 @@ +import { List } from '../ramda/dist/src/$types'; +import * as R_reverse from '../ramda/dist/src/reverse'; + +declare const string: string; +declare const number_list: List; + +// @dts-jest:pass -> string +R_reverse(string); +// @dts-jest:pass -> number[] +R_reverse(number_list); diff --git a/snapshots/scan.ts b/snapshots/scan.ts new file mode 100644 index 0000000..efeb7cb --- /dev/null +++ b/snapshots/scan.ts @@ -0,0 +1,12 @@ +import * as R_scan from '../ramda/dist/src/scan'; + +declare const number_array: number[]; +declare const object: object; +declare const object_number_to_object: (acc: object, val: number) => object; + +// @dts-jest:pass -> (values: number[] | ArrayLike) => object[] +R_scan(object_number_to_object, object); +// @dts-jest:pass -> object[] +R_scan(object_number_to_object)(object)(number_array); +// @dts-jest:pass -> object[] +R_scan(object_number_to_object, object, number_array); diff --git a/snapshots/sequence.ts b/snapshots/sequence.ts new file mode 100644 index 0000000..2abc6ec --- /dev/null +++ b/snapshots/sequence.ts @@ -0,0 +1,20 @@ +import { Applicative, Traversable } from '../ramda/dist/src/$types'; +import * as R_sequence from '../ramda/dist/src/sequence'; + +declare const any_applicative: Applicative; +declare const number_applicative: Applicative; +declare const any_applicative_traverable: Traversable>; + +// @dts-jest:pass -> Applicative<{}[]> +R_sequence(number_applicative.of, [number_applicative]); +// @dts-jest:pass -> Applicative<{}[]> +R_sequence(any_applicative.of, [any_applicative]); +// @dts-jest:pass -> Applicative +R_sequence(any_applicative.of, [any_applicative]); + +// @dts-jest:pass -> Applicative> +R_sequence(number_applicative.of, any_applicative_traverable); +// @dts-jest:pass -> Applicative> +R_sequence(any_applicative.of, any_applicative_traverable); +// @dts-jest:pass -> Applicative> +R_sequence(any_applicative.of, any_applicative_traverable); diff --git a/snapshots/set.ts b/snapshots/set.ts new file mode 100644 index 0000000..1ba6b36 --- /dev/null +++ b/snapshots/set.ts @@ -0,0 +1,37 @@ +import { ManualLens, PseudoLens } from '../ramda/dist/src/$types'; +import * as R_set from '../ramda/dist/src/set'; + +declare const menual_lens_number_object: ManualLens; +declare const pseudo_lens_a: PseudoLens<'a'>; +declare const pseudo_lens_1: PseudoLens<1>; + +declare const object: object; +declare const a_1_b_2_c_3: { a: 1; b: 2; c: 3 }; +declare const number_array: number[]; +declare const string_number_tuple: [string, number]; +declare const number: number; + +// @dts-jest:pass -> (target: object) => object +R_set(menual_lens_number_object, number); +// @dts-jest:pass -> object +R_set(menual_lens_number_object)(number)(object); +// @dts-jest:pass -> object +R_set(menual_lens_number_object, number, object); + +// @dts-jest:pass -> (target: Record<"a", any>) => Record<"a", any> +R_set(pseudo_lens_a, number); +// @dts-jest:pass -> Record<"a", any> +R_set(pseudo_lens_a)(number)(a_1_b_2_c_3); +// @dts-jest:pass -> { a: 1; b: 2; c: 3; } +R_set(pseudo_lens_a, number, a_1_b_2_c_3); + +// @dts-jest:pass -> (target: {}) => {} +R_set(pseudo_lens_1, number); +// @dts-jest:pass -> {} +R_set(pseudo_lens_1)(number)(string_number_tuple); +// @dts-jest:pass -> [string, number] +R_set(pseudo_lens_1, number, string_number_tuple); +// @dts-jest:pass -> {} +R_set(pseudo_lens_1)(number)(number_array); +// @dts-jest:pass -> number[] +R_set(pseudo_lens_1, number, number_array); diff --git a/snapshots/slice.ts b/snapshots/slice.ts new file mode 100644 index 0000000..d44c89f --- /dev/null +++ b/snapshots/slice.ts @@ -0,0 +1,16 @@ +import { List } from '../ramda/dist/src/$types'; +import * as R_slice from '../ramda/dist/src/slice'; + +declare const number: number; +declare const string: string; +declare const object_list: List; + +// @dts-jest:pass -> string +R_slice(number)(number)(string); +// @dts-jest:pass -> string +R_slice(number, number, string); + +// @dts-jest:pass -> object[] +R_slice(number)(number)(object_list); +// @dts-jest:pass -> object[] +R_slice(number, number, object_list); diff --git a/snapshots/sort.ts b/snapshots/sort.ts new file mode 100644 index 0000000..35d7612 --- /dev/null +++ b/snapshots/sort.ts @@ -0,0 +1,22 @@ +import { List } from '../ramda/dist/src/$types'; +import * as R_sort from '../ramda/dist/src/sort'; + +declare const string: string; +declare const string_string_to_number: (x: string, y: string) => number; + +declare const object_list: List; +declare const object_object_to_number: (x: object, y: object) => number; + +// @dts-jest:pass -> (list: List) => string[] +R_sort(string_string_to_number); +// @dts-jest:pass -> string[] +R_sort(string_string_to_number)(string); +// @dts-jest:pass -> string[] +R_sort(string_string_to_number, string); + +// @dts-jest:pass -> (list: List) => object[] +R_sort(object_object_to_number); +// @dts-jest:pass -> object[] +R_sort(object_object_to_number)(object_list); +// @dts-jest:pass -> object[] +R_sort(object_object_to_number, object_list); diff --git a/snapshots/sortBy.ts b/snapshots/sortBy.ts new file mode 100644 index 0000000..a843d68 --- /dev/null +++ b/snapshots/sortBy.ts @@ -0,0 +1,22 @@ +import { List } from '../ramda/dist/src/$types'; +import * as R_sortBy from '../ramda/dist/src/sortBy'; + +declare const string: string; +declare const string_to_number: (x: string) => number; + +declare const object_list: List; +declare const object_to_number: (x: object) => number; + +// @dts-jest:pass -> (list: List) => string[] +R_sortBy(string_to_number); +// @dts-jest:pass -> string[] +R_sortBy(string_to_number)(string); +// @dts-jest:pass -> string[] +R_sortBy(string_to_number, string); + +// @dts-jest:pass -> (list: List) => object[] +R_sortBy(object_to_number); +// @dts-jest:pass -> object[] +R_sortBy(object_to_number)(object_list); +// @dts-jest:pass -> object[] +R_sortBy(object_to_number, object_list); diff --git a/snapshots/sortWith.ts b/snapshots/sortWith.ts new file mode 100644 index 0000000..e128e52 --- /dev/null +++ b/snapshots/sortWith.ts @@ -0,0 +1,22 @@ +import { List } from '../ramda/dist/src/$types'; +import * as R_sortWith from '../ramda/dist/src/sortWith'; + +declare const string: string; +declare const string_string_to_number: (x: string, y: string) => number; + +declare const object_list: List; +declare const object_object_to_number: (x: object, y: object) => number; + +// @dts-jest:pass -> (list: List) => string[] +R_sortWith([string_string_to_number]); +// @dts-jest:pass -> string[] +R_sortWith([string_string_to_number])(string); +// @dts-jest:pass -> string[] +R_sortWith([string_string_to_number], string); + +// @dts-jest:pass -> (list: List) => object[] +R_sortWith([object_object_to_number]); +// @dts-jest:pass -> object[] +R_sortWith([object_object_to_number])(object_list); +// @dts-jest:pass -> object[] +R_sortWith([object_object_to_number], object_list); diff --git a/snapshots/split.ts b/snapshots/split.ts new file mode 100644 index 0000000..c10373d --- /dev/null +++ b/snapshots/split.ts @@ -0,0 +1,11 @@ +import * as R_split from '../ramda/dist/src/split'; + +declare const regex: RegExp; +declare const string: string; + +// @dts-jest:pass -> (str: string) => string[] +R_split(regex); +// @dts-jest:pass -> string[] +R_split(regex)(string); +// @dts-jest:pass -> string[] +R_split(regex, string); diff --git a/snapshots/splitAt.ts b/snapshots/splitAt.ts new file mode 100644 index 0000000..2563b47 --- /dev/null +++ b/snapshots/splitAt.ts @@ -0,0 +1,16 @@ +import { List } from '../ramda/dist/src/$types'; +import * as R_splitAt from '../ramda/dist/src/splitAt'; + +declare const number: number; +declare const string: string; +declare const object_list: List; + +// @dts-jest:pass -> [string, string] +R_splitAt(number)(string); +// @dts-jest:pass -> [string, string] +R_splitAt(number, string); + +// @dts-jest:pass -> [object[], object[]] +R_splitAt(number)(object_list); +// @dts-jest:pass -> [object[], object[]] +R_splitAt(number, object_list); diff --git a/snapshots/splitEvery.ts b/snapshots/splitEvery.ts new file mode 100644 index 0000000..e3aa659 --- /dev/null +++ b/snapshots/splitEvery.ts @@ -0,0 +1,16 @@ +import { List } from '../ramda/dist/src/$types'; +import * as R_splitEvery from '../ramda/dist/src/splitEvery'; + +declare const number: number; +declare const string: string; +declare const object_list: List; + +// @dts-jest:pass -> string[] +R_splitEvery(number)(string); +// @dts-jest:pass -> string[] +R_splitEvery(number, string); + +// @dts-jest:pass -> object[][] +R_splitEvery(number)(object_list); +// @dts-jest:pass -> object[][] +R_splitEvery(number, object_list); diff --git a/snapshots/splitWhen.ts b/snapshots/splitWhen.ts new file mode 100644 index 0000000..0fe1956 --- /dev/null +++ b/snapshots/splitWhen.ts @@ -0,0 +1,22 @@ +import { List } from '../ramda/dist/src/$types'; +import * as R_splitWhen from '../ramda/dist/src/splitWhen'; + +declare const string: string; +declare const string_to_boolean: (x: string) => boolean; + +declare const object_list: List; +declare const object_to_boolean: (x: object) => boolean; + +// @dts-jest:pass -> (list: List) => [string[], string[]] +R_splitWhen(string_to_boolean); +// @dts-jest:pass -> [string[], string[]] +R_splitWhen(string_to_boolean)(string); +// @dts-jest:pass -> [string[], string[]] +R_splitWhen(string_to_boolean, string); + +// @dts-jest:pass -> (list: List) => [object[], object[]] +R_splitWhen(object_to_boolean); +// @dts-jest:pass -> [object[], object[]] +R_splitWhen(object_to_boolean)(object_list); +// @dts-jest:pass -> [object[], object[]] +R_splitWhen(object_to_boolean, object_list); diff --git a/snapshots/startsWith.ts b/snapshots/startsWith.ts new file mode 100644 index 0000000..f264291 --- /dev/null +++ b/snapshots/startsWith.ts @@ -0,0 +1,13 @@ +import * as R_startsWith from '../ramda/dist/src/startsWith'; + +declare const string: string; +declare const boolean_array: boolean[]; + +// @dts-jest:pass -> (list: string) => boolean +R_startsWith(string); +// @dts-jest:pass -> boolean +R_startsWith(string, string); +// @dts-jest:pass -> (list: boolean[]) => boolean +R_startsWith(boolean_array); +// @dts-jest:pass -> boolean +R_startsWith(boolean_array, boolean_array); diff --git a/snapshots/subtract.ts b/snapshots/subtract.ts new file mode 100644 index 0000000..1033ff1 --- /dev/null +++ b/snapshots/subtract.ts @@ -0,0 +1,8 @@ +import * as R_subtract from '../ramda/dist/src/subtract'; + +declare const number: number; + +// @dts-jest:pass -> number +R_subtract(number, number); +// @dts-jest:pass -> number +R_subtract(number)(number); diff --git a/snapshots/sum.ts b/snapshots/sum.ts new file mode 100644 index 0000000..33be5e2 --- /dev/null +++ b/snapshots/sum.ts @@ -0,0 +1,6 @@ +import * as R_sum from '../ramda/dist/src/sum'; + +declare const number_array: number[]; + +// @dts-jest:pass -> number +R_sum(number_array); diff --git a/snapshots/symmetricDifference.ts b/snapshots/symmetricDifference.ts new file mode 100644 index 0000000..09fdf62 --- /dev/null +++ b/snapshots/symmetricDifference.ts @@ -0,0 +1,8 @@ +import * as R_symmetricDifference from '../ramda/dist/src/symmetricDifference'; + +declare const number_array: number[]; + +// @dts-jest:pass -> (b: number[] | ArrayLike) => number[] +R_symmetricDifference(number_array); +// @dts-jest:pass -> number[] +R_symmetricDifference(number_array, number_array); diff --git a/snapshots/symmetricDifferenceWith.ts b/snapshots/symmetricDifferenceWith.ts new file mode 100644 index 0000000..241c3e6 --- /dev/null +++ b/snapshots/symmetricDifferenceWith.ts @@ -0,0 +1,9 @@ +import * as R_symmetricDifferenceWith from '../ramda/dist/src/symmetricDifferenceWith'; + +declare const number_number_to_boolean: (a: number, b: number) => boolean; +declare const number_array: number[]; + +// @dts-jest:pass -> (b: number[] | ArrayLike) => number[] +R_symmetricDifferenceWith(number_number_to_boolean, number_array); +// @dts-jest:pass -> number[] +R_symmetricDifferenceWith(number_number_to_boolean, number_array, number_array); diff --git a/snapshots/tail.ts b/snapshots/tail.ts new file mode 100644 index 0000000..1444978 --- /dev/null +++ b/snapshots/tail.ts @@ -0,0 +1,9 @@ +import * as R_tail from '../ramda/dist/src/tail'; + +declare const string: string; +declare const string_array: string[]; + +// @dts-jest:pass -> string +R_tail(string); +// @dts-jest:pass -> string[] +R_tail(string_array); diff --git a/snapshots/take.ts b/snapshots/take.ts new file mode 100644 index 0000000..c7c794a --- /dev/null +++ b/snapshots/take.ts @@ -0,0 +1,10 @@ +import * as R_take from '../ramda/dist/src/take'; + +declare const number: number; +declare const string: string; +declare const boolean_array: boolean[]; + +// @dts-jest:pass -> string +R_take(number, string); +// @dts-jest:pass -> boolean[] +R_take(number, boolean_array); diff --git a/snapshots/takeLast.ts b/snapshots/takeLast.ts new file mode 100644 index 0000000..211e2a5 --- /dev/null +++ b/snapshots/takeLast.ts @@ -0,0 +1,10 @@ +import * as R_takeLast from '../ramda/dist/src/takeLast'; + +declare const number: number; +declare const string: string; +declare const boolean_array: boolean[]; + +// @dts-jest:pass -> string +R_takeLast(number, string); +// @dts-jest:pass -> boolean[] +R_takeLast(number, boolean_array); diff --git a/snapshots/takeLastWhile.ts b/snapshots/takeLastWhile.ts new file mode 100644 index 0000000..d6a4bc8 --- /dev/null +++ b/snapshots/takeLastWhile.ts @@ -0,0 +1,9 @@ +import * as R_takeLastWhile from '../ramda/dist/src/takeLastWhile'; + +declare const string_to_boolean: (x: string) => boolean; +declare const string_array: string[]; + +// @dts-jest:pass -> (list: string[] | ArrayLike) => string[] +R_takeLastWhile(string_to_boolean); +// @dts-jest:pass -> string[] +R_takeLastWhile(string_to_boolean, string_array); diff --git a/snapshots/takeWhile.ts b/snapshots/takeWhile.ts new file mode 100644 index 0000000..67c57ab --- /dev/null +++ b/snapshots/takeWhile.ts @@ -0,0 +1,9 @@ +import * as R_takeWhile from '../ramda/dist/src/takeWhile'; + +declare const string_to_boolean: (x: string) => boolean; +declare const string_array: string[]; + +// @dts-jest:pass -> (list: string[] | ArrayLike) => string[] +R_takeWhile(string_to_boolean); +// @dts-jest:pass -> string[] +R_takeWhile(string_to_boolean, string_array); diff --git a/snapshots/tap.ts b/snapshots/tap.ts new file mode 100644 index 0000000..3e8bf67 --- /dev/null +++ b/snapshots/tap.ts @@ -0,0 +1,9 @@ +import * as R_tap from '../ramda/dist/src/tap'; + +declare const string_to_void: (x: string) => void; +declare const string: string; + +// @dts-jest:pass -> (value: string) => string +R_tap(string_to_void); +// @dts-jest:pass -> string +R_tap(string_to_void, string); diff --git a/snapshots/test.ts b/snapshots/test.ts new file mode 100644 index 0000000..c85af44 --- /dev/null +++ b/snapshots/test.ts @@ -0,0 +1,9 @@ +import * as R_test from '../ramda/dist/src/test'; + +declare const regex: RegExp; +declare const string: string; + +// @dts-jest:pass -> (str: string) => boolean +R_test(regex); +// @dts-jest:pass -> boolean +R_test(regex, string); diff --git a/snapshots/times.ts b/snapshots/times.ts new file mode 100644 index 0000000..da7c8ed --- /dev/null +++ b/snapshots/times.ts @@ -0,0 +1,9 @@ +import * as R_times from '../ramda/dist/src/times'; + +declare const number_to_object: (x: number) => object; +declare const number: number; + +// @dts-jest:pass -> (n: number) => object[] +R_times(number_to_object); +// @dts-jest:pass -> object[] +R_times(number_to_object, number); diff --git a/snapshots/toLower.ts b/snapshots/toLower.ts new file mode 100644 index 0000000..642feb1 --- /dev/null +++ b/snapshots/toLower.ts @@ -0,0 +1,6 @@ +import * as R_toLower from '../ramda/dist/src/toLower'; + +declare const string: string; + +// @dts-jest:pass -> string +R_toLower(string); diff --git a/snapshots/toPairs.ts b/snapshots/toPairs.ts new file mode 100644 index 0000000..2316287 --- /dev/null +++ b/snapshots/toPairs.ts @@ -0,0 +1,13 @@ +import * as R_toPairs from '../ramda/dist/src/toPairs'; + +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; +declare const string_number_record: Record; + +// @dts-jest:pass -> ["a" | "b" | "c", 1 | 2 | 3][] +R_toPairs(a_1_b_2_c_3); +// @dts-jest:pass -> [string, number][] +R_toPairs(string_number_record); diff --git a/snapshots/toPairsIn.ts b/snapshots/toPairsIn.ts new file mode 100644 index 0000000..6b76d60 --- /dev/null +++ b/snapshots/toPairsIn.ts @@ -0,0 +1,13 @@ +import * as R_toPairsIn from '../ramda/dist/src/toPairsIn'; + +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; +declare const string_number_record: Record; + +// @dts-jest:pass -> ["a" | "b" | "c", 1 | 2 | 3][] +R_toPairsIn(a_1_b_2_c_3); +// @dts-jest:pass -> [string, number][] +R_toPairsIn(string_number_record); diff --git a/snapshots/toString.ts b/snapshots/toString.ts new file mode 100644 index 0000000..4bc6c4f --- /dev/null +++ b/snapshots/toString.ts @@ -0,0 +1,9 @@ +import * as R_toString from '../ramda/dist/src/toString'; + +declare const number: number; +declare const object: object; + +// @dts-jest:pass -> string +R_toString(number); +// @dts-jest:pass -> string +R_toString(object); diff --git a/snapshots/toUpper.ts b/snapshots/toUpper.ts new file mode 100644 index 0000000..e058fc1 --- /dev/null +++ b/snapshots/toUpper.ts @@ -0,0 +1,6 @@ +import * as R_toUpper from '../ramda/dist/src/toUpper'; + +declare const string: string; + +// @dts-jest:pass -> string +R_toUpper(string); diff --git a/snapshots/transduce.ts b/snapshots/transduce.ts new file mode 100644 index 0000000..c0d16b5 --- /dev/null +++ b/snapshots/transduce.ts @@ -0,0 +1,27 @@ +import { Transformer } from '../ramda/dist/src/$types'; +import * as R_transduce from '../ramda/dist/src/transduce'; + +declare const number_object_transformer_identity: ( + x: Transformer, +) => Transformer; +declare const number_array: number[]; +declare const object: object; +declare const object_number_to_object: (acc: object, val: number) => object; + +// @dts-jest:pass -> (values: number[]) => object +R_transduce( + number_object_transformer_identity, + object_number_to_object, + object, +); +// @dts-jest:pass -> object +R_transduce(number_object_transformer_identity)(object_number_to_object)( + object, +)(number_array); +// @dts-jest:pass -> object +R_transduce( + number_object_transformer_identity, + object_number_to_object, + object, + number_array, +); diff --git a/snapshots/transpose.ts b/snapshots/transpose.ts new file mode 100644 index 0000000..179dc6a --- /dev/null +++ b/snapshots/transpose.ts @@ -0,0 +1,13 @@ +import { List } from '../ramda/dist/src/$types'; +import * as R_transpose from '../ramda/dist/src/transpose'; + +declare const number_array_array: number[][]; +declare const number_list_list: List>; +declare const boolean_array_array: boolean[][]; + +// @dts-jest:pass -> number[][] +R_transpose(number_list_list); +// @dts-jest:pass -> number[][] +R_transpose(number_array_array); +// @dts-jest:pass -> boolean[][] +R_transpose(boolean_array_array); diff --git a/snapshots/traverse.ts b/snapshots/traverse.ts new file mode 100644 index 0000000..3b50416 --- /dev/null +++ b/snapshots/traverse.ts @@ -0,0 +1,22 @@ +import { Applicative, Traversable } from '../ramda/dist/src/$types'; +import * as R_traverse from '../ramda/dist/src/traverse'; + +declare const number_array: number[]; +declare const number_applicative: Applicative; +declare const number_traverable: Traversable; +declare const number_to_string_applicative: (x: number) => Applicative; + +// @dts-jest:pass -> Applicative +R_traverse(number_applicative.of, number_to_string_applicative, number_array); +// @dts-jest:pass -> Applicative +R_traverse(number_applicative.of)(number_to_string_applicative)(number_array); +// @dts-jest:pass -> Applicative> +R_traverse( + number_applicative.of, + number_to_string_applicative, + number_traverable, +); +// @dts-jest:pass -> Applicative> +R_traverse(number_applicative.of)(number_to_string_applicative)( + number_traverable, +); diff --git a/snapshots/trim.ts b/snapshots/trim.ts new file mode 100644 index 0000000..49330ef --- /dev/null +++ b/snapshots/trim.ts @@ -0,0 +1,6 @@ +import * as R_trim from '../ramda/dist/src/trim'; + +declare const string: string; + +// @dts-jest:pass -> string +R_trim(string); diff --git a/snapshots/tryCatch.ts b/snapshots/tryCatch.ts new file mode 100644 index 0000000..d48dad6 --- /dev/null +++ b/snapshots/tryCatch.ts @@ -0,0 +1,10 @@ +import * as R_tryCatch from '../ramda/dist/src/tryCatch'; + +declare const T_to_T: (x: T) => T; + +// @dts-jest:pass -> (catcher: (x: T) => T) => (x: T) => T +R_tryCatch(T_to_T); +// @dts-jest:pass -> (x: T) => T +R_tryCatch(T_to_T)(T_to_T); +// @dts-jest:pass -> (x: T) => T +R_tryCatch(T_to_T, T_to_T); diff --git a/snapshots/type.ts b/snapshots/type.ts new file mode 100644 index 0000000..05a3549 --- /dev/null +++ b/snapshots/type.ts @@ -0,0 +1,15 @@ +import * as R_type from '../ramda/dist/src/type'; + +declare const boolean: boolean; +declare const number: number; +declare const object: object; +declare const any: any; + +// @dts-jest:pass -> "Boolean" +R_type(boolean); +// @dts-jest:pass -> "Number" +R_type(number); +// @dts-jest:pass -> string +R_type(object); +// @dts-jest:pass -> string +R_type(any); diff --git a/snapshots/unapply.ts b/snapshots/unapply.ts new file mode 100644 index 0000000..2580323 --- /dev/null +++ b/snapshots/unapply.ts @@ -0,0 +1,9 @@ +import * as R_unapply from '../ramda/dist/src/unapply'; + +declare const number_array_to_string: (nums: number[]) => string; +declare const number_array: number[]; + +// @dts-jest:pass -> (...args: any[]) => string +R_unapply(number_array_to_string); +// @dts-jest:pass -> string +R_unapply(number_array_to_string)(...number_array); diff --git a/snapshots/unary.ts b/snapshots/unary.ts new file mode 100644 index 0000000..728eaa9 --- /dev/null +++ b/snapshots/unary.ts @@ -0,0 +1,14 @@ +import { Variadic } from '../ramda/dist/src/$types'; +import * as R_unary from '../ramda/dist/src/unary'; + +declare const string_number_symbol_to_boolean: ( + a: string, + b: number, + c: symbol, +) => boolean; +declare const object_variadic: Variadic; + +// @dts-jest:pass -> (a: string) => boolean +R_unary(string_number_symbol_to_boolean); +// @dts-jest:pass -> (a: any) => object +R_unary(object_variadic); diff --git a/snapshots/uncurryN.ts b/snapshots/uncurryN.ts new file mode 100644 index 0000000..5b2b207 --- /dev/null +++ b/snapshots/uncurryN.ts @@ -0,0 +1,32 @@ +import * as R_uncurryN from '../ramda/dist/src/uncurryN'; + +declare const string_to_object: (x: string) => object; +declare const number_boolean_to_string: (x: number, y: boolean) => string; +declare const number_args_to_boolean: (...args: number[]) => boolean; +declare const seven_string_to_number: ( + v1: string, + v2: string, + v3: string, + v4: string, + v5: string, + v6: string, + v7: string, +) => number; + +// @dts-jest:pass -> () => any +R_uncurryN(0, string_to_object); +// @dts-jest:pass -> CurriedFunction1 +R_uncurryN(1, number_boolean_to_string); +// @dts-jest:pass -> CurriedFunction4 +R_uncurryN(4, number_args_to_boolean); +// @dts-jest:pass -> (...args: any[]) => any +R_uncurryN(7, seven_string_to_number); + +// @dts-jest:pass -> () => object +R_uncurryN(0, string_to_object); +// @dts-jest:pass -> CurriedFunction1 +R_uncurryN(1, number_boolean_to_string); +// @dts-jest:pass -> CurriedFunction4 +R_uncurryN(4, number_args_to_boolean); +// @dts-jest:pass -> (...args: any[]) => number +R_uncurryN(7, seven_string_to_number); diff --git a/snapshots/unfold.ts b/snapshots/unfold.ts new file mode 100644 index 0000000..48e66f5 --- /dev/null +++ b/snapshots/unfold.ts @@ -0,0 +1,13 @@ +import * as R_unfold from '../ramda/dist/src/unfold'; + +declare const string_to_object_string_tuple_or_false: ( + x: string, +) => [object, string] | false; +declare const string: string; + +// @dts-jest:pass -> (initial: string) => object[] +R_unfold(string_to_object_string_tuple_or_false); +// @dts-jest:pass -> object[] +R_unfold(string_to_object_string_tuple_or_false)(string); +// @dts-jest:pass -> object[] +R_unfold(string_to_object_string_tuple_or_false, string); diff --git a/snapshots/union.ts b/snapshots/union.ts new file mode 100644 index 0000000..a1396b6 --- /dev/null +++ b/snapshots/union.ts @@ -0,0 +1,8 @@ +import * as R_union from '../ramda/dist/src/union'; + +declare const number_array: number[]; + +// @dts-jest:pass -> (b: number[] | ArrayLike) => number[] +R_union(number_array); +// @dts-jest:pass -> number[] +R_union(number_array, number_array); diff --git a/snapshots/unionWith.ts b/snapshots/unionWith.ts new file mode 100644 index 0000000..bb4ad80 --- /dev/null +++ b/snapshots/unionWith.ts @@ -0,0 +1,9 @@ +import * as R_unionWith from '../ramda/dist/src/unionWith'; + +declare const number_number_to_boolean: (a: number, b: number) => boolean; +declare const number_array: number[]; + +// @dts-jest:pass -> (b: number[] | ArrayLike) => number[] +R_unionWith(number_number_to_boolean, number_array); +// @dts-jest:pass -> number[] +R_unionWith(number_number_to_boolean, number_array, number_array); diff --git a/snapshots/uniq.ts b/snapshots/uniq.ts new file mode 100644 index 0000000..a47299c --- /dev/null +++ b/snapshots/uniq.ts @@ -0,0 +1,9 @@ +import * as R_uniq from '../ramda/dist/src/uniq'; + +declare const number_array: number[]; +declare const string_array: string[]; + +// @dts-jest:pass -> number[] +R_uniq(number_array); +// @dts-jest:pass -> string[] +R_uniq(string_array); diff --git a/snapshots/uniqBy.ts b/snapshots/uniqBy.ts new file mode 100644 index 0000000..313bf21 --- /dev/null +++ b/snapshots/uniqBy.ts @@ -0,0 +1,20 @@ +import * as R_uniqBy from '../ramda/dist/src/uniqBy'; + +declare const number_to_object: (x: number) => object; +declare const number_array: number[]; +declare const string_to_any: (x: string) => any; +declare const string_array: string[]; + +// @dts-jest:pass -> (list: number[] | ArrayLike) => number[] +R_uniqBy(number_to_object); +// @dts-jest:pass -> number[] +R_uniqBy(number_to_object)(number_array); +// @dts-jest:pass -> number[] +R_uniqBy(number_to_object, number_array); + +// @dts-jest:pass -> (list: string[] | ArrayLike) => string[] +R_uniqBy(string_to_any); +// @dts-jest:pass -> string[] +R_uniqBy(string_to_any)(string_array); +// @dts-jest:pass -> string[] +R_uniqBy(string_to_any, string_array); diff --git a/snapshots/uniqWith.ts b/snapshots/uniqWith.ts new file mode 100644 index 0000000..c63a040 --- /dev/null +++ b/snapshots/uniqWith.ts @@ -0,0 +1,20 @@ +import * as R_uniqWith from '../ramda/dist/src/uniqWith'; + +declare const number_number_to_boolean: (x: number, y: number) => boolean; +declare const number_array: number[]; +declare const string_string_to_boolean: (x: string, y: string) => boolean; +declare const string_array: string[]; + +// @dts-jest:pass -> (list: number[] | ArrayLike) => number[] +R_uniqWith(number_number_to_boolean); +// @dts-jest:pass -> number[] +R_uniqWith(number_number_to_boolean)(number_array); +// @dts-jest:pass -> number[] +R_uniqWith(number_number_to_boolean, number_array); + +// @dts-jest:pass -> (list: string[] | ArrayLike) => string[] +R_uniqWith(string_string_to_boolean); +// @dts-jest:pass -> string[] +R_uniqWith(string_string_to_boolean)(string_array); +// @dts-jest:pass -> string[] +R_uniqWith(string_string_to_boolean, string_array); diff --git a/snapshots/unless.ts b/snapshots/unless.ts new file mode 100644 index 0000000..d4c3a75 --- /dev/null +++ b/snapshots/unless.ts @@ -0,0 +1,20 @@ +import * as R_unless from '../ramda/dist/src/unless'; + +declare const number_is_1: (x: number) => x is 1; +declare const number_to_boolean: (x: number) => boolean; +declare const number_to_string: (x: number) => string; +declare const number: number; + +// @dts-jest:pass -> (value: number) => string | number +R_unless(number_to_boolean, number_to_string); +// @dts-jest:pass -> string | number +R_unless(number_to_boolean)(number_to_string)(number); +// @dts-jest:pass -> string | number +R_unless(number_to_boolean, number_to_string, number); + +// @dts-jest:pass -> (value: number) => string | 1 +R_unless(number_is_1, number_to_string); +// @dts-jest:pass -> string | 1 +R_unless(number_is_1)(number_to_string)(number); +// @dts-jest:pass -> string | 1 +R_unless(number_is_1, number_to_string, number); diff --git a/snapshots/unnest.ts b/snapshots/unnest.ts new file mode 100644 index 0000000..36753ff --- /dev/null +++ b/snapshots/unnest.ts @@ -0,0 +1,9 @@ +import * as R_unnest from '../ramda/dist/src/unnest'; + +declare const number_array: number[]; +declare const number_array_array: number[][]; + +// @dts-jest:pass -> number[] +R_unnest(number_array); +// @dts-jest:pass -> number[] +R_unnest(number_array_array); diff --git a/snapshots/until.ts b/snapshots/until.ts new file mode 100644 index 0000000..720e7fc --- /dev/null +++ b/snapshots/until.ts @@ -0,0 +1,12 @@ +import * as R_until from '../ramda/dist/src/until'; + +declare const number_to_boolean: (x: number) => boolean; +declare const number_to_number: (x: number) => number; +declare const number: number; + +// @dts-jest:pass -> (initial: number) => number +R_until(number_to_boolean, number_to_number); +// @dts-jest:pass -> number +R_until(number_to_boolean)(number_to_number)(number); +// @dts-jest:pass -> number +R_until(number_to_boolean, number_to_number, number); diff --git a/snapshots/update.ts b/snapshots/update.ts new file mode 100644 index 0000000..9bcd3c7 --- /dev/null +++ b/snapshots/update.ts @@ -0,0 +1,17 @@ +import * as R_update from '../ramda/dist/src/update'; + +declare const string_array: string[]; +declare const boolean: boolean; +declare const string: string; +declare const number: number; + +// @dts-jest:pass -> (list: U[] | ArrayLike) => (boolean | U)[] +R_update(number, boolean); +// @dts-jest:pass -> (string | boolean)[] +R_update(number)(boolean)(string_array); +// @dts-jest:pass -> (string | boolean)[] +R_update(number, boolean, string_array); +// @dts-jest:pass -> string[] +R_update(number)(string)(string_array); +// @dts-jest:pass -> string[] +R_update(number, string, string_array); diff --git a/snapshots/useWith.ts b/snapshots/useWith.ts new file mode 100644 index 0000000..4ae89d4 --- /dev/null +++ b/snapshots/useWith.ts @@ -0,0 +1,33 @@ +import * as R_useWith from '../ramda/dist/src/useWith'; + +declare const any_args_to_object: (...args: any[]) => object; +declare const string_number_boolean_to_object: ( + x: string, + y: number, + z: boolean, +) => object; +declare const number_to_boolean: (x: number) => boolean; +declare const symbol_to_number: (x: symbol) => number; +declare const number_to_string: (x: number) => string; + +// @dts-jest:pass -> (fns: [(value: T1) => string, (value: T2) => number, (value: T3) => boolean]) => CurriedFunction3 +R_useWith(string_number_boolean_to_object); +// @dts-jest:pass -> CurriedFunction3 +R_useWith(string_number_boolean_to_object)([ + number_to_string, + symbol_to_number, + number_to_boolean, +]); +// @dts-jest:pass -> CurriedFunction3 +R_useWith(string_number_boolean_to_object, [ + number_to_string, + symbol_to_number, + number_to_boolean, +]); + +// @dts-jest:pass -> (fns: never[]) => () => object +R_useWith(any_args_to_object); +// @dts-jest:pass -> (fns: [(value: T1) => any, (value: T2) => any]) => CurriedFunction2 +R_useWith<'1', '2arity'>()(any_args_to_object); +// @dts-jest:pass -> (fns: Function[]) => (...args: any[]) => object +R_useWith<'1', 'variadic'>()(any_args_to_object); diff --git a/snapshots/values.ts b/snapshots/values.ts new file mode 100644 index 0000000..eda01f9 --- /dev/null +++ b/snapshots/values.ts @@ -0,0 +1,13 @@ +import * as R_values from '../ramda/dist/src/values'; + +declare const object: object; +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; + +// @dts-jest:pass -> any[] +R_values(object); +// @dts-jest:pass -> (1 | 2 | 3)[] +R_values(a_1_b_2_c_3); diff --git a/snapshots/valuesIn.ts b/snapshots/valuesIn.ts new file mode 100644 index 0000000..8f791f0 --- /dev/null +++ b/snapshots/valuesIn.ts @@ -0,0 +1,13 @@ +import * as R_valuesIn from '../ramda/dist/src/valuesIn'; + +declare const object: object; +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; + +// @dts-jest:pass -> any[] +R_valuesIn(object); +// @dts-jest:pass -> (1 | 2 | 3)[] +R_valuesIn(a_1_b_2_c_3); diff --git a/snapshots/view.ts b/snapshots/view.ts new file mode 100644 index 0000000..b4b5f0e --- /dev/null +++ b/snapshots/view.ts @@ -0,0 +1,36 @@ +import { ManualLens, PseudoLens } from '../ramda/dist/src/$types'; +import * as R_view from '../ramda/dist/src/view'; + +declare const menual_lens_number_object: ManualLens; +declare const pseudo_lens_a: PseudoLens<'a'>; +declare const pseudo_lens_1: PseudoLens<1>; + +declare const object: object; +declare const a_1_b_2_c_3: { a: 1; b: 2; c: 3 }; +declare const number_array: number[]; +declare const string_number_tuple: [string, number]; + +// @dts-jest:pass -> (target: object) => number +R_view(menual_lens_number_object); +// @dts-jest:pass -> number +R_view(menual_lens_number_object)(object); +// @dts-jest:pass -> number +R_view(menual_lens_number_object, object); + +// @dts-jest:pass -> >(target: U) => U["a"] +R_view(pseudo_lens_a); +// @dts-jest:pass -> 1 +R_view(pseudo_lens_a)(a_1_b_2_c_3); +// @dts-jest:pass -> 1 +R_view(pseudo_lens_a, a_1_b_2_c_3); + +// @dts-jest:pass -> (target: U) => U["1"] +R_view(pseudo_lens_1); +// @dts-jest:pass -> number +R_view(pseudo_lens_1)(string_number_tuple); +// @dts-jest:pass -> number +R_view(pseudo_lens_1, string_number_tuple); +// @dts-jest:pass -> any +R_view(pseudo_lens_1)(number_array); +// @dts-jest:pass -> any +R_view(pseudo_lens_1, number_array); diff --git a/snapshots/when.ts b/snapshots/when.ts new file mode 100644 index 0000000..58c32cd --- /dev/null +++ b/snapshots/when.ts @@ -0,0 +1,12 @@ +import * as R_when from '../ramda/dist/src/when'; + +declare const number_to_boolean: (x: number) => boolean; +declare const number_to_string: (x: number) => string; +declare const number: number; + +// @dts-jest:pass -> (value: number) => string | number +R_when(number_to_boolean, number_to_string); +// @dts-jest:pass -> string | number +R_when(number_to_boolean)(number_to_string)(number); +// @dts-jest:pass -> string | number +R_when(number_to_boolean, number_to_string, number); diff --git a/snapshots/where.ts b/snapshots/where.ts new file mode 100644 index 0000000..f930737 --- /dev/null +++ b/snapshots/where.ts @@ -0,0 +1,43 @@ +import { Dictionary } from '../ramda/dist/src/$types'; +import * as R_where from '../ramda/dist/src/where'; + +declare const dictionary_of_number_to_boolean: Dictionary< + (x: number) => boolean +>; +declare const a_b_c_number_to_boolean: { + a: (x: number) => boolean; + b: (x: number) => boolean; + c: (x: number) => boolean; +}; +declare const number_dictionary: Dictionary; +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; + +// @dts-jest:pass -> (object: Dictionary) => boolean +R_where(a_b_c_number_to_boolean); + +// @dts-jest:pass -> boolean +R_where(a_b_c_number_to_boolean)(a_1_b_2_c_3); +// @dts-jest:pass -> boolean +R_where(a_b_c_number_to_boolean, a_1_b_2_c_3); + +// @dts-jest:pass -> boolean +R_where(a_b_c_number_to_boolean)(number_dictionary); +// @dts-jest:pass -> boolean +R_where(a_b_c_number_to_boolean, number_dictionary); + +// @dts-jest:pass -> (object: Dictionary) => boolean +R_where(dictionary_of_number_to_boolean); + +// @dts-jest:pass -> boolean +R_where(dictionary_of_number_to_boolean)(a_1_b_2_c_3); +// @dts-jest:pass -> boolean +R_where(dictionary_of_number_to_boolean, a_1_b_2_c_3); + +// @dts-jest:pass -> boolean +R_where(dictionary_of_number_to_boolean)(number_dictionary); +// @dts-jest:pass -> boolean +R_where(dictionary_of_number_to_boolean, number_dictionary); diff --git a/snapshots/whereEq.ts b/snapshots/whereEq.ts new file mode 100644 index 0000000..73a74ec --- /dev/null +++ b/snapshots/whereEq.ts @@ -0,0 +1,16 @@ +import { Dictionary } from '../ramda/dist/src/$types'; +import * as R_whereEq from '../ramda/dist/src/whereEq'; + +declare const number_dictionary: Dictionary; +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; + +// @dts-jest:pass -> (object: Dictionary) => boolean +R_whereEq(number_dictionary); +// @dts-jest:pass -> boolean +R_whereEq(number_dictionary)(a_1_b_2_c_3); +// @dts-jest:pass -> boolean +R_whereEq(number_dictionary, a_1_b_2_c_3); diff --git a/snapshots/without.ts b/snapshots/without.ts new file mode 100644 index 0000000..729664f --- /dev/null +++ b/snapshots/without.ts @@ -0,0 +1,8 @@ +import * as R_without from '../ramda/dist/src/without'; + +declare const number_array: number[]; + +// @dts-jest:pass -> (b: number[] | ArrayLike) => number[] +R_without(number_array); +// @dts-jest:pass -> number[] +R_without(number_array, number_array); diff --git a/snapshots/xprod.ts b/snapshots/xprod.ts new file mode 100644 index 0000000..548a19a --- /dev/null +++ b/snapshots/xprod.ts @@ -0,0 +1,11 @@ +import * as R_xprod from '../ramda/dist/src/xprod'; + +declare const number_array: number[]; +declare const string_array: string[]; + +// @dts-jest:pass -> (b: U[] | ArrayLike) => [number, U][] +R_xprod(number_array); +// @dts-jest:pass -> [number, string][] +R_xprod(number_array)(string_array); +// @dts-jest:pass -> [number, string][] +R_xprod(number_array, string_array); diff --git a/snapshots/zip.ts b/snapshots/zip.ts new file mode 100644 index 0000000..ff83100 --- /dev/null +++ b/snapshots/zip.ts @@ -0,0 +1,11 @@ +import * as R_zip from '../ramda/dist/src/zip'; + +declare const number_array: number[]; +declare const string_array: string[]; + +// @dts-jest:pass -> (b: U[] | ArrayLike) => [number, U][] +R_zip(number_array); +// @dts-jest:pass -> [number, string][] +R_zip(number_array)(string_array); +// @dts-jest:pass -> [number, string][] +R_zip(number_array, string_array); diff --git a/snapshots/zipObj.ts b/snapshots/zipObj.ts new file mode 100644 index 0000000..f9550c1 --- /dev/null +++ b/snapshots/zipObj.ts @@ -0,0 +1,18 @@ +import * as R_zipObj from '../ramda/dist/src/zipObj'; + +declare const number_array: number[]; +declare const string_array: string[]; + +// @dts-jest:pass -> (b: U[] | ArrayLike) => Record +R_zipObj(number_array); +// @dts-jest:pass -> Record +R_zipObj(number_array)(string_array); +// @dts-jest:pass -> Record +R_zipObj(number_array, string_array); + +// @dts-jest:pass -> (b: U[] | ArrayLike) => Record<"a" | "b", U> +R_zipObj(['a', 'b']); +// @dts-jest:pass -> Record<"a" | "b", number> +R_zipObj(['a', 'b'])(number_array); +// @dts-jest:pass -> Record<"a" | "b", number> +R_zipObj(['a', 'b'], number_array); diff --git a/snapshots/zipWith.ts b/snapshots/zipWith.ts new file mode 100644 index 0000000..cf65c0d --- /dev/null +++ b/snapshots/zipWith.ts @@ -0,0 +1,12 @@ +import * as R_zipWith from '../ramda/dist/src/zipWith'; + +declare const number_string_to_object: (x: number, y: string) => object; +declare const number_array: number[]; +declare const string_array: string[]; + +// @dts-jest:pass -> (b: string[] | ArrayLike) => object[] +R_zipWith(number_string_to_object, number_array); +// @dts-jest:pass -> object[] +R_zipWith(number_string_to_object)(number_array)(string_array); +// @dts-jest:pass -> object[] +R_zipWith(number_string_to_object, number_array, string_array); diff --git a/tasks/build-watch.ts b/tasks/build-watch.ts new file mode 100644 index 0000000..d26691c --- /dev/null +++ b/tasks/build-watch.ts @@ -0,0 +1,62 @@ +import * as gulp from 'gulp'; +import * as gulp_util from 'gulp-util'; +import * as path from 'path'; +import { + glob_templates, + input_relative_dirname, + output_relative_sub_dirname, +} from './utils/constants'; +import { generate_files } from './utils/generate-files'; +import { generate_index } from './utils/generate-index'; + +export const build_watch = (_callback: (error?: any) => void) => { + gulp.watch(glob_templates, event => { + const input_relative_filename = path.relative(process.cwd(), event.path); + gulp_util.log( + `Detected '${gulp_util.colors.cyan( + input_relative_filename, + )}' ${event.type}`, + ); + + const output_relative_filename = input_relative_filename + .replace(input_relative_dirname, output_relative_sub_dirname) + .replace(/(\.[a-z])?\.ts$/, '.d.ts'); + + switch (event.type) { + case 'changed': + generate_files(input_relative_filename, on_error, on_end); + break; + case 'added': + case 'deleted': + case 'renamed': + generate_index(); + generate_files(input_relative_filename, on_error, on_end); + break; + default: + throw new Error(`Unexpected event type '${event.type}'`); + } + + let error: Error | undefined; + function on_error(this: NodeJS.ReadWriteStream, e: Error) { + error = e; + // tslint:disable-next-line:no-invalid-this + this.end(); + } + function on_end() { + if (error !== undefined) { + gulp_util.log( + `Building '${gulp_util.colors.cyan( + output_relative_filename, + )}' failed\n\n${error.stack}`, + ); + } else { + gulp_util.log( + `Building '${gulp_util.colors.cyan( + output_relative_filename, + )}' complete`, + ); + } + gulp_util.log('Watching for file changes.'); + } + }); +}; diff --git a/tasks/mixins/path.d.ts b/tasks/mixins/path.d.ts new file mode 100644 index 0000000..02e1515 --- /dev/null +++ b/tasks/mixins/path.d.ts @@ -0,0 +1,36 @@ +// tslint:disable:prettier naming-convention + +// in-based +declare function path(path: [T1, T2], obj: {[K1 in T1]: {[K2 in T2]: TResult}}): TResult; +declare function path(path: [T1, T2, T3], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: TResult}}}): TResult; +declare function path(path: [T1, T2, T3, T4], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: TResult}}}}): TResult; +declare function path(path: [T1, T2, T3, T4, T5], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: TResult}}}}}): TResult; +declare function path(path: [T1, T2, T3, T4, T5, T6], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: {[K6 in T6]: TResult}}}}}}): TResult; +declare function path(path: [T1, T2, T3, T4, T5, T6, T7], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: {[K6 in T6]: {[K7 in T7]: TResult}}}}}}}): TResult; +declare function path(path: [T1, T2, T3, T4, T5, T6, T7, T8], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: {[K6 in T6]: {[K7 in T7]: {[K8 in T8]: TResult}}}}}}}}): TResult; +declare function path(path: [T1, T2, T3, T4, T5, T6, T7, T8, T9], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: {[K4 in T4]: {[K5 in T5]: {[K6 in T6]: {[K7 in T7]: {[K8 in T8]: {[K9 in T9]: TResult}}}}}}}}}): TResult; + +// Record-based +declare function path(path: [K1, K2], obj: Record>): TResult; +declare function path(path: [K1, K2, K3], obj: Record>>): TResult; +declare function path(path: [K1, K2, K3, K4], obj: Record>>>): TResult; +declare function path(path: [K1, K2, K3, K4, K5], obj: Record>>>>): TResult; +declare function path(path: [K1, K2, K3, K4, K5, K6], obj: Record>>>>>): TResult; +declare function path(path: [K1, K2, K3, K4, K5, K6, K7], obj: Record>>>>>>): TResult; +declare function path(path: [K1, K2, K3, K4, K5, K6, K7, K8], obj: Record>>>>>>>): TResult; +declare function path(path: [K1, K2, K3, K4, K5, K6, K7, K8, K9], obj: Record>>>>>>>>): TResult; + +// for each path length list all combinations of objects and homogeneous arrays... tuples not supported yet. + +declare function path(path: [T1, T2], obj: {[K1 in T1]: {[K2 in T2]: TResult}}): TResult; +declare function path(path: [T1, T2], obj: {[K1 in T1]: TResult[]}): TResult; +declare function path(path: [T1, T2], obj: {[K2 in T2]: TResult}[]): TResult; +declare function path(path: [T1, T2], obj: TResult[][]): TResult; +declare function path(path: [T1, T2, T3], obj: {[K1 in T1]: {[K2 in T2]: {[K3 in T3]: TResult}}}): TResult; +declare function path(path: [T1, T2, T3], obj: {[K1 in T1]: {[K2 in T2]: TResult[]}}): TResult; +declare function path(path: [T1, T2, T3], obj: {[K1 in T1]: {[K3 in T3]: TResult}[]}): TResult; +declare function path(path: [T1, T2, T3], obj: {[K1 in T1]: TResult[][]}): TResult; +declare function path(path: [T1, T2, T3], obj: {[K2 in T2]: {[K3 in T3]: TResult}}[]): TResult; +declare function path(path: [T1, T2, T3], obj: {[K2 in T2]: TResult[]}[]): TResult; +declare function path(path: [T1, T2, T3], obj: {[K3 in T3]: TResult}[][]): TResult; +declare function path(path: [T1, T2, T3], obj: TResult[][][]): TResult; diff --git a/tasks/remap-watch.ts b/tasks/remap-watch.ts new file mode 100644 index 0000000..78ce68e --- /dev/null +++ b/tasks/remap-watch.ts @@ -0,0 +1,73 @@ +import * as del from 'del'; +import * as fs from 'fs'; +import * as gulp from 'gulp'; +import * as gulp_util from 'gulp-util'; +import * as path from 'path'; +import { generate_remap_content } from './utils/generate-remap-content'; + +export const remap_watch = (_callback: (error?: any) => void) => { + gulp.watch('./tests/__snapshots__/*.ts.snap', event => { + const input_relative_filename = path.relative(process.cwd(), event.path); + gulp_util.log( + `Detected '${gulp_util.colors.cyan( + input_relative_filename, + )}' ${event.type}`, + ); + + const output_relative_filename = input_relative_filename + .replace('tests/__snapshots__/', 'snapshots/') + .replace(/\.snap$/, ''); + + switch (event.type) { + case 'added': + case 'changed': + case 'renamed': + const remapped_snapshot = generate_remap_content( + input_relative_filename, + ); + fs.writeFile( + output_relative_filename, + remapped_snapshot, + 'utf8', + (error: any) => { + if (!error) { + gulp_util.log( + `Remapping '${gulp_util.colors.cyan( + output_relative_filename, + )}' complete`, + ); + } else { + gulp_util.log( + `Remapping '${gulp_util.colors.cyan( + output_relative_filename, + )}' failed: ${error}`, + ); + } + gulp_util.log('Watching for file changes.'); + }, + ); + break; + case 'deleted': + del(input_relative_filename) + .then(() => { + gulp_util.log( + `Deleting '${gulp_util.colors.cyan( + output_relative_filename, + )}' complete`, + ); + gulp_util.log('Watching for file changes.'); + }) + .catch(error => { + gulp_util.log( + `Deleting '${gulp_util.colors.cyan( + output_relative_filename, + )}' failed: ${error}`, + ); + gulp_util.log('Watching for file changes.'); + }); + break; + default: + throw new Error(`Unexpected event type '${event.type}'`); + } + }); +}; diff --git a/tasks/utils/bind-jsdoc.ts b/tasks/utils/bind-jsdoc.ts new file mode 100644 index 0000000..2623b48 --- /dev/null +++ b/tasks/utils/bind-jsdoc.ts @@ -0,0 +1,7 @@ +import * as dts from 'dts-element'; +import { load_markdown } from './load-markdown'; + +export const bind_jsdoc = (filename: string, element: dts.IElement) => ({ + ...element, + jsdoc: load_markdown(filename), +}); diff --git a/tasks/utils/bind-mixin.ts b/tasks/utils/bind-mixin.ts new file mode 100644 index 0000000..2ee3e12 --- /dev/null +++ b/tasks/utils/bind-mixin.ts @@ -0,0 +1,24 @@ +import * as dts from 'dts-element'; + +export const bind_mixin = ( + members: dts.ITopLevelMember[], + function_types: dts.IFunctionType[], +) => { + const main_type_declaration = members.find( + dts.is_type_declaration, + ) as dts.ITypeDeclaration; + + const type = main_type_declaration.type as dts.IObjectType; + type.members!.splice( + 1, + 0, + ...function_types.map(function_type => + dts.create_object_member({ + owned: dts.create_function_declaration({ + name: undefined, + type: function_type, + }), + }), + ), + ); +}; diff --git a/tasks/utils/constants.ts b/tasks/utils/constants.ts new file mode 100644 index 0000000..9d9ac13 --- /dev/null +++ b/tasks/utils/constants.ts @@ -0,0 +1,15 @@ +import { get_options } from './get-options'; + +export const namespace_ramda = 'R'; + +export const input_relative_dirname = 'templates'; +export const glob_index = `${input_relative_dirname}/README.md`; +export const glob_templates = `${input_relative_dirname}/*.ts`; + +const { selectable, placeholder, output_dirname_postfix } = get_options(); +export { selectable, placeholder }; + +export const output_sub_dirname = 'src'; +export const output_relative_dirname = `./ramda/dist${output_dirname_postfix}`; +export const output_relative_sub_dirname = `${output_relative_dirname}/${output_sub_dirname}`; +export const output_extname = '.d.ts'; diff --git a/tasks/utils/create-transform.ts b/tasks/utils/create-transform.ts new file mode 100644 index 0000000..f2845da --- /dev/null +++ b/tasks/utils/create-transform.ts @@ -0,0 +1,22 @@ +import * as gulp_util from 'gulp-util'; +import * as through from 'through2'; + +export function create_transform(transformer: (filename: string) => string) { + return through.obj((file: gulp_util.File, _encoding, callback) => { + if (file.isNull()) { + callback(null, file); + return; + } + if (!file.isBuffer()) { + callback(new Error('Support buffer only.')); + return; + } + try { + const transformed = transformer(file.path); + file.contents = new Buffer(transformed); + callback(null, file); + } catch (e) { + callback(e); + } + }); +} diff --git a/tasks/utils/generate-file-content.ts b/tasks/utils/generate-file-content.ts new file mode 100644 index 0000000..263a197 --- /dev/null +++ b/tasks/utils/generate-file-content.ts @@ -0,0 +1,208 @@ +import * as dts from 'dts-element'; +import * as dts_fp from 'dts-element-fp'; +import * as fs from 'fs'; +import * as path from 'path'; +import { + placeholder_name, + placeholder_name_abbr, +} from '../../templates/utils/constants'; +import { bind_jsdoc } from './bind-jsdoc'; +import { bind_mixin } from './bind-mixin'; +import { placeholder, selectable } from './constants'; + +export function generate_file_content(filename: string) { + return dts.emit(get_top_level_members(filename)); +} + +function get_top_level_members(filename: string): dts.ITopLevelMember[] { + const members: dts.ITopLevelMember[] = []; + const basename = path.basename(filename); + const function_name = basename.match(/^\$?(.+?)\./)![1]; + + if (basename === '$curriedFunctions.ts') { + push_curried_functions_members(); + } else if (basename.endsWith('.d.ts')) { + if (basename.startsWith('$')) { + push_r_ts_members(); + } else { + push_d_ts_members(); + } + } else if (basename.endsWith('.c.ts')) { + push_c_ts_members(); + } else if (basename.endsWith('.r.ts')) { + push_r_ts_members(); + } else if (basename.endsWith('.ts')) { + push_ts_members(); + } else { + throw new Error(`Unexpected filename ${filename}`); + } + + if (!basename.startsWith('$')) { + bind_member_jsdoc_and_add_export_equal(); + } + + if (function_name === 'path') { + bind_mixin( + members, + dts + .parse( + fs.readFileSync( + path.resolve(__dirname, '../mixins/path.d.ts'), + 'utf8', + ), + ) + .members.filter(dts.is_function_declaration) + .map(function_declaration => function_declaration.type!), + ); + } + + return members; + + function bind_member_jsdoc_and_add_export_equal() { + const target_member_index = members.findIndex(member => { + switch (member.kind) { + case dts.ElementKind.FunctionDeclaration: + case dts.ElementKind.VariableDeclaration: + return true; + default: + return false; + } + }); + if (target_member_index === -1) { + throw new Error(`Cannot find element to bind jsdoc in ${filename}`); + } + const target_member = members[target_member_index] as + | dts.IVariableDeclaration + | dts.IFunctionDeclaration; + members[target_member_index] = bind_jsdoc(filename, target_member); + members.push(dts.create_export_equal({ value: target_member.name! })); + } + + function push_r_ts_members() { + const top_level_element = dts.parse(fs.readFileSync(filename, 'utf8')); + members.push(...top_level_element.members); + } + + function push_d_ts_members() { + const top_level_element = dts.parse(fs.readFileSync(filename, 'utf8')); + push_curry_members(top_level_element.members); + } + + function push_ts_members() { + const declarations = get_ts_default(); + members.push(...declarations); + } + + function push_c_ts_members() { + const declarations = get_ts_default(); + push_curry_members(declarations); + } + + function push_curried_functions_members() { + const curried_functions_generator = get_ts_default(true); + const declarations = curried_functions_generator(selectable, placeholder); + members.push(...declarations); + } + + function push_curry_members(the_members: dts.ITopLevelMember[]) { + const imports = the_members.filter( + (member): member is dts.IImportNamed => + member.kind === dts.ElementKind.ImportNamed, + ); + const functions = the_members.filter( + (member): member is dts.IFunctionDeclaration => + member.kind === dts.ElementKind.FunctionDeclaration, + ); + + if (!functions.every(fn => fn.name!.startsWith('$'))) { + throw new Error( + `Exported functions in ${filename} should be prefixed with $`, + ); + } + + const function_names_no_need_to_check_last_overload_name = ['cond']; + if ( + function_names_no_need_to_check_last_overload_name.indexOf( + function_name, + ) === -1 + ) { + const valid_last_overload_names = ['$mixed', '$general', '$variadic']; + if ( + functions.length > 1 && + valid_last_overload_names.indexOf( + functions[functions.length - 1].name!, + ) === -1 + ) { + throw new Error( + `Exported multi-overload functions in ${filename} should end with ${valid_last_overload_names.join( + ' / ', + )}}`, + ); + } + } + + const overload_names_should_exist_simultaneously = ['$record', '$keyof']; + if ( + functions.some( + func => + overload_names_should_exist_simultaneously.indexOf(func.name!) !== -1, + ) + ) { + const is_exist_simultaneously = overload_names_should_exist_simultaneously.every( + overload_name => functions.some(func => func.name === overload_name), + ); + if (!is_exist_simultaneously) { + throw new Error( + `Exported multi-overload functions in ${filename} should have ${overload_names_should_exist_simultaneously.join( + ' / ', + )} simultaneously`, + ); + } + } + + const placeholder_imports = + !placeholder || functions[0].type!.parameters!.length <= 1 + ? [] + : dts.parse(` + import {${placeholder_name} as ${placeholder_name_abbr}} from './$placeholder'; + `).members; + + const curried_declarations = dts_fp.create_curried_declarations( + path.basename(filename).replace(/(\.[a-z])?\.ts$/, ''), + functions.reduce>( + (current_functions, fn) => ({ + ...current_functions, + [fn.name!.slice(1)]: fn.type!, + }), + {}, + ), + { + selectable, + placeholder, + }, + ); + + members.push(...imports, ...placeholder_imports, ...curried_declarations); + } + + function get_ts_default(special_case = false) { + // tslint:disable-next-line:no-require-imports + const required: any = require(filename); + delete require.cache[require.resolve(filename)]; + const declarations = required.default; + + if (!special_case && !is_valid_export_default(declarations)) { + throw new Error( + `Template.ts should default-export an array of declarations: ${filename}`, + ); + } + + return declarations; + } + + function is_valid_export_default( + export_default: any, + ): export_default is dts.ITopLevelMember[] { + return export_default instanceof Array; + } +} diff --git a/tasks/utils/generate-files.ts b/tasks/utils/generate-files.ts new file mode 100644 index 0000000..80f388c --- /dev/null +++ b/tasks/utils/generate-files.ts @@ -0,0 +1,28 @@ +import * as gulp from 'gulp'; +import * as gulp_rename from 'gulp-rename'; +import { output_extname, output_relative_sub_dirname } from './constants'; +import { create_transform } from './create-transform'; +import { generate_file_content } from './generate-file-content'; + +export function generate_files( + glob_files: string, + on_error: (error: Error) => void = error => { + throw error; + }, + on_end: () => void = () => { + /* do nothing */ + }, +) { + return gulp + .src(glob_files) + .pipe(create_transform(generate_file_content)) + .on('error', on_error) + .on('end', on_end) + .pipe( + gulp_rename(the_path => { + the_path.basename = the_path.basename!.replace(/\.[a-z]$/, ''); + the_path.extname = output_extname; + }), + ) + .pipe(gulp.dest(output_relative_sub_dirname)); +} diff --git a/tasks/utils/generate-index-content.ts b/tasks/utils/generate-index-content.ts new file mode 100644 index 0000000..2fb18a1 --- /dev/null +++ b/tasks/utils/generate-index-content.ts @@ -0,0 +1,49 @@ +import * as dts from 'dts-element'; +import * as glob from 'glob'; +import * as path from 'path'; +import { + glob_templates, + input_relative_dirname, + namespace_ramda, + output_sub_dirname, +} from './constants'; + +export function generate_index_content() { + const filenames = glob + .sync(glob_templates) + .map( + filename => + `./${output_sub_dirname}/${path + .relative(input_relative_dirname, filename) + .replace(/(\.[a-z])?\.ts$/, '')}`, + ); + + const jsdoc_binded_filenames: string[] = []; + const non_jsdoc_binded_filenames: string[] = []; + + filenames.forEach(filename => { + if (path.basename(filename).startsWith('$')) { + non_jsdoc_binded_filenames.push(filename); + } else { + jsdoc_binded_filenames.push(filename); + } + }); + + return dts.emit([ + dts.create_export_namespace({ name: namespace_ramda }), + ...non_jsdoc_binded_filenames.map(filename => + dts.create_export_named({ from: filename }), + ), + ...jsdoc_binded_filenames.map(filename => + dts.create_import_equal({ + name: path.basename(filename), + from: filename, + }), + ), + dts.create_export_named({ + members: jsdoc_binded_filenames.map(filename => + dts.create_export_member({ name: path.basename(filename) }), + ), + }), + ]); +} diff --git a/tasks/utils/generate-index.ts b/tasks/utils/generate-index.ts new file mode 100644 index 0000000..ef74b2c --- /dev/null +++ b/tasks/utils/generate-index.ts @@ -0,0 +1,17 @@ +import * as gulp from 'gulp'; +import * as gulp_rename from 'gulp-rename'; +import { + glob_index, + output_extname, + output_relative_dirname, +} from './constants'; +import { create_transform } from './create-transform'; +import { generate_index_content } from './generate-index-content'; + +export function generate_index() { + return gulp + .src(glob_index) + .pipe(create_transform(generate_index_content)) + .pipe(gulp_rename({ basename: 'index', extname: output_extname })) + .pipe(gulp.dest(output_relative_dirname)); +} diff --git a/tasks/utils/generate-remap-content.ts b/tasks/utils/generate-remap-content.ts new file mode 100644 index 0000000..a997280 --- /dev/null +++ b/tasks/utils/generate-remap-content.ts @@ -0,0 +1,22 @@ +import * as dts_jest from 'dts-jest'; +import * as fs from 'fs'; +import * as path from 'path'; + +export function generate_remap_content(filename: string) { + const cache_filename = path.resolve( + process.cwd(), + filename.replace(/\.ts\.snap$/, '.js'), + ); + delete require.cache[cache_filename]; + return dts_jest.remap_snapshot( + fs.readFileSync(filename, 'utf8'), + fs.readFileSync( + path.resolve( + path.dirname(filename), + `../${path.basename(filename, '.snap')}`, + ), + 'utf8', + ), + cache_filename, + ); +} diff --git a/tasks/utils/get-options.ts b/tasks/utils/get-options.ts new file mode 100644 index 0000000..8fca748 --- /dev/null +++ b/tasks/utils/get-options.ts @@ -0,0 +1,41 @@ +import * as gulp_util from 'gulp-util'; +import * as yargs from 'yargs'; + +export function get_options() { + const options = { + placeholder: false, + selectable: false, + }; + type Kind = keyof typeof options; + const no_kind = 'simple'; + const all_kinds: Kind[] = ['placeholder', 'selectable']; + + const args = yargs + .array('kind') + .default('kind', all_kinds) + .choices('kind', all_kinds) + .parse(process.argv.slice(1)); + + const kinds = (args.kind as Kind[]).slice().sort(); + kinds.forEach(kind => { + options[kind] = true; + }); + + if (process.argv.some(x => x.startsWith('build'))) { + gulp_util.log( + `Features ${(kinds.length === 0 ? [no_kind] : kinds) + .map(kind => `'${gulp_util.colors.cyan(kind)}'`) + .join(', ')}`, + ); + } + + const dirname_postfixes = + kinds.length === 0 + ? [no_kind] + : kinds.length === all_kinds.length ? [] : kinds; + + return { + ...options, + output_dirname_postfix: dirname_postfixes.map(x => `-${x}`).join(''), + }; +} diff --git a/tasks/utils/load-markdown.ts b/tasks/utils/load-markdown.ts new file mode 100644 index 0000000..c1a9eae --- /dev/null +++ b/tasks/utils/load-markdown.ts @@ -0,0 +1,4 @@ +import * as fs from 'fs'; + +export const load_markdown = (filename: string) => + fs.readFileSync(filename.replace(/(\.[a-z])?\.ts$/, '.md'), 'utf8').trim(); diff --git a/templates/$curriedFunctions.ts b/templates/$curriedFunctions.ts new file mode 100644 index 0000000..1238ace --- /dev/null +++ b/templates/$curriedFunctions.ts @@ -0,0 +1,33 @@ +import * as dts from 'dts-element'; +import { create_curried_interfaces } from 'dts-element-fp'; +import { placeholder_name, placeholder_name_abbr } from './utils/constants'; + +export const max_curry_level = 6; + +export default (selectable: boolean, placeholder: boolean) => [ + ...dts.parse(` + ${placeholder + ? `import {${placeholder_name} as ${placeholder_name_abbr}} from './$placeholder';` + : ''} + export type CurriedFunction0 = () => R; + `).members, + ...create_curried_interfaces(max_curry_level, { + selectable, + placeholder, + }).map(the_interface => ({ + ...the_interface, + export: true, + })), +]; + +// reference placeholder + +// tslint:disable:no-empty-interface no-unused-variable no-unused +export interface CurriedFunction0 {} +export interface CurriedFunction1 {} +export interface CurriedFunction2 {} +export interface CurriedFunction3 {} +export interface CurriedFunction4 {} +export interface CurriedFunction5 {} +export interface CurriedFunction6 {} +// tslint:enable:no-empty-interface no-unused-variable no-unused diff --git a/templates/$operation.d.ts b/templates/$operation.d.ts new file mode 100644 index 0000000..5c54d29 --- /dev/null +++ b/templates/$operation.d.ts @@ -0,0 +1,22 @@ +import { Morphism } from './$types'; + +export type DeepPartial = { [K in keyof T]?: DeepPartial }; + +// from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/f8fb828/types/ramda/index.d.ts#L64 +export type Evolver = Morphism | { [K in keyof T]?: Evolver }; + +// from https://github.com/Microsoft/TypeScript/issues/12215#issuecomment-311923766 +export type Diff = ({ [P in T]: P } & + { [P in U]: never } & { [x: string]: never })[T]; +export type Omit = Pick>; + +export type Same = Diff< + T | U, + Diff | Diff +>; +export type Merge = Omit & U; + +// from https://github.com/tycho01/typical/blob/f0e6918/src/cast.ts#L18 +// to resolve https://github.com/Microsoft/TypeScript/issues/15768 +// tslint:disable-next-line:prettier interface-over-type-literal +export type NumberToString = { 0:'0',1:'1',2:'2',3:'3',4:'4',5:'5',6:'6',7:'7',8:'8',9:'9',10:'10',11:'11',12:'12',13:'13',14:'14',15:'15',16:'16',17:'17',18:'18',19:'19',20:'20',21:'21',22:'22',23:'23',24:'24',25:'25',26:'26',27:'27',28:'28',29:'29',30:'30',31:'31',32:'32',33:'33',34:'34',35:'35',36:'36',37:'37',38:'38',39:'39',40:'40',41:'41',42:'42',43:'43',44:'44',45:'45',46:'46',47:'47',48:'48',49:'49',50:'50',51:'51',52:'52',53:'53',54:'54',55:'55',56:'56',57:'57',58:'58',59:'59',60:'60',61:'61',62:'62',63:'63',64:'64',65:'65',66:'66',67:'67',68:'68',69:'69',70:'70',71:'71',72:'72',73:'73',74:'74',75:'75',76:'76',77:'77',78:'78',79:'79',80:'80',81:'81',82:'82',83:'83',84:'84',85:'85',86:'86',87:'87',88:'88',89:'89',90:'90',91:'91',92:'92',93:'93',94:'94',95:'95',96:'96',97:'97',98:'98',99:'99',100:'100',101:'101',102:'102',103:'103',104:'104',105:'105',106:'106',107:'107',108:'108',109:'109',110:'110',111:'111',112:'112',113:'113',114:'114',115:'115',116:'116',117:'117',118:'118',119:'119',120:'120',121:'121',122:'122',123:'123',124:'124',125:'125',126:'126',127:'127',128:'128',129:'129',130:'130',131:'131',132:'132',133:'133',134:'134',135:'135',136:'136',137:'137',138:'138',139:'139',140:'140',141:'141',142:'142',143:'143',144:'144',145:'145',146:'146',147:'147',148:'148',149:'149',150:'150',151:'151',152:'152',153:'153',154:'154',155:'155',156:'156',157:'157',158:'158',159:'159',160:'160',161:'161',162:'162',163:'163',164:'164',165:'165',166:'166',167:'167',168:'168',169:'169',170:'170',171:'171',172:'172',173:'173',174:'174',175:'175',176:'176',177:'177',178:'178',179:'179',180:'180',181:'181',182:'182',183:'183',184:'184',185:'185',186:'186',187:'187',188:'188',189:'189',190:'190',191:'191',192:'192',193:'193',194:'194',195:'195',196:'196',197:'197',198:'198',199:'199',200:'200',201:'201',202:'202',203:'203',204:'204',205:'205',206:'206',207:'207',208:'208',209:'209',210:'210',211:'211',212:'212',213:'213',214:'214',215:'215',216:'216',217:'217',218:'218',219:'219',220:'220',221:'221',222:'222',223:'223',224:'224',225:'225',226:'226',227:'227',228:'228',229:'229',230:'230',231:'231',232:'232',233:'233',234:'234',235:'235',236:'236',237:'237',238:'238',239:'239',240:'240',241:'241',242:'242',243:'243',244:'244',245:'245',246:'246',247:'247',248:'248',249:'249',250:'250',251:'251',252:'252',253:'253',254:'254',255:'255'}; diff --git a/templates/$placeholder.d.ts b/templates/$placeholder.d.ts new file mode 100644 index 0000000..27a34a4 --- /dev/null +++ b/templates/$placeholder.d.ts @@ -0,0 +1,3 @@ +export interface Placeholder { + '@@functional/placeholder': true; +} diff --git a/templates/$types.d.ts b/templates/$types.d.ts new file mode 100644 index 0000000..c735b08 --- /dev/null +++ b/templates/$types.d.ts @@ -0,0 +1,122 @@ +// simple + +export type Property = string | number | symbol; +export type Path = List; + +// general + +export type Constructor = new (...args: any[]) => T; + +export type Morphism = (value: T) => U; +export type NestedMorphism = (value: T) => (value: U) => V; +export type IndexedListMorphism = ( + value: T, + index: number, + list: List, +) => U; +export type IndexedObjectMorphism = ( + value: T, + index: number, + object: Record, +) => U; +export type KeyedObjectMorphism = ( + value: T, + key: K, + object: Record, +) => U; + +export type Tap = (value: T) => void; +export type KeyedObjectTap> = ( + value: T, + key: string, + object: U, +) => void; + +export type Predicate = Morphism; +export type Comparator = (a: T, b: T) => U; + +export type Variadic = (...args: any[]) => R; +export type TypedVariadic = (...args: T[]) => R; + +export type ListMapper = (fn: Morphism, list: List) => U[]; +export type ObjectMapper = ( + fn: Morphism, + object: Record, +) => Record; + +export interface KeyValuePair extends ArrayLike { + 0: K; + 1: V; +} + +export type List = T[] | ArrayLike; +export type NestedList = List>; + +export interface Dictionary { + [key: string]: T; +} +export interface NestedDictionary { + [key: string]: T | NestedDictionary; +} + +export interface Ordered { + valueOf(): string | number | boolean; +} + +// ramda + +export interface ManualLens { + _fake_lens_getter: T; + _fake_lens_setter: U; +} + +export interface PseudoLens { + _fake_lens_prop: K; +} + +export interface Transformer { + // https://github.com/cognitect-labs/transducers-js#transformer-protocol + '@@transducer/init': () => U; + '@@transducer/step': (accumulator: U, value: T) => U; + '@@transducer/result': (accumulator: U) => R; +} + +export interface Reduced { + '@@transducer/value': T; + '@@transducer/reduced': true; +} + +// ramda-dispatch + +export interface Filterable { + filter(fn: Predicate): Filterable; +} + +// https://github.com/fantasyland/fantasy-land + +export interface Functor { + map(fn: Morphism): Functor; +} + +export interface Apply extends Functor { + ap(fn: Apply>): Apply; +} + +export interface Chain extends Apply { + chain(fn: Morphism>): Chain; +} + +export interface Applicative extends Apply { + of(value: U): Applicative; +} + +export interface Foldable { + reduce(fn: (accumulator: U, value: T) => U, initial: U): U; +} + +export interface Traversable extends Functor, Foldable { + traverse( + fn: Morphism>, + of: Morphism>, + ): Applicative>; +} diff --git a/templates/F.md b/templates/F.md new file mode 100644 index 0000000..1d0b913 --- /dev/null +++ b/templates/F.md @@ -0,0 +1,13 @@ +A function that always returns `false`. Any passed in parameters are ignored. + +@func +@memberOf R +@since v0.9.0 +@category Function +@sig * -> Boolean +@param {*} +@return {Boolean} +@see R.always, R.T +@example + + R.F(); //=> false diff --git a/templates/F.r.ts b/templates/F.r.ts new file mode 100644 index 0000000..0dd5af5 --- /dev/null +++ b/templates/F.r.ts @@ -0,0 +1 @@ +declare const F: () => false; diff --git a/templates/README.md b/templates/README.md new file mode 100644 index 0000000..3a8da6a --- /dev/null +++ b/templates/README.md @@ -0,0 +1,35 @@ +- `$curriedFunctions.ts`: special codegen types without jsdoc binding + +- `*.r.ts`: manual constant with jsdoc binding +- `*.d.ts`: manual funciton prototypes with jsdoc binding and auto-currying +- `*.c.ts`: codegen funciton prototypes with jsdoc binding and auto-currying +- `*.ts`: codegen funciton prototypes with jsdoc binding + +- `$*.d.ts`: manual types without jsdoc binding +- `$*.ts`: codegen types without jsdoc binding + +- `README.md`: a placeholder file for gulp + +--- + +`*.d.ts`: function declarations should be prefixed with `$`. + +For example: + +(add.d.ts) + +function without overloads should be named `$`. + +```ts +export function $(a: number, b: number): number; +``` + +(map.d.ts) + +function with overloads should be named `$name`, where `name` is their selectable overload id. + +```ts +export function $list(fn: Morphism, list: List): U[]; +export function $functor(fn: Morphism, functor: Functor): Functor; +export function $object(fn: Morphism, object: Record): Record; +``` diff --git a/templates/T.md b/templates/T.md new file mode 100644 index 0000000..f4deb7f --- /dev/null +++ b/templates/T.md @@ -0,0 +1,13 @@ +A function that always returns `true`. Any passed in parameters are ignored. + +@func +@memberOf R +@since v0.9.0 +@category Function +@sig * -> Boolean +@param {*} +@return {Boolean} +@see R.always, R.F +@example + + R.T(); //=> true diff --git a/templates/T.r.ts b/templates/T.r.ts new file mode 100644 index 0000000..5ef05ef --- /dev/null +++ b/templates/T.r.ts @@ -0,0 +1 @@ +declare const T: () => true; diff --git a/templates/__.md b/templates/__.md new file mode 100644 index 0000000..41a4bc1 --- /dev/null +++ b/templates/__.md @@ -0,0 +1,24 @@ +A special placeholder value used to specify "gaps" within curried functions, +allowing partial application of any combination of arguments, regardless of +their positions. + +If `g` is a curried ternary function and `_` is `R.__`, the following are +equivalent: + + - `g(1, 2, 3)` + - `g(_, 2, 3)(1)` + - `g(_, _, 3)(1)(2)` + - `g(_, _, 3)(1, 2)` + - `g(_, 2, _)(1, 3)` + - `g(_, 2)(1)(3)` + - `g(_, 2)(1, 3)` + - `g(_, 2)(_, 3)(1)` + +@constant +@memberOf R +@since v0.6.0 +@category Function +@example + + var greet = R.replace('{name}', R.__, 'Hello, {name}!'); + greet('Alice'); //=> 'Hello, Alice!' diff --git a/templates/__.r.ts b/templates/__.r.ts new file mode 100644 index 0000000..761a684 --- /dev/null +++ b/templates/__.r.ts @@ -0,0 +1,4 @@ +import { Placeholder } from './$placeholder'; + +// tslint:disable-next-line:no-unused no-unused-variable +declare const $: Placeholder; diff --git a/templates/add.d.ts b/templates/add.d.ts new file mode 100644 index 0000000..9e0dcbf --- /dev/null +++ b/templates/add.d.ts @@ -0,0 +1 @@ +export function $(a: number, b: number): number; diff --git a/templates/add.md b/templates/add.md new file mode 100644 index 0000000..6b5eb6d --- /dev/null +++ b/templates/add.md @@ -0,0 +1,15 @@ +Adds two values. + +@func +@memberOf R +@since v0.1.0 +@category Math +@sig Number -> Number -> Number +@param {Number} a +@param {Number} b +@return {Number} +@see R.subtract +@example + + R.add(2, 3); //=> 5 + R.add(7)(10); //=> 17 diff --git a/templates/addIndex.c.ts b/templates/addIndex.c.ts new file mode 100644 index 0000000..215877f --- /dev/null +++ b/templates/addIndex.c.ts @@ -0,0 +1,62 @@ +import { max_curry_level } from './$curriedFunctions'; +import { create_n_ary_declarations } from './utils/create-n-ary-declarations'; + +const max_outer_count = max_curry_level - 2; + +const outer_variables = [...new Array(max_outer_count)].map( + (_, index) => `x${index + 1}`, +); +const outer_generics = [...new Array(max_outer_count)].map( + (_, index) => `P${index + 1}`, +); +const outer_paramters = outer_variables.map( + (variable, index) => `${variable}: ${outer_generics[index]}`, +); +const outer_arguments = [...new Array(max_outer_count + 1)].map((_, index) => ({ + count: index, + variables: outer_variables.slice(0, index), + generics: outer_generics.slice(0, index), + parameters: outer_paramters.slice(0, index), +})); + +export default create_n_ary_declarations( + 1, + max_curry_level, + args => + outer_arguments + .map( + outer_args => ` + function $v${args.curry_level}x${outer_args.count}<${[ + ...args.types, + 'U', + ...outer_args.generics, + 'V', + args.return_type, + ].join(',')}>( + iterFn: (fn: (${args.parameters.join(',')}) => U, ${[ + ...outer_args.parameters, + 'target: V', + ].join(',')}) => ${args.return_type} + ): CurriedFunction${outer_args.count + 2}<(${[ + ...args.parameters, + 'index: number', + 'target: V', + ].join(',')}) => U, ${[ + ...outer_args.generics, + 'V', + args.return_type, + ].join(',')}>; + `, + ) + .join(','), + args => ` + import {${args.curry_levels + .slice(1) + .map(i => `CurriedFunction${i}`) + .join(',')}} from './$curriedFunctions'; + import {Variadic} from './$types'; + function $variadic( + iterFn: (fn: Variadic, target: V) => ${args.return_type} + ): CurriedFunction2, V, ${args.return_type}>; + `, +); diff --git a/templates/addIndex.md b/templates/addIndex.md new file mode 100644 index 0000000..da7c93c --- /dev/null +++ b/templates/addIndex.md @@ -0,0 +1,22 @@ +Creates a new list iteration function from an existing one by adding two new +parameters to its callback function: the current index, and the entire list. + +This would turn, for instance, [`R.map`](#map) function into one that +more closely resembles `Array.prototype.map`. Note that this will only work +for functions in which the iteration callback function is the first +parameter, and where the list is the last parameter. (This latter might be +unimportant if the list parameter is not used.) + +@func +@memberOf R +@since v0.15.0 +@category Function +@category List +@sig ((a ... -> b) ... -> [a] -> *) -> (a ..., Int, [a] -> b) ... -> [a] -> *) +@param {Function} fn A list iteration function that does not pass index or list to its callback +@return {Function} An altered list iteration function that passes (item, index, list) to its callback +@example + + var mapIndexed = R.addIndex(R.map); + mapIndexed((val, idx) => idx + '-' + val, ['f', 'o', 'o', 'b', 'a', 'r']); + //=> ['0-f', '1-o', '2-o', '3-b', '4-a', '5-r'] diff --git a/templates/adjust.d.ts b/templates/adjust.d.ts new file mode 100644 index 0000000..7662bf7 --- /dev/null +++ b/templates/adjust.d.ts @@ -0,0 +1,7 @@ +import { List, Morphism } from './$types'; + +export function $( + fn: Morphism, + index: number, + list: List, +): (T | U)[]; diff --git a/templates/adjust.md b/templates/adjust.md new file mode 100644 index 0000000..263d1cc --- /dev/null +++ b/templates/adjust.md @@ -0,0 +1,23 @@ +Applies a function to the value at the given index of an array, returning a +new copy of the array with the element at the given index replaced with the +result of the function application. + +@func +@memberOf R +@since v0.14.0 +@category List +@sig (a -> a) -> Number -> [a] -> [a] +@param {Function} fn The function to apply. +@param {Number} idx The index. +@param {Array|Arguments} list An array-like object whose value + at the supplied index will be replaced. +@return {Array} A copy of the supplied array-like object with + the element at index `idx` replaced with the value + returned by applying `fn` to the existing element. +@see R.update +@example + + R.adjust(R.add(10), 1, [1, 2, 3]); //=> [1, 12, 3] + R.adjust(R.add(10))(1)([1, 2, 3]); //=> [1, 12, 3] +@symb R.adjust(f, -1, [a, b]) = [a, f(b)] +@symb R.adjust(f, 0, [a, b]) = [f(a), b] diff --git a/templates/all.d.ts b/templates/all.d.ts new file mode 100644 index 0000000..e1c372c --- /dev/null +++ b/templates/all.d.ts @@ -0,0 +1,3 @@ +import { List, Predicate } from './$types'; + +export function $(fn: Predicate, list: List): boolean; diff --git a/templates/all.md b/templates/all.md new file mode 100644 index 0000000..beb4678 --- /dev/null +++ b/templates/all.md @@ -0,0 +1,22 @@ +Returns `true` if all elements of the list match the predicate, `false` if +there are any that don't. + +Dispatches to the `all` method of the second argument, if present. + +Acts as a transducer if a transformer is given in list position. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig (a -> Boolean) -> [a] -> Boolean +@param {Function} fn The predicate function. +@param {Array} list The array to consider. +@return {Boolean} `true` if the predicate is satisfied by every element, `false` + otherwise. +@see R.any, R.none, R.transduce +@example + + var equals3 = R.equals(3); + R.all(equals3)([3, 3, 3, 3]); //=> true + R.all(equals3)([3, 3, 1, 3]); //=> false diff --git a/templates/allPass.d.ts b/templates/allPass.d.ts new file mode 100644 index 0000000..bde3a12 --- /dev/null +++ b/templates/allPass.d.ts @@ -0,0 +1,3 @@ +import { Variadic } from './$types'; + +export function $>(fns: F[]): F; diff --git a/templates/allPass.md b/templates/allPass.md new file mode 100644 index 0000000..9f0db94 --- /dev/null +++ b/templates/allPass.md @@ -0,0 +1,23 @@ +Takes a list of predicates and returns a predicate that returns true for a +given list of arguments if every one of the provided predicates is satisfied +by those arguments. + +The function returned is a curried function whose arity matches that of the +highest-arity predicate. + +@func +@memberOf R +@since v0.9.0 +@category Logic +@sig [(*... -> Boolean)] -> (*... -> Boolean) +@param {Array} predicates An array of predicates to check +@return {Function} The combined predicate +@see R.anyPass +@example + + var isQueen = R.propEq('rank', 'Q'); + var isSpade = R.propEq('suit', '♠︎'); + var isQueenOfSpades = R.allPass([isQueen, isSpade]); + + isQueenOfSpades({rank: 'Q', suit: '♣︎'}); //=> false + isQueenOfSpades({rank: 'Q', suit: '♠︎'}); //=> true diff --git a/templates/always.d.ts b/templates/always.d.ts new file mode 100644 index 0000000..9a72150 --- /dev/null +++ b/templates/always.d.ts @@ -0,0 +1 @@ +export function $(value: T): () => T; diff --git a/templates/always.md b/templates/always.md new file mode 100644 index 0000000..97be97c --- /dev/null +++ b/templates/always.md @@ -0,0 +1,17 @@ +Returns a function that always returns the given value. Note that for +non-primitives the value returned is a reference to the original value. + +This function is known as `const`, `constant`, or `K` (for K combinator) in +other languages and libraries. + +@func +@memberOf R +@since v0.1.0 +@category Function +@sig a -> (* -> a) +@param {*} val The value to wrap in a function +@return {Function} A Function :: * -> val. +@example + + var t = R.always('Tee'); + t(); //=> 'Tee' diff --git a/templates/and.d.ts b/templates/and.d.ts new file mode 100644 index 0000000..999310c --- /dev/null +++ b/templates/and.d.ts @@ -0,0 +1 @@ +export function $(a: T, b: U): T | U; diff --git a/templates/and.md b/templates/and.md new file mode 100644 index 0000000..6dd6d1c --- /dev/null +++ b/templates/and.md @@ -0,0 +1,17 @@ +Returns `true` if both arguments are `true`; `false` otherwise. + +@func +@memberOf R +@since v0.1.0 +@category Logic +@sig a -> b -> a | b +@param {Any} a +@param {Any} b +@return {Any} the first argument if it is falsy, otherwise the second argument. +@see R.both +@example + + R.and(true, true); //=> true + R.and(true, false); //=> false + R.and(false, true); //=> false + R.and(false, false); //=> false diff --git a/templates/any.d.ts b/templates/any.d.ts new file mode 100644 index 0000000..e1c372c --- /dev/null +++ b/templates/any.d.ts @@ -0,0 +1,3 @@ +import { List, Predicate } from './$types'; + +export function $(fn: Predicate, list: List): boolean; diff --git a/templates/any.md b/templates/any.md new file mode 100644 index 0000000..a3cf633 --- /dev/null +++ b/templates/any.md @@ -0,0 +1,23 @@ +Returns `true` if at least one of elements of the list match the predicate, +`false` otherwise. + +Dispatches to the `any` method of the second argument, if present. + +Acts as a transducer if a transformer is given in list position. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig (a -> Boolean) -> [a] -> Boolean +@param {Function} fn The predicate function. +@param {Array} list The array to consider. +@return {Boolean} `true` if the predicate is satisfied by at least one element, `false` + otherwise. +@see R.all, R.none, R.transduce +@example + + var lessThan0 = R.flip(R.lt)(0); + var lessThan2 = R.flip(R.lt)(2); + R.any(lessThan0)([1, 2]); //=> false + R.any(lessThan2)([1, 2]); //=> true diff --git a/templates/anyPass.d.ts b/templates/anyPass.d.ts new file mode 100644 index 0000000..bde3a12 --- /dev/null +++ b/templates/anyPass.d.ts @@ -0,0 +1,3 @@ +import { Variadic } from './$types'; + +export function $>(fns: F[]): F; diff --git a/templates/anyPass.md b/templates/anyPass.md new file mode 100644 index 0000000..fae1214 --- /dev/null +++ b/templates/anyPass.md @@ -0,0 +1,24 @@ +Takes a list of predicates and returns a predicate that returns true for a +given list of arguments if at least one of the provided predicates is +satisfied by those arguments. + +The function returned is a curried function whose arity matches that of the +highest-arity predicate. + +@func +@memberOf R +@since v0.9.0 +@category Logic +@sig [(*... -> Boolean)] -> (*... -> Boolean) +@param {Array} predicates An array of predicates to check +@return {Function} The combined predicate +@see R.allPass +@example + + var isClub = R.propEq('suit', '♣'); + var isSpade = R.propEq('suit', '♠'); + var isBlackCard = R.anyPass([isClub, isSpade]); + + isBlackCard({rank: '10', suit: '♣'}); //=> true + isBlackCard({rank: 'Q', suit: '♠'}); //=> true + isBlackCard({rank: 'Q', suit: '♦'}); //=> false diff --git a/templates/ap.d.ts b/templates/ap.d.ts new file mode 100644 index 0000000..2fe87ec --- /dev/null +++ b/templates/ap.d.ts @@ -0,0 +1,3 @@ +import { List, Morphism } from './$types'; + +export function $(fns: Morphism[], list: List): U[]; diff --git a/templates/ap.md b/templates/ap.md new file mode 100644 index 0000000..bdbd18c --- /dev/null +++ b/templates/ap.md @@ -0,0 +1,19 @@ +ap applies a list of functions to a list of values. + +Dispatches to the `ap` method of the second argument, if present. Also +treats curried functions as applicatives. + +@func +@memberOf R +@since v0.3.0 +@category Function +@sig [a -> b] -> [a] -> [b] +@sig Apply f => f (a -> b) -> f a -> f b +@param {*} applyF +@param {*} applyX +@return {*} +@example + + R.ap([R.multiply(2), R.add(3)], [1,2,3]); //=> [2, 4, 6, 4, 5, 6] + R.ap([R.concat('tasty '), R.toUpper], ['pizza', 'salad']); //=> ["tasty pizza", "tasty salad", "PIZZA", "SALAD"] +@symb R.ap([f, g], [a, b]) = [f(a), f(b), g(a), g(b)] diff --git a/templates/aperture.d.ts b/templates/aperture.d.ts new file mode 100644 index 0000000..c0424ee --- /dev/null +++ b/templates/aperture.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(n: number, list: List): T[][]; diff --git a/templates/aperture.md b/templates/aperture.md new file mode 100644 index 0000000..866f600 --- /dev/null +++ b/templates/aperture.md @@ -0,0 +1,19 @@ +Returns a new list, composed of n-tuples of consecutive elements. If `n` is +greater than the length of the list, an empty list is returned. + +Acts as a transducer if a transformer is given in list position. + +@func +@memberOf R +@since v0.12.0 +@category List +@sig Number -> [a] -> [[a]] +@param {Number} n The size of the tuples to create +@param {Array} list The list to split into `n`-length tuples +@return {Array} The resulting list of `n`-length tuples +@see R.transduce +@example + + R.aperture(2, [1, 2, 3, 4, 5]); //=> [[1, 2], [2, 3], [3, 4], [4, 5]] + R.aperture(3, [1, 2, 3, 4, 5]); //=> [[1, 2, 3], [2, 3, 4], [3, 4, 5]] + R.aperture(7, [1, 2, 3, 4, 5]); //=> [] diff --git a/templates/append.d.ts b/templates/append.d.ts new file mode 100644 index 0000000..d1fbfa9 --- /dev/null +++ b/templates/append.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(value: T, list: List): (T | U)[]; diff --git a/templates/append.md b/templates/append.md new file mode 100644 index 0000000..55e56e5 --- /dev/null +++ b/templates/append.md @@ -0,0 +1,18 @@ +Returns a new list containing the contents of the given list, followed by +the given element. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig a -> [a] -> [a] +@param {*} el The element to add to the end of the new list. +@param {Array} list The list of elements to add a new item to. + list. +@return {Array} A new list containing the elements of the old list followed by `el`. +@see R.prepend +@example + + R.append('tests', ['write', 'more']); //=> ['write', 'more', 'tests'] + R.append('tests', []); //=> ['tests'] + R.append(['tests'], ['write', 'more']); //=> ['write', 'more', ['tests']] diff --git a/templates/apply.d.ts b/templates/apply.d.ts new file mode 100644 index 0000000..e9a0ce7 --- /dev/null +++ b/templates/apply.d.ts @@ -0,0 +1,3 @@ +import { Variadic } from './$types'; + +export function $(fn: Variadic, args: any[]): T; diff --git a/templates/apply.md b/templates/apply.md new file mode 100644 index 0000000..71ed5fe --- /dev/null +++ b/templates/apply.md @@ -0,0 +1,18 @@ +Applies function `fn` to the argument list `args`. This is useful for +creating a fixed-arity function from a variadic function. `fn` should be a +bound function if context is significant. + +@func +@memberOf R +@since v0.7.0 +@category Function +@sig (*... -> a) -> [*] -> a +@param {Function} fn The function which will be called with `args` +@param {Array} args The arguments to call `fn` with +@return {*} result The result, equivalent to `fn(...args)` +@see R.call, R.unapply +@example + + var nums = [1, 2, 3, -99, 42, 6, 7]; + R.apply(Math.max, nums); //=> 42 +@symb R.apply(f, [a, b, c]) = f(a, b, c) diff --git a/templates/applySpec.d.ts b/templates/applySpec.d.ts new file mode 100644 index 0000000..0acea54 --- /dev/null +++ b/templates/applySpec.d.ts @@ -0,0 +1,3 @@ +import { NestedDictionary, Variadic } from './$types'; + +export function $(spec: NestedDictionary>): Variadic; diff --git a/templates/applySpec.md b/templates/applySpec.md new file mode 100644 index 0000000..44ec7e1 --- /dev/null +++ b/templates/applySpec.md @@ -0,0 +1,23 @@ +Given a spec object recursively mapping properties to functions, creates a +function producing an object of the same structure, by mapping each property +to the result of calling its associated function with the supplied arguments. + +@func +@memberOf R +@since v0.20.0 +@category Function +@sig {k: ((a, b, ..., m) -> v)} -> ((a, b, ..., m) -> {k: v}) +@param {Object} spec an object recursively mapping properties to functions for + producing the values for these properties. +@return {Function} A function that returns an object of the same structure +as `spec', with each property set to the value returned by calling its +associated function with the supplied arguments. +@see R.converge, R.juxt +@example + + var getMetrics = R.applySpec({ + sum: R.add, + nested: { mul: R.multiply } + }); + getMetrics(2, 4); // => { sum: 6, nested: { mul: 8 } } +@symb R.applySpec({ x: f, y: { z: g } })(a, b) = { x: f(a, b), y: { z: g(a, b) } } diff --git a/templates/ascend.d.ts b/templates/ascend.d.ts new file mode 100644 index 0000000..ca06130 --- /dev/null +++ b/templates/ascend.d.ts @@ -0,0 +1,3 @@ +import { Morphism, Ordered } from './$types'; + +export function $(fn: Morphism, a: T, b: T): number; diff --git a/templates/ascend.md b/templates/ascend.md new file mode 100644 index 0000000..e28259d --- /dev/null +++ b/templates/ascend.md @@ -0,0 +1,20 @@ +Makes an ascending comparator function out of a function that returns a value +that can be compared with `<` and `>`. + +@func +@memberOf R +@since v0.23.0 +@category Function +@sig Ord b => (a -> b) -> a -> a -> Number +@param {Function} fn A function of arity one that returns a value that can be compared +@param {*} a The first item to be compared. +@param {*} b The second item to be compared. +@return {Number} `-1` if fn(a) < fn(b), `1` if fn(b) < fn(a), otherwise `0` +@see R.descend +@example + + var byAge = R.ascend(R.prop('age')); + var people = [ + // ... + ]; + var peopleByYoungestFirst = R.sort(byAge, people); diff --git a/templates/assoc.d.ts b/templates/assoc.d.ts new file mode 100644 index 0000000..ae33b39 --- /dev/null +++ b/templates/assoc.d.ts @@ -0,0 +1,12 @@ +import { Property } from './$types'; + +export function $extend( + property: K, + value: V, + object: T, +): T & Record; +export function $general( + property: Property, + value: any, + object: T, +): T; diff --git a/templates/assoc.md b/templates/assoc.md new file mode 100644 index 0000000..aedc175 --- /dev/null +++ b/templates/assoc.md @@ -0,0 +1,18 @@ +Makes a shallow clone of an object, setting or overriding the specified +property with the given value. Note that this copies and flattens prototype +properties onto the new object as well. All non-primitive properties are +copied by reference. + +@func +@memberOf R +@since v0.8.0 +@category Object +@sig String -> a -> {k: v} -> {k: v} +@param {String} prop The property name to set +@param {*} val The new value +@param {Object} obj The object to clone +@return {Object} A new object equivalent to the original except for the changed property. +@see R.dissoc +@example + + R.assoc('c', 3, {a: 1, b: 2}); //=> {a: 1, b: 2, c: 3} diff --git a/templates/assocPath.d.ts b/templates/assocPath.d.ts new file mode 100644 index 0000000..c15f36b --- /dev/null +++ b/templates/assocPath.d.ts @@ -0,0 +1,3 @@ +import { Path } from './$types'; + +export function $(path: Path, value: any, object: T): T; diff --git a/templates/assocPath.md b/templates/assocPath.md new file mode 100644 index 0000000..479bb71 --- /dev/null +++ b/templates/assocPath.md @@ -0,0 +1,22 @@ +Makes a shallow clone of an object, setting or overriding the nodes required +to create the given path, and placing the specific value at the tail end of +that path. Note that this copies and flattens prototype properties onto the +new object as well. All non-primitive properties are copied by reference. + +@func +@memberOf R +@since v0.8.0 +@category Object +@typedefn Idx = String | Int +@sig [Idx] -> a -> {a} -> {a} +@param {Array} path the path to set +@param {*} val The new value +@param {Object} obj The object to clone +@return {Object} A new object equivalent to the original except along the specified path. +@see R.dissocPath +@example + + R.assocPath(['a', 'b', 'c'], 42, {a: {b: {c: 0}}}); //=> {a: {b: {c: 42}}} + + // Any missing or non-object keys in path will be overridden + R.assocPath(['a', 'b', 'c'], 42, {a: 5}); //=> {a: {b: {c: 42}}} diff --git a/templates/binary.d.ts b/templates/binary.d.ts new file mode 100644 index 0000000..1d95b99 --- /dev/null +++ b/templates/binary.d.ts @@ -0,0 +1,6 @@ +import { Variadic } from './$types'; + +export function $base( + fn: (a: T, b: U, ...args: any[]) => R, +): (a: T, b: U) => R; +export function $variadic(fn: Variadic): (a: any, b: any) => R; diff --git a/templates/binary.md b/templates/binary.md new file mode 100644 index 0000000..9573d35 --- /dev/null +++ b/templates/binary.md @@ -0,0 +1,26 @@ +Wraps a function of any arity (including nullary) in a function that accepts +exactly 2 parameters. Any extraneous parameters will not be passed to the +supplied function. + +@func +@memberOf R +@since v0.2.0 +@category Function +@sig (* -> c) -> (a, b -> c) +@param {Function} fn The function to wrap. +@return {Function} A new function wrapping `fn`. The new function is guaranteed to be of + arity 2. +@see R.nAry, R.unary +@example + + var takesThreeArgs = function(a, b, c) { + return [a, b, c]; + }; + takesThreeArgs.length; //=> 3 + takesThreeArgs(1, 2, 3); //=> [1, 2, 3] + + var takesTwoArgs = R.binary(takesThreeArgs); + takesTwoArgs.length; //=> 2 + // Only 2 arguments are passed to the wrapped function + takesTwoArgs(1, 2, 3); //=> [1, 2, undefined] +@symb R.binary(f)(a, b, c) = f(a, b) diff --git a/templates/bind.d.ts b/templates/bind.d.ts new file mode 100644 index 0000000..1257912 --- /dev/null +++ b/templates/bind.d.ts @@ -0,0 +1 @@ +export function $(fn: T, context: any): T; diff --git a/templates/bind.md b/templates/bind.md new file mode 100644 index 0000000..976184b --- /dev/null +++ b/templates/bind.md @@ -0,0 +1,20 @@ +Creates a function that is bound to a context. +Note: `R.bind` does not provide the additional argument-binding capabilities of +[Function.prototype.bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind). + +@func +@memberOf R +@since v0.6.0 +@category Function +@category Object +@sig (* -> *) -> {*} -> (* -> *) +@param {Function} fn The function to bind to context +@param {Object} thisObj The context to bind `fn` to +@return {Function} A function that will execute in the context of `thisObj`. +@see R.partial +@example + + var log = R.bind(console.log, console); + R.pipe(R.assoc('a', 2), R.tap(log), R.assoc('a', 3))({a: 1}); //=> {a: 3} + // logs {a: 2} +@symb R.bind(f, o)(a, b) = f.call(o, a, b) diff --git a/templates/both.d.ts b/templates/both.d.ts new file mode 100644 index 0000000..15087d5 --- /dev/null +++ b/templates/both.d.ts @@ -0,0 +1,3 @@ +import { Variadic } from './$types'; + +export function $>(fn1: F, fn2: F): F; diff --git a/templates/both.md b/templates/both.md new file mode 100644 index 0000000..42f5d2c --- /dev/null +++ b/templates/both.md @@ -0,0 +1,26 @@ +A function which calls the two provided functions and returns the `&&` +of the results. +It returns the result of the first function if it is false-y and the result +of the second function otherwise. Note that this is short-circuited, +meaning that the second function will not be invoked if the first returns a +false-y value. + +In addition to functions, `R.both` also accepts any fantasy-land compatible +applicative functor. + +@func +@memberOf R +@since v0.12.0 +@category Logic +@sig (*... -> Boolean) -> (*... -> Boolean) -> (*... -> Boolean) +@param {Function} f A predicate +@param {Function} g Another predicate +@return {Function} a function that applies its arguments to `f` and `g` and `&&`s their outputs together. +@see R.and +@example + + var gt10 = R.gt(R.__, 10) + var lt20 = R.lt(R.__, 20) + var f = R.both(gt10, lt20); + f(15); //=> true + f(30); //=> false diff --git a/templates/call.md b/templates/call.md new file mode 100644 index 0000000..7fb0bf6 --- /dev/null +++ b/templates/call.md @@ -0,0 +1,30 @@ +Returns the result of calling its first argument with the remaining +arguments. This is occasionally useful as a converging function for +[`R.converge`](#converge): the first branch can produce a function while the +remaining branches produce values to be passed to that function as its +arguments. + +@func +@memberOf R +@since v0.9.0 +@category Function +@sig (*... -> a),*... -> a +@param {Function} fn The function to apply to the remaining arguments. +@param {...*} args Any number of positional arguments. +@return {*} +@see R.apply +@example + + R.call(R.add, 1, 2); //=> 3 + + var indentN = R.pipe(R.times(R.always(' ')), + R.join(''), + R.replace(/^(?!$)/gm)); + + var format = R.converge(R.call, [ + R.pipe(R.prop('indent'), indentN), + R.prop('value') + ]); + + format({indent: 2, value: 'foo\nbar\nbaz\n'}); //=> ' foo\n bar\n baz\n' +@symb R.call(f, a, b) = f(a, b) diff --git a/templates/call.r.ts b/templates/call.r.ts new file mode 100644 index 0000000..3cbe8f3 --- /dev/null +++ b/templates/call.r.ts @@ -0,0 +1,4 @@ +import { Variadic } from './$types'; + +// tslint:disable-next-line:no-unused no-unused-variable +declare const call: (fn: Variadic, ...args: any[]) => T; diff --git a/templates/chain.d.ts b/templates/chain.d.ts new file mode 100644 index 0000000..9890041 --- /dev/null +++ b/templates/chain.d.ts @@ -0,0 +1,23 @@ +import { Chain, List, Morphism, NestedMorphism } from './$types'; + +export function $list(fn: Morphism>, list: List): U[]; +export function $chain( + fn: Morphism>, + list: Chain, +): Chain; +export function $listFn( + fn: NestedMorphism, U>, + monad: Morphism, V>, +): Morphism, U>; +export function $chainFn( + fn: NestedMorphism, Chain>, + monad: Morphism, V>, +): Morphism, Chain>; +export function $mixed( + fn: + | Morphism> + | Morphism> + | NestedMorphism, U> + | NestedMorphism, Chain>, + monad: List | Chain | Morphism, V> | Morphism, V>, +): Morphism, U> | Morphism, Chain>; diff --git a/templates/chain.md b/templates/chain.md new file mode 100644 index 0000000..dfb9c54 --- /dev/null +++ b/templates/chain.md @@ -0,0 +1,20 @@ +`chain` maps a function over a list and concatenates the results. `chain` +is also known as `flatMap` in some libraries + +Dispatches to the `chain` method of the second argument, if present, +according to the [FantasyLand Chain spec](https://github.com/fantasyland/fantasy-land#chain). + +@func +@memberOf R +@since v0.3.0 +@category List +@sig Chain m => (a -> m b) -> m a -> m b +@param {Function} fn The function to map with +@param {Array} list The list to map over +@return {Array} The result of flat-mapping `list` with `fn` +@example + + var duplicate = n => [n, n]; + R.chain(duplicate, [1, 2, 3]); //=> [1, 1, 2, 2, 3, 3] + + R.chain(R.append, R.head)([1, 2, 3]); //=> [1, 2, 3, 1] diff --git a/templates/clamp.d.ts b/templates/clamp.d.ts new file mode 100644 index 0000000..4db041b --- /dev/null +++ b/templates/clamp.d.ts @@ -0,0 +1,3 @@ +import { Ordered } from './$types'; + +export function $(min: T, max: T, value: T): T; diff --git a/templates/clamp.md b/templates/clamp.md new file mode 100644 index 0000000..585b849 --- /dev/null +++ b/templates/clamp.md @@ -0,0 +1,18 @@ +Restricts a number to be within a range. + +Also works for other ordered types such as Strings and Dates. + +@func +@memberOf R +@since v0.20.0 +@category Relation +@sig Ord a => a -> a -> a -> a +@param {Number} minimum The lower limit of the clamp (inclusive) +@param {Number} maximum The upper limit of the clamp (inclusive) +@param {Number} value Value to be clamped +@return {Number} Returns `minimum` when `val < minimum`, `maximum` when `val > maximum`, returns `val` otherwise +@example + + R.clamp(1, 10, -5) // => 1 + R.clamp(1, 10, 15) // => 10 + R.clamp(1, 10, 4) // => 4 diff --git a/templates/clone.d.ts b/templates/clone.d.ts new file mode 100644 index 0000000..49f7e19 --- /dev/null +++ b/templates/clone.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(value: T): T; diff --git a/templates/clone.md b/templates/clone.md new file mode 100644 index 0000000..07e3a45 --- /dev/null +++ b/templates/clone.md @@ -0,0 +1,19 @@ +Creates a deep copy of the value which may contain (nested) `Array`s and +`Object`s, `Number`s, `String`s, `Boolean`s and `Date`s. `Function`s are +assigned by reference rather than copied + +Dispatches to a `clone` method if present. + +@func +@memberOf R +@since v0.1.0 +@category Object +@sig {*} -> {*} +@param {*} value The object or array to clone +@return {*} A deeply cloned copy of `val` +@example + + var objects = [{}, {}, {}]; + var objectsClone = R.clone(objects); + objects === objectsClone; //=> false + objects[0] === objectsClone[0]; //=> false diff --git a/templates/comparator.d.ts b/templates/comparator.d.ts new file mode 100644 index 0000000..c1e5e54 --- /dev/null +++ b/templates/comparator.d.ts @@ -0,0 +1,3 @@ +import { Comparator } from './$types'; + +export function $(fn: Comparator): Comparator; diff --git a/templates/comparator.md b/templates/comparator.md new file mode 100644 index 0000000..9f69d46 --- /dev/null +++ b/templates/comparator.md @@ -0,0 +1,18 @@ +Makes a comparator function out of a function that reports whether the first +element is less than the second. + +@func +@memberOf R +@since v0.1.0 +@category Function +@sig (a, b -> Boolean) -> (a, b -> Number) +@param {Function} pred A predicate function of arity two which will return `true` if the first argument +is less than the second, `false` otherwise +@return {Function} A Function :: a -> b -> Int that returns `-1` if a < b, `1` if b < a, otherwise `0` +@example + + var byAge = R.comparator((a, b) => a.age < b.age); + var people = [ + // ... + ]; + var peopleByIncreasingAge = R.sort(byAge, people); diff --git a/templates/complement.d.ts b/templates/complement.d.ts new file mode 100644 index 0000000..231ad94 --- /dev/null +++ b/templates/complement.d.ts @@ -0,0 +1,3 @@ +import { Variadic } from './$types'; + +export function $(fn: Variadic): Variadic; diff --git a/templates/complement.md b/templates/complement.md new file mode 100644 index 0000000..1033e60 --- /dev/null +++ b/templates/complement.md @@ -0,0 +1,20 @@ +Takes a function `f` and returns a function `g` such that if called with the same arguments +when `f` returns a "truthy" value, `g` returns `false` and when `f` returns a "falsy" value `g` returns `true`. + +`R.complement` may be applied to any functor + +@func +@memberOf R +@since v0.12.0 +@category Logic +@sig (*... -> *) -> (*... -> Boolean) +@param {Function} f +@return {Function} +@see R.not +@example + + var isNotNil = R.complement(R.isNil); + isNil(null); //=> true + isNotNil(null); //=> false + isNil(7); //=> false + isNotNil(7); //=> true diff --git a/templates/compose.md b/templates/compose.md new file mode 100644 index 0000000..ec06805 --- /dev/null +++ b/templates/compose.md @@ -0,0 +1,22 @@ +Performs right-to-left function composition. The rightmost function may have +any arity; the remaining functions must be unary. + +**Note:** The result of compose is not automatically curried. + +@func +@memberOf R +@since v0.1.0 +@category Function +@sig ((y -> z), (x -> y), ..., (o -> p), ((a, b, ..., n) -> o)) -> ((a, b, ..., n) -> z) +@param {...Function} ...functions The functions to compose +@return {Function} +@see R.pipe +@example + + var classyGreeting = (firstName, lastName) => "The name's " + lastName + ", " + firstName + " " + lastName + var yellGreeting = R.compose(R.toUpper, classyGreeting); + yellGreeting('James', 'Bond'); //=> "THE NAME'S BOND, JAMES BOND" + + R.compose(Math.abs, R.add(1), R.multiply(2))(-4) //=> 7 + +@symb R.compose(f, g, h)(a, b) = f(g(h(a, b))) diff --git a/templates/compose.ts b/templates/compose.ts new file mode 100644 index 0000000..a8e6f09 --- /dev/null +++ b/templates/compose.ts @@ -0,0 +1,9 @@ +import { max_curry_level } from './$curriedFunctions'; +import { create_composition_declarations } from './utils/create-composition-declarations'; + +export default create_composition_declarations( + 'compose', + 'compose', + max_curry_level, + max_curry_level, +); diff --git a/templates/composeK.md b/templates/composeK.md new file mode 100644 index 0000000..102de0d --- /dev/null +++ b/templates/composeK.md @@ -0,0 +1,28 @@ +Returns the right-to-left Kleisli composition of the provided functions, +each of which must return a value of a type supported by [`chain`](#chain). + +`R.composeK(h, g, f)` is equivalent to `R.compose(R.chain(h), R.chain(g), R.chain(f))`. + +@func +@memberOf R +@since v0.16.0 +@category Function +@sig Chain m => ((y -> m z), (x -> m y), ..., (a -> m b)) -> (a -> m z) +@param {...Function} ...functions The functions to compose +@return {Function} +@see R.pipeK +@example + + // get :: String -> Object -> Maybe * + var get = R.curry((propName, obj) => Maybe(obj[propName])) + + // getStateCode :: Maybe String -> Maybe String + var getStateCode = R.composeK( + R.compose(Maybe.of, R.toUpper), + get('state'), + get('address'), + get('user'), + ); + getStateCode({"user":{"address":{"state":"ny"}}}); //=> Maybe.Just("NY") + getStateCode({}); //=> Maybe.Nothing() +@symb R.composeK(f, g, h)(a) = R.chain(f, R.chain(g, h(a))) diff --git a/templates/composeK.ts b/templates/composeK.ts new file mode 100644 index 0000000..5431750 --- /dev/null +++ b/templates/composeK.ts @@ -0,0 +1,17 @@ +import * as dts from 'dts-element'; +import { max_curry_level } from './$curriedFunctions'; +import { create_composition_declarations } from './utils/create-composition-declarations'; + +export default [ + ...dts.parse(` + import {Chain} from './$types'; + `).members, + ...create_composition_declarations( + 'composeK', + 'compose', + max_curry_level, + 1, + x => `Chain<${x}>`, + x => `Chain<${x}>`, + ), +]; diff --git a/templates/composeP.md b/templates/composeP.md new file mode 100644 index 0000000..5c0c31a --- /dev/null +++ b/templates/composeP.md @@ -0,0 +1,32 @@ +Performs right-to-left composition of one or more Promise-returning +functions. The rightmost function may have any arity; the remaining +functions must be unary. + +@func +@memberOf R +@since v0.10.0 +@category Function +@sig ((y -> Promise z), (x -> Promise y), ..., (a -> Promise b)) -> (a -> Promise z) +@param {...Function} functions The functions to compose +@return {Function} +@see R.pipeP +@example + + var db = { + users: { + JOE: { + name: 'Joe', + followers: ['STEVE', 'SUZY'] + } + } + } + + // We'll pretend to do a db lookup which returns a promise + var lookupUser = (userId) => Promise.resolve(db.users[userId]) + var lookupFollowers = (user) => Promise.resolve(user.followers) + lookupUser('JOE').then(lookupFollowers) + + // followersForUser :: String -> Promise [UserId] + var followersForUser = R.composeP(lookupFollowers, lookupUser); + followersForUser('JOE').then(followers => console.log('Followers:', followers)) + // Followers: ["STEVE","SUZY"] diff --git a/templates/composeP.ts b/templates/composeP.ts new file mode 100644 index 0000000..523a669 --- /dev/null +++ b/templates/composeP.ts @@ -0,0 +1,12 @@ +import { max_curry_level } from './$curriedFunctions'; +import { create_composition_declarations } from './utils/create-composition-declarations'; + +export default create_composition_declarations( + 'composeP', + 'compose', + max_curry_level, + 6, + x => x, + x => `PromiseLike<${x}> | ${x}`, + x => `PromiseLike<${x}>`, +); diff --git a/templates/concat.d.ts b/templates/concat.d.ts new file mode 100644 index 0000000..c2c3d2c --- /dev/null +++ b/templates/concat.d.ts @@ -0,0 +1,8 @@ +import { List } from './$types'; + +export function $string(a: string, b: string): string; +export function $list(a: T[], b: U[]): (T | U)[]; +export function $mixed( + a: T[] | string, + b: U[] | string, +): (T | U)[] | string; diff --git a/templates/concat.md b/templates/concat.md new file mode 100644 index 0000000..458b37f --- /dev/null +++ b/templates/concat.md @@ -0,0 +1,24 @@ +Returns the result of concatenating the given lists or strings. + +Note: `R.concat` expects both arguments to be of the same type, +unlike the native `Array.prototype.concat` method. It will throw +an error if you `concat` an Array with a non-Array value. + +Dispatches to the `concat` method of the first argument, if present. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig [a] -> [a] -> [a] +@sig String -> String -> String +@param {Array|String} firstList The first list +@param {Array|String} secondList The second list +@return {Array|String} A list consisting of the elements of `firstList` followed by the elements of +`secondList`. + +@example + + R.concat('ABC', 'DEF'); // 'ABCDEF' + R.concat([4, 5, 6], [1, 2, 3]); //=> [4, 5, 6, 1, 2, 3] + R.concat([], []); //=> [] diff --git a/templates/cond.c.ts b/templates/cond.c.ts new file mode 100644 index 0000000..d8d637f --- /dev/null +++ b/templates/cond.c.ts @@ -0,0 +1,14 @@ +import { max_curry_level } from './$curriedFunctions'; +import { create_n_ary_declarations } from './utils/create-n-ary-declarations'; + +export default create_n_ary_declarations( + 1, + max_curry_level, + args => ` + function $${args.curry_level}arity<${args.generics.join(',')}>( + fns: [(${args.parameters.join(',')}) => boolean, (${args.parameters.join( + ',', + )}) => ${args.return_type}][] + ): (${args.parameters.join(',')}) => ${args.return_type}; + `, +); diff --git a/templates/cond.md b/templates/cond.md new file mode 100644 index 0000000..220bead --- /dev/null +++ b/templates/cond.md @@ -0,0 +1,24 @@ +Returns a function, `fn`, which encapsulates `if/else, if/else, ...` logic. +`R.cond` takes a list of [predicate, transformer] pairs. All of the arguments +to `fn` are applied to each of the predicates in turn until one returns a +"truthy" value, at which point `fn` returns the result of applying its +arguments to the corresponding transformer. If none of the predicates +matches, `fn` returns undefined. + +@func +@memberOf R +@since v0.6.0 +@category Logic +@sig [[(*... -> Boolean),(*... -> *)]] -> (*... -> *) +@param {Array} pairs A list of [predicate, transformer] +@return {Function} +@example + + var fn = R.cond([ + [R.equals(0), R.always('water freezes at 0°C')], + [R.equals(100), R.always('water boils at 100°C')], + [R.T, temp => 'nothing special happens at ' + temp + '°C'] + ]); + fn(0); //=> 'water freezes at 0°C' + fn(50); //=> 'nothing special happens at 50°C' + fn(100); //=> 'water boils at 100°C' diff --git a/templates/construct.c.ts b/templates/construct.c.ts new file mode 100644 index 0000000..2fe2cd6 --- /dev/null +++ b/templates/construct.c.ts @@ -0,0 +1,21 @@ +import { max_curry_level } from './$curriedFunctions'; +import { create_n_ary_declarations } from './utils/create-n-ary-declarations'; + +export default create_n_ary_declarations( + 0, + max_curry_level, + args => ` + function $${args.curry_level}arity<${args.generics.join(',')}>( + constructor: new (${args.parameters.join(',')}) => ${args.return_type} + ): CurriedFunction${args.curry_level}<${args.generics.join(',')}>; + `, + args => ` + import {${args.curry_levels + .map(i => `CurriedFunction${i}`) + .join(',')}} from './$curriedFunctions'; + import {Constructor, Variadic} from './$types'; + function $variadic<${args.return_type}>( + constructor: Constructor<${args.return_type}> + ): Variadic<${args.return_type}>; + `, +); diff --git a/templates/construct.md b/templates/construct.md new file mode 100644 index 0000000..779ad71 --- /dev/null +++ b/templates/construct.md @@ -0,0 +1,30 @@ +Wraps a constructor function inside a curried function that can be called +with the same arguments and returns the same type. + +@func +@memberOf R +@since v0.1.0 +@category Function +@sig (* -> {*}) -> (* -> {*}) +@param {Function} fn The constructor function to wrap. +@return {Function} A wrapped, curried constructor function. +@see R.invoker +@example + + // Constructor function + function Animal(kind) { + this.kind = kind; + }; + Animal.prototype.sighting = function() { + return "It's a " + this.kind + "!"; + } + + var AnimalConstructor = R.construct(Animal) + + // Notice we no longer need the 'new' keyword: + AnimalConstructor('Pig'); //=> {"kind": "Pig", "sighting": function (){...}}; + + var animalTypes = ["Lion", "Tiger", "Bear"]; + var animalSighting = R.invoker(0, 'sighting'); + var sightNewAnimal = R.compose(animalSighting, AnimalConstructor); + R.map(sightNewAnimal, animalTypes); //=> ["It's a Lion!", "It's a Tiger!", "It's a Bear!"] diff --git a/templates/constructN.c.ts b/templates/constructN.c.ts new file mode 100644 index 0000000..4570022 --- /dev/null +++ b/templates/constructN.c.ts @@ -0,0 +1,25 @@ +import { max_curry_level } from './$curriedFunctions'; +import { create_n_ary_declarations } from './utils/create-n-ary-declarations'; + +export default create_n_ary_declarations( + 0, + max_curry_level, + args => ` + function $${args.curry_level}arity<${args.generics.join(',')}>( + n: ${args.curry_level}, + constructor: new (${[...args.parameters, '...args: any[]'].join( + ',', + )}) => ${args.return_type} + ): CurriedFunction${args.curry_level}<${args.generics.join(',')}>; + `, + args => ` + import {${args.curry_levels + .map(i => `CurriedFunction${i}`) + .join(',')}} from './$curriedFunctions'; + import {Constructor, Variadic} from './$types'; + function $variadic<${args.return_type}>( + n: number, + constructor: Constructor<${args.return_type}> + ): Variadic<${args.return_type}>; + `, +); diff --git a/templates/constructN.md b/templates/constructN.md new file mode 100644 index 0000000..19904e3 --- /dev/null +++ b/templates/constructN.md @@ -0,0 +1,33 @@ +Wraps a constructor function inside a curried function that can be called +with the same arguments and returns the same type. The arity of the function +returned is specified to allow using variadic constructor functions. + +@func +@memberOf R +@since v0.4.0 +@category Function +@sig Number -> (* -> {*}) -> (* -> {*}) +@param {Number} n The arity of the constructor function. +@param {Function} Fn The constructor function to wrap. +@return {Function} A wrapped, curried constructor function. +@example + + // Variadic Constructor function + function Salad() { + this.ingredients = arguments; + }; + Salad.prototype.recipe = function() { + var instructions = R.map((ingredient) => ( + 'Add a whollop of ' + ingredient, this.ingredients) + ) + return R.join('\n', instructions) + } + + var ThreeLayerSalad = R.constructN(3, Salad) + + // Notice we no longer need the 'new' keyword, and the constructor is curried for 3 arguments. + var salad = ThreeLayerSalad('Mayonnaise')('Potato Chips')('Ketchup') + console.log(salad.recipe()); + // Add a whollop of Mayonnaise + // Add a whollop of Potato Chips + // Add a whollop of Potato Ketchup diff --git a/templates/contains.d.ts b/templates/contains.d.ts new file mode 100644 index 0000000..501eb03 --- /dev/null +++ b/templates/contains.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(value: T, list: List): boolean; diff --git a/templates/contains.md b/templates/contains.md new file mode 100644 index 0000000..d14cbe7 --- /dev/null +++ b/templates/contains.md @@ -0,0 +1,18 @@ +Returns `true` if the specified value is equal, in [`R.equals`](#equals) +terms, to at least one element of the given list; `false` otherwise. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig a -> [a] -> Boolean +@param {Object} a The item to compare against. +@param {Array} list The array to consider. +@return {Boolean} `true` if an equivalent item is in the list, `false` otherwise. +@see R.any +@example + + R.contains(3, [1, 2, 3]); //=> true + R.contains(4, [1, 2, 3]); //=> false + R.contains({ name: 'Fred' }, [{ name: 'Fred' }]); //=> true + R.contains([42], [[42]]); //=> true diff --git a/templates/converge.c.ts b/templates/converge.c.ts new file mode 100644 index 0000000..649e68d --- /dev/null +++ b/templates/converge.c.ts @@ -0,0 +1,74 @@ +import * as dts from 'dts-element'; +import { max_curry_level } from './$curriedFunctions'; + +const min_input_count = 1; +const max_input_count = 3; +const min_function_count = 1; +const max_function_count = max_curry_level; + +const generic_return = 'R'; +const after_generics = [...new Array(max_function_count)].map( + (_, index) => `U${index + 1}`, +); +const input_generics = [...new Array(max_input_count)].map( + (_, index) => `T${index + 1}`, +); +const parameters = [ + ...new Array(Math.max(max_function_count, max_input_count)), +].map((_, index) => `v${index + 1}`); + +const import_curried_functions = []; +const declarations = []; +for ( + let input_count = min_input_count; + input_count <= max_input_count; + input_count++ +) { + const curried_function_name = `CurriedFunction${input_count}`; + for ( + let function_count = min_function_count; + function_count <= max_function_count; + function_count++ + ) { + const current_input_generics = input_generics.slice(0, input_count); + const current_after_generics = after_generics.slice(0, function_count); + const current_generics = [ + ...current_input_generics, + ...current_after_generics, + generic_return, + ]; + declarations.push(` + function $i${input_count}f${function_count}<${current_generics.join( + ',', + )}>( + after: (${current_after_generics + .map((generic, index) => `${parameters[index]}: ${generic}`) + .join(',')}) => ${generic_return}, + fns: [${current_after_generics + .map( + after_generic => ` + (${current_input_generics + .map( + (input_generic, index) => ` + ${parameters[index]}: ${input_generic} + `, + ) + .join(',')}) => ${after_generic} + `, + ) + .join(',')}] + ): ${curried_function_name}<${[ + ...current_input_generics, + generic_return, + ].join(',')}>; + `); + } + import_curried_functions.push(curried_function_name); +} + +export default dts.parse(` + import {${import_curried_functions.join(',')}} from './$curriedFunctions'; + import {List, Variadic} from './$types'; + ${declarations.join('\n')} + function $variadic<${generic_return}>(after: Variadic<${generic_return}>, fns: List>): Variadic<${generic_return}>; +`).members; diff --git a/templates/converge.md b/templates/converge.md new file mode 100644 index 0000000..db979a2 --- /dev/null +++ b/templates/converge.md @@ -0,0 +1,25 @@ +Accepts 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. + +@func +@memberOf R +@since v0.4.2 +@category Function +@sig (x1 -> x2 -> ... -> z) -> [(a -> b -> ... -> x1), (a -> b -> ... -> x2), ...] -> (a -> b -> ... -> z) +@param {Function} after A function. `after` will be invoked with the return values of + `fn1` and `fn2` as its arguments. +@param {Array} functions A list of functions. +@return {Function} A new function. +@see R.useWith +@example + + var average = R.converge(R.divide, [R.sum, R.length]) + average([1, 2, 3, 4, 5, 6, 7]) //=> 4 + + var strangeConcat = R.converge(R.concat, [R.toUpper, R.toLower]) + strangeConcat("Yodel") //=> "YODELyodel" + +@symb R.converge(f, [g, h])(a, b) = f(g(a, b), h(a, b)) diff --git a/templates/countBy.d.ts b/templates/countBy.d.ts new file mode 100644 index 0000000..fef6886 --- /dev/null +++ b/templates/countBy.d.ts @@ -0,0 +1,6 @@ +import { Dictionary, List, Morphism, Property } from './$types'; + +export function $( + fn: Morphism, + list: List, +): Dictionary; diff --git a/templates/countBy.md b/templates/countBy.md new file mode 100644 index 0000000..40d7964 --- /dev/null +++ b/templates/countBy.md @@ -0,0 +1,22 @@ +Counts the elements of a list according to how many match each value of a +key generated by the supplied function. Returns an object mapping the keys +produced by `fn` to the number of occurrences in the list. Note that all +keys are coerced to strings because of how JavaScript objects work. + +Acts as a transducer if a transformer is given in list position. + +@func +@memberOf R +@since v0.1.0 +@category Relation +@sig (a -> String) -> [a] -> {*} +@param {Function} fn The function used to map values to keys. +@param {Array} list The list to count elements from. +@return {Object} An object mapping keys to number of occurrences in the list. +@example + + var numbers = [1.0, 1.1, 1.2, 2.0, 3.0, 2.2]; + R.countBy(Math.floor)(numbers); //=> {'1': 3, '2': 2, '3': 1} + + var letters = ['a', 'b', 'A', 'a', 'B', 'c']; + R.countBy(R.toLower)(letters); //=> {'a': 3, 'b': 2, 'c': 1} diff --git a/templates/curry.c.ts b/templates/curry.c.ts new file mode 100644 index 0000000..0be2c6a --- /dev/null +++ b/templates/curry.c.ts @@ -0,0 +1,21 @@ +import { max_curry_level } from './$curriedFunctions'; +import { create_n_ary_declarations } from './utils/create-n-ary-declarations'; + +export default create_n_ary_declarations( + 0, + max_curry_level, + args => ` + function $${args.curry_level}arity<${args.generics.join(',')}>( + fn: (${args.parameters.join(',')}) => ${args.return_type} + ): CurriedFunction${args.curry_level}<${args.generics.join(',')}>; + `, + args => ` + import {${args.curry_levels + .map(i => `CurriedFunction${i}`) + .join(',')}} from './$curriedFunctions'; + import {Variadic} from './$types'; + function $variadic<${args.return_type}>( + fn: Variadic<${args.return_type}> + ): Variadic<${args.return_type}>; + `, +); diff --git a/templates/curry.md b/templates/curry.md new file mode 100644 index 0000000..20e4b31 --- /dev/null +++ b/templates/curry.md @@ -0,0 +1,39 @@ +Returns a curried equivalent of the provided function. The curried function +has two unusual capabilities. First, its arguments needn't be provided one +at a time. If `f` is a ternary function and `g` is `R.curry(f)`, the +following are equivalent: + + - `g(1)(2)(3)` + - `g(1)(2, 3)` + - `g(1, 2)(3)` + - `g(1, 2, 3)` + +Secondly, the special placeholder value [`R.__`](#__) may be used to specify +"gaps", allowing partial application of any combination of arguments, +regardless of their positions. If `g` is as above and `_` is [`R.__`](#__), +the following are equivalent: + + - `g(1, 2, 3)` + - `g(_, 2, 3)(1)` + - `g(_, _, 3)(1)(2)` + - `g(_, _, 3)(1, 2)` + - `g(_, 2)(1)(3)` + - `g(_, 2)(1, 3)` + - `g(_, 2)(_, 3)(1)` + +@func +@memberOf R +@since v0.1.0 +@category Function +@sig (* -> a) -> (* -> a) +@param {Function} fn The function to curry. +@return {Function} A new, curried function. +@see R.curryN +@example + + var addFourNumbers = (a, b, c, d) => a + b + c + d; + + var curriedAddFourNumbers = R.curry(addFourNumbers); + var f = curriedAddFourNumbers(1, 2); + var g = f(3); + g(4); //=> 10 diff --git a/templates/curryN.c.ts b/templates/curryN.c.ts new file mode 100644 index 0000000..0128cda --- /dev/null +++ b/templates/curryN.c.ts @@ -0,0 +1,25 @@ +import { max_curry_level } from './$curriedFunctions'; +import { create_n_ary_declarations } from './utils/create-n-ary-declarations'; + +export default create_n_ary_declarations( + 0, + max_curry_level, + args => ` + function $${args.curry_level}arity<${args.generics.join(',')}>( + n: ${args.curry_level}, + fn: (${[...args.parameters, '...args: any[]'].join( + ',', + )}) => ${args.return_type} + ): CurriedFunction${args.curry_level}<${args.generics.join(',')}>; + `, + args => ` + import {${args.curry_levels + .map(i => `CurriedFunction${i}`) + .join(',')}} from './$curriedFunctions'; + import {Variadic} from './$types'; + function $variadic<${args.return_type}>( + n: number, + fn: Variadic<${args.return_type}> + ): Variadic<${args.return_type}>; + `, +); diff --git a/templates/curryN.md b/templates/curryN.md new file mode 100644 index 0000000..b47ee58 --- /dev/null +++ b/templates/curryN.md @@ -0,0 +1,40 @@ +Returns a curried equivalent of the provided function, with the specified +arity. The curried function has two unusual capabilities. First, its +arguments needn't be provided one at a time. If `g` is `R.curryN(3, f)`, the +following are equivalent: + + - `g(1)(2)(3)` + - `g(1)(2, 3)` + - `g(1, 2)(3)` + - `g(1, 2, 3)` + +Secondly, the special placeholder value [`R.__`](#__) may be used to specify +"gaps", allowing partial application of any combination of arguments, +regardless of their positions. If `g` is as above and `_` is [`R.__`](#__), +the following are equivalent: + + - `g(1, 2, 3)` + - `g(_, 2, 3)(1)` + - `g(_, _, 3)(1)(2)` + - `g(_, _, 3)(1, 2)` + - `g(_, 2)(1)(3)` + - `g(_, 2)(1, 3)` + - `g(_, 2)(_, 3)(1)` + +@func +@memberOf R +@since v0.5.0 +@category Function +@sig Number -> (* -> a) -> (* -> a) +@param {Number} length The arity for the returned function. +@param {Function} fn The function to curry. +@return {Function} A new, curried function. +@see R.curry +@example + + var sumArgs = (...args) => R.sum(args); + + var curriedAddFourNumbers = R.curryN(4, sumArgs); + var f = curriedAddFourNumbers(1, 2); + var g = f(3); + g(4); //=> 10 diff --git a/templates/dec.d.ts b/templates/dec.d.ts new file mode 100644 index 0000000..7e84ac3 --- /dev/null +++ b/templates/dec.d.ts @@ -0,0 +1 @@ +export function $(n: number): number; diff --git a/templates/dec.md b/templates/dec.md new file mode 100644 index 0000000..f941c7f --- /dev/null +++ b/templates/dec.md @@ -0,0 +1,13 @@ +Decrements its argument. + +@func +@memberOf R +@since v0.9.0 +@category Math +@sig Number -> Number +@param {Number} n +@return {Number} n - 1 +@see R.inc +@example + + R.dec(42); //=> 41 diff --git a/templates/defaultTo.d.ts b/templates/defaultTo.d.ts new file mode 100644 index 0000000..d911441 --- /dev/null +++ b/templates/defaultTo.d.ts @@ -0,0 +1,2 @@ +export function $void(defaults: T, value: null | undefined): T; +export function $general(defaults: T, value: U | null | undefined): T | U; diff --git a/templates/defaultTo.md b/templates/defaultTo.md new file mode 100644 index 0000000..2748941 --- /dev/null +++ b/templates/defaultTo.md @@ -0,0 +1,20 @@ +Returns the second argument if it is not `null`, `undefined` or `NaN`; +otherwise the first argument is returned. + +@func +@memberOf R +@since v0.10.0 +@category Logic +@sig a -> b -> a | b +@param {a} default The default value. +@param {b} val `val` will be returned instead of `default` unless `val` is `null`, `undefined` or `NaN`. +@return {*} The second value if it is not `null`, `undefined` or `NaN`, otherwise the default value +@example + + var defaultTo42 = R.defaultTo(42); + + defaultTo42(null); //=> 42 + defaultTo42(undefined); //=> 42 + defaultTo42('Ramda'); //=> 'Ramda' + // parseInt('string') results in NaN + defaultTo42(parseInt('string')); //=> 42 diff --git a/templates/descend.d.ts b/templates/descend.d.ts new file mode 100644 index 0000000..ca06130 --- /dev/null +++ b/templates/descend.d.ts @@ -0,0 +1,3 @@ +import { Morphism, Ordered } from './$types'; + +export function $(fn: Morphism, a: T, b: T): number; diff --git a/templates/descend.md b/templates/descend.md new file mode 100644 index 0000000..8de1ed6 --- /dev/null +++ b/templates/descend.md @@ -0,0 +1,20 @@ +Makes a descending comparator function out of a function that returns a value +that can be compared with `<` and `>`. + +@func +@memberOf R +@since v0.23.0 +@category Function +@sig Ord b => (a -> b) -> a -> a -> Number +@param {Function} fn A function of arity one that returns a value that can be compared +@param {*} a The first item to be compared. +@param {*} b The second item to be compared. +@return {Number} `-1` if fn(a) > fn(b), `1` if fn(b) > fn(a), otherwise `0` +@see R.ascend +@example + + var byAge = R.descend(R.prop('age')); + var people = [ + // ... + ]; + var peopleByOldestFirst = R.sort(byAge, people); diff --git a/templates/difference.d.ts b/templates/difference.d.ts new file mode 100644 index 0000000..29943c3 --- /dev/null +++ b/templates/difference.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(a: List, b: List): T[]; diff --git a/templates/difference.md b/templates/difference.md new file mode 100644 index 0000000..6013f4a --- /dev/null +++ b/templates/difference.md @@ -0,0 +1,18 @@ +Finds the set (i.e. no duplicates) of all elements in the first list not +contained in the second list. Objects and Arrays are compared in terms of +value equality, not reference equality. + +@func +@memberOf R +@since v0.1.0 +@category Relation +@sig [*] -> [*] -> [*] +@param {Array} list1 The first list. +@param {Array} list2 The second list. +@return {Array} The elements in `list1` that are not in `list2`. +@see R.differenceWith, R.symmetricDifference, R.symmetricDifferenceWith, R.without +@example + + R.difference([1,2,3,4], [7,6,5,4,3]); //=> [1,2] + R.difference([7,6,5,4,3], [1,2,3,4]); //=> [7,6,5] + R.difference([{a: 1}, {b: 2}], [{a: 1}, {c: 3}]) //=> [{b: 2}] diff --git a/templates/differenceWith.d.ts b/templates/differenceWith.d.ts new file mode 100644 index 0000000..5dbd900 --- /dev/null +++ b/templates/differenceWith.d.ts @@ -0,0 +1,3 @@ +import { Comparator, List } from './$types'; + +export function $(fn: Comparator, a: List, b: List): T[]; diff --git a/templates/differenceWith.md b/templates/differenceWith.md new file mode 100644 index 0000000..d918122 --- /dev/null +++ b/templates/differenceWith.md @@ -0,0 +1,20 @@ +Finds the set (i.e. no duplicates) of all elements in the first list not +contained in the second list. Duplication is determined according to the +value returned by applying the supplied predicate to two list elements. + +@func +@memberOf R +@since v0.1.0 +@category Relation +@sig ((a, a) -> Boolean) -> [a] -> [a] -> [a] +@param {Function} pred A predicate used to test whether two items are equal. +@param {Array} list1 The first list. +@param {Array} list2 The second list. +@return {Array} The elements in `list1` that are not in `list2`. +@see R.difference, R.symmetricDifference, R.symmetricDifferenceWith +@example + + var cmp = (x, y) => x.a === y.a; + var l1 = [{a: 1}, {a: 2}, {a: 3}]; + var l2 = [{a: 3}, {a: 4}]; + R.differenceWith(cmp, l1, l2); //=> [{a: 1}, {a: 2}] diff --git a/templates/dissoc.d.ts b/templates/dissoc.d.ts new file mode 100644 index 0000000..e22eb66 --- /dev/null +++ b/templates/dissoc.d.ts @@ -0,0 +1,12 @@ +import { Omit } from './$operation'; +import { Property } from './$types'; + +export function $keyof( + property: K, + object: T, +): Omit; +export function $record, V extends string>( + property: V, + object: U, +): Omit; +export function $general(property: Property, object: T): T; diff --git a/templates/dissoc.md b/templates/dissoc.md new file mode 100644 index 0000000..090f05e --- /dev/null +++ b/templates/dissoc.md @@ -0,0 +1,14 @@ +Returns a new object that does not contain a `prop` property. + +@func +@memberOf R +@since v0.10.0 +@category Object +@sig String -> {k: v} -> {k: v} +@param {String} prop The name of the property to dissociate +@param {Object} obj The object to clone +@return {Object} A new object equivalent to the original but without the specified property +@see R.assoc +@example + + R.dissoc('b', {a: 1, b: 2, c: 3}); //=> {a: 1, c: 3} diff --git a/templates/dissocPath.d.ts b/templates/dissocPath.d.ts new file mode 100644 index 0000000..414ffef --- /dev/null +++ b/templates/dissocPath.d.ts @@ -0,0 +1,4 @@ +import { DeepPartial } from './$operation'; +import { Path } from './$types'; + +export function $(path: Path, object: T): DeepPartial; diff --git a/templates/dissocPath.md b/templates/dissocPath.md new file mode 100644 index 0000000..79c4df3 --- /dev/null +++ b/templates/dissocPath.md @@ -0,0 +1,17 @@ +Makes a shallow clone of an object, omitting the property at the given path. +Note that this copies and flattens prototype properties onto the new object +as well. All non-primitive properties are copied by reference. + +@func +@memberOf R +@since v0.11.0 +@category Object +@typedefn Idx = String | Int +@sig [Idx] -> {k: v} -> {k: v} +@param {Array} path The path to the value to omit +@param {Object} obj The object to clone +@return {Object} A new object without the property at path +@see R.assocPath +@example + + R.dissocPath(['a', 'b', 'c'], {a: {b: {c: 42}}}); //=> {a: {b: {}}} diff --git a/templates/divide.d.ts b/templates/divide.d.ts new file mode 100644 index 0000000..9e0dcbf --- /dev/null +++ b/templates/divide.d.ts @@ -0,0 +1 @@ +export function $(a: number, b: number): number; diff --git a/templates/divide.md b/templates/divide.md new file mode 100644 index 0000000..839d090 --- /dev/null +++ b/templates/divide.md @@ -0,0 +1,20 @@ +Divides two numbers. Equivalent to `a / b`. + +@func +@memberOf R +@since v0.1.0 +@category Math +@sig Number -> Number -> Number +@param {Number} a The first value. +@param {Number} b The second value. +@return {Number} The result of `a / b`. +@see R.multiply +@example + + R.divide(71, 100); //=> 0.71 + + var half = R.divide(R.__, 2); + half(42); //=> 21 + + var reciprocal = R.divide(1); + reciprocal(4); //=> 0.25 diff --git a/templates/drop.d.ts b/templates/drop.d.ts new file mode 100644 index 0000000..63dfe38 --- /dev/null +++ b/templates/drop.d.ts @@ -0,0 +1,5 @@ +import { List } from './$types'; + +export function $string(n: number, str: string): string; +export function $list(n: number, list: List): T[]; +export function $mixed(n: number, list: string | List): string | T[]; diff --git a/templates/drop.md b/templates/drop.md new file mode 100644 index 0000000..3813874 --- /dev/null +++ b/templates/drop.md @@ -0,0 +1,22 @@ +Returns all but the first `n` elements of the given list, string, or +transducer/transformer (or object with a `drop` method). + +Dispatches to the `drop` method of the second argument, if present. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig Number -> [a] -> [a] +@sig Number -> String -> String +@param {Number} n +@param {*} list +@return {*} A copy of list without the first `n` elements +@see R.take, R.transduce, R.dropLast, R.dropWhile +@example + + R.drop(1, ['foo', 'bar', 'baz']); //=> ['bar', 'baz'] + R.drop(2, ['foo', 'bar', 'baz']); //=> ['baz'] + R.drop(3, ['foo', 'bar', 'baz']); //=> [] + R.drop(4, ['foo', 'bar', 'baz']); //=> [] + R.drop(3, 'ramda'); //=> 'da' diff --git a/templates/dropLast.d.ts b/templates/dropLast.d.ts new file mode 100644 index 0000000..63dfe38 --- /dev/null +++ b/templates/dropLast.d.ts @@ -0,0 +1,5 @@ +import { List } from './$types'; + +export function $string(n: number, str: string): string; +export function $list(n: number, list: List): T[]; +export function $mixed(n: number, list: string | List): string | T[]; diff --git a/templates/dropLast.md b/templates/dropLast.md new file mode 100644 index 0000000..927835d --- /dev/null +++ b/templates/dropLast.md @@ -0,0 +1,19 @@ +Returns a list containing all but the last `n` elements of the given `list`. + +@func +@memberOf R +@since v0.16.0 +@category List +@sig Number -> [a] -> [a] +@sig Number -> String -> String +@param {Number} n The number of elements of `list` to skip. +@param {Array} list The list of elements to consider. +@return {Array} A copy of the list with only the first `list.length - n` elements +@see R.takeLast, R.drop, R.dropWhile, R.dropLastWhile +@example + + R.dropLast(1, ['foo', 'bar', 'baz']); //=> ['foo', 'bar'] + R.dropLast(2, ['foo', 'bar', 'baz']); //=> ['foo'] + R.dropLast(3, ['foo', 'bar', 'baz']); //=> [] + R.dropLast(4, ['foo', 'bar', 'baz']); //=> [] + R.dropLast(3, 'ramda'); //=> 'ra' diff --git a/templates/dropLastWhile.d.ts b/templates/dropLastWhile.d.ts new file mode 100644 index 0000000..9dca73b --- /dev/null +++ b/templates/dropLastWhile.d.ts @@ -0,0 +1,3 @@ +import { List, Predicate } from './$types'; + +export function $(fn: Predicate, list: List): T[]; diff --git a/templates/dropLastWhile.md b/templates/dropLastWhile.md new file mode 100644 index 0000000..42cabe3 --- /dev/null +++ b/templates/dropLastWhile.md @@ -0,0 +1,20 @@ +Returns a new list excluding all the tailing elements of a given list which +satisfy the supplied predicate function. It passes each value from the right +to the supplied predicate function, skipping elements until the predicate +function returns a `falsy` value. The predicate function is applied to one argument: +*(value)*. + +@func +@memberOf R +@since v0.16.0 +@category List +@sig (a -> Boolean) -> [a] -> [a] +@param {Function} predicate The function to be called on each element +@param {Array} list The collection to iterate over. +@return {Array} A new array without any trailing elements that return `falsy` values from the `predicate`. +@see R.takeLastWhile, R.addIndex, R.drop, R.dropWhile +@example + + var lteThree = x => x <= 3; + + R.dropLastWhile(lteThree, [1, 2, 3, 4, 3, 2, 1]); //=> [1, 2, 3, 4] diff --git a/templates/dropRepeats.d.ts b/templates/dropRepeats.d.ts new file mode 100644 index 0000000..345471f --- /dev/null +++ b/templates/dropRepeats.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(list: List): T[]; diff --git a/templates/dropRepeats.md b/templates/dropRepeats.md new file mode 100644 index 0000000..5c789a3 --- /dev/null +++ b/templates/dropRepeats.md @@ -0,0 +1,16 @@ +Returns a new list without any consecutively repeating elements. +[`R.equals`](#equals) is used to determine equality. + +Acts as a transducer if a transformer is given in list position. + +@func +@memberOf R +@since v0.14.0 +@category List +@sig [a] -> [a] +@param {Array} list The array to consider. +@return {Array} `list` without repeating elements. +@see R.transduce +@example + + R.dropRepeats([1, 1, 1, 2, 3, 4, 4, 2, 2]); //=> [1, 2, 3, 4, 2] diff --git a/templates/dropRepeatsWith.d.ts b/templates/dropRepeatsWith.d.ts new file mode 100644 index 0000000..e0cca47 --- /dev/null +++ b/templates/dropRepeatsWith.d.ts @@ -0,0 +1,3 @@ +import { List, Morphism } from './$types'; + +export function $(fn: Morphism, list: List): T[]; diff --git a/templates/dropRepeatsWith.md b/templates/dropRepeatsWith.md new file mode 100644 index 0000000..f4f32c1 --- /dev/null +++ b/templates/dropRepeatsWith.md @@ -0,0 +1,19 @@ +Returns a new list without any consecutively repeating elements. Equality is +determined by applying the supplied predicate to each pair of consecutive elements. The +first element in a series of equal elements will be preserved. + +Acts as a transducer if a transformer is given in list position. + +@func +@memberOf R +@since v0.14.0 +@category List +@sig (a, a -> Boolean) -> [a] -> [a] +@param {Function} pred A predicate used to test whether two items are equal. +@param {Array} list The array to consider. +@return {Array} `list` without repeating elements. +@see R.transduce +@example + + var l = [1, -1, 1, 3, 4, -4, -4, -5, 5, 3, 3]; + R.dropRepeatsWith(R.eqBy(Math.abs), l); //=> [1, 3, 4, -5, 3] diff --git a/templates/dropWhile.d.ts b/templates/dropWhile.d.ts new file mode 100644 index 0000000..9dca73b --- /dev/null +++ b/templates/dropWhile.d.ts @@ -0,0 +1,3 @@ +import { List, Predicate } from './$types'; + +export function $(fn: Predicate, list: List): T[]; diff --git a/templates/dropWhile.md b/templates/dropWhile.md new file mode 100644 index 0000000..d2cb8a3 --- /dev/null +++ b/templates/dropWhile.md @@ -0,0 +1,23 @@ +Returns a new list excluding the leading elements of a given list which +satisfy the supplied predicate function. It passes each value to the supplied +predicate function, skipping elements while the predicate function returns +`true`. The predicate function is applied to one argument: *(value)*. + +Dispatches to the `dropWhile` method of the second argument, if present. + +Acts as a transducer if a transformer is given in list position. + +@func +@memberOf R +@since v0.9.0 +@category List +@sig (a -> Boolean) -> [a] -> [a] +@param {Function} fn The function called per iteration. +@param {Array} list The collection to iterate over. +@return {Array} A new array. +@see R.takeWhile, R.transduce, R.addIndex +@example + + var lteTwo = x => x <= 2; + + R.dropWhile(lteTwo, [1, 2, 3, 4, 3, 2, 1]); //=> [3, 4, 3, 2, 1] diff --git a/templates/either.d.ts b/templates/either.d.ts new file mode 100644 index 0000000..15087d5 --- /dev/null +++ b/templates/either.d.ts @@ -0,0 +1,3 @@ +import { Variadic } from './$types'; + +export function $>(fn1: F, fn2: F): F; diff --git a/templates/either.md b/templates/either.md new file mode 100644 index 0000000..c4bdf5c --- /dev/null +++ b/templates/either.md @@ -0,0 +1,25 @@ +A function wrapping calls to the two functions in an `||` operation, +returning the result of the first function if it is truth-y and the result +of the second function otherwise. Note that this is short-circuited, +meaning that the second function will not be invoked if the first returns a +truth-y value. + +In addition to functions, `R.either` also accepts any fantasy-land compatible +applicative functor. + +@func +@memberOf R +@since v0.12.0 +@category Logic +@sig (*... -> Boolean) -> (*... -> Boolean) -> (*... -> Boolean) +@param {Function} f a predicate +@param {Function} g another predicate +@return {Function} a function that applies its arguments to `f` and `g` and `||`s their outputs together. +@see R.or +@example + + var gt10 = x => x > 10; + var even = x => x % 2 === 0; + var f = R.either(gt10, even); + f(101); //=> true + f(8); //=> true diff --git a/templates/empty.d.ts b/templates/empty.d.ts new file mode 100644 index 0000000..3f01f7d --- /dev/null +++ b/templates/empty.d.ts @@ -0,0 +1,4 @@ +export function $list(container: T[]): T[]; +export function $string(container: string): string; +export function $object(container: object): {}; +export function $general(container: any): T; diff --git a/templates/empty.md b/templates/empty.md new file mode 100644 index 0000000..1f072ae --- /dev/null +++ b/templates/empty.md @@ -0,0 +1,20 @@ +Returns the empty value of its argument's type. Ramda defines the empty +value of Array (`[]`), Object (`{}`), String (`''`), and Arguments. Other +types are supported if they define `.empty` and/or +`.prototype.empty`. + +Dispatches to the `empty` method of the first argument, if present. + +@func +@memberOf R +@since v0.3.0 +@category Function +@sig a -> a +@param {*} x +@return {*} +@example + + R.empty(Just(42)); //=> Nothing() + R.empty([1, 2, 3]); //=> [] + R.empty('unicorns'); //=> '' + R.empty({x: 1, y: 2}); //=> {} diff --git a/templates/endsWith.d.ts b/templates/endsWith.d.ts new file mode 100644 index 0000000..4da70fd --- /dev/null +++ b/templates/endsWith.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $>(suffix: T, list: T): boolean; diff --git a/templates/endsWith.md b/templates/endsWith.md new file mode 100644 index 0000000..6258c64 --- /dev/null +++ b/templates/endsWith.md @@ -0,0 +1,17 @@ +Checks if a list ends with the provided values + +@func +@memberOf R +@since v0.24.0 +@category List +@sig [a] -> Boolean +@sig String -> Boolean +@param {*} suffix +@param {*} list +@return {Boolean} +@example + + R.endsWith('c', 'abc') //=> true + R.endsWith('b', 'abc') //=> false + R.endsWith(['c'], ['a', 'b', 'c']) //=> true + R.endsWith(['b'], ['a', 'b', 'c']) //=> false diff --git a/templates/eqBy.d.ts b/templates/eqBy.d.ts new file mode 100644 index 0000000..e2e226b --- /dev/null +++ b/templates/eqBy.d.ts @@ -0,0 +1,3 @@ +import { Morphism } from './$types'; + +export function $(fn: Morphism, a: T, b: T): boolean; diff --git a/templates/eqBy.md b/templates/eqBy.md new file mode 100644 index 0000000..937beed --- /dev/null +++ b/templates/eqBy.md @@ -0,0 +1,15 @@ +Takes a function and two values in its domain and returns `true` if the +values map to the same value in the codomain; `false` otherwise. + +@func +@memberOf R +@since v0.18.0 +@category Relation +@sig (a -> b) -> a -> a -> Boolean +@param {Function} f +@param {*} x +@param {*} y +@return {Boolean} +@example + + R.eqBy(Math.abs, 5, -5); //=> true diff --git a/templates/eqProps.d.ts b/templates/eqProps.d.ts new file mode 100644 index 0000000..9561434 --- /dev/null +++ b/templates/eqProps.d.ts @@ -0,0 +1,3 @@ +import { Property } from './$types'; + +export function $(property: Property, a: T, b: T): boolean; diff --git a/templates/eqProps.md b/templates/eqProps.md new file mode 100644 index 0000000..eecb41b --- /dev/null +++ b/templates/eqProps.md @@ -0,0 +1,19 @@ +Reports whether two objects have the same value, in [`R.equals`](#equals) +terms, for the specified property. Useful as a curried predicate. + +@func +@memberOf R +@since v0.1.0 +@category Object +@sig k -> {k: v} -> {k: v} -> Boolean +@param {String} prop The name of the property to compare +@param {Object} obj1 +@param {Object} obj2 +@return {Boolean} + +@example + + var o1 = { a: 1, b: 2, c: 3, d: 4 }; + var o2 = { a: 10, b: 20, c: 3, d: 40 }; + R.eqProps('a', o1, o2); //=> false + R.eqProps('c', o1, o2); //=> true diff --git a/templates/equals.d.ts b/templates/equals.d.ts new file mode 100644 index 0000000..18cc70f --- /dev/null +++ b/templates/equals.d.ts @@ -0,0 +1 @@ +export function $(a: T, b: T): boolean; diff --git a/templates/equals.md b/templates/equals.md new file mode 100644 index 0000000..ad03023 --- /dev/null +++ b/templates/equals.md @@ -0,0 +1,23 @@ +Returns `true` if its arguments are equivalent, `false` otherwise. Handles +cyclical data structures. + +Dispatches symmetrically to the `equals` methods of both arguments, if +present. + +@func +@memberOf R +@since v0.15.0 +@category Relation +@sig a -> b -> Boolean +@param {*} a +@param {*} b +@return {Boolean} +@example + + R.equals(1, 1); //=> true + R.equals(1, '1'); //=> false + R.equals([1, 2, 3], [1, 2, 3]); //=> true + + var a = {}; a.v = a; + var b = {}; b.v = b; + R.equals(a, b); //=> true diff --git a/templates/evolve.d.ts b/templates/evolve.d.ts new file mode 100644 index 0000000..f5801cb --- /dev/null +++ b/templates/evolve.d.ts @@ -0,0 +1,3 @@ +import { Evolver } from './$operation'; + +export function $(transformations: Evolver, object: U): U; diff --git a/templates/evolve.md b/templates/evolve.md new file mode 100644 index 0000000..394274e --- /dev/null +++ b/templates/evolve.md @@ -0,0 +1,25 @@ +Creates a new object by recursively evolving a shallow copy of `object`, +according to the `transformation` functions. All non-primitive properties +are copied by reference. + +A `transformation` function will not be invoked if its corresponding key +does not exist in the evolved object. + +@func +@memberOf R +@since v0.9.0 +@category Object +@sig {k: (v -> v)} -> {k: v} -> {k: v} +@param {Object} transformations The object specifying transformation functions to apply + to the object. +@param {Object} object The object to be transformed. +@return {Object} The transformed object. +@example + + var tomato = {firstName: ' Tomato ', data: {elapsed: 100, remaining: 1400}, id:123}; + var transformations = { + firstName: R.trim, + lastName: R.trim, // Will not get invoked. + data: {elapsed: R.add(1), remaining: R.add(-1)} + }; + R.evolve(transformations, tomato); //=> {firstName: 'Tomato', data: {elapsed: 101, remaining: 1399}, id:123} diff --git a/templates/filter.d.ts b/templates/filter.d.ts new file mode 100644 index 0000000..1ff853c --- /dev/null +++ b/templates/filter.d.ts @@ -0,0 +1,15 @@ +import { Dictionary, Filterable, List, Predicate } from './$types'; + +export function $list(fn: Predicate, list: List): T[]; +export function $filterable>( + fn: Predicate, + filterable: U, +): U; +export function $object>( + fn: Predicate, + object: U, +): Partial; +export function $mixed | Filterable | Dictionary>( + fn: Predicate, + target: U, +): T[] | U | Partial; diff --git a/templates/filter.md b/templates/filter.md new file mode 100644 index 0000000..466915f --- /dev/null +++ b/templates/filter.md @@ -0,0 +1,25 @@ +Takes a predicate and a `Filterable`, and returns a new filterable of the +same type containing the members of the given filterable which satisfy the +given predicate. Filterable objects include plain objects or any object +that has a filter method such as `Array`. + +Dispatches to the `filter` method of the second argument, if present. + +Acts as a transducer if a transformer is given in list position. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig Filterable f => (a -> Boolean) -> f a -> f a +@param {Function} pred +@param {Array} filterable +@return {Array} Filterable +@see R.reject, R.transduce, R.addIndex +@example + + var isEven = n => n % 2 === 0; + + R.filter(isEven, [1, 2, 3, 4]); //=> [2, 4] + + R.filter(isEven, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4} diff --git a/templates/find.d.ts b/templates/find.d.ts new file mode 100644 index 0000000..1b44093 --- /dev/null +++ b/templates/find.d.ts @@ -0,0 +1,3 @@ +import { List, Predicate } from './$types'; + +export function $(fn: Predicate, list: List): T | undefined; diff --git a/templates/find.md b/templates/find.md new file mode 100644 index 0000000..8488ae8 --- /dev/null +++ b/templates/find.md @@ -0,0 +1,22 @@ +Returns the first element of the list which matches the predicate, or +`undefined` if no element matches. + +Dispatches to the `find` method of the second argument, if present. + +Acts as a transducer if a transformer is given in list position. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig (a -> Boolean) -> [a] -> a | undefined +@param {Function} fn The predicate function used to determine if the element is the + desired one. +@param {Array} list The array to consider. +@return {Object} The element found, or `undefined`. +@see R.transduce +@example + + var xs = [{a: 1}, {a: 2}, {a: 3}]; + R.find(R.propEq('a', 2))(xs); //=> {a: 2} + R.find(R.propEq('a', 4))(xs); //=> undefined diff --git a/templates/findIndex.d.ts b/templates/findIndex.d.ts new file mode 100644 index 0000000..23118db --- /dev/null +++ b/templates/findIndex.d.ts @@ -0,0 +1,3 @@ +import { List, Predicate } from './$types'; + +export function $(fn: Predicate, list: List): number; diff --git a/templates/findIndex.md b/templates/findIndex.md new file mode 100644 index 0000000..233bda5 --- /dev/null +++ b/templates/findIndex.md @@ -0,0 +1,20 @@ +Returns the index of the first element of the list which matches the +predicate, or `-1` if no element matches. + +Acts as a transducer if a transformer is given in list position. + +@func +@memberOf R +@since v0.1.1 +@category List +@sig (a -> Boolean) -> [a] -> Number +@param {Function} fn The predicate function used to determine if the element is the +desired one. +@param {Array} list The array to consider. +@return {Number} The index of the element found, or `-1`. +@see R.transduce +@example + + var xs = [{a: 1}, {a: 2}, {a: 3}]; + R.findIndex(R.propEq('a', 2))(xs); //=> 1 + R.findIndex(R.propEq('a', 4))(xs); //=> -1 diff --git a/templates/findLast.d.ts b/templates/findLast.d.ts new file mode 100644 index 0000000..1b44093 --- /dev/null +++ b/templates/findLast.d.ts @@ -0,0 +1,3 @@ +import { List, Predicate } from './$types'; + +export function $(fn: Predicate, list: List): T | undefined; diff --git a/templates/findLast.md b/templates/findLast.md new file mode 100644 index 0000000..d9cd4bd --- /dev/null +++ b/templates/findLast.md @@ -0,0 +1,20 @@ +Returns the last element of the list which matches the predicate, or +`undefined` if no element matches. + +Acts as a transducer if a transformer is given in list position. + +@func +@memberOf R +@since v0.1.1 +@category List +@sig (a -> Boolean) -> [a] -> a | undefined +@param {Function} fn The predicate function used to determine if the element is the +desired one. +@param {Array} list The array to consider. +@return {Object} The element found, or `undefined`. +@see R.transduce +@example + + var xs = [{a: 1, b: 0}, {a:1, b: 1}]; + R.findLast(R.propEq('a', 1))(xs); //=> {a: 1, b: 1} + R.findLast(R.propEq('a', 4))(xs); //=> undefined diff --git a/templates/findLastIndex.d.ts b/templates/findLastIndex.d.ts new file mode 100644 index 0000000..23118db --- /dev/null +++ b/templates/findLastIndex.d.ts @@ -0,0 +1,3 @@ +import { List, Predicate } from './$types'; + +export function $(fn: Predicate, list: List): number; diff --git a/templates/findLastIndex.md b/templates/findLastIndex.md new file mode 100644 index 0000000..78ef9e4 --- /dev/null +++ b/templates/findLastIndex.md @@ -0,0 +1,20 @@ +Returns the index of the last element of the list which matches the +predicate, or `-1` if no element matches. + +Acts as a transducer if a transformer is given in list position. + +@func +@memberOf R +@since v0.1.1 +@category List +@sig (a -> Boolean) -> [a] -> Number +@param {Function} fn The predicate function used to determine if the element is the +desired one. +@param {Array} list The array to consider. +@return {Number} The index of the element found, or `-1`. +@see R.transduce +@example + + var xs = [{a: 1, b: 0}, {a:1, b: 1}]; + R.findLastIndex(R.propEq('a', 1))(xs); //=> 1 + R.findLastIndex(R.propEq('a', 4))(xs); //=> -1 diff --git a/templates/flatten.d.ts b/templates/flatten.d.ts new file mode 100644 index 0000000..747e8f0 --- /dev/null +++ b/templates/flatten.d.ts @@ -0,0 +1,3 @@ +import { NestedList } from './$types'; + +export function $(list: NestedList): T[]; diff --git a/templates/flatten.md b/templates/flatten.md new file mode 100644 index 0000000..8b88962 --- /dev/null +++ b/templates/flatten.md @@ -0,0 +1,15 @@ +Returns a new list by pulling every item out of it (and all its sub-arrays) +and putting them in a new array, depth-first. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig [a] -> [b] +@param {Array} list The array to consider. +@return {Array} The flattened list. +@see R.unnest +@example + + R.flatten([1, 2, [3, 4], 5, [6, [7, 8, [9, [10, 11], 12]]]]); + //=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] diff --git a/templates/flip.c.ts b/templates/flip.c.ts new file mode 100644 index 0000000..9258b6f --- /dev/null +++ b/templates/flip.c.ts @@ -0,0 +1,29 @@ +import { max_curry_level } from './$curriedFunctions'; +import { create_n_ary_declarations } from './utils/create-n-ary-declarations'; + +export default create_n_ary_declarations( + 2, + max_curry_level, + args => ` + function $${args.curry_level}arity<${args.generics.join(',')}>( + fn: (${args.parameters.join(',')}) => ${args.return_type} + ): CurriedFunction${args.curry_level}<${[ + ...args.generics.slice(0, 2).reverse(), + ...args.generics.slice(2), + ].join(',')}>; + `, + args => ` + import {${args.curry_levels + .map(i => `CurriedFunction${i}`) + .join(',')}} from './$curriedFunctions'; + function $variadic<${[...args.types.slice(0, 2), args.return_type].join( + ',', + )}>( + fn: (${[...args.parameters.slice(0, 2), '...args: any[]'].join( + ',', + )}) => ${args.return_type} + ): (${[...args.parameters.slice(0, 2).reverse(), '...args: any[]'].join( + ',', + )}) => ${args.return_type}; + `, +); diff --git a/templates/flip.md b/templates/flip.md new file mode 100644 index 0000000..9f8f997 --- /dev/null +++ b/templates/flip.md @@ -0,0 +1,18 @@ +Returns a new function much like the supplied one, except that the first two +arguments' order is reversed. + +@func +@memberOf R +@since v0.1.0 +@category Function +@sig (a -> b -> c -> ... -> z) -> (b -> a -> c -> ... -> z) +@param {Function} fn The function to invoke with its first two parameters reversed. +@return {*} The result of invoking `fn` with its first two parameters' order reversed. +@example + + var mergeThree = (a, b, c) => [].concat(a, b, c); + + mergeThree(1, 2, 3); //=> [1, 2, 3] + + R.flip(mergeThree)(1, 2, 3); //=> [2, 1, 3] +@symb R.flip(f)(a, b, c) = f(b, a, c) diff --git a/templates/forEach.d.ts b/templates/forEach.d.ts new file mode 100644 index 0000000..3537078 --- /dev/null +++ b/templates/forEach.d.ts @@ -0,0 +1,3 @@ +import { List, Tap } from './$types'; + +export function $>(fn: Tap, list: U): U; diff --git a/templates/forEach.md b/templates/forEach.md new file mode 100644 index 0000000..68010bf --- /dev/null +++ b/templates/forEach.md @@ -0,0 +1,32 @@ +Iterate over an input `list`, calling a provided function `fn` for each +element in the list. + +`fn` receives one argument: *(value)*. + +Note: `R.forEach` does not skip deleted or unassigned indices (sparse +arrays), unlike the native `Array.prototype.forEach` method. For more +details on this behavior, see: +https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#Description + +Also note that, unlike `Array.prototype.forEach`, Ramda's `forEach` returns +the original array. In some libraries this function is named `each`. + +Dispatches to the `forEach` method of the second argument, if present. + +@func +@memberOf R +@since v0.1.1 +@category List +@sig (a -> *) -> [a] -> [a] +@param {Function} fn The function to invoke. Receives one argument, `value`. +@param {Array} list The list to iterate over. +@return {Array} The original list. +@see R.addIndex +@example + + var printXPlusFive = x => console.log(x + 5); + R.forEach(printXPlusFive, [1, 2, 3]); //=> [1, 2, 3] + // logs 6 + // logs 7 + // logs 8 +@symb R.forEach(f, [a, b, c]) = [a, b, c] diff --git a/templates/forEachObjIndexed.d.ts b/templates/forEachObjIndexed.d.ts new file mode 100644 index 0000000..8a75156 --- /dev/null +++ b/templates/forEachObjIndexed.d.ts @@ -0,0 +1,6 @@ +import { Dictionary, KeyedObjectTap } from './$types'; + +export function $>( + fn: KeyedObjectTap, + list: U, +): U; diff --git a/templates/forEachObjIndexed.md b/templates/forEachObjIndexed.md new file mode 100644 index 0000000..e2afa57 --- /dev/null +++ b/templates/forEachObjIndexed.md @@ -0,0 +1,20 @@ +Iterate over an input `object`, calling a provided function `fn` for each +key and value in the object. + +`fn` receives three argument: *(value, key, obj)*. + +@func +@memberOf R +@since v0.23.0 +@category Object +@sig ((a, String, StrMap a) -> Any) -> StrMap a -> StrMap a +@param {Function} fn The function to invoke. Receives three argument, `value`, `key`, `obj`. +@param {Object} obj The object to iterate over. +@return {Object} The original object. +@example + + var printKeyConcatValue = (value, key) => console.log(key + ':' + value); + R.forEachObjIndexed(printKeyConcatValue, {x: 1, y: 2}); //=> {x: 1, y: 2} + // logs x:1 + // logs y:2 +@symb R.forEachObjIndexed(f, {x: a, y: b}) = {x: a, y: b} diff --git a/templates/fromPairs.d.ts b/templates/fromPairs.d.ts new file mode 100644 index 0000000..a8201f5 --- /dev/null +++ b/templates/fromPairs.d.ts @@ -0,0 +1,3 @@ +import { Dictionary, KeyValuePair, List, Property } from './$types'; + +export function $(pairs: List>): Dictionary; diff --git a/templates/fromPairs.md b/templates/fromPairs.md new file mode 100644 index 0000000..2c86e08 --- /dev/null +++ b/templates/fromPairs.md @@ -0,0 +1,14 @@ +Creates a new object from a list key-value pairs. If a key appears in +multiple pairs, the rightmost pair is included in the object. + +@func +@memberOf R +@since v0.3.0 +@category List +@sig [[k,v]] -> {k: v} +@param {Array} pairs An array of two-element arrays that will be the keys and values of the output object. +@return {Object} The object made by pairing up `keys` and `values`. +@see R.toPairs, R.pair +@example + + R.fromPairs([['a', 1], ['b', 2], ['c', 3]]); //=> {a: 1, b: 2, c: 3} diff --git a/templates/groupBy.d.ts b/templates/groupBy.d.ts new file mode 100644 index 0000000..58aa1a1 --- /dev/null +++ b/templates/groupBy.d.ts @@ -0,0 +1,3 @@ +import { Dictionary, List, Morphism, Property } from './$types'; + +export function $(fn: Morphism, list: List): Dictionary; diff --git a/templates/groupBy.md b/templates/groupBy.md new file mode 100644 index 0000000..87c374c --- /dev/null +++ b/templates/groupBy.md @@ -0,0 +1,38 @@ +Splits a list into sub-lists stored in an object, based on the result of +calling a String-returning function on each element, and grouping the +results according to values returned. + +Dispatches to the `groupBy` method of the second argument, if present. + +Acts as a transducer if a transformer is given in list position. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig (a -> String) -> [a] -> {String: [a]} +@param {Function} fn Function :: a -> String +@param {Array} list The array to group +@return {Object} An object with the output of `fn` for keys, mapped to arrays of elements + that produced that key when passed to `fn`. +@see R.transduce +@example + + var byGrade = R.groupBy(function(student) { + var score = student.score; + return score < 65 ? 'F' : + score < 70 ? 'D' : + score < 80 ? 'C' : + score < 90 ? 'B' : 'A'; + }); + var students = [{name: 'Abby', score: 84}, + {name: 'Eddy', score: 58}, + // ... + {name: 'Jack', score: 69}]; + byGrade(students); + // { + // 'A': [{name: 'Dianne', score: 99}], + // 'B': [{name: 'Abby', score: 84}] + // // ..., + // 'F': [{name: 'Eddy', score: 58}] + // } diff --git a/templates/groupWith.d.ts b/templates/groupWith.d.ts new file mode 100644 index 0000000..1213cb8 --- /dev/null +++ b/templates/groupWith.d.ts @@ -0,0 +1,6 @@ +import { Comparator, List } from './$types'; + +export function $>( + fn: Comparator, + list: U, +): U[]; diff --git a/templates/groupWith.md b/templates/groupWith.md new file mode 100644 index 0000000..7c7a1ea --- /dev/null +++ b/templates/groupWith.md @@ -0,0 +1,28 @@ +Takes a list and returns a list of lists where each sublist's elements are +all satisfied pairwise comparison according to the provided function. +Only adjacent elements are passed to the comparison function. + +@func +@memberOf R +@since v0.21.0 +@category List +@sig ((a, a) → Boolean) → [a] → [[a]] +@param {Function} fn Function for determining whether two given (adjacent) + elements should be in the same group +@param {Array} list The array to group. Also accepts a string, which will be + treated as a list of characters. +@return {List} A list that contains sublists of elements, + whose concatenations are equal to the original list. +@example + +R.groupWith(R.equals, [0, 1, 1, 2, 3, 5, 8, 13, 21]) +//=> [[0], [1, 1], [2], [3], [5], [8], [13], [21]] + +R.groupWith((a, b) => a + 1 === b, [0, 1, 1, 2, 3, 5, 8, 13, 21]) +//=> [[0, 1], [1, 2, 3], [5], [8], [13], [21]] + +R.groupWith((a, b) => a % 2 === b % 2, [0, 1, 1, 2, 3, 5, 8, 13, 21]) +//=> [[0], [1, 1], [2], [3, 5], [8], [13, 21]] + +R.groupWith(R.eqBy(isVowel), 'aestiou') +//=> ['ae', 'st', 'iou'] diff --git a/templates/gt.d.ts b/templates/gt.d.ts new file mode 100644 index 0000000..9c75807 --- /dev/null +++ b/templates/gt.d.ts @@ -0,0 +1,3 @@ +import { Ordered } from './$types'; + +export function $(a: T, b: T): boolean; diff --git a/templates/gt.md b/templates/gt.md new file mode 100644 index 0000000..46b5c84 --- /dev/null +++ b/templates/gt.md @@ -0,0 +1,19 @@ +Returns `true` if the first argument is greater than the second; `false` +otherwise. + +@func +@memberOf R +@since v0.1.0 +@category Relation +@sig Ord a => a -> a -> Boolean +@param {*} a +@param {*} b +@return {Boolean} +@see R.lt +@example + + R.gt(2, 1); //=> true + R.gt(2, 2); //=> false + R.gt(2, 3); //=> false + R.gt('a', 'z'); //=> false + R.gt('z', 'a'); //=> true diff --git a/templates/gte.d.ts b/templates/gte.d.ts new file mode 100644 index 0000000..9c75807 --- /dev/null +++ b/templates/gte.d.ts @@ -0,0 +1,3 @@ +import { Ordered } from './$types'; + +export function $(a: T, b: T): boolean; diff --git a/templates/gte.md b/templates/gte.md new file mode 100644 index 0000000..cd3f815 --- /dev/null +++ b/templates/gte.md @@ -0,0 +1,19 @@ +Returns `true` if the first argument is greater than or equal to the second; +`false` otherwise. + +@func +@memberOf R +@since v0.1.0 +@category Relation +@sig Ord a => a -> a -> Boolean +@param {Number} a +@param {Number} b +@return {Boolean} +@see R.lte +@example + + R.gte(2, 1); //=> true + R.gte(2, 2); //=> true + R.gte(2, 3); //=> false + R.gte('a', 'z'); //=> false + R.gte('z', 'a'); //=> true diff --git a/templates/has.d.ts b/templates/has.d.ts new file mode 100644 index 0000000..03fff11 --- /dev/null +++ b/templates/has.d.ts @@ -0,0 +1,3 @@ +import { Property } from './$types'; + +export function $(property: Property, object: {}): boolean; diff --git a/templates/has.md b/templates/has.md new file mode 100644 index 0000000..538c799 --- /dev/null +++ b/templates/has.md @@ -0,0 +1,22 @@ +Returns whether or not an object has an own property with the specified name + +@func +@memberOf R +@since v0.7.0 +@category Object +@sig s -> {s: x} -> Boolean +@param {String} prop The name of the property to check for. +@param {Object} obj The object to query. +@return {Boolean} Whether the property exists. +@example + + var hasName = R.has('name'); + hasName({name: 'alice'}); //=> true + hasName({name: 'bob'}); //=> true + hasName({}); //=> false + + var point = {x: 0, y: 0}; + var pointHas = R.has(R.__, point); + pointHas('x'); //=> true + pointHas('y'); //=> true + pointHas('z'); //=> false diff --git a/templates/hasIn.d.ts b/templates/hasIn.d.ts new file mode 100644 index 0000000..03fff11 --- /dev/null +++ b/templates/hasIn.d.ts @@ -0,0 +1,3 @@ +import { Property } from './$types'; + +export function $(property: Property, object: {}): boolean; diff --git a/templates/hasIn.md b/templates/hasIn.md new file mode 100644 index 0000000..dcfc5ed --- /dev/null +++ b/templates/hasIn.md @@ -0,0 +1,24 @@ +Returns whether or not an object or its prototype chain has a property with +the specified name + +@func +@memberOf R +@since v0.7.0 +@category Object +@sig s -> {s: x} -> Boolean +@param {String} prop The name of the property to check for. +@param {Object} obj The object to query. +@return {Boolean} Whether the property exists. +@example + + function Rectangle(width, height) { + this.width = width; + this.height = height; + } + Rectangle.prototype.area = function() { + return this.width * this.height; + }; + + var square = new Rectangle(2, 2); + R.hasIn('width', square); //=> true + R.hasIn('area', square); //=> true diff --git a/templates/head.d.ts b/templates/head.d.ts new file mode 100644 index 0000000..8dcc942 --- /dev/null +++ b/templates/head.d.ts @@ -0,0 +1,5 @@ +import { List } from './$types'; + +export function $string(str: string): string; +export function $tuple(list: T): T[0]; +export function $general>(list: T): T[0] | undefined; diff --git a/templates/head.md b/templates/head.md new file mode 100644 index 0000000..ce63db7 --- /dev/null +++ b/templates/head.md @@ -0,0 +1,19 @@ +Returns the first element of the given list or string. In some libraries +this function is named `first`. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig [a] -> a | Undefined +@sig String -> String +@param {Array|String} list +@return {*} +@see R.tail, R.init, R.last +@example + + R.head(['fi', 'fo', 'fum']); //=> 'fi' + R.head([]); //=> undefined + + R.head('abc'); //=> 'a' + R.head(''); //=> '' diff --git a/templates/identical.d.ts b/templates/identical.d.ts new file mode 100644 index 0000000..18cc70f --- /dev/null +++ b/templates/identical.d.ts @@ -0,0 +1 @@ +export function $(a: T, b: T): boolean; diff --git a/templates/identical.md b/templates/identical.md new file mode 100644 index 0000000..381800e --- /dev/null +++ b/templates/identical.md @@ -0,0 +1,21 @@ +Returns true if its arguments are identical, false otherwise. Values are +identical if they reference the same memory. `NaN` is identical to `NaN`; +`0` and `-0` are not identical. + +@func +@memberOf R +@since v0.15.0 +@category Relation +@sig a -> a -> Boolean +@param {*} a +@param {*} b +@return {Boolean} +@example + + var o = {}; + R.identical(o, o); //=> true + R.identical(1, 1); //=> true + R.identical(1, '1'); //=> false + R.identical([], []); //=> false + R.identical(0, -0); //=> false + R.identical(NaN, NaN); //=> true diff --git a/templates/identity.d.ts b/templates/identity.d.ts new file mode 100644 index 0000000..2c7c123 --- /dev/null +++ b/templates/identity.d.ts @@ -0,0 +1 @@ +export function $(value: T): T; diff --git a/templates/identity.md b/templates/identity.md new file mode 100644 index 0000000..035f7fb --- /dev/null +++ b/templates/identity.md @@ -0,0 +1,17 @@ +A function that does nothing but return the parameter supplied to it. Good +as a default or placeholder function. + +@func +@memberOf R +@since v0.1.0 +@category Function +@sig a -> a +@param {*} x The value to return. +@return {*} The input value, `x`. +@example + + R.identity(1); //=> 1 + + var obj = {}; + R.identity(obj) === obj; //=> true +@symb R.identity(a) = a diff --git a/templates/ifElse.d.ts b/templates/ifElse.d.ts new file mode 100644 index 0000000..d8197b8 --- /dev/null +++ b/templates/ifElse.d.ts @@ -0,0 +1,7 @@ +import { Morphism, Predicate } from './$types'; + +export function $( + pred: Predicate, + onTrue: Morphism, + onFalse: Morphism, +): Morphism; diff --git a/templates/ifElse.md b/templates/ifElse.md new file mode 100644 index 0000000..f433979 --- /dev/null +++ b/templates/ifElse.md @@ -0,0 +1,23 @@ +Creates a function that will process either the `onTrue` or the `onFalse` +function depending upon the result of the `condition` predicate. + +@func +@memberOf R +@since v0.8.0 +@category Logic +@sig (*... -> Boolean) -> (*... -> *) -> (*... -> *) -> (*... -> *) +@param {Function} condition A predicate function +@param {Function} onTrue A function to invoke when the `condition` evaluates to a truthy value. +@param {Function} onFalse A function to invoke when the `condition` evaluates to a falsy value. +@return {Function} A new unary function that will process either the `onTrue` or the `onFalse` + function depending upon the result of the `condition` predicate. +@see R.unless, R.when +@example + + var incCount = R.ifElse( + R.has('count'), + R.over(R.lensProp('count'), R.inc), + R.assoc('count', 1) + ); + incCount({}); //=> { count: 1 } + incCount({ count: 1 }); //=> { count: 2 } diff --git a/templates/inc.d.ts b/templates/inc.d.ts new file mode 100644 index 0000000..7e84ac3 --- /dev/null +++ b/templates/inc.d.ts @@ -0,0 +1 @@ +export function $(n: number): number; diff --git a/templates/inc.md b/templates/inc.md new file mode 100644 index 0000000..f756680 --- /dev/null +++ b/templates/inc.md @@ -0,0 +1,13 @@ +Increments its argument. + +@func +@memberOf R +@since v0.9.0 +@category Math +@sig Number -> Number +@param {Number} n +@return {Number} n + 1 +@see R.dec +@example + + R.inc(42); //=> 43 diff --git a/templates/indexBy.d.ts b/templates/indexBy.d.ts new file mode 100644 index 0000000..ed48df3 --- /dev/null +++ b/templates/indexBy.d.ts @@ -0,0 +1,3 @@ +import { Dictionary, List, Morphism, Property } from './$types'; + +export function $(fn: Morphism, list: List): Dictionary; diff --git a/templates/indexBy.md b/templates/indexBy.md new file mode 100644 index 0000000..e2fef09 --- /dev/null +++ b/templates/indexBy.md @@ -0,0 +1,20 @@ +Given a function that generates a key, turns a list of objects into an +object indexing the objects by the given key. Note that if multiple +objects generate the same value for the indexing key only the last value +will be included in the generated object. + +Acts as a transducer if a transformer is given in list position. + +@func +@memberOf R +@since v0.19.0 +@category List +@sig (a -> String) -> [{k: v}] -> {k: {k: v}} +@param {Function} fn Function :: a -> String +@param {Array} array The array of objects to index +@return {Object} An object indexing each array element by the given property. +@example + + var list = [{id: 'xyz', title: 'A'}, {id: 'abc', title: 'B'}]; + R.indexBy(R.prop('id'), list); + //=> {abc: {id: 'abc', title: 'B'}, xyz: {id: 'xyz', title: 'A'}} diff --git a/templates/indexOf.d.ts b/templates/indexOf.d.ts new file mode 100644 index 0000000..af21c44 --- /dev/null +++ b/templates/indexOf.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(target: T, list: List): number; diff --git a/templates/indexOf.md b/templates/indexOf.md new file mode 100644 index 0000000..c35e649 --- /dev/null +++ b/templates/indexOf.md @@ -0,0 +1,17 @@ +Returns the position of the first occurrence of an item in an array, or -1 +if the item is not included in the array. [`R.equals`](#equals) is used to +determine equality. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig a -> [a] -> Number +@param {*} target The item to find. +@param {Array} xs The array to search in. +@return {Number} the index of the target, or -1 if the target is not found. +@see R.lastIndexOf +@example + + R.indexOf(3, [1,2,3,4]); //=> 2 + R.indexOf(10, [1,2,3,4]); //=> -1 diff --git a/templates/init.d.ts b/templates/init.d.ts new file mode 100644 index 0000000..52ff4bc --- /dev/null +++ b/templates/init.d.ts @@ -0,0 +1,5 @@ +import { List } from './$types'; + +export function $string(str: string): string; +export function $list(list: List): T[]; +export function $mixed(list: string | List): string | T[]; diff --git a/templates/init.md b/templates/init.md new file mode 100644 index 0000000..2c9e44b --- /dev/null +++ b/templates/init.md @@ -0,0 +1,22 @@ +Returns all but the last element of the given list or string. + +@func +@memberOf R +@since v0.9.0 +@category List +@sig [a] -> [a] +@sig String -> String +@param {*} list +@return {*} +@see R.last, R.head, R.tail +@example + + R.init([1, 2, 3]); //=> [1, 2] + R.init([1, 2]); //=> [1] + R.init([1]); //=> [] + R.init([]); //=> [] + + R.init('abc'); //=> 'ab' + R.init('ab'); //=> 'a' + R.init('a'); //=> '' + R.init(''); //=> '' diff --git a/templates/innerJoin.d.ts b/templates/innerJoin.d.ts new file mode 100644 index 0000000..00cb1ea --- /dev/null +++ b/templates/innerJoin.d.ts @@ -0,0 +1,7 @@ +import { List } from './$types'; + +export function $( + pred: (a: T, b: U) => boolean, + xs: List, + ys: List, +): T[]; diff --git a/templates/innerJoin.md b/templates/innerJoin.md new file mode 100644 index 0000000..8b073c4 --- /dev/null +++ b/templates/innerJoin.md @@ -0,0 +1,33 @@ +Takes a predicate `pred`, a list `xs`, and a list `ys`, and returns a list +`xs'` comprising each of the elements of `xs` which is equal to one or more +elements of `ys` according to `pred`. + +`pred` must be a binary function expecting an element from each list. + +`xs`, `ys`, and `xs'` are treated as sets, semantically, so ordering should +not be significant, but since `xs'` is ordered the implementation guarantees +that its values are in the same order as they appear in `xs`. Duplicates are +not removed, so `xs'` may contain duplicates if `xs` contains duplicates. + +@func +@memberOf R +@since v0.24.0 +@category Relation +@sig (a -> b -> Boolean) -> [a] -> [b] -> [a] +@param {Function} pred +@param {Array} xs +@param {Array} ys +@return {Array} +@see R.intersection +@example + + R.innerJoin( + (record, id) => record.id === id, + [{id: 824, name: 'Richie Furay'}, + {id: 956, name: 'Dewey Martin'}, + {id: 313, name: 'Bruce Palmer'}, + {id: 456, name: 'Stephen Stills'}, + {id: 177, name: 'Neil Young'}], + [177, 456, 999] + ); + //=> [{id: 456, name: 'Stephen Stills'}, {id: 177, name: 'Neil Young'}] diff --git a/templates/insert.d.ts b/templates/insert.d.ts new file mode 100644 index 0000000..924aa57 --- /dev/null +++ b/templates/insert.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(index: number, value: T, list: List): (T | U)[]; diff --git a/templates/insert.md b/templates/insert.md new file mode 100644 index 0000000..b9eff96 --- /dev/null +++ b/templates/insert.md @@ -0,0 +1,17 @@ +Inserts the supplied element into the list, at the specified `index`. _Note that + +this is not destructive_: it returns a copy of the list with the changes. +No lists have been harmed in the application of this function. + +@func +@memberOf R +@since v0.2.2 +@category List +@sig Number -> a -> [a] -> [a] +@param {Number} index The position to insert the element +@param {*} elt The element to insert into the Array +@param {Array} list The list to insert into +@return {Array} A new Array with `elt` inserted at `index`. +@example + + R.insert(2, 'x', [1,2,3,4]); //=> [1,2,'x',3,4] diff --git a/templates/insertAll.d.ts b/templates/insertAll.d.ts new file mode 100644 index 0000000..48ba6f4 --- /dev/null +++ b/templates/insertAll.d.ts @@ -0,0 +1,7 @@ +import { List } from './$types'; + +export function $( + index: number, + values: List, + list: List, +): (T | U)[]; diff --git a/templates/insertAll.md b/templates/insertAll.md new file mode 100644 index 0000000..5b55a62 --- /dev/null +++ b/templates/insertAll.md @@ -0,0 +1,16 @@ +Inserts the sub-list into the list, at the specified `index`. _Note that this is not +destructive_: it returns a copy of the list with the changes. +No lists have been harmed in the application of this function. + +@func +@memberOf R +@since v0.9.0 +@category List +@sig Number -> [a] -> [a] -> [a] +@param {Number} index The position to insert the sub-list +@param {Array} elts The sub-list to insert into the Array +@param {Array} list The list to insert the sub-list into +@return {Array} A new Array with `elts` inserted starting at `index`. +@example + + R.insertAll(2, ['x','y','z'], [1,2,3,4]); //=> [1,2,'x','y','z',3,4] diff --git a/templates/intersection.d.ts b/templates/intersection.d.ts new file mode 100644 index 0000000..29943c3 --- /dev/null +++ b/templates/intersection.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(a: List, b: List): T[]; diff --git a/templates/intersection.md b/templates/intersection.md new file mode 100644 index 0000000..63cf757 --- /dev/null +++ b/templates/intersection.md @@ -0,0 +1,15 @@ +Combines two lists into a set (i.e. no duplicates) composed of those +elements common to both lists. + +@func +@memberOf R +@since v0.1.0 +@category Relation +@sig [*] -> [*] -> [*] +@param {Array} list1 The first list. +@param {Array} list2 The second list. +@return {Array} The list of elements found in both `list1` and `list2`. +@see R.innerJoin +@example + + R.intersection([1,2,3,4], [7,6,5,4,3]); //=> [4, 3] diff --git a/templates/intersectionWith.d.ts b/templates/intersectionWith.d.ts new file mode 100644 index 0000000..5dbd900 --- /dev/null +++ b/templates/intersectionWith.d.ts @@ -0,0 +1,3 @@ +import { Comparator, List } from './$types'; + +export function $(fn: Comparator, a: List, b: List): T[]; diff --git a/templates/intersectionWith.md b/templates/intersectionWith.md new file mode 100644 index 0000000..e7a1f0a --- /dev/null +++ b/templates/intersectionWith.md @@ -0,0 +1,34 @@ +Combines two lists into a set (i.e. no duplicates) composed of those +elements common to both lists. Duplication is determined according to the +value returned by applying the supplied predicate to two list elements. + +@func +@memberOf R +@since v0.1.0 +@category Relation +@sig ((a, a) -> Boolean) -> [a] -> [a] -> [a] +@param {Function} pred A predicate function that determines whether + the two supplied elements are equal. +@param {Array} list1 One list of items to compare +@param {Array} list2 A second list of items to compare +@return {Array} A new list containing those elements common to both lists. +@see R.innerJoin +@deprecated since v0.24.0 +@example + + var buffaloSpringfield = [ + {id: 824, name: 'Richie Furay'}, + {id: 956, name: 'Dewey Martin'}, + {id: 313, name: 'Bruce Palmer'}, + {id: 456, name: 'Stephen Stills'}, + {id: 177, name: 'Neil Young'} + ]; + var csny = [ + {id: 204, name: 'David Crosby'}, + {id: 456, name: 'Stephen Stills'}, + {id: 539, name: 'Graham Nash'}, + {id: 177, name: 'Neil Young'} + ]; + + R.intersectionWith(R.eqBy(R.prop('id')), buffaloSpringfield, csny); + //=> [{id: 456, name: 'Stephen Stills'}, {id: 177, name: 'Neil Young'}] diff --git a/templates/intersperse.d.ts b/templates/intersperse.d.ts new file mode 100644 index 0000000..921d420 --- /dev/null +++ b/templates/intersperse.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(separator: T, list: List): (T | U)[]; diff --git a/templates/intersperse.md b/templates/intersperse.md new file mode 100644 index 0000000..8a552b9 --- /dev/null +++ b/templates/intersperse.md @@ -0,0 +1,15 @@ +Creates a new list with the separator interposed between elements. + +Dispatches to the `intersperse` method of the second argument, if present. + +@func +@memberOf R +@since v0.14.0 +@category List +@sig a -> [a] -> [a] +@param {*} separator The element to add to the list. +@param {Array} list The list to be interposed. +@return {Array} The new list. +@example + + R.intersperse('n', ['ba', 'a', 'a']); //=> ['ba', 'n', 'a', 'n', 'a'] diff --git a/templates/into.d.ts b/templates/into.d.ts new file mode 100644 index 0000000..9352d02 --- /dev/null +++ b/templates/into.d.ts @@ -0,0 +1,30 @@ +import { Morphism, Reduced, Transformer } from './$types'; + +// NOTE: morphism transducer is just a fake type for built-in transformer: R.take, R.drop, etc. +export function $transformer( + initial: Transformer, + transducer: + | Morphism + | (( + transformer: Transformer, + ) => (accumulator: U, value: T) => U | Reduced), + values: T[], +): U; +export function $base( + initial: V, + transducer: + | Morphism + | (( + transformer: Transformer, + ) => (accumulator: V, value: T) => V | Reduced), + values: T[], +): V; +export function $mixed( + initial: Transformer | U, + transducer: + | Morphism + | (( + transformer: Transformer, + ) => (accumulator: U, value: T) => U | Reduced), + values: T[], +): U; diff --git a/templates/into.md b/templates/into.md new file mode 100644 index 0000000..2bef42a --- /dev/null +++ b/templates/into.md @@ -0,0 +1,36 @@ +Transforms the items of the list with the transducer and appends the +transformed items to the accumulator using an appropriate iterator function +based on the accumulator type. + +The accumulator can be an array, string, object or a transformer. Iterated +items will be appended to arrays and concatenated to strings. Objects will +be merged directly or 2-item arrays will be merged as key, value pairs. + +The accumulator can also be a transformer object that provides a 2-arity +reducing iterator function, step, 0-arity initial value function, init, and +1-arity result extraction function result. The step function is used as the +iterator function in reduce. The result function is used to convert the +final accumulator into the return type and in most cases is R.identity. The +init function is used to provide the initial accumulator. + +The iteration is performed with [`R.reduce`](#reduce) after initializing the +transducer. + +@func +@memberOf R +@since v0.12.0 +@category List +@sig a -> (b -> b) -> [c] -> a +@param {*} acc The initial accumulator value. +@param {Function} xf The transducer function. Receives a transformer and returns a transformer. +@param {Array} list The list to iterate over. +@return {*} The final, accumulated value. +@example + + var numbers = [1, 2, 3, 4]; + var transducer = R.compose(R.map(R.add(1)), R.take(2)); + + R.into([], transducer, numbers); //=> [2, 3] + + var intoArray = R.into([]); + intoArray(transducer, numbers); //=> [2, 3] diff --git a/templates/invert.d.ts b/templates/invert.d.ts new file mode 100644 index 0000000..a943c13 --- /dev/null +++ b/templates/invert.d.ts @@ -0,0 +1,3 @@ +import { Dictionary } from './$types'; + +export function $(object: Dictionary): Dictionary; diff --git a/templates/invert.md b/templates/invert.md new file mode 100644 index 0000000..671e4d8 --- /dev/null +++ b/templates/invert.md @@ -0,0 +1,20 @@ +Same as [`R.invertObj`](#invertObj), however this accounts for objects with +duplicate values by putting the values into an array. + +@func +@memberOf R +@since v0.9.0 +@category Object +@sig {s: x} -> {x: [ s, ... ]} +@param {Object} obj The object or array to invert +@return {Object} out A new object with keys in an array. +@see R.invertObj +@example + + var raceResultsByFirstName = { + first: 'alice', + second: 'jake', + third: 'alice', + }; + R.invert(raceResultsByFirstName); + //=> { 'alice': ['first', 'third'], 'jake':['second'] } diff --git a/templates/invertObj.d.ts b/templates/invertObj.d.ts new file mode 100644 index 0000000..584078f --- /dev/null +++ b/templates/invertObj.d.ts @@ -0,0 +1,3 @@ +import { Dictionary } from './$types'; + +export function $(object: Dictionary): Dictionary; diff --git a/templates/invertObj.md b/templates/invertObj.md new file mode 100644 index 0000000..7d9bcac --- /dev/null +++ b/templates/invertObj.md @@ -0,0 +1,25 @@ +Returns a new object with the keys of the given object as values, and the +values of the given object, which are coerced to strings, as keys. Note +that the last key found is preferred when handling the same value. + +@func +@memberOf R +@since v0.9.0 +@category Object +@sig {s: x} -> {x: s} +@param {Object} obj The object or array to invert +@return {Object} out A new object +@see R.invert +@example + + var raceResults = { + first: 'alice', + second: 'jake' + }; + R.invertObj(raceResults); + //=> { 'alice': 'first', 'jake':'second' } + + // Alternatively: + var raceResults = ['alice', 'jake']; + R.invertObj(raceResults); + //=> { 'alice': '0', 'jake':'1' } diff --git a/templates/invoker.c.ts b/templates/invoker.c.ts new file mode 100644 index 0000000..d10219c --- /dev/null +++ b/templates/invoker.c.ts @@ -0,0 +1,31 @@ +import { max_curry_level } from './$curriedFunctions'; +import { create_n_ary_declarations } from './utils/create-n-ary-declarations'; + +export default create_n_ary_declarations( + 0, + max_curry_level - 1, + args => ` + function $${args.curry_level}arity<${[ + 'N extends string', + 'V extends Record', + ...args.generics, + ].join(',')}>( + arity: ${args.curry_level}, + method: N + ): CurriedFunction${args.curry_level + 1}<${[ + ...args.types, + 'V', + args.return_type, + ].join(',')}>; + `, + args => ` + import {${args.curry_levels + .map(i => `CurriedFunction${i + 1}`) + .join(',')}} from './$curriedFunctions'; + import {Property, Variadic} from './$types'; + function $variadic( + arity: number, + method: N + ): Variadic<${args.return_type}>; + `, +); diff --git a/templates/invoker.md b/templates/invoker.md new file mode 100644 index 0000000..8a58306 --- /dev/null +++ b/templates/invoker.md @@ -0,0 +1,25 @@ +Turns a named method with a specified arity into a function that can be +called directly supplied with arguments and a target object. + +The returned function is curried and accepts `arity + 1` parameters where +the final parameter is the target object. + +@func +@memberOf R +@since v0.1.0 +@category Function +@sig Number -> String -> (a -> b -> ... -> n -> Object -> *) +@param {Number} arity Number of arguments the returned function should take + before the target object. +@param {String} method Name of the method to call. +@return {Function} A new curried function. +@see R.construct +@example + + var sliceFrom = R.invoker(1, 'slice'); + sliceFrom(6, 'abcdefghijklm'); //=> 'ghijklm' + var sliceFrom6 = R.invoker(2, 'slice')(6); + sliceFrom6(8, 'abcdefghijklm'); //=> 'gh' +@symb R.invoker(0, 'method')(o) = o['method']() +@symb R.invoker(1, 'method')(a, o) = o['method'](a) +@symb R.invoker(2, 'method')(a, b, o) = o['method'](a, b) diff --git a/templates/is.d.ts b/templates/is.d.ts new file mode 100644 index 0000000..9d8f580 --- /dev/null +++ b/templates/is.d.ts @@ -0,0 +1,3 @@ +import { Constructor } from './$types'; + +export function $(constructor: Constructor, value: any): value is T; diff --git a/templates/is.md b/templates/is.md new file mode 100644 index 0000000..3066e84 --- /dev/null +++ b/templates/is.md @@ -0,0 +1,21 @@ +See if an object (`val`) is an instance of the supplied constructor. This +function will check up the inheritance chain, if any. + +@func +@memberOf R +@since v0.3.0 +@category Type +@sig (* -> {*}) -> a -> Boolean +@param {Object} ctor A constructor +@param {*} val The value to test +@return {Boolean} +@example + + R.is(Object, {}); //=> true + R.is(Number, 1); //=> true + R.is(Object, 1); //=> false + R.is(String, 's'); //=> true + R.is(String, new String('')); //=> true + R.is(Object, new String('')); //=> true + R.is(Object, 's'); //=> false + R.is(Number, {}); //=> false diff --git a/templates/isEmpty.d.ts b/templates/isEmpty.d.ts new file mode 100644 index 0000000..82e2221 --- /dev/null +++ b/templates/isEmpty.d.ts @@ -0,0 +1 @@ +export function $(value: any): boolean; diff --git a/templates/isEmpty.md b/templates/isEmpty.md new file mode 100644 index 0000000..eef1a49 --- /dev/null +++ b/templates/isEmpty.md @@ -0,0 +1,19 @@ +Returns `true` if the given value is its type's empty value; `false` +otherwise. + +@func +@memberOf R +@since v0.1.0 +@category Logic +@sig a -> Boolean +@param {*} x +@return {Boolean} +@see R.empty +@example + + R.isEmpty([1, 2, 3]); //=> false + R.isEmpty([]); //=> true + R.isEmpty(''); //=> true + R.isEmpty(null); //=> false + R.isEmpty({}); //=> true + R.isEmpty({length: 0}); //=> false diff --git a/templates/isNil.d.ts b/templates/isNil.d.ts new file mode 100644 index 0000000..78219f0 --- /dev/null +++ b/templates/isNil.d.ts @@ -0,0 +1 @@ +export function $(value: any): value is null | undefined; diff --git a/templates/isNil.md b/templates/isNil.md new file mode 100644 index 0000000..615543c --- /dev/null +++ b/templates/isNil.md @@ -0,0 +1,15 @@ +Checks if the input value is `null` or `undefined`. + +@func +@memberOf R +@since v0.9.0 +@category Type +@sig * -> Boolean +@param {*} x The value to test. +@return {Boolean} `true` if `x` is `undefined` or `null`, otherwise `false`. +@example + + R.isNil(null); //=> true + R.isNil(undefined); //=> true + R.isNil(0); //=> false + R.isNil([]); //=> false diff --git a/templates/join.d.ts b/templates/join.d.ts new file mode 100644 index 0000000..d220da3 --- /dev/null +++ b/templates/join.d.ts @@ -0,0 +1 @@ +export function $(separator: string, list: any[]): string; diff --git a/templates/join.md b/templates/join.md new file mode 100644 index 0000000..08c0624 --- /dev/null +++ b/templates/join.md @@ -0,0 +1,17 @@ +Returns a string made by inserting the `separator` between each element and +concatenating all the elements into a single string. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig String -> [a] -> String +@param {Number|String} separator The string used to separate the elements. +@param {Array} xs The elements to join into a string. +@return {String} str The string made by concatenating `xs` with `separator`. +@see R.split +@example + + var spacer = R.join(' '); + spacer(['a', 2, 3.4]); //=> 'a 2 3.4' + R.join('|', [1, 2, 3]); //=> '1|2|3' diff --git a/templates/juxt.d.ts b/templates/juxt.d.ts new file mode 100644 index 0000000..1595fe6 --- /dev/null +++ b/templates/juxt.d.ts @@ -0,0 +1,3 @@ +import { TypedVariadic } from './$types'; + +export function $(fns: TypedVariadic[]): TypedVariadic; diff --git a/templates/juxt.md b/templates/juxt.md new file mode 100644 index 0000000..50a6f87 --- /dev/null +++ b/templates/juxt.md @@ -0,0 +1,15 @@ +juxt applies a list of functions to a list of values. + +@func +@memberOf R +@since v0.19.0 +@category Function +@sig [(a, b, ..., m) -> n] -> ((a, b, ..., m) -> [n]) +@param {Array} fns An array of functions +@return {Function} A function that returns a list of values after applying each of the original `fns` to its parameters. +@see R.applySpec +@example + + var getRange = R.juxt([Math.min, Math.max]); + getRange(3, 4, 9, -3); //=> [-3, 9] +@symb R.juxt([f, g, h])(a, b) = [f(a, b), g(a, b), h(a, b)] diff --git a/templates/keys.d.ts b/templates/keys.d.ts new file mode 100644 index 0000000..6a23608 --- /dev/null +++ b/templates/keys.d.ts @@ -0,0 +1 @@ +export function $(object: T): K[]; diff --git a/templates/keys.md b/templates/keys.md new file mode 100644 index 0000000..2ef9c8e --- /dev/null +++ b/templates/keys.md @@ -0,0 +1,16 @@ +Returns a list containing the names of all the enumerable own properties of +the supplied object. +Note that the order of the output array is not guaranteed to be consistent +across different JS platforms. + +@func +@memberOf R +@since v0.1.0 +@category Object +@sig {k: v} -> [k] +@param {Object} obj The object to extract properties from +@return {Array} An array of the object's own properties. +@see R.keysIn, R.values +@example + + R.keys({a: 1, b: 2, c: 3}); //=> ['a', 'b', 'c'] diff --git a/templates/keysIn.d.ts b/templates/keysIn.d.ts new file mode 100644 index 0000000..6a23608 --- /dev/null +++ b/templates/keysIn.d.ts @@ -0,0 +1 @@ +export function $(object: T): K[]; diff --git a/templates/keysIn.md b/templates/keysIn.md new file mode 100644 index 0000000..75d2c9c --- /dev/null +++ b/templates/keysIn.md @@ -0,0 +1,19 @@ +Returns a list containing the names of all the properties of the supplied +object, including prototype properties. +Note that the order of the output array is not guaranteed to be consistent +across different JS platforms. + +@func +@memberOf R +@since v0.2.0 +@category Object +@sig {k: v} -> [k] +@param {Object} obj The object to extract properties from +@return {Array} An array of the object's own and prototype properties. +@see R.keys, R.valuesIn +@example + + var F = function() { this.x = 'X'; }; + F.prototype.y = 'Y'; + var f = new F(); + R.keysIn(f); //=> ['x', 'y'] diff --git a/templates/last.d.ts b/templates/last.d.ts new file mode 100644 index 0000000..ae0a4ba --- /dev/null +++ b/templates/last.d.ts @@ -0,0 +1,4 @@ +import { List } from './$types'; + +export function $string(str: string): string; +export function $general>(list: T): T[number] | undefined; diff --git a/templates/last.md b/templates/last.md new file mode 100644 index 0000000..df8a961 --- /dev/null +++ b/templates/last.md @@ -0,0 +1,18 @@ +Returns the last element of the given list or string. + +@func +@memberOf R +@since v0.1.4 +@category List +@sig [a] -> a | Undefined +@sig String -> String +@param {*} list +@return {*} +@see R.init, R.head, R.tail +@example + + R.last(['fi', 'fo', 'fum']); //=> 'fum' + R.last([]); //=> undefined + + R.last('abc'); //=> 'c' + R.last(''); //=> '' diff --git a/templates/lastIndexOf.d.ts b/templates/lastIndexOf.d.ts new file mode 100644 index 0000000..af21c44 --- /dev/null +++ b/templates/lastIndexOf.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(target: T, list: List): number; diff --git a/templates/lastIndexOf.md b/templates/lastIndexOf.md new file mode 100644 index 0000000..daa133e --- /dev/null +++ b/templates/lastIndexOf.md @@ -0,0 +1,17 @@ +Returns the position of the last occurrence of an item in an array, or -1 if +the item is not included in the array. [`R.equals`](#equals) is used to +determine equality. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig a -> [a] -> Number +@param {*} target The item to find. +@param {Array} xs The array to search in. +@return {Number} the index of the target, or -1 if the target is not found. +@see R.indexOf +@example + + R.lastIndexOf(3, [-1,3,3,0,1,2,3,4]); //=> 6 + R.lastIndexOf(10, [1,2,3,4]); //=> -1 diff --git a/templates/length.d.ts b/templates/length.d.ts new file mode 100644 index 0000000..07f0622 --- /dev/null +++ b/templates/length.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(list: List): number; diff --git a/templates/length.md b/templates/length.md new file mode 100644 index 0000000..89940b3 --- /dev/null +++ b/templates/length.md @@ -0,0 +1,13 @@ +Returns the number of elements in the array by returning `list.length`. + +@func +@memberOf R +@since v0.3.0 +@category List +@sig [a] -> Number +@param {Array} list The array to inspect. +@return {Number} The length of the array. +@example + + R.length([]); //=> 0 + R.length([1, 2, 3]); //=> 3 diff --git a/templates/lens.d.ts b/templates/lens.d.ts new file mode 100644 index 0000000..21696a0 --- /dev/null +++ b/templates/lens.d.ts @@ -0,0 +1,6 @@ +import { ManualLens } from './$types'; + +export function $( + getter: (target: U) => T, + setter: (focus: T, target: U) => U, +): ManualLens; diff --git a/templates/lens.md b/templates/lens.md new file mode 100644 index 0000000..b939941 --- /dev/null +++ b/templates/lens.md @@ -0,0 +1,21 @@ +Returns a lens for the given getter and setter functions. The getter "gets" +the value of the focus; the setter "sets" the value of the focus. The setter +should not mutate the data structure. + +@func +@memberOf R +@since v0.8.0 +@category Object +@typedefn Lens s a = Functor f => (a -> f a) -> s -> f s +@sig (s -> a) -> ((a, s) -> s) -> Lens s a +@param {Function} getter +@param {Function} setter +@return {Lens} +@see R.view, R.set, R.over, R.lensIndex, R.lensProp +@example + + var xLens = R.lens(R.prop('x'), R.assoc('x')); + + R.view(xLens, {x: 1, y: 2}); //=> 1 + R.set(xLens, 4, {x: 1, y: 2}); //=> {x: 4, y: 2} + R.over(xLens, R.negate, {x: 1, y: 2}); //=> {x: -1, y: 2} diff --git a/templates/lensIndex.d.ts b/templates/lensIndex.d.ts new file mode 100644 index 0000000..7a9125e --- /dev/null +++ b/templates/lensIndex.d.ts @@ -0,0 +1,3 @@ +import { List, PseudoLens } from './$types'; + +export function $(index: N): PseudoLens; diff --git a/templates/lensIndex.md b/templates/lensIndex.md new file mode 100644 index 0000000..cd96e86 --- /dev/null +++ b/templates/lensIndex.md @@ -0,0 +1,18 @@ +Returns a lens whose focus is the specified index. + +@func +@memberOf R +@since v0.14.0 +@category Object +@typedefn Lens s a = Functor f => (a -> f a) -> s -> f s +@sig Number -> Lens s a +@param {Number} n +@return {Lens} +@see R.view, R.set, R.over +@example + + var headLens = R.lensIndex(0); + + R.view(headLens, ['a', 'b', 'c']); //=> 'a' + R.set(headLens, 'x', ['a', 'b', 'c']); //=> ['x', 'b', 'c'] + R.over(headLens, R.toUpper, ['a', 'b', 'c']); //=> ['A', 'b', 'c'] diff --git a/templates/lensPath.d.ts b/templates/lensPath.d.ts new file mode 100644 index 0000000..3577220 --- /dev/null +++ b/templates/lensPath.d.ts @@ -0,0 +1,3 @@ +import { ManualLens, Path } from './$types'; + +export function $(path: Path): ManualLens; diff --git a/templates/lensPath.md b/templates/lensPath.md new file mode 100644 index 0000000..23b326e --- /dev/null +++ b/templates/lensPath.md @@ -0,0 +1,22 @@ +Returns a lens whose focus is the specified path. + +@func +@memberOf R +@since v0.19.0 +@category Object +@typedefn Idx = String | Int +@typedefn Lens s a = Functor f => (a -> f a) -> s -> f s +@sig [Idx] -> Lens s a +@param {Array} path The path to use. +@return {Lens} +@see R.view, R.set, R.over +@example + + var xHeadYLens = R.lensPath(['x', 0, 'y']); + + R.view(xHeadYLens, {x: [{y: 2, z: 3}, {y: 4, z: 5}]}); + //=> 2 + R.set(xHeadYLens, 1, {x: [{y: 2, z: 3}, {y: 4, z: 5}]}); + //=> {x: [{y: 1, z: 3}, {y: 4, z: 5}]} + R.over(xHeadYLens, R.negate, {x: [{y: 2, z: 3}, {y: 4, z: 5}]}); + //=> {x: [{y: -2, z: 3}, {y: 4, z: 5}]} diff --git a/templates/lensProp.d.ts b/templates/lensProp.d.ts new file mode 100644 index 0000000..4e92237 --- /dev/null +++ b/templates/lensProp.d.ts @@ -0,0 +1,4 @@ +import { ManualLens, Property, PseudoLens } from './$types'; + +export function $key(property: K): PseudoLens; +export function $general(property: Property): ManualLens; diff --git a/templates/lensProp.md b/templates/lensProp.md new file mode 100644 index 0000000..32ef99d --- /dev/null +++ b/templates/lensProp.md @@ -0,0 +1,18 @@ +Returns a lens whose focus is the specified property. + +@func +@memberOf R +@since v0.14.0 +@category Object +@typedefn Lens s a = Functor f => (a -> f a) -> s -> f s +@sig String -> Lens s a +@param {String} k +@return {Lens} +@see R.view, R.set, R.over +@example + + var xLens = R.lensProp('x'); + + R.view(xLens, {x: 1, y: 2}); //=> 1 + R.set(xLens, 4, {x: 1, y: 2}); //=> {x: 4, y: 2} + R.over(xLens, R.negate, {x: 1, y: 2}); //=> {x: -1, y: 2} diff --git a/templates/lift.c.ts b/templates/lift.c.ts new file mode 100644 index 0000000..2ebb43e --- /dev/null +++ b/templates/lift.c.ts @@ -0,0 +1,24 @@ +import { max_curry_level } from './$curriedFunctions'; +import { create_n_ary_declarations } from './utils/create-n-ary-declarations'; + +export default create_n_ary_declarations( + 0, + max_curry_level, + args => ` + function $${args.curry_level}arity<${args.generics.join(',')}>( + fn: (${args.parameters.join(',')}) => ${args.return_type} + ): CurriedFunction${args.curry_level}<${[ + ...args.types.map(type => `List<${type}>`), + `${args.return_type}[]`, + ].join(',')}>; + `, + args => ` + import {${args.curry_levels + .map(i => `CurriedFunction${i}`) + .join(',')}} from './$curriedFunctions'; + import {List, Variadic} from './$types'; + function $variadic<${args.return_type}>( + fn: Variadic<${args.return_type}> + ): Variadic<${args.return_type}[]>; + `, +); diff --git a/templates/lift.md b/templates/lift.md new file mode 100644 index 0000000..3d00069 --- /dev/null +++ b/templates/lift.md @@ -0,0 +1,20 @@ +"lifts" a function of arity > 1 so that it may "map over" a list, Function or other +object that satisfies the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply). + +@func +@memberOf R +@since v0.7.0 +@category Function +@sig (*... -> *) -> ([*]... -> [*]) +@param {Function} fn The function to lift into higher context +@return {Function} The lifted function. +@see R.liftN +@example + + var madd3 = R.lift((a, b, c) => a + b + c); + + madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7] + + var madd5 = R.lift((a, b, c, d, e) => a + b + c + d + e); + + madd5([1,2], [3], [4, 5], [6], [7, 8]); //=> [21, 22, 22, 23, 22, 23, 23, 24] diff --git a/templates/liftN.c.ts b/templates/liftN.c.ts new file mode 100644 index 0000000..46ac704 --- /dev/null +++ b/templates/liftN.c.ts @@ -0,0 +1,28 @@ +import { max_curry_level } from './$curriedFunctions'; +import { create_n_ary_declarations } from './utils/create-n-ary-declarations'; + +export default create_n_ary_declarations( + 0, + max_curry_level, + args => ` + function $${args.curry_level}arity<${args.generics.join(',')}>( + n: ${args.curry_level}, + fn: (${[...args.parameters, '...args: any[]'].join( + ',', + )}) => ${args.return_type} + ): CurriedFunction${args.curry_level}<${[ + ...args.types.map(type => `List<${type}>`), + `${args.return_type}[]`, + ].join(',')}>; + `, + args => ` + import {${args.curry_levels + .map(i => `CurriedFunction${i}`) + .join(',')}} from './$curriedFunctions'; + import {List, Variadic} from './$types'; + function $variadic<${args.return_type}>( + n: number, + fn: Variadic<${args.return_type}> + ): Variadic<${args.return_type}[]>; + `, +); diff --git a/templates/liftN.md b/templates/liftN.md new file mode 100644 index 0000000..0275b0c --- /dev/null +++ b/templates/liftN.md @@ -0,0 +1,15 @@ +"lifts" a function to be the specified arity, so that it may "map over" that +many lists, Functions or other objects that satisfy the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply). + +@func +@memberOf R +@since v0.7.0 +@category Function +@sig Number -> (*... -> *) -> ([*]... -> [*]) +@param {Function} fn The function to lift into higher context +@return {Function} The lifted function. +@see R.lift, R.ap +@example + + var madd3 = R.liftN(3, (...args) => R.sum(args)); + madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7] diff --git a/templates/lt.d.ts b/templates/lt.d.ts new file mode 100644 index 0000000..9c75807 --- /dev/null +++ b/templates/lt.d.ts @@ -0,0 +1,3 @@ +import { Ordered } from './$types'; + +export function $(a: T, b: T): boolean; diff --git a/templates/lt.md b/templates/lt.md new file mode 100644 index 0000000..519bb8e --- /dev/null +++ b/templates/lt.md @@ -0,0 +1,19 @@ +Returns `true` if the first argument is less than the second; `false` +otherwise. + +@func +@memberOf R +@since v0.1.0 +@category Relation +@sig Ord a => a -> a -> Boolean +@param {*} a +@param {*} b +@return {Boolean} +@see R.gt +@example + + R.lt(2, 1); //=> false + R.lt(2, 2); //=> false + R.lt(2, 3); //=> true + R.lt('a', 'z'); //=> true + R.lt('z', 'a'); //=> false diff --git a/templates/lte.d.ts b/templates/lte.d.ts new file mode 100644 index 0000000..9c75807 --- /dev/null +++ b/templates/lte.d.ts @@ -0,0 +1,3 @@ +import { Ordered } from './$types'; + +export function $(a: T, b: T): boolean; diff --git a/templates/lte.md b/templates/lte.md new file mode 100644 index 0000000..1015a2a --- /dev/null +++ b/templates/lte.md @@ -0,0 +1,19 @@ +Returns `true` if the first argument is less than or equal to the second; +`false` otherwise. + +@func +@memberOf R +@since v0.1.0 +@category Relation +@sig Ord a => a -> a -> Boolean +@param {Number} a +@param {Number} b +@return {Boolean} +@see R.gte +@example + + R.lte(2, 1); //=> false + R.lte(2, 2); //=> true + R.lte(2, 3); //=> true + R.lte('a', 'z'); //=> true + R.lte('z', 'a'); //=> false diff --git a/templates/map.d.ts b/templates/map.d.ts new file mode 100644 index 0000000..a5e7565 --- /dev/null +++ b/templates/map.d.ts @@ -0,0 +1,15 @@ +import { Functor, List, Morphism } from './$types'; + +export function $list(fn: Morphism, list: List): U[]; +export function $functor( + fn: Morphism, + functor: Functor, +): Functor; +export function $object( + fn: Morphism, + object: Record, +): Record; +export function $mixed( + fn: Morphism, + target: List | Functor | Record, +): U[] | Functor | Record; diff --git a/templates/map.md b/templates/map.md new file mode 100644 index 0000000..d09dc2c --- /dev/null +++ b/templates/map.md @@ -0,0 +1,33 @@ +Takes a function and +a [functor](https://github.com/fantasyland/fantasy-land#functor), +applies the function to each of the functor's values, and returns +a functor of the same shape. + +Ramda provides suitable `map` implementations for `Array` and `Object`, +so this function may be applied to `[1, 2, 3]` or `{x: 1, y: 2, z: 3}`. + +Dispatches to the `map` method of the second argument, if present. + +Acts as a transducer if a transformer is given in list position. + +Also treats functions as functors and will compose them together. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig Functor f => (a -> b) -> f a -> f b +@param {Function} fn The function to be called on every element of the input `list`. +@param {Array} list The list to be iterated over. +@return {Array} The new list. +@see R.transduce, R.addIndex +@example + + var double = x => x * 2; + + R.map(double, [1, 2, 3]); //=> [2, 4, 6] + + R.map(double, {x: 1, y: 2, z: 3}); //=> {x: 2, y: 4, z: 6} +@symb R.map(f, [a, b]) = [f(a), f(b)] +@symb R.map(f, { x: a, y: b }) = { x: f(a), y: f(b) } +@symb R.map(f, functor_o) = functor_o.map(f) diff --git a/templates/mapAccum.d.ts b/templates/mapAccum.d.ts new file mode 100644 index 0000000..7ca47d3 --- /dev/null +++ b/templates/mapAccum.d.ts @@ -0,0 +1,7 @@ +import { List } from './$types'; + +export function $( + fn: (accumulator: U, value: T) => [U, R], + initial: U, + list: List, +): [U, R[]]; diff --git a/templates/mapAccum.md b/templates/mapAccum.md new file mode 100644 index 0000000..b729f92 --- /dev/null +++ b/templates/mapAccum.md @@ -0,0 +1,32 @@ +The `mapAccum` function behaves like a combination of map and reduce; it +applies a function to each element of a list, passing an accumulating +parameter from left to right, and returning a final value of this +accumulator together with the new list. + +The iterator function receives two arguments, *acc* and *value*, and should +return a tuple *[acc, value]*. + +@func +@memberOf R +@since v0.10.0 +@category List +@sig (acc -> x -> (acc, y)) -> acc -> [x] -> (acc, [y]) +@param {Function} fn The function to be called on every element of the input `list`. +@param {*} acc The accumulator value. +@param {Array} list The list to iterate over. +@return {*} The final, accumulated value. +@see R.addIndex, R.mapAccumRight +@example + + var digits = ['1', '2', '3', '4']; + var appender = (a, b) => [a + b, a + b]; + + R.mapAccum(appender, 0, digits); //=> ['01234', ['01', '012', '0123', '01234']] +@symb R.mapAccum(f, a, [b, c, d]) = [ + f(f(f(a, b)[0], c)[0], d)[0], + [ + f(a, b)[1], + f(f(a, b)[0], c)[1], + f(f(f(a, b)[0], c)[0], d)[1] + ] +] diff --git a/templates/mapAccumRight.d.ts b/templates/mapAccumRight.d.ts new file mode 100644 index 0000000..5ba8685 --- /dev/null +++ b/templates/mapAccumRight.d.ts @@ -0,0 +1,7 @@ +import { List } from './$types'; + +export function $( + fn: (value: T, accumulator: U) => [R, U], + initial: U, + list: List, +): [R[], U]; diff --git a/templates/mapAccumRight.md b/templates/mapAccumRight.md new file mode 100644 index 0000000..d1a5b08 --- /dev/null +++ b/templates/mapAccumRight.md @@ -0,0 +1,35 @@ +The `mapAccumRight` function behaves like a combination of map and reduce; it +applies a function to each element of a list, passing an accumulating +parameter from right to left, and returning a final value of this +accumulator together with the new list. + +Similar to [`mapAccum`](#mapAccum), except moves through the input list from +the right to the left. + +The iterator function receives two arguments, *value* and *acc*, and should +return a tuple *[value, acc]*. + +@func +@memberOf R +@since v0.10.0 +@category List +@sig (x-> acc -> (y, acc)) -> acc -> [x] -> ([y], acc) +@param {Function} fn The function to be called on every element of the input `list`. +@param {*} acc The accumulator value. +@param {Array} list The list to iterate over. +@return {*} The final, accumulated value. +@see R.addIndex, R.mapAccum +@example + + var digits = ['1', '2', '3', '4']; + var append = (a, b) => [a + b, a + b]; + + R.mapAccumRight(append, 5, digits); //=> [['12345', '2345', '345', '45'], '12345'] +@symb R.mapAccumRight(f, a, [b, c, d]) = [ + [ + f(b, f(c, f(d, a)[0])[0])[1], + f(c, f(d, a)[0])[1], + f(d, a)[1], + ] + f(b, f(c, f(d, a)[0])[0])[0], +] diff --git a/templates/mapObjIndexed.d.ts b/templates/mapObjIndexed.d.ts new file mode 100644 index 0000000..72597e6 --- /dev/null +++ b/templates/mapObjIndexed.d.ts @@ -0,0 +1,6 @@ +import { KeyedObjectMorphism } from './$types'; + +export function $( + fn: KeyedObjectMorphism, + object: Record, +): Record; diff --git a/templates/mapObjIndexed.md b/templates/mapObjIndexed.md new file mode 100644 index 0000000..1a8ac49 --- /dev/null +++ b/templates/mapObjIndexed.md @@ -0,0 +1,19 @@ +An Object-specific version of [`map`](#map). The function is applied to three +arguments: *(value, key, obj)*. If only the value is significant, use +[`map`](#map) instead. + +@func +@memberOf R +@since v0.9.0 +@category Object +@sig ((*, String, Object) -> *) -> Object -> Object +@param {Function} fn +@param {Object} obj +@return {Object} +@see R.map +@example + + var values = { x: 1, y: 2, z: 3 }; + var prependKeyAndDouble = (num, key, obj) => key + (num * 2); + + R.mapObjIndexed(prependKeyAndDouble, values); //=> { x: 'x2', y: 'y4', z: 'z6' } diff --git a/templates/match.d.ts b/templates/match.d.ts new file mode 100644 index 0000000..dfdd7d8 --- /dev/null +++ b/templates/match.d.ts @@ -0,0 +1 @@ +export function $(regex: RegExp, str: string): string[]; diff --git a/templates/match.md b/templates/match.md new file mode 100644 index 0000000..ca9eac2 --- /dev/null +++ b/templates/match.md @@ -0,0 +1,19 @@ +Tests a regular expression against a String. Note that this function will +return an empty array when there are no matches. This differs from +[`String.prototype.match`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match) +which returns `null` when there are no matches. + +@func +@memberOf R +@since v0.1.0 +@category String +@sig RegExp -> String -> [String | Undefined] +@param {RegExp} rx A regular expression. +@param {String} str The string to match against +@return {Array} The list of matches or empty array. +@see R.test +@example + + R.match(/([a-z]a)/g, 'bananas'); //=> ['ba', 'na', 'na'] + R.match(/a/, 'b'); //=> [] + R.match(/a/, null); //=> TypeError: null does not have a method named "match" diff --git a/templates/mathMod.d.ts b/templates/mathMod.d.ts new file mode 100644 index 0000000..9e0dcbf --- /dev/null +++ b/templates/mathMod.d.ts @@ -0,0 +1 @@ +export function $(a: number, b: number): number; diff --git a/templates/mathMod.md b/templates/mathMod.md new file mode 100644 index 0000000..b7bf1fe --- /dev/null +++ b/templates/mathMod.md @@ -0,0 +1,31 @@ +`mathMod` behaves like the modulo operator should mathematically, unlike the +`%` operator (and by extension, [`R.modulo`](#modulo)). So while +`-17 % 5` is `-2`, `mathMod(-17, 5)` is `3`. `mathMod` requires Integer +arguments, and returns NaN when the modulus is zero or negative. + +@func +@memberOf R +@since v0.3.0 +@category Math +@sig Number -> Number -> Number +@param {Number} m The dividend. +@param {Number} p the modulus. +@return {Number} The result of `b mod a`. +@see R.modulo +@example + + R.mathMod(-17, 5); //=> 3 + R.mathMod(17, 5); //=> 2 + R.mathMod(17, -5); //=> NaN + R.mathMod(17, 0); //=> NaN + R.mathMod(17.2, 5); //=> NaN + R.mathMod(17, 5.3); //=> NaN + + var clock = R.mathMod(R.__, 12); + clock(15); //=> 3 + clock(24); //=> 0 + + var seventeenMod = R.mathMod(17); + seventeenMod(3); //=> 2 + seventeenMod(4); //=> 1 + seventeenMod(10); //=> 7 diff --git a/templates/max.d.ts b/templates/max.d.ts new file mode 100644 index 0000000..626ec3a --- /dev/null +++ b/templates/max.d.ts @@ -0,0 +1,3 @@ +import { Ordered } from './$types'; + +export function $(a: T, b: T): T; diff --git a/templates/max.md b/templates/max.md new file mode 100644 index 0000000..817fb06 --- /dev/null +++ b/templates/max.md @@ -0,0 +1,15 @@ +Returns the larger of its two arguments. + +@func +@memberOf R +@since v0.1.0 +@category Relation +@sig Ord a => a -> a -> a +@param {*} a +@param {*} b +@return {*} +@see R.maxBy, R.min +@example + + R.max(789, 123); //=> 789 + R.max('a', 'b'); //=> 'b' diff --git a/templates/maxBy.d.ts b/templates/maxBy.d.ts new file mode 100644 index 0000000..b5a9a16 --- /dev/null +++ b/templates/maxBy.d.ts @@ -0,0 +1,3 @@ +import { Morphism, Ordered } from './$types'; + +export function $(fn: Morphism, a: T, b: T): T; diff --git a/templates/maxBy.md b/templates/maxBy.md new file mode 100644 index 0000000..22d6deb --- /dev/null +++ b/templates/maxBy.md @@ -0,0 +1,22 @@ +Takes a function and two values, and returns whichever value produces the +larger result when passed to the provided function. + +@func +@memberOf R +@since v0.8.0 +@category Relation +@sig Ord b => (a -> b) -> a -> a -> a +@param {Function} f +@param {*} a +@param {*} b +@return {*} +@see R.max, R.minBy +@example + + // square :: Number -> Number + var square = n => n * n; + + R.maxBy(square, -3, 2); //=> -3 + + R.reduce(R.maxBy(square), 0, [3, -5, 4, 1, -2]); //=> -5 + R.reduce(R.maxBy(square), 0, []); //=> 0 diff --git a/templates/mean.d.ts b/templates/mean.d.ts new file mode 100644 index 0000000..9e5a54d --- /dev/null +++ b/templates/mean.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(numbers: List): number; diff --git a/templates/mean.md b/templates/mean.md new file mode 100644 index 0000000..64772d1 --- /dev/null +++ b/templates/mean.md @@ -0,0 +1,14 @@ +Returns the mean of the given list of numbers. + +@func +@memberOf R +@since v0.14.0 +@category Math +@sig [Number] -> Number +@param {Array} list +@return {Number} +@see R.median +@example + + R.mean([2, 7, 9]); //=> 6 + R.mean([]); //=> NaN diff --git a/templates/median.d.ts b/templates/median.d.ts new file mode 100644 index 0000000..9e5a54d --- /dev/null +++ b/templates/median.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(numbers: List): number; diff --git a/templates/median.md b/templates/median.md new file mode 100644 index 0000000..d28281a --- /dev/null +++ b/templates/median.md @@ -0,0 +1,15 @@ +Returns the median of the given list of numbers. + +@func +@memberOf R +@since v0.14.0 +@category Math +@sig [Number] -> Number +@param {Array} list +@return {Number} +@see R.mean +@example + + R.median([2, 9, 7]); //=> 7 + R.median([7, 2, 10, 9]); //=> 8 + R.median([]); //=> NaN diff --git a/templates/memoize.d.ts b/templates/memoize.d.ts new file mode 100644 index 0000000..f3ae017 --- /dev/null +++ b/templates/memoize.d.ts @@ -0,0 +1 @@ +export function $(fn: T): T; diff --git a/templates/memoize.md b/templates/memoize.md new file mode 100644 index 0000000..fa4b6a7 --- /dev/null +++ b/templates/memoize.md @@ -0,0 +1,25 @@ +Creates a new function that, when invoked, caches the result of calling `fn` +for a given argument set and returns the result. Subsequent calls to the +memoized `fn` with the same argument set will not result in an additional +call to `fn`; instead, the cached result for that set of arguments will be +returned. + +@func +@memberOf R +@since v0.1.0 +@category Function +@sig (*... -> a) -> (*... -> a) +@param {Function} fn The function to memoize. +@return {Function} Memoized version of `fn`. +@see R.memoizeWith +@example + + let count = 0; + const factorial = R.memoize(n => { + count += 1; + return R.product(R.range(1, n + 1)); + }); + factorial(5); //=> 120 + factorial(5); //=> 120 + factorial(5); //=> 120 + count; //=> 1 diff --git a/templates/memoizeWith.d.ts b/templates/memoizeWith.d.ts new file mode 100644 index 0000000..840911c --- /dev/null +++ b/templates/memoizeWith.d.ts @@ -0,0 +1,3 @@ +import { Property, Variadic } from './$types'; + +export function $(cacheKey: Variadic, fn: T): T; diff --git a/templates/memoizeWith.md b/templates/memoizeWith.md new file mode 100644 index 0000000..c55f5ee --- /dev/null +++ b/templates/memoizeWith.md @@ -0,0 +1,27 @@ +A customisable version of [`R.memoize`](#memoize). `memoizeWith` takes an +additional function that will be applied to a given argument set and used to +create the cache key under which the results of the function to be memoized +will be stored. Care must be taken when implementing key generation to avoid +clashes that may overwrite previous entries erroneously. + + +@func +@memberOf R +@since v0.24.0 +@category Function +@sig (*... -> String) -> (*... -> a) -> (*... -> a) +@param {Function} fn The function to generate the cache key. +@param {Function} fn The function to memoize. +@return {Function} Memoized version of `fn`. +@see R.memoize +@example + + let count = 0; + const factorial = R.memoizeWith(R.identity, n => { + count += 1; + return R.product(R.range(1, n + 1)); + }); + factorial(5); //=> 120 + factorial(5); //=> 120 + factorial(5); //=> 120 + count; //=> 1 diff --git a/templates/merge.d.ts b/templates/merge.d.ts new file mode 100644 index 0000000..466592e --- /dev/null +++ b/templates/merge.d.ts @@ -0,0 +1,3 @@ +import { Merge } from './$operation'; + +export function $(a: T, b: U): Merge; diff --git a/templates/merge.md b/templates/merge.md new file mode 100644 index 0000000..1216365 --- /dev/null +++ b/templates/merge.md @@ -0,0 +1,21 @@ +Create 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, +the value from the second object will be used. + +@func +@memberOf R +@since v0.1.0 +@category Object +@sig {k: v} -> {k: v} -> {k: v} +@param {Object} l +@param {Object} r +@return {Object} +@see R.mergeDeepRight, R.mergeWith, R.mergeWithKey +@example + + R.merge({ 'name': 'fred', 'age': 10 }, { 'age': 40 }); + //=> { 'name': 'fred', 'age': 40 } + + var resetToDefault = R.merge(R.__, {x: 0}); + resetToDefault({x: 5, y: 2}); //=> {x: 0, y: 2} +@symb R.merge({ x: 1, y: 2 }, { y: 5, z: 3 }) = { x: 1, y: 5, z: 3 } diff --git a/templates/mergeAll.d.ts b/templates/mergeAll.d.ts new file mode 100644 index 0000000..a49021a --- /dev/null +++ b/templates/mergeAll.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(list: List): object; diff --git a/templates/mergeAll.md b/templates/mergeAll.md new file mode 100644 index 0000000..7f13ffd --- /dev/null +++ b/templates/mergeAll.md @@ -0,0 +1,15 @@ +Merges a list of objects together into one object. + +@func +@memberOf R +@since v0.10.0 +@category List +@sig [{k: v}] -> {k: v} +@param {Array} list An array of objects +@return {Object} A merged object. +@see R.reduce +@example + + R.mergeAll([{foo:1},{bar:2},{baz:3}]); //=> {foo:1,bar:2,baz:3} + R.mergeAll([{foo:1},{foo:2},{bar:2}]); //=> {foo:2,bar:2} +@symb R.mergeAll([{ x: 1 }, { y: 2 }, { z: 3 }]) = { x: 1, y: 2, z: 3 } diff --git a/templates/mergeDeepLeft.d.ts b/templates/mergeDeepLeft.d.ts new file mode 100644 index 0000000..8567336 --- /dev/null +++ b/templates/mergeDeepLeft.d.ts @@ -0,0 +1 @@ +export function $(left: object, right: object): object; diff --git a/templates/mergeDeepLeft.md b/templates/mergeDeepLeft.md new file mode 100644 index 0000000..994cc25 --- /dev/null +++ b/templates/mergeDeepLeft.md @@ -0,0 +1,19 @@ +Creates 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: +- and both values are objects, the two values will be recursively merged +- otherwise the value from the first object will be used. + +@func +@memberOf R +@since v0.24.0 +@category Object +@sig {a} -> {a} -> {a} +@param {Object} lObj +@param {Object} rObj +@return {Object} +@see R.merge, R.mergeDeepRight, R.mergeDeepWith, R.mergeDeepWithKey +@example + + R.mergeDeepLeft({ name: 'fred', age: 10, contact: { email: 'moo@example.com' }}, + { age: 40, contact: { email: 'baa@example.com' }}); + //=> { name: 'fred', age: 10, contact: { email: 'moo@example.com' }} diff --git a/templates/mergeDeepRight.d.ts b/templates/mergeDeepRight.d.ts new file mode 100644 index 0000000..8567336 --- /dev/null +++ b/templates/mergeDeepRight.d.ts @@ -0,0 +1 @@ +export function $(left: object, right: object): object; diff --git a/templates/mergeDeepRight.md b/templates/mergeDeepRight.md new file mode 100644 index 0000000..95343ff --- /dev/null +++ b/templates/mergeDeepRight.md @@ -0,0 +1,19 @@ +Creates 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: +- and both values are objects, the two values will be recursively merged +- otherwise the value from the second object will be used. + +@func +@memberOf R +@since v0.24.0 +@category Object +@sig {a} -> {a} -> {a} +@param {Object} lObj +@param {Object} rObj +@return {Object} +@see R.merge, R.mergeDeepLeft, R.mergeDeepWith, R.mergeDeepWithKey +@example + + R.mergeDeepRight({ name: 'fred', age: 10, contact: { email: 'moo@example.com' }}, + { age: 40, contact: { email: 'baa@example.com' }}); + //=> { name: 'fred', age: 40, contact: { email: 'baa@example.com' }} diff --git a/templates/mergeDeepWith.d.ts b/templates/mergeDeepWith.d.ts new file mode 100644 index 0000000..d6d671b --- /dev/null +++ b/templates/mergeDeepWith.d.ts @@ -0,0 +1,5 @@ +export function $( + fn: (a: V, b: V) => any, + left: object, + right: object, +): object; diff --git a/templates/mergeDeepWith.md b/templates/mergeDeepWith.md new file mode 100644 index 0000000..24e58f3 --- /dev/null +++ b/templates/mergeDeepWith.md @@ -0,0 +1,25 @@ +Creates a new object with the own properties of the two provided objects. +If a key exists in both objects: +- and both associated values are also objects then the values will be + recursively merged. +- otherwise the provided function is applied to associated values using the + resulting value as the new value associated with the key. +If a key only exists in one object, the value will be associated with the key +of the resulting object. + +@func +@memberOf R +@since v0.24.0 +@category Object +@sig (a -> a -> a) -> {a} -> {a} -> {a} +@param {Function} fn +@param {Object} lObj +@param {Object} rObj +@return {Object} +@see R.mergeWith, R.mergeDeep, R.mergeDeepWithKey +@example + + R.mergeDeepWith(R.concat, + { a: true, c: { values: [10, 20] }}, + { b: true, c: { values: [15, 35] }}); + //=> { a: true, b: true, c: { values: [10, 20, 15, 35] }} diff --git a/templates/mergeDeepWithKey.d.ts b/templates/mergeDeepWithKey.d.ts new file mode 100644 index 0000000..bf71727 --- /dev/null +++ b/templates/mergeDeepWithKey.d.ts @@ -0,0 +1,5 @@ +export function $( + fn: (key: string, a: V, b: V) => any, + left: object, + right: object, +): object; diff --git a/templates/mergeDeepWithKey.md b/templates/mergeDeepWithKey.md new file mode 100644 index 0000000..ab8e83c --- /dev/null +++ b/templates/mergeDeepWithKey.md @@ -0,0 +1,26 @@ +Creates a new object with the own properties of the two provided objects. +If a key exists in both objects: +- and both associated values are also objects then the values will be + recursively merged. +- otherwise the provided function is applied to the key and associated values + using the resulting value as the new value associated with the key. +If a key only exists in one object, the value will be associated with the key +of the resulting object. + +@func +@memberOf R +@since v0.24.0 +@category Object +@sig (String -> a -> a -> a) -> {a} -> {a} -> {a} +@param {Function} fn +@param {Object} lObj +@param {Object} rObj +@return {Object} +@see R.mergeWithKey, R.mergeDeep, R.mergeDeepWith +@example + + let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r + R.mergeDeepWithKey(concatValues, + { a: true, c: { thing: 'foo', values: [10, 20] }}, + { b: true, c: { thing: 'bar', values: [15, 35] }}); + //=> { a: true, b: true, c: { thing: 'bar', values: [10, 20, 15, 35] }} diff --git a/templates/mergeWith.d.ts b/templates/mergeWith.d.ts new file mode 100644 index 0000000..99cb96c --- /dev/null +++ b/templates/mergeWith.d.ts @@ -0,0 +1,7 @@ +import { Omit, Same } from './$operation'; + +export function $( + fn: (a: V, b: V) => W, + left: T, + right: U, +): Omit & Omit & Record, W>; diff --git a/templates/mergeWith.md b/templates/mergeWith.md new file mode 100644 index 0000000..62ac805 --- /dev/null +++ b/templates/mergeWith.md @@ -0,0 +1,21 @@ +Creates a new object with the own properties of the two provided objects. If +a key exists in both objects, the provided function is applied to the values +associated with the key in each object, with the result being used as the +value associated with the key in the returned object. + +@func +@memberOf R +@since v0.19.0 +@category Object +@sig (a -> a -> a) -> {a} -> {a} -> {a} +@param {Function} fn +@param {Object} l +@param {Object} r +@return {Object} +@see R.mergeDeepWith, R.merge, R.mergeWithKey +@example + + R.mergeWith(R.concat, + { a: true, values: [10, 20] }, + { b: true, values: [15, 35] }); + //=> { a: true, b: true, values: [10, 20, 15, 35] } diff --git a/templates/mergeWithKey.d.ts b/templates/mergeWithKey.d.ts new file mode 100644 index 0000000..316c6a4 --- /dev/null +++ b/templates/mergeWithKey.d.ts @@ -0,0 +1,7 @@ +import { Omit, Same } from './$operation'; + +export function $( + fn: (key: string, a: V, b: V) => W, + left: T, + right: U, +): Omit & Omit & Record, W>; diff --git a/templates/mergeWithKey.md b/templates/mergeWithKey.md new file mode 100644 index 0000000..fd0ff5b --- /dev/null +++ b/templates/mergeWithKey.md @@ -0,0 +1,23 @@ +Creates a new object with the own properties of the two provided objects. If +a key exists in both objects, the provided function is applied to the key +and the values associated with the key in each object, with the result being +used as the value associated with the key in the returned object. + +@func +@memberOf R +@since v0.19.0 +@category Object +@sig (String -> a -> a -> a) -> {a} -> {a} -> {a} +@param {Function} fn +@param {Object} l +@param {Object} r +@return {Object} +@see R.mergeDeepWithKey, R.merge, R.mergeWith +@example + + let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r + R.mergeWithKey(concatValues, + { a: true, thing: 'foo', values: [10, 20] }, + { b: true, thing: 'bar', values: [15, 35] }); + //=> { a: true, b: true, thing: 'bar', values: [10, 20, 15, 35] } +@symb R.mergeWithKey(f, { x: 1, y: 2 }, { y: 5, z: 3 }) = { x: 1, y: f('y', 2, 5), z: 3 } diff --git a/templates/min.d.ts b/templates/min.d.ts new file mode 100644 index 0000000..626ec3a --- /dev/null +++ b/templates/min.d.ts @@ -0,0 +1,3 @@ +import { Ordered } from './$types'; + +export function $(a: T, b: T): T; diff --git a/templates/min.md b/templates/min.md new file mode 100644 index 0000000..db948a7 --- /dev/null +++ b/templates/min.md @@ -0,0 +1,15 @@ +Returns the smaller of its two arguments. + +@func +@memberOf R +@since v0.1.0 +@category Relation +@sig Ord a => a -> a -> a +@param {*} a +@param {*} b +@return {*} +@see R.minBy, R.max +@example + + R.min(789, 123); //=> 123 + R.min('a', 'b'); //=> 'a' diff --git a/templates/minBy.d.ts b/templates/minBy.d.ts new file mode 100644 index 0000000..b5a9a16 --- /dev/null +++ b/templates/minBy.d.ts @@ -0,0 +1,3 @@ +import { Morphism, Ordered } from './$types'; + +export function $(fn: Morphism, a: T, b: T): T; diff --git a/templates/minBy.md b/templates/minBy.md new file mode 100644 index 0000000..5be0983 --- /dev/null +++ b/templates/minBy.md @@ -0,0 +1,22 @@ +Takes a function and two values, and returns whichever value produces the +smaller result when passed to the provided function. + +@func +@memberOf R +@since v0.8.0 +@category Relation +@sig Ord b => (a -> b) -> a -> a -> a +@param {Function} f +@param {*} a +@param {*} b +@return {*} +@see R.min, R.maxBy +@example + + // square :: Number -> Number + var square = n => n * n; + + R.minBy(square, -3, 2); //=> 2 + + R.reduce(R.minBy(square), Infinity, [3, -5, 4, 1, -2]); //=> 1 + R.reduce(R.minBy(square), Infinity, []); //=> Infinity diff --git a/templates/modulo.d.ts b/templates/modulo.d.ts new file mode 100644 index 0000000..9e0dcbf --- /dev/null +++ b/templates/modulo.d.ts @@ -0,0 +1 @@ +export function $(a: number, b: number): number; diff --git a/templates/modulo.md b/templates/modulo.md new file mode 100644 index 0000000..a73d850 --- /dev/null +++ b/templates/modulo.md @@ -0,0 +1,23 @@ +Divides the first parameter by the second and returns the remainder. Note +that this function preserves the JavaScript-style behavior for modulo. For +mathematical modulo see [`mathMod`](#mathMod). + +@func +@memberOf R +@since v0.1.1 +@category Math +@sig Number -> Number -> Number +@param {Number} a The value to the divide. +@param {Number} b The pseudo-modulus +@return {Number} The result of `b % a`. +@see R.mathMod +@example + + R.modulo(17, 3); //=> 2 + // JS behavior: + R.modulo(-17, 3); //=> -2 + R.modulo(17, -3); //=> 2 + + var isOdd = R.modulo(R.__, 2); + isOdd(42); //=> 0 + isOdd(21); //=> 1 diff --git a/templates/multiply.d.ts b/templates/multiply.d.ts new file mode 100644 index 0000000..9e0dcbf --- /dev/null +++ b/templates/multiply.d.ts @@ -0,0 +1 @@ +export function $(a: number, b: number): number; diff --git a/templates/multiply.md b/templates/multiply.md new file mode 100644 index 0000000..8790250 --- /dev/null +++ b/templates/multiply.md @@ -0,0 +1,18 @@ +Multiplies two numbers. Equivalent to `a * b` but curried. + +@func +@memberOf R +@since v0.1.0 +@category Math +@sig Number -> Number -> Number +@param {Number} a The first value. +@param {Number} b The second value. +@return {Number} The result of `a * b`. +@see R.divide +@example + + var double = R.multiply(2); + var triple = R.multiply(3); + double(3); //=> 6 + triple(4); //=> 12 + R.multiply(2, 5); //=> 10 diff --git a/templates/nAry.c.ts b/templates/nAry.c.ts new file mode 100644 index 0000000..e58c931 --- /dev/null +++ b/templates/nAry.c.ts @@ -0,0 +1,22 @@ +import { max_curry_level } from './$curriedFunctions'; +import { create_n_ary_declarations } from './utils/create-n-ary-declarations'; + +export default create_n_ary_declarations( + 0, + max_curry_level, + args => ` + function $${args.curry_level}arity<${args.generics.join(',')}>( + n: ${args.curry_level}, + fn: (${[...args.parameters, '...args: any[]'].join( + ',', + )}) => ${args.return_type} + ): (${args.parameters.join(',')}) => ${args.return_type}; + `, + args => ` + import {Variadic} from './$types'; + function $variadic<${args.return_type}>( + n: number, + fn: Variadic<${args.return_type}> + ): Variadic<${args.return_type}>; + `, +); diff --git a/templates/nAry.md b/templates/nAry.md new file mode 100644 index 0000000..d4c0abc --- /dev/null +++ b/templates/nAry.md @@ -0,0 +1,28 @@ +Wraps a function of any arity (including nullary) in a function that accepts +exactly `n` parameters. Any extraneous parameters will not be passed to the +supplied function. + +@func +@memberOf R +@since v0.1.0 +@category Function +@sig Number -> (* -> a) -> (* -> a) +@param {Number} n The desired arity of the new function. +@param {Function} fn The function to wrap. +@return {Function} A new function wrapping `fn`. The new function is guaranteed to be of + arity `n`. +@see R.binary, R.unary +@example + + var takesTwoArgs = (a, b) => [a, b]; + + takesTwoArgs.length; //=> 2 + takesTwoArgs(1, 2); //=> [1, 2] + + var takesOneArg = R.nAry(1, takesTwoArgs); + takesOneArg.length; //=> 1 + // Only `n` arguments are passed to the wrapped function + takesOneArg(1, 2); //=> [1, undefined] +@symb R.nAry(0, f)(a, b) = f() +@symb R.nAry(1, f)(a, b) = f(a) +@symb R.nAry(2, f)(a, b) = f(a, b) diff --git a/templates/negate.d.ts b/templates/negate.d.ts new file mode 100644 index 0000000..7e84ac3 --- /dev/null +++ b/templates/negate.d.ts @@ -0,0 +1 @@ +export function $(n: number): number; diff --git a/templates/negate.md b/templates/negate.md new file mode 100644 index 0000000..3586996 --- /dev/null +++ b/templates/negate.md @@ -0,0 +1,12 @@ +Negates its argument. + +@func +@memberOf R +@since v0.9.0 +@category Math +@sig Number -> Number +@param {Number} n +@return {Number} +@example + + R.negate(42); //=> -42 diff --git a/templates/none.d.ts b/templates/none.d.ts new file mode 100644 index 0000000..e1c372c --- /dev/null +++ b/templates/none.d.ts @@ -0,0 +1,3 @@ +import { List, Predicate } from './$types'; + +export function $(fn: Predicate, list: List): boolean; diff --git a/templates/none.md b/templates/none.md new file mode 100644 index 0000000..9419a98 --- /dev/null +++ b/templates/none.md @@ -0,0 +1,20 @@ +Returns `true` if no elements of the list match the predicate, `false` +otherwise. + +Dispatches to the `any` method of the second argument, if present. + +@func +@memberOf R +@since v0.12.0 +@category List +@sig (a -> Boolean) -> [a] -> Boolean +@param {Function} fn The predicate function. +@param {Array} list The array to consider. +@return {Boolean} `true` if the predicate is not satisfied by every element, `false` otherwise. +@see R.all, R.any +@example + + var isEven = n => n % 2 === 0; + + R.none(isEven, [1, 3, 5, 7, 9, 11]); //=> true + R.none(isEven, [1, 3, 5, 7, 8, 11]); //=> false diff --git a/templates/not.d.ts b/templates/not.d.ts new file mode 100644 index 0000000..82e2221 --- /dev/null +++ b/templates/not.d.ts @@ -0,0 +1 @@ +export function $(value: any): boolean; diff --git a/templates/not.md b/templates/not.md new file mode 100644 index 0000000..162627c --- /dev/null +++ b/templates/not.md @@ -0,0 +1,17 @@ +A function that returns the `!` of its argument. It will return `true` when +passed false-y value, and `false` when passed a truth-y one. + +@func +@memberOf R +@since v0.1.0 +@category Logic +@sig * -> Boolean +@param {*} a any value +@return {Boolean} the logical inverse of passed argument. +@see R.complement +@example + + R.not(true); //=> false + R.not(false); //=> true + R.not(0); //=> true + R.not(1); //=> false diff --git a/templates/nth.d.ts b/templates/nth.d.ts new file mode 100644 index 0000000..552f49b --- /dev/null +++ b/templates/nth.d.ts @@ -0,0 +1,7 @@ +import { List } from './$types'; + +export function $string(n: number, str: string): string; +export function $general>( + n: number, + list: T, +): T[number] | undefined; diff --git a/templates/nth.md b/templates/nth.md new file mode 100644 index 0000000..fe8105c --- /dev/null +++ b/templates/nth.md @@ -0,0 +1,24 @@ +Returns the nth element of the given list or string. If n is negative the +element at index length + n is returned. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig Number -> [a] -> a | Undefined +@sig Number -> String -> String +@param {Number} offset +@param {*} list +@return {*} +@example + + var list = ['foo', 'bar', 'baz', 'quux']; + R.nth(1, list); //=> 'bar' + R.nth(-1, list); //=> 'quux' + R.nth(-99, list); //=> undefined + + R.nth(2, 'abc'); //=> 'c' + R.nth(3, 'abc'); //=> '' +@symb R.nth(-1, [a, b, c]) = c +@symb R.nth(0, [a, b, c]) = a +@symb R.nth(1, [a, b, c]) = b diff --git a/templates/nthArg.d.ts b/templates/nthArg.d.ts new file mode 100644 index 0000000..4cf7f02 --- /dev/null +++ b/templates/nthArg.d.ts @@ -0,0 +1 @@ +export function $(n: number): (...args: T[]) => T; diff --git a/templates/nthArg.md b/templates/nthArg.md new file mode 100644 index 0000000..3b5a59d --- /dev/null +++ b/templates/nthArg.md @@ -0,0 +1,16 @@ +Returns a function which returns its nth argument. + +@func +@memberOf R +@since v0.9.0 +@category Function +@sig Number -> *... -> * +@param {Number} n +@return {Function} +@example + + R.nthArg(1)('a', 'b', 'c'); //=> 'b' + R.nthArg(-1)('a', 'b', 'c'); //=> 'c' +@symb R.nthArg(-1)(a, b, c) = c +@symb R.nthArg(0)(a, b, c) = a +@symb R.nthArg(1)(a, b, c) = b diff --git a/templates/o.d.ts b/templates/o.d.ts new file mode 100644 index 0000000..0c58946 --- /dev/null +++ b/templates/o.d.ts @@ -0,0 +1,7 @@ +import { Morphism } from './$types'; + +export function $( + a: Morphism, + b: Morphism, + value: T1, +): R; diff --git a/templates/o.md b/templates/o.md new file mode 100644 index 0000000..87c8443 --- /dev/null +++ b/templates/o.md @@ -0,0 +1,23 @@ +`o` is a curried composition function that returns a unary function. +Like [`compose`](#compose), `o` performs right-to-left function composition. +Unlike [`compose`](#compose), the rightmost function passed to `o` will be +invoked with only one argument. + +@func +@memberOf R +@since v0.24.0 +@category Function +@sig (b -> c) -> (a -> b) -> a -> c +@param {Function} f +@param {Function} g +@return {Function} +@see R.compose, R.pipe +@example + + var classyGreeting = name => "The name's " + name.last + ", " + name.first + " " + lastName + var yellGreeting = R.o(R.toUpper, classyGreeting); + yellGreeting({first: 'James', last: 'Bond'}); //=> "THE NAME'S BOND, JAMES BOND" + + R.o(R.multiply(10), R.add(10))(-4) //=> 60 + +@symb R.o(f, g, x) = f(g(x)) diff --git a/templates/objOf.d.ts b/templates/objOf.d.ts new file mode 100644 index 0000000..90067ce --- /dev/null +++ b/templates/objOf.d.ts @@ -0,0 +1 @@ +export function $(key: K, value: V): Record; diff --git a/templates/objOf.md b/templates/objOf.md new file mode 100644 index 0000000..ccff776 --- /dev/null +++ b/templates/objOf.md @@ -0,0 +1,18 @@ +Creates an object containing a single key:value pair. + +@func +@memberOf R +@since v0.18.0 +@category Object +@sig String -> a -> {String:a} +@param {String} key +@param {*} val +@return {Object} +@see R.pair +@example + + var matchPhrases = R.compose( + R.objOf('must'), + R.map(R.objOf('match_phrase')) + ); + matchPhrases(['foo', 'bar', 'baz']); //=> {must: [{match_phrase: 'foo'}, {match_phrase: 'bar'}, {match_phrase: 'baz'}]} diff --git a/templates/of.d.ts b/templates/of.d.ts new file mode 100644 index 0000000..092cca2 --- /dev/null +++ b/templates/of.d.ts @@ -0,0 +1 @@ +export function $(value: T): T[]; diff --git a/templates/of.md b/templates/of.md new file mode 100644 index 0000000..40af145 --- /dev/null +++ b/templates/of.md @@ -0,0 +1,16 @@ +Returns a singleton array containing the value provided. + +Note this `of` is different from the ES6 `of`; See +https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/of + +@func +@memberOf R +@since v0.3.0 +@category Function +@sig a -> [a] +@param {*} x any value +@return {Array} An array wrapping `x`. +@example + + R.of(null); //=> [null] + R.of([42]); //=> [[42]] diff --git a/templates/omit.d.ts b/templates/omit.d.ts new file mode 100644 index 0000000..0cec410 --- /dev/null +++ b/templates/omit.d.ts @@ -0,0 +1,3 @@ +import { List, Property } from './$types'; + +export function $(keys: List, object: T): Partial; diff --git a/templates/omit.md b/templates/omit.md new file mode 100644 index 0000000..9f944f9 --- /dev/null +++ b/templates/omit.md @@ -0,0 +1,14 @@ +Returns a partial copy of an object omitting the keys specified. + +@func +@memberOf R +@since v0.1.0 +@category Object +@sig [String] -> {String: *} -> {String: *} +@param {Array} names an array of String property names to omit from the new object +@param {Object} obj The object to copy from +@return {Object} A new object with properties from `names` not on it. +@see R.pick +@example + + R.omit(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, c: 3} diff --git a/templates/once.d.ts b/templates/once.d.ts new file mode 100644 index 0000000..f3ae017 --- /dev/null +++ b/templates/once.d.ts @@ -0,0 +1 @@ +export function $(fn: T): T; diff --git a/templates/once.md b/templates/once.md new file mode 100644 index 0000000..7f31501 --- /dev/null +++ b/templates/once.md @@ -0,0 +1,17 @@ +Accepts a function `fn` and returns a function that guards invocation of +`fn` such that `fn` can only ever be called once, no matter how many times +the returned function is invoked. The first value calculated is returned in +subsequent invocations. + +@func +@memberOf R +@since v0.1.0 +@category Function +@sig (a... -> b) -> (a... -> b) +@param {Function} fn The function to wrap in a call-only-once wrapper. +@return {Function} The wrapped function. +@example + + var addOneOnce = R.once(x => x + 1); + addOneOnce(10); //=> 11 + addOneOnce(addOneOnce(50)); //=> 11 diff --git a/templates/or.d.ts b/templates/or.d.ts new file mode 100644 index 0000000..999310c --- /dev/null +++ b/templates/or.d.ts @@ -0,0 +1 @@ +export function $(a: T, b: U): T | U; diff --git a/templates/or.md b/templates/or.md new file mode 100644 index 0000000..7e69ae1 --- /dev/null +++ b/templates/or.md @@ -0,0 +1,18 @@ +Returns `true` if one or both of its arguments are `true`. Returns `false` +if both arguments are `false`. + +@func +@memberOf R +@since v0.1.0 +@category Logic +@sig a -> b -> a | b +@param {Any} a +@param {Any} b +@return {Any} the first argument if truthy, otherwise the second argument. +@see R.either +@example + + R.or(true, true); //=> true + R.or(true, false); //=> true + R.or(false, true); //=> true + R.or(false, false); //=> false diff --git a/templates/over.d.ts b/templates/over.d.ts new file mode 100644 index 0000000..9302025 --- /dev/null +++ b/templates/over.d.ts @@ -0,0 +1,23 @@ +import { NumberToString } from './$operation'; +import { ManualLens, Morphism, PseudoLens } from './$types'; + +export function $number( + lens: PseudoLens, + fn: Morphism, + target: U, +): U; +export function $string>( + lens: PseudoLens, + fn: Morphism, + target: U, +): U; +export function $manual( + lens: ManualLens, + fn: Morphism, + target: U, +): U; +export function $general( + lens: PseudoLens | ManualLens, + fn: Morphism, + target: V, +): V; diff --git a/templates/over.md b/templates/over.md new file mode 100644 index 0000000..2c5e332 --- /dev/null +++ b/templates/over.md @@ -0,0 +1,20 @@ +Returns the result of "setting" the portion of the given data structure +focused by the given lens to the result of applying the given function to +the focused value. + +@func +@memberOf R +@since v0.16.0 +@category Object +@typedefn Lens s a = Functor f => (a -> f a) -> s -> f s +@sig Lens s a -> (a -> a) -> s -> s +@param {Lens} lens +@param {*} v +@param {*} x +@return {*} +@see R.prop, R.lensIndex, R.lensProp +@example + + var headLens = R.lensIndex(0); + + R.over(headLens, R.toUpper, ['foo', 'bar', 'baz']); //=> ['FOO', 'bar', 'baz'] diff --git a/templates/pair.d.ts b/templates/pair.d.ts new file mode 100644 index 0000000..798b8c0 --- /dev/null +++ b/templates/pair.d.ts @@ -0,0 +1,3 @@ +import { KeyValuePair, Property } from './$types'; + +export function $(key: K, value: V): KeyValuePair; diff --git a/templates/pair.md b/templates/pair.md new file mode 100644 index 0000000..4a16c59 --- /dev/null +++ b/templates/pair.md @@ -0,0 +1,14 @@ +Takes two arguments, `fst` and `snd`, and returns `[fst, snd]`. + +@func +@memberOf R +@since v0.18.0 +@category List +@sig a -> b -> (a,b) +@param {*} fst +@param {*} snd +@return {Array} +@see R.objOf, R.of +@example + + R.pair('foo', 'bar'); //=> ['foo', 'bar'] diff --git a/templates/partial.d.ts b/templates/partial.d.ts new file mode 100644 index 0000000..492e0b3 --- /dev/null +++ b/templates/partial.d.ts @@ -0,0 +1,3 @@ +import { Variadic } from './$types'; + +export function $(fn: Variadic, args: any[]): Variadic; diff --git a/templates/partial.md b/templates/partial.md new file mode 100644 index 0000000..39797a7 --- /dev/null +++ b/templates/partial.md @@ -0,0 +1,26 @@ +Takes a function `f` and a list of arguments, and returns a function `g`. +When applied, `g` returns the result of applying `f` to the arguments +provided initially followed by the arguments provided to `g`. + +@func +@memberOf R +@since v0.10.0 +@category Function +@sig ((a, b, c, ..., n) -> x) -> [a, b, c, ...] -> ((d, e, f, ..., n) -> x) +@param {Function} f +@param {Array} args +@return {Function} +@see R.partialRight +@example + + var multiply2 = (a, b) => a * b; + var double = R.partial(multiply2, [2]); + double(2); //=> 4 + + var greet = (salutation, title, firstName, lastName) => + salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!'; + + var sayHello = R.partial(greet, ['Hello']); + var sayHelloToMs = R.partial(sayHello, ['Ms.']); + sayHelloToMs('Jane', 'Jones'); //=> 'Hello, Ms. Jane Jones!' +@symb R.partial(f, [a, b])(c, d) = f(a, b, c, d) diff --git a/templates/partialRight.d.ts b/templates/partialRight.d.ts new file mode 100644 index 0000000..492e0b3 --- /dev/null +++ b/templates/partialRight.d.ts @@ -0,0 +1,3 @@ +import { Variadic } from './$types'; + +export function $(fn: Variadic, args: any[]): Variadic; diff --git a/templates/partialRight.md b/templates/partialRight.md new file mode 100644 index 0000000..396cfd4 --- /dev/null +++ b/templates/partialRight.md @@ -0,0 +1,22 @@ +Takes a function `f` and a list of arguments, and returns a function `g`. +When applied, `g` returns the result of applying `f` to the arguments +provided to `g` followed by the arguments provided initially. + +@func +@memberOf R +@since v0.10.0 +@category Function +@sig ((a, b, c, ..., n) -> x) -> [d, e, f, ..., n] -> ((a, b, c, ...) -> x) +@param {Function} f +@param {Array} args +@return {Function} +@see R.partial +@example + + var greet = (salutation, title, firstName, lastName) => + salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!'; + + var greetMsJaneJones = R.partialRight(greet, ['Ms.', 'Jane', 'Jones']); + + greetMsJaneJones('Hello'); //=> 'Hello, Ms. Jane Jones!' +@symb R.partialRight(f, [a, b])(c, d) = f(c, d, a, b) diff --git a/templates/partition.d.ts b/templates/partition.d.ts new file mode 100644 index 0000000..2c79334 --- /dev/null +++ b/templates/partition.d.ts @@ -0,0 +1,11 @@ +import { Dictionary, List, Predicate } from './$types'; + +export function $list(fn: Predicate, list: List): [T[], T[]]; +export function $object>( + fn: Predicate, + dictionary: U, +): [Partial, Partial]; +export function $mixed | Dictionary>( + fn: Predicate, + target: U, +): [T[], T[]] | [Partial, Partial]; diff --git a/templates/partition.md b/templates/partition.md new file mode 100644 index 0000000..d5af4f5 --- /dev/null +++ b/templates/partition.md @@ -0,0 +1,22 @@ +Takes a predicate and a list or other `Filterable` object and returns the +pair of filterable objects of the same type of elements which do and do not +satisfy, the predicate, respectively. Filterable objects include plain objects or any object +that has a filter method such as `Array`. + +@func +@memberOf R +@since v0.1.4 +@category List +@sig Filterable f => (a -> Boolean) -> f a -> [f a, f a] +@param {Function} pred A predicate to determine which side the element belongs to. +@param {Array} filterable the list (or other filterable) to partition. +@return {Array} An array, containing first the subset of elements that satisfy the + predicate, and second the subset of elements that do not satisfy. +@see R.filter, R.reject +@example + + R.partition(R.contains('s'), ['sss', 'ttt', 'foo', 'bars']); + // => [ [ 'sss', 'bars' ], [ 'ttt', 'foo' ] ] + + R.partition(R.contains('s'), { a: 'sss', b: 'ttt', foo: 'bars' }); + // => [ { a: 'sss', foo: 'bars' }, { b: 'ttt' } ] diff --git a/templates/path.d.ts b/templates/path.d.ts new file mode 100644 index 0000000..67d1185 --- /dev/null +++ b/templates/path.d.ts @@ -0,0 +1,3 @@ +import { Path } from './$types'; + +export function $(path: Path, object: {}): T | undefined; diff --git a/templates/path.md b/templates/path.md new file mode 100644 index 0000000..1b98521 --- /dev/null +++ b/templates/path.md @@ -0,0 +1,16 @@ +Retrieve the value at a given path. + +@func +@memberOf R +@since v0.2.0 +@category Object +@typedefn Idx = String | Int +@sig [Idx] -> {a} -> a | Undefined +@param {Array} path The path to use. +@param {Object} obj The object to retrieve the nested property from. +@return {*} The data at `path`. +@see R.prop +@example + + R.path(['a', 'b'], {a: {b: 2}}); //=> 2 + R.path(['a', 'b'], {c: {b: 2}}); //=> undefined diff --git a/templates/pathEq.d.ts b/templates/pathEq.d.ts new file mode 100644 index 0000000..574d121 --- /dev/null +++ b/templates/pathEq.d.ts @@ -0,0 +1,3 @@ +import { Path } from './$types'; + +export function $(path: Path, value: any, object: {}): boolean; diff --git a/templates/pathEq.md b/templates/pathEq.md new file mode 100644 index 0000000..f80151b --- /dev/null +++ b/templates/pathEq.md @@ -0,0 +1,22 @@ +Determines whether a nested path on an object has a specific value, in +[`R.equals`](#equals) terms. Most likely used to filter a list. + +@func +@memberOf R +@since v0.7.0 +@category Relation +@typedefn Idx = String | Int +@sig [Idx] -> a -> {a} -> Boolean +@param {Array} path The path of the nested property to use +@param {*} val The value to compare the nested property with +@param {Object} obj The object to check the nested property in +@return {Boolean} `true` if the value equals the nested object property, + `false` otherwise. +@example + + var user1 = { address: { zipCode: 90210 } }; + var user2 = { address: { zipCode: 55555 } }; + var user3 = { name: 'Bob' }; + var users = [ user1, user2, user3 ]; + var isFamous = R.pathEq(['address', 'zipCode'], 90210); + R.filter(isFamous, users); //=> [ user1 ] diff --git a/templates/pathOr.d.ts b/templates/pathOr.d.ts new file mode 100644 index 0000000..c618115 --- /dev/null +++ b/templates/pathOr.d.ts @@ -0,0 +1,3 @@ +import { Path } from './$types'; + +export function $(defaults: T, path: Path, object: {}): T | U; diff --git a/templates/pathOr.md b/templates/pathOr.md new file mode 100644 index 0000000..64d815a --- /dev/null +++ b/templates/pathOr.md @@ -0,0 +1,17 @@ +If the given, non-null object has a value at the given path, returns the +value at that path. Otherwise returns the provided default value. + +@func +@memberOf R +@since v0.18.0 +@category Object +@typedefn Idx = String | Int +@sig a -> [Idx] -> {a} -> a +@param {*} d The default value. +@param {Array} p The path to use. +@param {Object} obj The object to retrieve the nested property from. +@return {*} The data at `path` of the supplied object or the default value. +@example + + R.pathOr('N/A', ['a', 'b'], {a: {b: 2}}); //=> 2 + R.pathOr('N/A', ['a', 'b'], {c: {b: 2}}); //=> "N/A" diff --git a/templates/pathSatisfies.d.ts b/templates/pathSatisfies.d.ts new file mode 100644 index 0000000..eed8354 --- /dev/null +++ b/templates/pathSatisfies.d.ts @@ -0,0 +1,3 @@ +import { Path, Predicate } from './$types'; + +export function $(fn: Predicate, path: Path, object: {}): boolean; diff --git a/templates/pathSatisfies.md b/templates/pathSatisfies.md new file mode 100644 index 0000000..91206f3 --- /dev/null +++ b/templates/pathSatisfies.md @@ -0,0 +1,17 @@ +Returns `true` if the specified object property at given path satisfies the +given predicate; `false` otherwise. + +@func +@memberOf R +@since v0.19.0 +@category Logic +@typedefn Idx = String | Int +@sig (a -> Boolean) -> [Idx] -> {a} -> Boolean +@param {Function} pred +@param {Array} propPath +@param {*} obj +@return {Boolean} +@see R.propSatisfies, R.path +@example + + R.pathSatisfies(y => y > 0, ['x', 'y'], {x: {y: 2}}); //=> true diff --git a/templates/pick.d.ts b/templates/pick.d.ts new file mode 100644 index 0000000..fe4d6d7 --- /dev/null +++ b/templates/pick.d.ts @@ -0,0 +1,14 @@ +import { List, Property } from './$types'; + +export function $keyof( + keys: List, + object: T, +): Pick; +export function $record, V extends string>( + keys: List, + object: U, +): Pick; +export function $general( + keys: List, + object: T, +): Partial; diff --git a/templates/pick.md b/templates/pick.md new file mode 100644 index 0000000..af67249 --- /dev/null +++ b/templates/pick.md @@ -0,0 +1,16 @@ +Returns a partial copy of an object containing only the keys specified. If +the key does not exist, the property is ignored. + +@func +@memberOf R +@since v0.1.0 +@category Object +@sig [k] -> {k: v} -> {k: v} +@param {Array} names an array of String property names to copy onto a new object +@param {Object} obj The object to copy from +@return {Object} A new object with only properties from `names` on it. +@see R.omit, R.props +@example + + R.pick(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4} + R.pick(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1} diff --git a/templates/pickAll.d.ts b/templates/pickAll.d.ts new file mode 100644 index 0000000..ab36b81 --- /dev/null +++ b/templates/pickAll.d.ts @@ -0,0 +1,10 @@ +import { List, Property } from './$types'; + +export function $pick( + keys: List, + object: T, +): Pick; +export function $general( + keys: List, + object: T, +): Partial; diff --git a/templates/pickAll.md b/templates/pickAll.md new file mode 100644 index 0000000..118356e --- /dev/null +++ b/templates/pickAll.md @@ -0,0 +1,16 @@ +Similar to `pick` except that this one includes a `key: undefined` pair for +properties that don't exist. + +@func +@memberOf R +@since v0.1.0 +@category Object +@sig [k] -> {k: v} -> {k: v} +@param {Array} names an array of String property names to copy onto a new object +@param {Object} obj The object to copy from +@return {Object} A new object with only properties from `names` on it. +@see R.pick +@example + + R.pickAll(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4} + R.pickAll(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, e: undefined, f: undefined} diff --git a/templates/pickBy.d.ts b/templates/pickBy.d.ts new file mode 100644 index 0000000..41df454 --- /dev/null +++ b/templates/pickBy.d.ts @@ -0,0 +1,6 @@ +import { Dictionary, KeyedObjectMorphism } from './$types'; + +export function $>( + fn: KeyedObjectMorphism, + object: U, +): Partial; diff --git a/templates/pickBy.md b/templates/pickBy.md new file mode 100644 index 0000000..ef7a787 --- /dev/null +++ b/templates/pickBy.md @@ -0,0 +1,18 @@ +Returns a partial copy of an object containing only the keys that satisfy +the supplied predicate. + +@func +@memberOf R +@since v0.8.0 +@category Object +@sig (v, k -> Boolean) -> {k: v} -> {k: v} +@param {Function} pred A predicate to determine whether or not a key + should be included on the output object. +@param {Object} obj The object to copy from +@return {Object} A new object with only properties that satisfy `pred` + on it. +@see R.pick, R.filter +@example + + var isUpperCase = (val, key) => key.toUpperCase() === key; + R.pickBy(isUpperCase, {a: 1, b: 2, A: 3, B: 4}); //=> {A: 3, B: 4} diff --git a/templates/pipe.md b/templates/pipe.md new file mode 100644 index 0000000..06e5572 --- /dev/null +++ b/templates/pipe.md @@ -0,0 +1,21 @@ +Performs left-to-right function composition. The leftmost function may have +any arity; the remaining functions must be unary. + +In some libraries this function is named `sequence`. + +**Note:** The result of pipe is not automatically curried. + +@func +@memberOf R +@since v0.1.0 +@category Function +@sig (((a, b, ..., n) -> o), (o -> p), ..., (x -> y), (y -> z)) -> ((a, b, ..., n) -> z) +@param {...Function} functions +@return {Function} +@see R.compose +@example + + var f = R.pipe(Math.pow, R.negate, R.inc); + + f(3, 4); // -(3^4) + 1 +@symb R.pipe(f, g, h)(a, b) = h(g(f(a, b))) diff --git a/templates/pipe.ts b/templates/pipe.ts new file mode 100644 index 0000000..9dd3284 --- /dev/null +++ b/templates/pipe.ts @@ -0,0 +1,9 @@ +import { max_curry_level } from './$curriedFunctions'; +import { create_composition_declarations } from './utils/create-composition-declarations'; + +export default create_composition_declarations( + 'pipe', + 'pipe', + max_curry_level, + max_curry_level, +); diff --git a/templates/pipeK.md b/templates/pipeK.md new file mode 100644 index 0000000..c98215f --- /dev/null +++ b/templates/pipeK.md @@ -0,0 +1,32 @@ +Returns the left-to-right Kleisli composition of the provided functions, +each of which must return a value of a type supported by [`chain`](#chain). + +`R.pipeK(f, g, h)` is equivalent to `R.pipe(R.chain(f), R.chain(g), R.chain(h))`. + +@func +@memberOf R +@since v0.16.0 +@category Function +@sig Chain m => ((a -> m b), (b -> m c), ..., (y -> m z)) -> (a -> m z) +@param {...Function} +@return {Function} +@see R.composeK +@example + + // parseJson :: String -> Maybe * + // get :: String -> Object -> Maybe * + + // getStateCode :: Maybe String -> Maybe String + var getStateCode = R.pipeK( + parseJson, + get('user'), + get('address'), + get('state'), + R.compose(Maybe.of, R.toUpper) + ); + + getStateCode('{"user":{"address":{"state":"ny"}}}'); + //=> Just('NY') + getStateCode('[Invalid JSON]'); + //=> Nothing() +@symb R.pipeK(f, g, h)(a) = R.chain(h, R.chain(g, f(a))) diff --git a/templates/pipeK.ts b/templates/pipeK.ts new file mode 100644 index 0000000..d859a09 --- /dev/null +++ b/templates/pipeK.ts @@ -0,0 +1,17 @@ +import * as dts from 'dts-element'; +import { max_curry_level } from './$curriedFunctions'; +import { create_composition_declarations } from './utils/create-composition-declarations'; + +export default [ + ...dts.parse(` + import {Chain} from './$types'; + `).members, + ...create_composition_declarations( + 'pipeK', + 'pipe', + max_curry_level, + 1, + x => `Chain<${x}>`, + x => `Chain<${x}>`, + ), +]; diff --git a/templates/pipeP.md b/templates/pipeP.md new file mode 100644 index 0000000..ec32530 --- /dev/null +++ b/templates/pipeP.md @@ -0,0 +1,16 @@ +Performs left-to-right composition of one or more Promise-returning +functions. The leftmost function may have any arity; the remaining functions +must be unary. + +@func +@memberOf R +@since v0.10.0 +@category Function +@sig ((a -> Promise b), (b -> Promise c), ..., (y -> Promise z)) -> (a -> Promise z) +@param {...Function} functions +@return {Function} +@see R.composeP +@example + + // followersForUser :: String -> Promise [User] + var followersForUser = R.pipeP(db.getUserById, db.getFollowers); diff --git a/templates/pipeP.ts b/templates/pipeP.ts new file mode 100644 index 0000000..0d31d4e --- /dev/null +++ b/templates/pipeP.ts @@ -0,0 +1,12 @@ +import { max_curry_level } from './$curriedFunctions'; +import { create_composition_declarations } from './utils/create-composition-declarations'; + +export default create_composition_declarations( + 'pipeP', + 'pipe', + max_curry_level, + 6, + x => x, + x => `PromiseLike<${x}> | ${x}`, + x => `PromiseLike<${x}>`, +); diff --git a/templates/pluck.d.ts b/templates/pluck.d.ts new file mode 100644 index 0000000..f7dcf15 --- /dev/null +++ b/templates/pluck.d.ts @@ -0,0 +1,9 @@ +import { Functor, List, Property } from './$types'; + +export function $list(index: number, list: List>): U[]; +export function $keyof(key: K, list: List): T[K][]; +export function $record>( + key: K, + list: List, +): T[K][]; +export function $general(key: Property, list: List): any[]; diff --git a/templates/pluck.md b/templates/pluck.md new file mode 100644 index 0000000..1f2ffe5 --- /dev/null +++ b/templates/pluck.md @@ -0,0 +1,23 @@ +Returns a new list by plucking the same named property off all objects in +the list supplied. + +`pluck` will work on +any [functor](https://github.com/fantasyland/fantasy-land#functor) in +addition to arrays, as it is equivalent to `R.map(R.prop(k), f)`. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig Functor f => k -> f {k: v} -> f v +@param {Number|String} key The key name to pluck off of each object. +@param {Array} f The array or functor to consider. +@return {Array} The list of values for the given key. +@see R.props +@example + + R.pluck('a')([{a: 1}, {a: 2}]); //=> [1, 2] + R.pluck(0)([[1, 2], [3, 4]]); //=> [1, 3] + R.pluck('val', {a: {val: 3}, b: {val: 5}}); //=> {a: 3, b: 5} +@symb R.pluck('x', [{x: 1, y: 2}, {x: 3, y: 4}, {x: 5, y: 6}]) = [1, 3, 5] +@symb R.pluck(0, [[1, 2], [3, 4], [5, 6]]) = [1, 3, 5] diff --git a/templates/prepend.d.ts b/templates/prepend.d.ts new file mode 100644 index 0000000..d1fbfa9 --- /dev/null +++ b/templates/prepend.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(value: T, list: List): (T | U)[]; diff --git a/templates/prepend.md b/templates/prepend.md new file mode 100644 index 0000000..90088d3 --- /dev/null +++ b/templates/prepend.md @@ -0,0 +1,15 @@ +Returns a new list with the given element at the front, followed by the +contents of the list. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig a -> [a] -> [a] +@param {*} el The item to add to the head of the output list. +@param {Array} list The array to add to the tail of the output list. +@return {Array} A new array. +@see R.append +@example + + R.prepend('fee', ['fi', 'fo', 'fum']); //=> ['fee', 'fi', 'fo', 'fum'] diff --git a/templates/product.d.ts b/templates/product.d.ts new file mode 100644 index 0000000..9e5a54d --- /dev/null +++ b/templates/product.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(numbers: List): number; diff --git a/templates/product.md b/templates/product.md new file mode 100644 index 0000000..4ad16b3 --- /dev/null +++ b/templates/product.md @@ -0,0 +1,13 @@ +Multiplies together all the elements of a list. + +@func +@memberOf R +@since v0.1.0 +@category Math +@sig [Number] -> Number +@param {Array} list An array of numbers +@return {Number} The product of all the numbers in the list. +@see R.reduce +@example + + R.product([2,4,6,8,100,1]); //=> 38400 diff --git a/templates/project.d.ts b/templates/project.d.ts new file mode 100644 index 0000000..4d4f836 --- /dev/null +++ b/templates/project.d.ts @@ -0,0 +1,11 @@ +import { List, Property } from './$types'; + +export function $keyof( + keys: List, + list: List, +): Pick[]; +export function $record>( + keys: List, + list: List, +): Pick[]; +export function $general(keys: Property[], object: List): any[]; diff --git a/templates/project.md b/templates/project.md new file mode 100644 index 0000000..a21bbf8 --- /dev/null +++ b/templates/project.md @@ -0,0 +1,17 @@ +Reasonable analog to SQL `select` statement. + +@func +@memberOf R +@since v0.1.0 +@category Object +@category Relation +@sig [k] -> [{k: v}] -> [{k: v}] +@param {Array} props The property names to project +@param {Array} objs The objects to query +@return {Array} An array of objects with just the `props` properties. +@example + + var abby = {name: 'Abby', age: 7, hair: 'blond', grade: 2}; + var fred = {name: 'Fred', age: 12, hair: 'brown', grade: 7}; + var kids = [abby, fred]; + R.project(['name', 'grade'], kids); //=> [{name: 'Abby', grade: 2}, {name: 'Fred', grade: 7}] diff --git a/templates/prop.d.ts b/templates/prop.d.ts new file mode 100644 index 0000000..0bd21f8 --- /dev/null +++ b/templates/prop.d.ts @@ -0,0 +1,11 @@ +import { List, Property } from './$types'; + +export function $keyof( + key: K, + object: T, +): T[K]; +export function $record>( + key: K, + object: T, +): T[K]; +export function $general(key: Property, object: {}): T | undefined; diff --git a/templates/prop.md b/templates/prop.md new file mode 100644 index 0000000..4608742 --- /dev/null +++ b/templates/prop.md @@ -0,0 +1,16 @@ +Returns a function that when supplied an object returns the indicated +property of that object, if it exists. + +@func +@memberOf R +@since v0.1.0 +@category Object +@sig s -> {s: a} -> a | Undefined +@param {String} p The property name +@param {Object} obj The object to query +@return {*} The value at `obj.p`. +@see R.path +@example + + R.prop('x', {x: 100}); //=> 100 + R.prop('x', {}); //=> undefined diff --git a/templates/propEq.d.ts b/templates/propEq.d.ts new file mode 100644 index 0000000..ff9b1dc --- /dev/null +++ b/templates/propEq.d.ts @@ -0,0 +1,3 @@ +import { Property } from './$types'; + +export function $(key: Property, value: any, object: {}): boolean; diff --git a/templates/propEq.md b/templates/propEq.md new file mode 100644 index 0000000..4a4d377 --- /dev/null +++ b/templates/propEq.md @@ -0,0 +1,22 @@ +Returns `true` if the specified object property is equal, in +[`R.equals`](#equals) terms, to the given value; `false` otherwise. + +@func +@memberOf R +@since v0.1.0 +@category Relation +@sig String -> a -> Object -> Boolean +@param {String} name +@param {*} val +@param {*} obj +@return {Boolean} +@see R.equals, R.propSatisfies +@example + + var abby = {name: 'Abby', age: 7, hair: 'blond'}; + var fred = {name: 'Fred', age: 12, hair: 'brown'}; + var rusty = {name: 'Rusty', age: 10, hair: 'brown'}; + var alois = {name: 'Alois', age: 15, disposition: 'surly'}; + var kids = [abby, fred, rusty, alois]; + var hasBrownHair = R.propEq('hair', 'brown'); + R.filter(hasBrownHair, kids); //=> [fred, rusty] diff --git a/templates/propIs.d.ts b/templates/propIs.d.ts new file mode 100644 index 0000000..c724769 --- /dev/null +++ b/templates/propIs.d.ts @@ -0,0 +1,12 @@ +import { Constructor, Property } from './$types'; + +export function $guard( + constructor: Constructor, + key: K, + object: U, +): object is U & Record; +export function $general( + constructor: Constructor, + key: Property, + object: {}, +): boolean; diff --git a/templates/propIs.md b/templates/propIs.md new file mode 100644 index 0000000..606f09e --- /dev/null +++ b/templates/propIs.md @@ -0,0 +1,18 @@ +Returns `true` if the specified object property is of the given type; +`false` otherwise. + +@func +@memberOf R +@since v0.16.0 +@category Type +@sig Type -> String -> Object -> Boolean +@param {Function} type +@param {String} name +@param {*} obj +@return {Boolean} +@see R.is, R.propSatisfies +@example + + R.propIs(Number, 'x', {x: 1, y: 2}); //=> true + R.propIs(Number, 'x', {x: 'foo'}); //=> false + R.propIs(Number, 'x', {}); //=> false diff --git a/templates/propOr.d.ts b/templates/propOr.d.ts new file mode 100644 index 0000000..6d9051b --- /dev/null +++ b/templates/propOr.d.ts @@ -0,0 +1,13 @@ +import { List, Property } from './$types'; + +export function $keyof( + defaults: D, + key: K, + object: T, +): T[K] | D; +export function $record>( + defaults: D, + key: K, + object: T, +): T[K] | D; +export function $general(defaults: T, key: Property, object: {}): T | U; diff --git a/templates/propOr.md b/templates/propOr.md new file mode 100644 index 0000000..b790012 --- /dev/null +++ b/templates/propOr.md @@ -0,0 +1,24 @@ +If the given, non-null object has an own property with the specified name, +returns the value of that property. Otherwise returns the provided default +value. + +@func +@memberOf R +@since v0.6.0 +@category Object +@sig a -> String -> Object -> a +@param {*} val The default value. +@param {String} p The name of the property to return. +@param {Object} obj The object to query. +@return {*} The value of given property of the supplied object or the default value. +@example + + var alice = { + name: 'ALICE', + age: 101 + }; + var favorite = R.prop('favoriteLibrary'); + var favoriteWithDefault = R.propOr('Ramda', 'favoriteLibrary'); + + favorite(alice); //=> undefined + favoriteWithDefault(alice); //=> 'Ramda' diff --git a/templates/propSatisfies.d.ts b/templates/propSatisfies.d.ts new file mode 100644 index 0000000..dc6d3d6 --- /dev/null +++ b/templates/propSatisfies.d.ts @@ -0,0 +1,17 @@ +import { Predicate, Property } from './$types'; + +export function $keyof( + fn: Predicate, + key: K, + object: T, +): boolean; +export function $record>( + fn: Predicate, + key: K, + object: T, +): boolean; +export function $general( + fn: Predicate, + key: Property, + object: {}, +): boolean; diff --git a/templates/propSatisfies.md b/templates/propSatisfies.md new file mode 100644 index 0000000..868b080 --- /dev/null +++ b/templates/propSatisfies.md @@ -0,0 +1,16 @@ +Returns `true` if the specified object property satisfies the given +predicate; `false` otherwise. + +@func +@memberOf R +@since v0.16.0 +@category Logic +@sig (a -> Boolean) -> String -> {String: a} -> Boolean +@param {Function} pred +@param {String} name +@param {*} obj +@return {Boolean} +@see R.propEq, R.propIs +@example + + R.propSatisfies(x => x > 0, 'x', {x: 1, y: 2}); //=> true diff --git a/templates/props.d.ts b/templates/props.d.ts new file mode 100644 index 0000000..1328058 --- /dev/null +++ b/templates/props.d.ts @@ -0,0 +1,11 @@ +import { List, Property } from './$types'; + +export function $keyof( + keys: List, + object: T, +): T[K][]; +export function $record>( + keys: List, + object: T, +): T[K][]; +export function $general(keys: Property[], object: {}): any[]; diff --git a/templates/props.md b/templates/props.md new file mode 100644 index 0000000..a489334 --- /dev/null +++ b/templates/props.md @@ -0,0 +1,18 @@ +Acts as multiple `prop`: array of keys in, array of values out. Preserves +order. + +@func +@memberOf R +@since v0.1.0 +@category Object +@sig [k] -> {k: v} -> [v] +@param {Array} ps The property names to fetch +@param {Object} obj The object to query +@return {Array} The corresponding values or partially applied function. +@example + + R.props(['x', 'y'], {x: 1, y: 2}); //=> [1, 2] + R.props(['c', 'a', 'b'], {b: 2, a: 1}); //=> [undefined, 1, 2] + + var fullName = R.compose(R.join(' '), R.props(['first', 'last'])); + fullName({last: 'Bullet-Tooth', age: 33, first: 'Tony'}); //=> 'Tony Bullet-Tooth' diff --git a/templates/range.d.ts b/templates/range.d.ts new file mode 100644 index 0000000..8d04a6e --- /dev/null +++ b/templates/range.d.ts @@ -0,0 +1 @@ +export function $(from: number, to: number): number[]; diff --git a/templates/range.md b/templates/range.md new file mode 100644 index 0000000..6a25f9a --- /dev/null +++ b/templates/range.md @@ -0,0 +1,14 @@ +Returns a list of numbers from `from` (inclusive) to `to` (exclusive). + +@func +@memberOf R +@since v0.1.0 +@category List +@sig Number -> Number -> [Number] +@param {Number} from The first number in the list. +@param {Number} to One more than the last number in the list. +@return {Array} The list of numbers in tthe set `[a, b)`. +@example + + R.range(1, 5); //=> [1, 2, 3, 4] + R.range(50, 53); //=> [50, 51, 52] diff --git a/templates/reduce.d.ts b/templates/reduce.d.ts new file mode 100644 index 0000000..a48ec77 --- /dev/null +++ b/templates/reduce.d.ts @@ -0,0 +1,7 @@ +import { List, Reduced } from './$types'; + +export function $( + fn: (accumulator: U, value: T) => Reduced | U, + initial: U, + values: List, +): U; diff --git a/templates/reduce.md b/templates/reduce.md new file mode 100644 index 0000000..bce79ba --- /dev/null +++ b/templates/reduce.md @@ -0,0 +1,44 @@ +Returns a single item by iterating through the list, successively calling +the iterator function and passing it an accumulator value and the current +value from the array, and then passing the result to the next call. + +The iterator function receives two values: *(acc, value)*. It may use +[`R.reduced`](#reduced) to shortcut the iteration. + +The arguments' order of [`reduceRight`](#reduceRight)'s iterator function +is *(value, acc)*. + +Note: `R.reduce` does not skip deleted or unassigned indices (sparse +arrays), unlike the native `Array.prototype.reduce` method. For more details +on this behavior, see: +https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce#Description + +Dispatches to the `reduce` method of the third argument, if present. When +doing so, it is up to the user to handle the [`R.reduced`](#reduced) +shortcuting, as this is not implemented by `reduce`. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig ((a, b) -> a) -> a -> [b] -> a +@param {Function} fn The iterator function. Receives two values, the accumulator and the + current element from the array. +@param {*} acc The accumulator value. +@param {Array} list The list to iterate over. +@return {*} The final, accumulated value. +@see R.reduced, R.addIndex, R.reduceRight +@example + + R.reduce(R.subtract, 0, [1, 2, 3, 4]) // => ((((0 - 1) - 2) - 3) - 4) = -10 + - -10 + / \ / \ + - 4 -6 4 + / \ / \ + - 3 ==> -3 3 + / \ / \ + - 2 -1 2 + / \ / \ + 0 1 0 1 + +@symb R.reduce(f, a, [b, c, d]) = f(f(f(a, b), c), d) diff --git a/templates/reduceBy.d.ts b/templates/reduceBy.d.ts new file mode 100644 index 0000000..0f103ef --- /dev/null +++ b/templates/reduceBy.d.ts @@ -0,0 +1,8 @@ +import { List, Morphism, Reduced } from './$types'; + +export function $( + valueFn: (accumulator: U, value: T) => Reduced | U, + initial: U, + keyFn: Morphism, + values: List, +): Partial>; diff --git a/templates/reduceBy.md b/templates/reduceBy.md new file mode 100644 index 0000000..70ee160 --- /dev/null +++ b/templates/reduceBy.md @@ -0,0 +1,42 @@ +Groups the elements of the list according to the result of calling +the String-returning function `keyFn` on each element and reduces the elements +of each group to a single value via the reducer function `valueFn`. + +This function is basically a more general [`groupBy`](#groupBy) function. + +Acts as a transducer if a transformer is given in list position. + +@func +@memberOf R +@since v0.20.0 +@category List +@sig ((a, b) -> a) -> a -> (b -> String) -> [b] -> {String: a} +@param {Function} valueFn The function that reduces the elements of each group to a single + value. Receives two values, accumulator for a particular group and the current element. +@param {*} acc The (initial) accumulator value for each group. +@param {Function} keyFn The function that maps the list's element into a key. +@param {Array} list The array to group. +@return {Object} An object with the output of `keyFn` for keys, mapped to the output of + `valueFn` for elements which produced that key when passed to `keyFn`. +@see R.groupBy, R.reduce +@example + + var reduceToNamesBy = R.reduceBy((acc, student) => acc.concat(student.name), []); + var namesByGrade = reduceToNamesBy(function(student) { + var score = student.score; + return score < 65 ? 'F' : + score < 70 ? 'D' : + score < 80 ? 'C' : + score < 90 ? 'B' : 'A'; + }); + var students = [{name: 'Lucy', score: 92}, + {name: 'Drew', score: 85}, + // ... + {name: 'Bart', score: 62}]; + namesByGrade(students); + // { + // 'A': ['Lucy'], + // 'B': ['Drew'] + // // ..., + // 'F': ['Bart'] + // } diff --git a/templates/reduceRight.d.ts b/templates/reduceRight.d.ts new file mode 100644 index 0000000..300a8a8 --- /dev/null +++ b/templates/reduceRight.d.ts @@ -0,0 +1,7 @@ +import { List, Reduced } from './$types'; + +export function $( + fn: (value: T, accumulator: U) => Reduced | U, + initial: U, + values: List, +): U; diff --git a/templates/reduceRight.md b/templates/reduceRight.md new file mode 100644 index 0000000..c0901df --- /dev/null +++ b/templates/reduceRight.md @@ -0,0 +1,40 @@ +Returns a single item by iterating through the list, successively calling +the iterator function and passing it an accumulator value and the current +value from the array, and then passing the result to the next call. + +Similar to [`reduce`](#reduce), except moves through the input list from the +right to the left. + +The iterator function receives two values: *(value, acc)*, while the arguments' +order of `reduce`'s iterator function is *(acc, value)*. + +Note: `R.reduceRight` does not skip deleted or unassigned indices (sparse +arrays), unlike the native `Array.prototype.reduceRight` method. For more details +on this behavior, see: +https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight#Description + +@func +@memberOf R +@since v0.1.0 +@category List +@sig (a, b -> b) -> b -> [a] -> b +@param {Function} fn The iterator function. Receives two values, the current element from the array + and the accumulator. +@param {*} acc The accumulator value. +@param {Array} list The list to iterate over. +@return {*} The final, accumulated value. +@see R.reduce, R.addIndex +@example + + R.reduceRight(R.subtract, 0, [1, 2, 3, 4]) // => (1 - (2 - (3 - (4 - 0)))) = -2 + - -2 + / \ / \ + 1 - 1 3 + / \ / \ + 2 - ==> 2 -1 + / \ / \ + 3 - 3 4 + / \ / \ + 4 0 4 0 + +@symb R.reduceRight(f, a, [b, c, d]) = f(b, f(c, f(d, a))) diff --git a/templates/reduceWhile.d.ts b/templates/reduceWhile.d.ts new file mode 100644 index 0000000..8aed2ab --- /dev/null +++ b/templates/reduceWhile.d.ts @@ -0,0 +1,8 @@ +import { List, Reduced } from './$types'; + +export function $( + pred: (accumulator: U, value: T) => boolean, + fn: (accumulator: U, value: T) => Reduced | U, + initial: U, + values: List, +): U; diff --git a/templates/reduceWhile.md b/templates/reduceWhile.md new file mode 100644 index 0000000..e9f60a8 --- /dev/null +++ b/templates/reduceWhile.md @@ -0,0 +1,27 @@ +Like [`reduce`](#reduce), `reduceWhile` returns a single item by iterating +through the list, successively calling the iterator function. `reduceWhile` +also takes a predicate that is evaluated before each step. If the predicate +returns `false`, it "short-circuits" the iteration and returns the current +value of the accumulator. + +@func +@memberOf R +@since v0.22.0 +@category List +@sig ((a, b) -> Boolean) -> ((a, b) -> a) -> a -> [b] -> a +@param {Function} pred The predicate. It is passed the accumulator and the + current element. +@param {Function} fn The iterator function. Receives two values, the + accumulator and the current element. +@param {*} a The accumulator value. +@param {Array} list The list to iterate over. +@return {*} The final, accumulated value. +@see R.reduce, R.reduced +@example + + var isOdd = (acc, x) => x % 2 === 1; + var xs = [1, 3, 5, 60, 777, 800]; + R.reduceWhile(isOdd, R.add, 0, xs); //=> 9 + + var ys = [2, 4, 6] + R.reduceWhile(isOdd, R.add, 111, ys); //=> 111 diff --git a/templates/reduced.d.ts b/templates/reduced.d.ts new file mode 100644 index 0000000..b4fff93 --- /dev/null +++ b/templates/reduced.d.ts @@ -0,0 +1,3 @@ +import { Reduced } from './$types'; + +export function $(value: Reduced | T): Reduced; diff --git a/templates/reduced.md b/templates/reduced.md new file mode 100644 index 0000000..303c389 --- /dev/null +++ b/templates/reduced.md @@ -0,0 +1,22 @@ +Returns a value wrapped to indicate that it is the final value of the reduce +and transduce functions. The returned value should be considered a black +box: the internal structure is not guaranteed to be stable. + +Note: this optimization is unavailable to functions not explicitly listed +above. For instance, it is not currently supported by +[`reduceRight`](#reduceRight). + +@func +@memberOf R +@since v0.15.0 +@category List +@sig a -> * +@param {*} x The final value of the reduce. +@return {*} The wrapped value. +@see R.reduce, R.transduce +@example + + R.reduce( + (acc, item) => item > 3 ? R.reduced(acc) : acc.concat(item), + [], + [1, 2, 3, 4, 5]) // [1, 2, 3] diff --git a/templates/reject.d.ts b/templates/reject.d.ts new file mode 100644 index 0000000..1ff853c --- /dev/null +++ b/templates/reject.d.ts @@ -0,0 +1,15 @@ +import { Dictionary, Filterable, List, Predicate } from './$types'; + +export function $list(fn: Predicate, list: List): T[]; +export function $filterable>( + fn: Predicate, + filterable: U, +): U; +export function $object>( + fn: Predicate, + object: U, +): Partial; +export function $mixed | Filterable | Dictionary>( + fn: Predicate, + target: U, +): T[] | U | Partial; diff --git a/templates/reject.md b/templates/reject.md new file mode 100644 index 0000000..7d02eaf --- /dev/null +++ b/templates/reject.md @@ -0,0 +1,22 @@ +The complement of [`filter`](#filter). + +Acts as a transducer if a transformer is given in list position. Filterable +objects include plain objects or any object that has a filter method such +as `Array`. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig Filterable f => (a -> Boolean) -> f a -> f a +@param {Function} pred +@param {Array} filterable +@return {Array} +@see R.filter, R.transduce, R.addIndex +@example + + var isOdd = (n) => n % 2 === 1; + + R.reject(isOdd, [1, 2, 3, 4]); //=> [2, 4] + + R.reject(isOdd, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4} diff --git a/templates/remove.d.ts b/templates/remove.d.ts new file mode 100644 index 0000000..52a0937 --- /dev/null +++ b/templates/remove.d.ts @@ -0,0 +1 @@ +export function $(start: number, counter: number, list: T[]): T[]; diff --git a/templates/remove.md b/templates/remove.md new file mode 100644 index 0000000..ecbd2de --- /dev/null +++ b/templates/remove.md @@ -0,0 +1,17 @@ +Removes the sub-list of `list` starting at index `start` and containing +`count` elements. _Note that this is not destructive_: it returns a copy of +the list with the changes. +No lists have been harmed in the application of this function. + +@func +@memberOf R +@since v0.2.2 +@category List +@sig Number -> Number -> [a] -> [a] +@param {Number} start The position to start removing elements +@param {Number} count The number of elements to remove +@param {Array} list The list to remove from +@return {Array} A new Array with `count` elements from `start` removed. +@example + + R.remove(2, 3, [1,2,3,4,5,6,7,8]); //=> [1,2,6,7,8] diff --git a/templates/repeat.d.ts b/templates/repeat.d.ts new file mode 100644 index 0000000..98ba2bf --- /dev/null +++ b/templates/repeat.d.ts @@ -0,0 +1 @@ +export function $(value: T, count: number): T[]; diff --git a/templates/repeat.md b/templates/repeat.md new file mode 100644 index 0000000..ce0939b --- /dev/null +++ b/templates/repeat.md @@ -0,0 +1,21 @@ +Returns a fixed list of size `n` containing a specified identical value. + +@func +@memberOf R +@since v0.1.1 +@category List +@sig a -> n -> [a] +@param {*} value The value to repeat. +@param {Number} n The desired size of the output list. +@return {Array} A new array containing `n` `value`s. +@see R.times +@example + + R.repeat('hi', 5); //=> ['hi', 'hi', 'hi', 'hi', 'hi'] + + var obj = {}; + var repeatedObjs = R.repeat(obj, 5); //=> [{}, {}, {}, {}, {}] + repeatedObjs[0] === repeatedObjs[1]; //=> true +@symb R.repeat(a, 0) = [] +@symb R.repeat(a, 1) = [a] +@symb R.repeat(a, 2) = [a, a] diff --git a/templates/replace.d.ts b/templates/replace.d.ts new file mode 100644 index 0000000..fa81782 --- /dev/null +++ b/templates/replace.d.ts @@ -0,0 +1,5 @@ +export function $( + pattern: RegExp | string, + replacement: string, + str: string, +): string; diff --git a/templates/replace.md b/templates/replace.md new file mode 100644 index 0000000..c920d52 --- /dev/null +++ b/templates/replace.md @@ -0,0 +1,18 @@ +Replace a substring or regex match in a string with a replacement. + +@func +@memberOf R +@since v0.7.0 +@category String +@sig RegExp|String -> String -> String -> String +@param {RegExp|String} pattern A regular expression or a substring to match. +@param {String} replacement The string to replace the matches with. +@param {String} str The String to do the search and replacement in. +@return {String} The result. +@example + + R.replace('foo', 'bar', 'foo foo foo'); //=> 'bar foo foo' + R.replace(/foo/, 'bar', 'foo foo foo'); //=> 'bar foo foo' + + // Use the "g" (global) flag to replace all occurrences: + R.replace(/foo/g, 'bar', 'foo foo foo'); //=> 'bar bar bar' diff --git a/templates/reverse.d.ts b/templates/reverse.d.ts new file mode 100644 index 0000000..52ff4bc --- /dev/null +++ b/templates/reverse.d.ts @@ -0,0 +1,5 @@ +import { List } from './$types'; + +export function $string(str: string): string; +export function $list(list: List): T[]; +export function $mixed(list: string | List): string | T[]; diff --git a/templates/reverse.md b/templates/reverse.md new file mode 100644 index 0000000..30acc29 --- /dev/null +++ b/templates/reverse.md @@ -0,0 +1,22 @@ +Returns a new list or string with the elements or characters in reverse +order. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig [a] -> [a] +@sig String -> String +@param {Array|String} list +@return {Array|String} +@example + + R.reverse([1, 2, 3]); //=> [3, 2, 1] + R.reverse([1, 2]); //=> [2, 1] + R.reverse([1]); //=> [1] + R.reverse([]); //=> [] + + R.reverse('abc'); //=> 'cba' + R.reverse('ab'); //=> 'ba' + R.reverse('a'); //=> 'a' + R.reverse(''); //=> '' diff --git a/templates/scan.d.ts b/templates/scan.d.ts new file mode 100644 index 0000000..51da6d6 --- /dev/null +++ b/templates/scan.d.ts @@ -0,0 +1,7 @@ +import { List, Reduced } from './$types'; + +export function $( + fn: (accumulator: U, value: T) => Reduced | U, + initial: U, + values: List, +): U[]; diff --git a/templates/scan.md b/templates/scan.md new file mode 100644 index 0000000..bbd9d1b --- /dev/null +++ b/templates/scan.md @@ -0,0 +1,19 @@ +Scan is similar to [`reduce`](#reduce), but returns a list of successively +reduced values from the left + +@func +@memberOf R +@since v0.10.0 +@category List +@sig (a,b -> a) -> a -> [b] -> [a] +@param {Function} fn The iterator function. Receives two values, the accumulator and the + current element from the array +@param {*} acc The accumulator value. +@param {Array} list The list to iterate over. +@return {Array} A list of all intermediately reduced values. +@see R.reduce +@example + + var numbers = [1, 2, 3, 4]; + var factorials = R.scan(R.multiply, 1, numbers); //=> [1, 1, 2, 6, 24] +@symb R.scan(f, a, [b, c]) = [a, f(a, b), f(f(a, b), c)] diff --git a/templates/sequence.d.ts b/templates/sequence.d.ts new file mode 100644 index 0000000..13a6a83 --- /dev/null +++ b/templates/sequence.d.ts @@ -0,0 +1,14 @@ +import { Applicative, List, Morphism, Traversable } from './$types'; + +export function $list( + of: Morphism>, + traversable: List>, +): Applicative; +export function $traversable( + of: Morphism>, + traversable: Traversable>, +): Applicative>; +export function $mixed( + of: Morphism>, + traversable: List> | Traversable>, +): Applicative | Applicative>; diff --git a/templates/sequence.md b/templates/sequence.md new file mode 100644 index 0000000..ac4f9de --- /dev/null +++ b/templates/sequence.md @@ -0,0 +1,22 @@ +Transforms a [Traversable](https://github.com/fantasyland/fantasy-land#traversable) +of [Applicative](https://github.com/fantasyland/fantasy-land#applicative) into an +Applicative of Traversable. + +Dispatches to the `sequence` method of the second argument, if present. + +@func +@memberOf R +@since v0.19.0 +@category List +@sig (Applicative f, Traversable t) => (a -> f a) -> t (f a) -> f (t a) +@param {Function} of +@param {*} traversable +@return {*} +@see R.traverse +@example + + R.sequence(Maybe.of, [Just(1), Just(2), Just(3)]); //=> Just([1, 2, 3]) + R.sequence(Maybe.of, [Just(1), Just(2), Nothing()]); //=> Nothing() + + R.sequence(R.of, Just([1, 2, 3])); //=> [Just(1), Just(2), Just(3)] + R.sequence(R.of, Nothing()); //=> [Nothing()] diff --git a/templates/set.d.ts b/templates/set.d.ts new file mode 100644 index 0000000..c33fefe --- /dev/null +++ b/templates/set.d.ts @@ -0,0 +1,19 @@ +import { NumberToString } from './$operation'; +import { ManualLens, PseudoLens } from './$types'; + +export function $number( + lens: PseudoLens, + value: U[NumberToString[N]], + target: U, +): U; +export function $string>( + lens: PseudoLens, + value: U[K], + target: U, +): U; +export function $manual(lens: ManualLens, value: T, target: U): U; +export function $general( + lens: PseudoLens | ManualLens, + fn: any, + target: V, +): V; diff --git a/templates/set.md b/templates/set.md new file mode 100644 index 0000000..0c15b3b --- /dev/null +++ b/templates/set.md @@ -0,0 +1,20 @@ +Returns the result of "setting" the portion of the given data structure +focused by the given lens to the given value. + +@func +@memberOf R +@since v0.16.0 +@category Object +@typedefn Lens s a = Functor f => (a -> f a) -> s -> f s +@sig Lens s a -> a -> s -> s +@param {Lens} lens +@param {*} v +@param {*} x +@return {*} +@see R.prop, R.lensIndex, R.lensProp +@example + + var xLens = R.lensProp('x'); + + R.set(xLens, 4, {x: 1, y: 2}); //=> {x: 4, y: 2} + R.set(xLens, 8, {x: 1, y: 2}); //=> {x: 8, y: 2} diff --git a/templates/slice.d.ts b/templates/slice.d.ts new file mode 100644 index 0000000..7927141 --- /dev/null +++ b/templates/slice.d.ts @@ -0,0 +1,9 @@ +import { List } from './$types'; + +export function $string(from: number, to: number, str: string): string; +export function $list(from: number, to: number, list: List): T[]; +export function $mixed( + from: number, + to: number, + list: string | List, +): string | T[]; diff --git a/templates/slice.md b/templates/slice.md new file mode 100644 index 0000000..808247c --- /dev/null +++ b/templates/slice.md @@ -0,0 +1,22 @@ +Returns the elements of the given list or string (or object with a `slice` +method) from `fromIndex` (inclusive) to `toIndex` (exclusive). + +Dispatches to the `slice` method of the third argument, if present. + +@func +@memberOf R +@since v0.1.4 +@category List +@sig Number -> Number -> [a] -> [a] +@sig Number -> Number -> String -> String +@param {Number} fromIndex The start index (inclusive). +@param {Number} toIndex The end index (exclusive). +@param {*} list +@return {*} +@example + + R.slice(1, 3, ['a', 'b', 'c', 'd']); //=> ['b', 'c'] + R.slice(1, Infinity, ['a', 'b', 'c', 'd']); //=> ['b', 'c', 'd'] + R.slice(0, -1, ['a', 'b', 'c', 'd']); //=> ['a', 'b', 'c'] + R.slice(-3, -1, ['a', 'b', 'c', 'd']); //=> ['b', 'c'] + R.slice(0, 3, 'ramda'); //=> 'ram' diff --git a/templates/sort.d.ts b/templates/sort.d.ts new file mode 100644 index 0000000..ad18259 --- /dev/null +++ b/templates/sort.d.ts @@ -0,0 +1,3 @@ +import { Comparator, List } from './$types'; + +export function $(fn: Comparator, list: List): T[]; diff --git a/templates/sort.md b/templates/sort.md new file mode 100644 index 0000000..5c3be75 --- /dev/null +++ b/templates/sort.md @@ -0,0 +1,18 @@ +Returns a copy of the list, sorted according to the comparator function, +which should accept two values at a time and return a negative number if the +first value is smaller, a positive number if it's larger, and zero if they +are equal. Please note that this is a **copy** of the list. It does not +modify the original. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig (a,a -> Number) -> [a] -> [a] +@param {Function} comparator A sorting function :: a -> b -> Int +@param {Array} list The list to sort +@return {Array} a new array with its elements sorted by the comparator function. +@example + + var diff = function(a, b) { return a - b; }; + R.sort(diff, [4,2,7,5]); //=> [2, 4, 5, 7] diff --git a/templates/sortBy.d.ts b/templates/sortBy.d.ts new file mode 100644 index 0000000..bf1a33e --- /dev/null +++ b/templates/sortBy.d.ts @@ -0,0 +1,3 @@ +import { List, Morphism, Ordered } from './$types'; + +export function $(fn: Morphism, list: List): T[]; diff --git a/templates/sortBy.md b/templates/sortBy.md new file mode 100644 index 0000000..f7c8833 --- /dev/null +++ b/templates/sortBy.md @@ -0,0 +1,30 @@ +Sorts the list according to the supplied function. + +@func +@memberOf R +@since v0.1.0 +@category Relation +@sig Ord b => (a -> b) -> [a] -> [a] +@param {Function} fn +@param {Array} list The list to sort. +@return {Array} A new list sorted by the keys generated by `fn`. +@example + + var sortByFirstItem = R.sortBy(R.prop(0)); + var sortByNameCaseInsensitive = R.sortBy(R.compose(R.toLower, R.prop('name'))); + var pairs = [[-1, 1], [-2, 2], [-3, 3]]; + sortByFirstItem(pairs); //=> [[-3, 3], [-2, 2], [-1, 1]] + var alice = { + name: 'ALICE', + age: 101 + }; + var bob = { + name: 'Bob', + age: -10 + }; + var clara = { + name: 'clara', + age: 314.159 + }; + var people = [clara, bob, alice]; + sortByNameCaseInsensitive(people); //=> [alice, bob, clara] diff --git a/templates/sortWith.d.ts b/templates/sortWith.d.ts new file mode 100644 index 0000000..fa19a97 --- /dev/null +++ b/templates/sortWith.d.ts @@ -0,0 +1,3 @@ +import { Comparator, List } from './$types'; + +export function $(fns: Comparator[], list: List): T[]; diff --git a/templates/sortWith.md b/templates/sortWith.md new file mode 100644 index 0000000..b023b84 --- /dev/null +++ b/templates/sortWith.md @@ -0,0 +1,30 @@ +Sorts a list according to a list of comparators. + +@func +@memberOf R +@since v0.23.0 +@category Relation +@sig [a -> a -> Number] -> [a] -> [a] +@param {Array} functions A list of comparator functions. +@param {Array} list The list to sort. +@return {Array} A new list sorted according to the comarator functions. +@example + + var alice = { + name: 'alice', + age: 40 + }; + var bob = { + name: 'bob', + age: 30 + }; + var clara = { + name: 'clara', + age: 40 + }; + var people = [clara, bob, alice]; + var ageNameSort = R.sortWith([ + R.descend(R.prop('age')), + R.ascend(R.prop('name')) + ]); + ageNameSort(people); //=> [alice, clara, bob] diff --git a/templates/split.d.ts b/templates/split.d.ts new file mode 100644 index 0000000..3761c76 --- /dev/null +++ b/templates/split.d.ts @@ -0,0 +1 @@ +export function $(separator: RegExp | string, str: string): string[]; diff --git a/templates/split.md b/templates/split.md new file mode 100644 index 0000000..529732c --- /dev/null +++ b/templates/split.md @@ -0,0 +1,18 @@ +Splits a string into an array of strings based on the given +separator. + +@func +@memberOf R +@since v0.1.0 +@category String +@sig (String | RegExp) -> String -> [String] +@param {String|RegExp} sep The pattern. +@param {String} str The string to separate into an array. +@return {Array} The array of strings from `str` separated by `str`. +@see R.join +@example + + var pathComponents = R.split('/'); + R.tail(pathComponents('/usr/local/bin/node')); //=> ['usr', 'local', 'bin', 'node'] + + R.split('.', 'a.b.c.xyz.d'); //=> ['a', 'b', 'c', 'xyz', 'd'] diff --git a/templates/splitAt.d.ts b/templates/splitAt.d.ts new file mode 100644 index 0000000..dcf48f2 --- /dev/null +++ b/templates/splitAt.d.ts @@ -0,0 +1,8 @@ +import { List } from './$types'; + +export function $string(index: number, str: string): [string, string]; +export function $list(index: number, list: List): [T[], T[]]; +export function $mixed( + index: number, + list: string | List, +): [string, string] | [T[], T[]]; diff --git a/templates/splitAt.md b/templates/splitAt.md new file mode 100644 index 0000000..74ed0f6 --- /dev/null +++ b/templates/splitAt.md @@ -0,0 +1,16 @@ +Splits a given list or string at a given index. + +@func +@memberOf R +@since v0.19.0 +@category List +@sig Number -> [a] -> [[a], [a]] +@sig Number -> String -> [String, String] +@param {Number} index The index where the array/string is split. +@param {Array|String} array The array/string to be split. +@return {Array} +@example + + R.splitAt(1, [1, 2, 3]); //=> [[1], [2, 3]] + R.splitAt(5, 'hello world'); //=> ['hello', ' world'] + R.splitAt(-1, 'foobar'); //=> ['fooba', 'r'] diff --git a/templates/splitEvery.d.ts b/templates/splitEvery.d.ts new file mode 100644 index 0000000..432d935 --- /dev/null +++ b/templates/splitEvery.d.ts @@ -0,0 +1,5 @@ +import { List } from './$types'; + +export function $string(n: number, str: string): string[]; +export function $list(n: number, list: List): T[][]; +export function $mixed(n: number, list: string | List): string[] | T[][]; diff --git a/templates/splitEvery.md b/templates/splitEvery.md new file mode 100644 index 0000000..8f52e34 --- /dev/null +++ b/templates/splitEvery.md @@ -0,0 +1,15 @@ +Splits a collection into slices of the specified length. + +@func +@memberOf R +@since v0.16.0 +@category List +@sig Number -> [a] -> [[a]] +@sig Number -> String -> [String] +@param {Number} n +@param {Array} list +@return {Array} +@example + + R.splitEvery(3, [1, 2, 3, 4, 5, 6, 7]); //=> [[1, 2, 3], [4, 5, 6], [7]] + R.splitEvery(3, 'foobarbaz'); //=> ['foo', 'bar', 'baz'] diff --git a/templates/splitWhen.d.ts b/templates/splitWhen.d.ts new file mode 100644 index 0000000..72e57d3 --- /dev/null +++ b/templates/splitWhen.d.ts @@ -0,0 +1,3 @@ +import { List, Predicate } from './$types'; + +export function $(fn: Predicate, list: List): [T[], T[]]; diff --git a/templates/splitWhen.md b/templates/splitWhen.md new file mode 100644 index 0000000..7ed4dd9 --- /dev/null +++ b/templates/splitWhen.md @@ -0,0 +1,17 @@ +Takes a list and a predicate and returns a pair of lists with the following properties: + + - the result of concatenating the two output lists is equivalent to the input list; + - none of the elements of the first output list satisfies the predicate; and + - if the second output list is non-empty, its first element satisfies the predicate. + +@func +@memberOf R +@since v0.19.0 +@category List +@sig (a -> Boolean) -> [a] -> [[a], [a]] +@param {Function} pred The predicate that determines where the array is split. +@param {Array} list The array to be split. +@return {Array} +@example + + R.splitWhen(R.equals(2), [1, 2, 3, 1, 2, 3]); //=> [[1], [2, 3, 1, 2, 3]] diff --git a/templates/startsWith.d.ts b/templates/startsWith.d.ts new file mode 100644 index 0000000..1783de2 --- /dev/null +++ b/templates/startsWith.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $>(prefix: T, list: T): boolean; diff --git a/templates/startsWith.md b/templates/startsWith.md new file mode 100644 index 0000000..ecc269c --- /dev/null +++ b/templates/startsWith.md @@ -0,0 +1,17 @@ +Checks if a list starts with the provided values + +@func +@memberOf R +@since v0.24.0 +@category List +@sig [a] -> Boolean +@sig String -> Boolean +@param {*} prefix +@param {*} list +@return {Boolean} +@example + + R.startsWith('a', 'abc') //=> true + R.startsWith('b', 'abc') //=> false + R.startsWith(['a'], ['a', 'b', 'c']) //=> true + R.startsWith(['b'], ['a', 'b', 'c']) //=> false diff --git a/templates/subtract.d.ts b/templates/subtract.d.ts new file mode 100644 index 0000000..9e0dcbf --- /dev/null +++ b/templates/subtract.d.ts @@ -0,0 +1 @@ +export function $(a: number, b: number): number; diff --git a/templates/subtract.md b/templates/subtract.md new file mode 100644 index 0000000..a03c63b --- /dev/null +++ b/templates/subtract.md @@ -0,0 +1,21 @@ +Subtracts its second argument from its first argument. + +@func +@memberOf R +@since v0.1.0 +@category Math +@sig Number -> Number -> Number +@param {Number} a The first value. +@param {Number} b The second value. +@return {Number} The result of `a - b`. +@see R.add +@example + + R.subtract(10, 8); //=> 2 + + var minus5 = R.subtract(R.__, 5); + minus5(17); //=> 12 + + var complementaryAngle = R.subtract(90); + complementaryAngle(30); //=> 60 + complementaryAngle(72); //=> 18 diff --git a/templates/sum.d.ts b/templates/sum.d.ts new file mode 100644 index 0000000..9e5a54d --- /dev/null +++ b/templates/sum.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(numbers: List): number; diff --git a/templates/sum.md b/templates/sum.md new file mode 100644 index 0000000..8b0c87b --- /dev/null +++ b/templates/sum.md @@ -0,0 +1,13 @@ +Adds together all the elements of a list. + +@func +@memberOf R +@since v0.1.0 +@category Math +@sig [Number] -> Number +@param {Array} list An array of numbers +@return {Number} The sum of all the numbers in the list. +@see R.reduce +@example + + R.sum([2,4,6,8,100,1]); //=> 121 diff --git a/templates/symmetricDifference.d.ts b/templates/symmetricDifference.d.ts new file mode 100644 index 0000000..29943c3 --- /dev/null +++ b/templates/symmetricDifference.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(a: List, b: List): T[]; diff --git a/templates/symmetricDifference.md b/templates/symmetricDifference.md new file mode 100644 index 0000000..957c31d --- /dev/null +++ b/templates/symmetricDifference.md @@ -0,0 +1,16 @@ +Finds the set (i.e. no duplicates) of all elements contained in the first or +second list, but not both. + +@func +@memberOf R +@since v0.19.0 +@category Relation +@sig [*] -> [*] -> [*] +@param {Array} list1 The first list. +@param {Array} list2 The second list. +@return {Array} The elements in `list1` or `list2`, but not both. +@see R.symmetricDifferenceWith, R.difference, R.differenceWith +@example + + R.symmetricDifference([1,2,3,4], [7,6,5,4,3]); //=> [1,2,7,6,5] + R.symmetricDifference([7,6,5,4,3], [1,2,3,4]); //=> [7,6,5,1,2] diff --git a/templates/symmetricDifferenceWith.d.ts b/templates/symmetricDifferenceWith.d.ts new file mode 100644 index 0000000..5dbd900 --- /dev/null +++ b/templates/symmetricDifferenceWith.d.ts @@ -0,0 +1,3 @@ +import { Comparator, List } from './$types'; + +export function $(fn: Comparator, a: List, b: List): T[]; diff --git a/templates/symmetricDifferenceWith.md b/templates/symmetricDifferenceWith.md new file mode 100644 index 0000000..976b7dc --- /dev/null +++ b/templates/symmetricDifferenceWith.md @@ -0,0 +1,20 @@ +Finds the set (i.e. no duplicates) of all elements contained in the first or +second list, but not both. Duplication is determined according to the value +returned by applying the supplied predicate to two list elements. + +@func +@memberOf R +@since v0.19.0 +@category Relation +@sig ((a, a) -> Boolean) -> [a] -> [a] -> [a] +@param {Function} pred A predicate used to test whether two items are equal. +@param {Array} list1 The first list. +@param {Array} list2 The second list. +@return {Array} The elements in `list1` or `list2`, but not both. +@see R.symmetricDifference, R.difference, R.differenceWith +@example + + var eqA = R.eqBy(R.prop('a')); + var l1 = [{a: 1}, {a: 2}, {a: 3}, {a: 4}]; + var l2 = [{a: 3}, {a: 4}, {a: 5}, {a: 6}]; + R.symmetricDifferenceWith(eqA, l1, l2); //=> [{a: 1}, {a: 2}, {a: 5}, {a: 6}] diff --git a/templates/tail.d.ts b/templates/tail.d.ts new file mode 100644 index 0000000..52ff4bc --- /dev/null +++ b/templates/tail.d.ts @@ -0,0 +1,5 @@ +import { List } from './$types'; + +export function $string(str: string): string; +export function $list(list: List): T[]; +export function $mixed(list: string | List): string | T[]; diff --git a/templates/tail.md b/templates/tail.md new file mode 100644 index 0000000..2bf3e7a --- /dev/null +++ b/templates/tail.md @@ -0,0 +1,25 @@ +Returns all but the first element of the given list or string (or object +with a `tail` method). + +Dispatches to the `slice` method of the first argument, if present. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig [a] -> [a] +@sig String -> String +@param {*} list +@return {*} +@see R.head, R.init, R.last +@example + + R.tail([1, 2, 3]); //=> [2, 3] + R.tail([1, 2]); //=> [2] + R.tail([1]); //=> [] + R.tail([]); //=> [] + + R.tail('abc'); //=> 'bc' + R.tail('ab'); //=> 'b' + R.tail('a'); //=> '' + R.tail(''); //=> '' diff --git a/templates/take.d.ts b/templates/take.d.ts new file mode 100644 index 0000000..63dfe38 --- /dev/null +++ b/templates/take.d.ts @@ -0,0 +1,5 @@ +import { List } from './$types'; + +export function $string(n: number, str: string): string; +export function $list(n: number, list: List): T[]; +export function $mixed(n: number, list: string | List): string | T[]; diff --git a/templates/take.md b/templates/take.md new file mode 100644 index 0000000..b640da5 --- /dev/null +++ b/templates/take.md @@ -0,0 +1,41 @@ +Returns the first `n` elements of the given list, string, or +transducer/transformer (or object with a `take` method). + +Dispatches to the `take` method of the second argument, if present. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig Number -> [a] -> [a] +@sig Number -> String -> String +@param {Number} n +@param {*} list +@return {*} +@see R.drop +@example + + R.take(1, ['foo', 'bar', 'baz']); //=> ['foo'] + R.take(2, ['foo', 'bar', 'baz']); //=> ['foo', 'bar'] + R.take(3, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz'] + R.take(4, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz'] + R.take(3, 'ramda'); //=> 'ram' + + var personnel = [ + 'Dave Brubeck', + 'Paul Desmond', + 'Eugene Wright', + 'Joe Morello', + 'Gerry Mulligan', + 'Bob Bates', + 'Joe Dodge', + 'Ron Crotty' + ]; + + var takeFive = R.take(5); + takeFive(personnel); + //=> ['Dave Brubeck', 'Paul Desmond', 'Eugene Wright', 'Joe Morello', 'Gerry Mulligan'] +@symb R.take(-1, [a, b]) = [a, b] +@symb R.take(0, [a, b]) = [] +@symb R.take(1, [a, b]) = [a] +@symb R.take(2, [a, b]) = [a, b] diff --git a/templates/takeLast.d.ts b/templates/takeLast.d.ts new file mode 100644 index 0000000..63dfe38 --- /dev/null +++ b/templates/takeLast.d.ts @@ -0,0 +1,5 @@ +import { List } from './$types'; + +export function $string(n: number, str: string): string; +export function $list(n: number, list: List): T[]; +export function $mixed(n: number, list: string | List): string | T[]; diff --git a/templates/takeLast.md b/templates/takeLast.md new file mode 100644 index 0000000..0f90f81 --- /dev/null +++ b/templates/takeLast.md @@ -0,0 +1,20 @@ +Returns a new list containing the last `n` elements of the given list. +If `n > list.length`, returns a list of `list.length` elements. + +@func +@memberOf R +@since v0.16.0 +@category List +@sig Number -> [a] -> [a] +@sig Number -> String -> String +@param {Number} n The number of elements to return. +@param {Array} xs The collection to consider. +@return {Array} +@see R.dropLast +@example + + R.takeLast(1, ['foo', 'bar', 'baz']); //=> ['baz'] + R.takeLast(2, ['foo', 'bar', 'baz']); //=> ['bar', 'baz'] + R.takeLast(3, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz'] + R.takeLast(4, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz'] + R.takeLast(3, 'ramda'); //=> 'mda' diff --git a/templates/takeLastWhile.d.ts b/templates/takeLastWhile.d.ts new file mode 100644 index 0000000..9dca73b --- /dev/null +++ b/templates/takeLastWhile.d.ts @@ -0,0 +1,3 @@ +import { List, Predicate } from './$types'; + +export function $(fn: Predicate, list: List): T[]; diff --git a/templates/takeLastWhile.md b/templates/takeLastWhile.md new file mode 100644 index 0000000..a80e779 --- /dev/null +++ b/templates/takeLastWhile.md @@ -0,0 +1,20 @@ +Returns a new list containing the last `n` elements of a given list, passing +each value to the supplied predicate function, and terminating when the +predicate function returns `false`. Excludes the element that caused the +predicate function to fail. The predicate function is passed one argument: +*(value)*. + +@func +@memberOf R +@since v0.16.0 +@category List +@sig (a -> Boolean) -> [a] -> [a] +@param {Function} fn The function called per iteration. +@param {Array} list The collection to iterate over. +@return {Array} A new array. +@see R.dropLastWhile, R.addIndex +@example + + var isNotOne = x => x !== 1; + + R.takeLastWhile(isNotOne, [1, 2, 3, 4]); //=> [2, 3, 4] diff --git a/templates/takeWhile.d.ts b/templates/takeWhile.d.ts new file mode 100644 index 0000000..9dca73b --- /dev/null +++ b/templates/takeWhile.d.ts @@ -0,0 +1,3 @@ +import { List, Predicate } from './$types'; + +export function $(fn: Predicate, list: List): T[]; diff --git a/templates/takeWhile.md b/templates/takeWhile.md new file mode 100644 index 0000000..4f7d3c8 --- /dev/null +++ b/templates/takeWhile.md @@ -0,0 +1,24 @@ +Returns a new list containing the first `n` elements of a given list, +passing each value to the supplied predicate function, and terminating when +the predicate function returns `false`. Excludes the element that caused the +predicate function to fail. The predicate function is passed one argument: +*(value)*. + +Dispatches to the `takeWhile` method of the second argument, if present. + +Acts as a transducer if a transformer is given in list position. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig (a -> Boolean) -> [a] -> [a] +@param {Function} fn The function called per iteration. +@param {Array} list The collection to iterate over. +@return {Array} A new array. +@see R.dropWhile, R.transduce, R.addIndex +@example + + var isNotFour = x => x !== 4; + + R.takeWhile(isNotFour, [1, 2, 3, 4, 3, 2, 1]); //=> [1, 2, 3] diff --git a/templates/tap.d.ts b/templates/tap.d.ts new file mode 100644 index 0000000..161aa1d --- /dev/null +++ b/templates/tap.d.ts @@ -0,0 +1,3 @@ +import { Tap } from './$types'; + +export function $(fn: Tap, value: T): T; diff --git a/templates/tap.md b/templates/tap.md new file mode 100644 index 0000000..23c54a7 --- /dev/null +++ b/templates/tap.md @@ -0,0 +1,16 @@ +Runs the given function with the supplied object, then returns the object. + +@func +@memberOf R +@since v0.1.0 +@category Function +@sig (a -> *) -> a -> a +@param {Function} fn The function to call with `x`. The return value of `fn` will be thrown away. +@param {*} x +@return {*} `x`. +@example + + var sayX = x => console.log('x is ' + x); + R.tap(sayX, 100); //=> 100 + // logs 'x is 100' +@symb R.tap(f, a) = a diff --git a/templates/test.d.ts b/templates/test.d.ts new file mode 100644 index 0000000..76ba883 --- /dev/null +++ b/templates/test.d.ts @@ -0,0 +1 @@ +export function $(pattern: RegExp, str: string): boolean; diff --git a/templates/test.md b/templates/test.md new file mode 100644 index 0000000..916ed36 --- /dev/null +++ b/templates/test.md @@ -0,0 +1,15 @@ +Determines whether a given string matches a given regular expression. + +@func +@memberOf R +@since v0.12.0 +@category String +@sig RegExp -> String -> Boolean +@param {RegExp} pattern +@param {String} str +@return {Boolean} +@see R.match +@example + + R.test(/^x/, 'xyz'); //=> true + R.test(/^y/, 'xyz'); //=> false diff --git a/templates/times.d.ts b/templates/times.d.ts new file mode 100644 index 0000000..cfda561 --- /dev/null +++ b/templates/times.d.ts @@ -0,0 +1,3 @@ +import { Morphism } from './$types'; + +export function $(fn: Morphism, n: number): T[]; diff --git a/templates/times.md b/templates/times.md new file mode 100644 index 0000000..c0db41c --- /dev/null +++ b/templates/times.md @@ -0,0 +1,21 @@ +Calls an input function `n` times, returning an array containing the results +of those function calls. + +`fn` is passed one argument: The current value of `n`, which begins at `0` +and is gradually incremented to `n - 1`. + +@func +@memberOf R +@since v0.2.3 +@category List +@sig (Number -> a) -> Number -> [a] +@param {Function} fn The function to invoke. Passed one argument, the current value of `n`. +@param {Number} n A value between `0` and `n - 1`. Increments after each function call. +@return {Array} An array containing the return values of all calls to `fn`. +@see R.repeat +@example + + R.times(R.identity, 5); //=> [0, 1, 2, 3, 4] +@symb R.times(f, 0) = [] +@symb R.times(f, 1) = [f(0)] +@symb R.times(f, 2) = [f(0), f(1)] diff --git a/templates/toLower.d.ts b/templates/toLower.d.ts new file mode 100644 index 0000000..1148e50 --- /dev/null +++ b/templates/toLower.d.ts @@ -0,0 +1 @@ +export function $(str: string): string; diff --git a/templates/toLower.md b/templates/toLower.md new file mode 100644 index 0000000..5836ef3 --- /dev/null +++ b/templates/toLower.md @@ -0,0 +1,13 @@ +The lower case version of a string. + +@func +@memberOf R +@since v0.9.0 +@category String +@sig String -> String +@param {String} str The string to lower case. +@return {String} The lower case version of `str`. +@see R.toUpper +@example + + R.toLower('XYZ'); //=> 'xyz' diff --git a/templates/toPairs.d.ts b/templates/toPairs.d.ts new file mode 100644 index 0000000..30bd36c --- /dev/null +++ b/templates/toPairs.d.ts @@ -0,0 +1 @@ +export function $(object: T): [keyof T, T[keyof T]][]; diff --git a/templates/toPairs.md b/templates/toPairs.md new file mode 100644 index 0000000..e6f5f91 --- /dev/null +++ b/templates/toPairs.md @@ -0,0 +1,16 @@ +Converts an object into an array of key, value arrays. Only the object's +own properties are used. +Note that the order of the output array is not guaranteed to be consistent +across different JS platforms. + +@func +@memberOf R +@since v0.4.0 +@category Object +@sig {String: *} -> [[String,*]] +@param {Object} obj The object to extract from +@return {Array} An array of key, value arrays from the object's own properties. +@see R.fromPairs +@example + + R.toPairs({a: 1, b: 2, c: 3}); //=> [['a', 1], ['b', 2], ['c', 3]] diff --git a/templates/toPairsIn.d.ts b/templates/toPairsIn.d.ts new file mode 100644 index 0000000..30bd36c --- /dev/null +++ b/templates/toPairsIn.d.ts @@ -0,0 +1 @@ +export function $(object: T): [keyof T, T[keyof T]][]; diff --git a/templates/toPairsIn.md b/templates/toPairsIn.md new file mode 100644 index 0000000..3b25485 --- /dev/null +++ b/templates/toPairsIn.md @@ -0,0 +1,19 @@ +Converts an object into an array of key, value arrays. The object's own +properties and prototype properties are used. Note that the order of the +output array is not guaranteed to be consistent across different JS +platforms. + +@func +@memberOf R +@since v0.4.0 +@category Object +@sig {String: *} -> [[String,*]] +@param {Object} obj The object to extract from +@return {Array} An array of key, value arrays from the object's own + and prototype properties. +@example + + var F = function() { this.x = 'X'; }; + F.prototype.y = 'Y'; + var f = new F(); + R.toPairsIn(f); //=> [['x','X'], ['y','Y']] diff --git a/templates/toString.d.ts b/templates/toString.d.ts new file mode 100644 index 0000000..65c6b24 --- /dev/null +++ b/templates/toString.d.ts @@ -0,0 +1 @@ +export function $(value: any): string; diff --git a/templates/toString.md b/templates/toString.md new file mode 100644 index 0000000..e9d6bf7 --- /dev/null +++ b/templates/toString.md @@ -0,0 +1,34 @@ +Returns the string representation of the given value. `eval`'ing the output +should result in a value equivalent to the input value. Many of the built-in +`toString` methods do not satisfy this requirement. + +If the given value is an `[object Object]` with a `toString` method other +than `Object.prototype.toString`, this method is invoked with no arguments +to produce the return value. This means user-defined constructor functions +can provide a suitable `toString` method. For example: + + function Point(x, y) { + this.x = x; + this.y = y; + } + + Point.prototype.toString = function() { + return 'new Point(' + this.x + ', ' + this.y + ')'; + }; + + R.toString(new Point(1, 2)); //=> 'new Point(1, 2)' + +@func +@memberOf R +@since v0.14.0 +@category String +@sig * -> String +@param {*} val +@return {String} +@example + + R.toString(42); //=> '42' + R.toString('abc'); //=> '"abc"' + R.toString([1, 2, 3]); //=> '[1, 2, 3]' + R.toString({foo: 1, bar: 2, baz: 3}); //=> '{"bar": 2, "baz": 3, "foo": 1}' + R.toString(new Date('2001-02-03T04:05:06Z')); //=> 'new Date("2001-02-03T04:05:06.000Z")' diff --git a/templates/toUpper.d.ts b/templates/toUpper.d.ts new file mode 100644 index 0000000..1148e50 --- /dev/null +++ b/templates/toUpper.d.ts @@ -0,0 +1 @@ +export function $(str: string): string; diff --git a/templates/toUpper.md b/templates/toUpper.md new file mode 100644 index 0000000..d2dab89 --- /dev/null +++ b/templates/toUpper.md @@ -0,0 +1,13 @@ +The upper case version of a string. + +@func +@memberOf R +@since v0.9.0 +@category String +@sig String -> String +@param {String} str The string to upper case. +@return {String} The upper case version of `str`. +@see R.toLower +@example + + R.toUpper('abc'); //=> 'ABC' diff --git a/templates/transduce.d.ts b/templates/transduce.d.ts new file mode 100644 index 0000000..6f0e58d --- /dev/null +++ b/templates/transduce.d.ts @@ -0,0 +1,11 @@ +import { Morphism, Reduced, Transformer } from './$types'; + +// NOTE: morphism transducer is just a fake type for built-in transformer: R.take, R.drop, etc. +export function $( + transducer: + | Morphism + | Morphism, Transformer>, + fn: (accumulator: U, value: T) => U | Reduced, + initial: U, + values: T[], +): U; diff --git a/templates/transduce.md b/templates/transduce.md new file mode 100644 index 0000000..3ae5469 --- /dev/null +++ b/templates/transduce.md @@ -0,0 +1,45 @@ +Initializes a transducer using supplied iterator function. Returns a single +item by iterating through the list, successively calling the transformed +iterator function and passing it an accumulator value and the current value +from the array, and then passing the result to the next call. + +The iterator function receives two values: *(acc, value)*. It will be +wrapped as a transformer to initialize the transducer. A transformer can be +passed directly in place of an iterator function. In both cases, iteration +may be stopped early with the [`R.reduced`](#reduced) function. + +A transducer is a function that accepts a transformer and returns a +transformer and can be composed directly. + +A transformer is an an object that provides a 2-arity reducing iterator +function, step, 0-arity initial value function, init, and 1-arity result +extraction function, result. The step function is used as the iterator +function in reduce. The result function is used to convert the final +accumulator into the return type and in most cases is +[`R.identity`](#identity). The init function can be used to provide an +initial accumulator, but is ignored by transduce. + +The iteration is performed with [`R.reduce`](#reduce) after initializing the transducer. + +@func +@memberOf R +@since v0.12.0 +@category List +@sig (c -> c) -> ((a, b) -> a) -> a -> [b] -> a +@param {Function} xf The transducer function. Receives a transformer and returns a transformer. +@param {Function} fn The iterator function. Receives two values, the accumulator and the + current element from the array. Wrapped as transformer, if necessary, and used to + initialize the transducer +@param {*} acc The initial accumulator value. +@param {Array} list The list to iterate over. +@return {*} The final, accumulated value. +@see R.reduce, R.reduced, R.into +@example + + var numbers = [1, 2, 3, 4]; + var transducer = R.compose(R.map(R.add(1)), R.take(2)); + R.transduce(transducer, R.flip(R.append), [], numbers); //=> [2, 3] + + var isOdd = (x) => x % 2 === 1; + var firstOddTransducer = R.compose(R.filter(isOdd), R.take(1)); + R.transduce(firstOddTransducer, R.flip(R.append), [], R.range(0, 100)); //=> [1] diff --git a/templates/transpose.d.ts b/templates/transpose.d.ts new file mode 100644 index 0000000..0647424 --- /dev/null +++ b/templates/transpose.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(list: List>): T[][]; diff --git a/templates/transpose.md b/templates/transpose.md new file mode 100644 index 0000000..fda2a7e --- /dev/null +++ b/templates/transpose.md @@ -0,0 +1,22 @@ +Transposes the rows and columns of a 2D list. +When passed a list of `n` lists of length `x`, +returns a list of `x` lists of length `n`. + + +@func +@memberOf R +@since v0.19.0 +@category List +@sig [[a]] -> [[a]] +@param {Array} list A 2D list +@return {Array} A 2D list +@example + + R.transpose([[1, 'a'], [2, 'b'], [3, 'c']]) //=> [[1, 2, 3], ['a', 'b', 'c']] + R.transpose([[1, 2, 3], ['a', 'b', 'c']]) //=> [[1, 'a'], [2, 'b'], [3, 'c']] + + // If some of the rows are shorter than the following rows, their elements are skipped: + R.transpose([[10, 11], [20], [], [30, 31, 32]]) //=> [[10, 20, 30], [11, 31], [32]] +@symb R.transpose([[a], [b], [c]]) = [a, b, c] +@symb R.transpose([[a, b], [c, d]]) = [[a, c], [b, d]] +@symb R.transpose([[a, b], [c]]) = [[a, c], [b]] diff --git a/templates/traverse.d.ts b/templates/traverse.d.ts new file mode 100644 index 0000000..2637881 --- /dev/null +++ b/templates/traverse.d.ts @@ -0,0 +1,17 @@ +import { Applicative, List, Morphism, Traversable } from './$types'; + +export function $list( + of: Morphism>, + fn: Morphism>, + traversable: List, +): Applicative; +export function $traversable( + of: Morphism>, + fn: Morphism>, + traversable: Traversable, +): Applicative>; +export function $mixed( + of: Morphism>, + fn: Morphism>, + traversable: List | Traversable, +): Applicative | Applicative>; diff --git a/templates/traverse.md b/templates/traverse.md new file mode 100644 index 0000000..164eadf --- /dev/null +++ b/templates/traverse.md @@ -0,0 +1,24 @@ +Maps an [Applicative](https://github.com/fantasyland/fantasy-land#applicative)-returning +function over a [Traversable](https://github.com/fantasyland/fantasy-land#traversable), +then uses [`sequence`](#sequence) to transform the resulting Traversable of Applicative +into an Applicative of Traversable. + +Dispatches to the `sequence` method of the third argument, if present. + +@func +@memberOf R +@since v0.19.0 +@category List +@sig (Applicative f, Traversable t) => (a -> f a) -> (a -> f b) -> t a -> f (t b) +@param {Function} of +@param {Function} f +@param {*} traversable +@return {*} +@see R.sequence +@example + + // Returns `Nothing` if the given divisor is `0` + safeDiv = n => d => d === 0 ? Nothing() : Just(n / d) + + R.traverse(Maybe.of, safeDiv(10), [2, 4, 5]); //=> Just([5, 2.5, 2]) + R.traverse(Maybe.of, safeDiv(10), [2, 0, 5]); //=> Nothing diff --git a/templates/trim.d.ts b/templates/trim.d.ts new file mode 100644 index 0000000..1148e50 --- /dev/null +++ b/templates/trim.d.ts @@ -0,0 +1 @@ +export function $(str: string): string; diff --git a/templates/trim.md b/templates/trim.md new file mode 100644 index 0000000..853df81 --- /dev/null +++ b/templates/trim.md @@ -0,0 +1,13 @@ +Removes (strips) whitespace from both ends of the string. + +@func +@memberOf R +@since v0.6.0 +@category String +@sig String -> String +@param {String} str The string to trim. +@return {String} Trimmed version of `str`. +@example + + R.trim(' xyz '); //=> 'xyz' + R.map(R.trim, R.split(',', 'x, y, z')); //=> ['x', 'y', 'z'] diff --git a/templates/tryCatch.d.ts b/templates/tryCatch.d.ts new file mode 100644 index 0000000..6df45a1 --- /dev/null +++ b/templates/tryCatch.d.ts @@ -0,0 +1 @@ +export function $(tryer: F, catcher: F): F; diff --git a/templates/tryCatch.md b/templates/tryCatch.md new file mode 100644 index 0000000..d38a02d --- /dev/null +++ b/templates/tryCatch.md @@ -0,0 +1,19 @@ +`tryCatch` takes two functions, a `tryer` and a `catcher`. The returned +function evaluates the `tryer`; if it does not throw, it simply returns the +result. If the `tryer` *does* throw, the returned function evaluates the +`catcher` function and returns its result. Note that for effective +composition with this function, both the `tryer` and `catcher` functions +must return the same type of results. + +@func +@memberOf R +@since v0.20.0 +@category Function +@sig (...x -> a) -> ((e, ...x) -> a) -> (...x -> a) +@param {Function} tryer The function that may throw. +@param {Function} catcher The function that will be evaluated if `tryer` throws. +@return {Function} A new function that will catch exceptions and send then to the catcher. +@example + + R.tryCatch(R.prop('x'), R.F)({x: true}); //=> true + R.tryCatch(R.prop('x'), R.F)(null); //=> false diff --git a/templates/tslint.json b/templates/tslint.json new file mode 100644 index 0000000..9b7e08d --- /dev/null +++ b/templates/tslint.json @@ -0,0 +1,15 @@ +{ + "extends": "../tslint.json", + "rules": { + "no-default-export": false, + "filename-convention": [ + true, + { + "namingStyle": "camelCase", + "allowPatterns": ["^(__|T|F)(\\.r)?$"], + "allowPrefixes": ["$"], + "allowSuffixes": [".c", ".r"] + } + ] + } +} diff --git a/templates/type.d.ts b/templates/type.d.ts new file mode 100644 index 0000000..7eb7b23 --- /dev/null +++ b/templates/type.d.ts @@ -0,0 +1,7 @@ +export function $null(value: null): 'Null'; +export function $undefined(value: undefined): 'Undefined'; +export function $boolean(value: boolean): 'Boolean'; +export function $number(value: number): 'Number'; +export function $string(value: string): 'String'; +export function $symbol(value: symbol): 'Symbol'; +export function $general(value: any): string; diff --git a/templates/type.md b/templates/type.md new file mode 100644 index 0000000..86a745b --- /dev/null +++ b/templates/type.md @@ -0,0 +1,22 @@ +Gives a single-word string description of the (native) type of a value, +returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not +attempt to distinguish user Object types any further, reporting them all as +'Object'. + +@func +@memberOf R +@since v0.8.0 +@category Type +@sig (* -> {*}) -> String +@param {*} val The value to test +@return {String} +@example + + R.type({}); //=> "Object" + R.type(1); //=> "Number" + R.type(false); //=> "Boolean" + R.type('s'); //=> "String" + R.type(null); //=> "Null" + R.type([]); //=> "Array" + R.type(/[A-z]/); //=> "RegExp" + R.type(() => {}); //=> "Function" diff --git a/templates/unapply.d.ts b/templates/unapply.d.ts new file mode 100644 index 0000000..cf03331 --- /dev/null +++ b/templates/unapply.d.ts @@ -0,0 +1,3 @@ +import { Variadic } from './$types'; + +export function $(fn: (args: any[]) => T): Variadic; diff --git a/templates/unapply.md b/templates/unapply.md new file mode 100644 index 0000000..f7f5d63 --- /dev/null +++ b/templates/unapply.md @@ -0,0 +1,22 @@ +Takes a function `fn`, which takes a single array argument, and returns a +function which: + + - takes any number of positional arguments; + - passes these arguments to `fn` as an array; and + - returns the result. + +In other words, `R.unapply` derives a variadic function from a function which +takes an array. `R.unapply` is the inverse of [`R.apply`](#apply). + +@func +@memberOf R +@since v0.8.0 +@category Function +@sig ([*...] -> a) -> (*... -> a) +@param {Function} fn +@return {Function} +@see R.apply +@example + + R.unapply(JSON.stringify)(1, 2, 3); //=> '[1,2,3]' +@symb R.unapply(f)(a, b) = f([a, b]) diff --git a/templates/unary.d.ts b/templates/unary.d.ts new file mode 100644 index 0000000..9cdbb07 --- /dev/null +++ b/templates/unary.d.ts @@ -0,0 +1,4 @@ +import { Variadic } from './$types'; + +export function $base(fn: (a: T, ...args: any[]) => R): (a: T) => R; +export function $variadic(fn: Variadic): (a: any) => R; diff --git a/templates/unary.md b/templates/unary.md new file mode 100644 index 0000000..1c9dda9 --- /dev/null +++ b/templates/unary.md @@ -0,0 +1,26 @@ +Wraps a function of any arity (including nullary) in a function that accepts +exactly 1 parameter. Any extraneous parameters will not be passed to the +supplied function. + +@func +@memberOf R +@since v0.2.0 +@category Function +@sig (* -> b) -> (a -> b) +@param {Function} fn The function to wrap. +@return {Function} A new function wrapping `fn`. The new function is guaranteed to be of + arity 1. +@see R.binary, R.nAry +@example + + var takesTwoArgs = function(a, b) { + return [a, b]; + }; + takesTwoArgs.length; //=> 2 + takesTwoArgs(1, 2); //=> [1, 2] + + var takesOneArg = R.unary(takesTwoArgs); + takesOneArg.length; //=> 1 + // Only 1 argument is passed to the wrapped function + takesOneArg(1, 2); //=> [1, undefined] +@symb R.unary(f)(a, b, c) = f(a) diff --git a/templates/uncurryN.c.ts b/templates/uncurryN.c.ts new file mode 100644 index 0000000..51cb72a --- /dev/null +++ b/templates/uncurryN.c.ts @@ -0,0 +1,25 @@ +import { max_curry_level } from './$curriedFunctions'; +import { create_n_ary_declarations } from './utils/create-n-ary-declarations'; + +export default create_n_ary_declarations( + 0, + max_curry_level, + args => ` + function $${args.curry_level}arity<${[args.return_type, ...args.types] + .map(x => `${x} = any`) + .join(',')}>( + n: ${args.curry_level}, + fn: Variadic + ): CurriedFunction${args.curry_level}<${args.generics.join(',')}>; + `, + args => ` + import {${args.curry_levels + .map(i => `CurriedFunction${i}`) + .join(',')}} from './$curriedFunctions'; + import {Variadic} from './$types'; + function $variadic<${args.return_type} = any>( + n: number, + fn: Variadic + ): Variadic<${args.return_type}>; + `, +); diff --git a/templates/uncurryN.md b/templates/uncurryN.md new file mode 100644 index 0000000..405076e --- /dev/null +++ b/templates/uncurryN.md @@ -0,0 +1,17 @@ +Returns a function of arity `n` from a (manually) curried function. + +@func +@memberOf R +@since v0.14.0 +@category Function +@sig Number -> (a -> b) -> (a -> c) +@param {Number} length The arity for the returned function. +@param {Function} fn The function to uncurry. +@return {Function} A new function. +@see R.curry +@example + + var addFour = a => b => c => d => a + b + c + d; + + var uncurriedAddFour = R.uncurryN(4, addFour); + uncurriedAddFour(1, 2, 3, 4); //=> 10 diff --git a/templates/unfold.d.ts b/templates/unfold.d.ts new file mode 100644 index 0000000..e345c87 --- /dev/null +++ b/templates/unfold.d.ts @@ -0,0 +1 @@ +export function $(fn: (seed: T) => [R, T] | false, initial: T): R[]; diff --git a/templates/unfold.md b/templates/unfold.md new file mode 100644 index 0000000..83b7485 --- /dev/null +++ b/templates/unfold.md @@ -0,0 +1,23 @@ +Builds a list from a seed value. Accepts an iterator function, which returns +either false to stop iteration or an array of length 2 containing the value +to add to the resulting list and the seed to be used in the next call to the +iterator function. + +The iterator function receives one argument: *(seed)*. + +@func +@memberOf R +@since v0.10.0 +@category List +@sig (a -> [b]) -> * -> [b] +@param {Function} fn The iterator function. receives one argument, `seed`, and returns + either false to quit iteration or an array of length two to proceed. The element + at index 0 of this array will be added to the resulting array, and the element + at index 1 will be passed to the next call to `fn`. +@param {*} seed The seed value. +@return {Array} The final list. +@example + + var f = n => n > 50 ? false : [-n, n + 10]; + R.unfold(f, 10); //=> [-10, -20, -30, -40, -50] +@symb R.unfold(f, x) = [f(x)[0], f(f(x)[1])[0], f(f(f(x)[1])[1])[0], ...] diff --git a/templates/union.d.ts b/templates/union.d.ts new file mode 100644 index 0000000..29943c3 --- /dev/null +++ b/templates/union.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(a: List, b: List): T[]; diff --git a/templates/union.md b/templates/union.md new file mode 100644 index 0000000..282312c --- /dev/null +++ b/templates/union.md @@ -0,0 +1,15 @@ +Combines two lists into a set (i.e. no duplicates) composed of the elements +of each list. + +@func +@memberOf R +@since v0.1.0 +@category Relation +@sig [*] -> [*] -> [*] +@param {Array} as The first list. +@param {Array} bs The second list. +@return {Array} The first and second lists concatenated, with + duplicates removed. +@example + + R.union([1, 2, 3], [2, 3, 4]); //=> [1, 2, 3, 4] diff --git a/templates/unionWith.d.ts b/templates/unionWith.d.ts new file mode 100644 index 0000000..5dbd900 --- /dev/null +++ b/templates/unionWith.d.ts @@ -0,0 +1,3 @@ +import { Comparator, List } from './$types'; + +export function $(fn: Comparator, a: List, b: List): T[]; diff --git a/templates/unionWith.md b/templates/unionWith.md new file mode 100644 index 0000000..c8ee916 --- /dev/null +++ b/templates/unionWith.md @@ -0,0 +1,20 @@ +Combines two lists into a set (i.e. no duplicates) composed of the elements +of each list. Duplication is determined according to the value returned by +applying the supplied predicate to two list elements. + +@func +@memberOf R +@since v0.1.0 +@category Relation +@sig (a -> a -> Boolean) -> [*] -> [*] -> [*] +@param {Function} pred A predicate used to test whether two items are equal. +@param {Array} list1 The first list. +@param {Array} list2 The second list. +@return {Array} The first and second lists concatenated, with + duplicates removed. +@see R.union +@example + + var l1 = [{a: 1}, {a: 2}]; + var l2 = [{a: 1}, {a: 4}]; + R.unionWith(R.eqBy(R.prop('a')), l1, l2); //=> [{a: 1}, {a: 2}, {a: 4}] diff --git a/templates/uniq.d.ts b/templates/uniq.d.ts new file mode 100644 index 0000000..345471f --- /dev/null +++ b/templates/uniq.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(list: List): T[]; diff --git a/templates/uniq.md b/templates/uniq.md new file mode 100644 index 0000000..96aa02e --- /dev/null +++ b/templates/uniq.md @@ -0,0 +1,15 @@ +Returns a new list containing only one copy of each element in the original +list. [`R.equals`](#equals) is used to determine equality. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig [a] -> [a] +@param {Array} list The array to consider. +@return {Array} The list of unique items. +@example + + R.uniq([1, 1, 2, 1]); //=> [1, 2] + R.uniq([1, '1']); //=> [1, '1'] + R.uniq([[42], [42]]); //=> [[42]] diff --git a/templates/uniqBy.d.ts b/templates/uniqBy.d.ts new file mode 100644 index 0000000..e0cca47 --- /dev/null +++ b/templates/uniqBy.d.ts @@ -0,0 +1,3 @@ +import { List, Morphism } from './$types'; + +export function $(fn: Morphism, list: List): T[]; diff --git a/templates/uniqBy.md b/templates/uniqBy.md new file mode 100644 index 0000000..8e77f1a --- /dev/null +++ b/templates/uniqBy.md @@ -0,0 +1,16 @@ +Returns a new list containing only one copy of each element in the original +list, based upon the value returned by applying the supplied function to +each list element. Prefers the first item if the supplied function produces +the same value on two items. [`R.equals`](#equals) is used for comparison. + +@func +@memberOf R +@since v0.16.0 +@category List +@sig (a -> b) -> [a] -> [a] +@param {Function} fn A function used to produce a value to use during comparisons. +@param {Array} list The array to consider. +@return {Array} The list of unique items. +@example + + R.uniqBy(Math.abs, [-1, -5, 2, 10, 1, 2]); //=> [-1, -5, 2, 10] diff --git a/templates/uniqWith.d.ts b/templates/uniqWith.d.ts new file mode 100644 index 0000000..327ab42 --- /dev/null +++ b/templates/uniqWith.d.ts @@ -0,0 +1,3 @@ +import { Comparator, List } from './$types'; + +export function $(fn: Comparator, list: List): T[]; diff --git a/templates/uniqWith.md b/templates/uniqWith.md new file mode 100644 index 0000000..5691e68 --- /dev/null +++ b/templates/uniqWith.md @@ -0,0 +1,20 @@ +Returns a new list containing only one copy of each element in the original +list, based upon the value returned by applying the supplied predicate to +two list elements. Prefers the first item if two items compare equal based +on the predicate. + +@func +@memberOf R +@since v0.2.0 +@category List +@sig (a, a -> Boolean) -> [a] -> [a] +@param {Function} pred A predicate used to test whether two items are equal. +@param {Array} list The array to consider. +@return {Array} The list of unique items. +@example + + var strEq = R.eqBy(String); + R.uniqWith(strEq)([1, '1', 2, 1]); //=> [1, 2] + R.uniqWith(strEq)([{}, {}]); //=> [{}] + R.uniqWith(strEq)([1, '1', 1]); //=> [1] + R.uniqWith(strEq)(['1', 1, 1]); //=> ['1'] diff --git a/templates/unless.d.ts b/templates/unless.d.ts new file mode 100644 index 0000000..b36767d --- /dev/null +++ b/templates/unless.d.ts @@ -0,0 +1,12 @@ +import { Morphism, Predicate } from './$types'; + +export function $predicate( + pred: (value: T) => value is V, + whenFalseFn: Morphism, + value: T, +): V | U; +export function $general( + pred: Predicate, + whenFalseFn: Morphism, + value: T, +): T | U; diff --git a/templates/unless.md b/templates/unless.md new file mode 100644 index 0000000..9436f83 --- /dev/null +++ b/templates/unless.md @@ -0,0 +1,22 @@ +Tests the final argument by passing it to the given predicate function. If +the predicate is not satisfied, the function will return the result of +calling the `whenFalseFn` function with the same argument. If the predicate +is satisfied, the argument is returned as is. + +@func +@memberOf R +@since v0.18.0 +@category Logic +@sig (a -> Boolean) -> (a -> a) -> a -> a +@param {Function} pred A predicate function +@param {Function} whenFalseFn A function to invoke when the `pred` evaluates + to a falsy value. +@param {*} x An object to test with the `pred` function and + pass to `whenFalseFn` if necessary. +@return {*} Either `x` or the result of applying `x` to `whenFalseFn`. +@see R.ifElse, R.when +@example + + let safeInc = R.unless(R.isNil, R.inc); + safeInc(null); //=> null + safeInc(1); //=> 2 diff --git a/templates/unnest.d.ts b/templates/unnest.d.ts new file mode 100644 index 0000000..b96c889 --- /dev/null +++ b/templates/unnest.d.ts @@ -0,0 +1,5 @@ +import { List } from './$types'; + +export function $deep(list: List>): T[]; +export function $shallow(list: List): T[]; +export function $mixed(list: List> | List): T[]; diff --git a/templates/unnest.md b/templates/unnest.md new file mode 100644 index 0000000..9234f72 --- /dev/null +++ b/templates/unnest.md @@ -0,0 +1,15 @@ +Shorthand for `R.chain(R.identity)`, which removes one level of nesting from +any [Chain](https://github.com/fantasyland/fantasy-land#chain). + +@func +@memberOf R +@since v0.3.0 +@category List +@sig Chain c => c (c a) -> c a +@param {*} list +@return {*} +@see R.flatten, R.chain +@example + + R.unnest([1, [2], [[3]]]); //=> [1, 2, [3]] + R.unnest([[1, 2], [3, 4], [5, 6]]); //=> [1, 2, 3, 4, 5, 6] diff --git a/templates/until.d.ts b/templates/until.d.ts new file mode 100644 index 0000000..6f94232 --- /dev/null +++ b/templates/until.d.ts @@ -0,0 +1,3 @@ +import { Morphism, Predicate } from './$types'; + +export function $(pred: Predicate, fn: Morphism, initial: T): T; diff --git a/templates/until.md b/templates/until.md new file mode 100644 index 0000000..b0c3dc6 --- /dev/null +++ b/templates/until.md @@ -0,0 +1,17 @@ +Takes a predicate, a transformation function, and an initial value, +and returns a value of the same type as the initial value. +It does so by applying the transformation until the predicate is satisfied, +at which point it returns the satisfactory value. + +@func +@memberOf R +@since v0.20.0 +@category Logic +@sig (a -> Boolean) -> (a -> a) -> a -> a +@param {Function} pred A predicate function +@param {Function} fn The iterator function +@param {*} init Initial value +@return {*} Final value that satisfies predicate +@example + + R.until(R.gt(R.__, 100), R.multiply(2))(1) // => 128 diff --git a/templates/update.d.ts b/templates/update.d.ts new file mode 100644 index 0000000..924aa57 --- /dev/null +++ b/templates/update.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(index: number, value: T, list: List): (T | U)[]; diff --git a/templates/update.md b/templates/update.md new file mode 100644 index 0000000..a6ffd4f --- /dev/null +++ b/templates/update.md @@ -0,0 +1,20 @@ +Returns a new copy of the array with the element at the provided index +replaced with the given value. + +@func +@memberOf R +@since v0.14.0 +@category List +@sig Number -> a -> [a] -> [a] +@param {Number} idx The index to update. +@param {*} x The value to exist at the given index of the returned array. +@param {Array|Arguments} list The source array-like object to be updated. +@return {Array} A copy of `list` with the value at index `idx` replaced with `x`. +@see R.adjust +@example + + R.update(1, 11, [0, 1, 2]); //=> [0, 11, 2] + R.update(1)(11)([0, 1, 2]); //=> [0, 11, 2] +@symb R.update(-1, a, [b, c]) = [b, a] +@symb R.update(0, a, [b, c]) = [a, c] +@symb R.update(1, a, [b, c]) = [b, a] diff --git a/templates/useWith.c.ts b/templates/useWith.c.ts new file mode 100644 index 0000000..d1269b9 --- /dev/null +++ b/templates/useWith.c.ts @@ -0,0 +1,61 @@ +import * as dts from 'dts-element'; +import { max_curry_level } from './$curriedFunctions'; + +const return_generic = 'R'; +const variable_names = [...new Array(max_curry_level)].map( + (_, index) => `v${index + 1}`, +); +const input_generics = [...new Array(max_curry_level)].map( + (_, index) => `T${index + 1}`, +); +const middle_generics = [...new Array(max_curry_level)].map( + (_, index) => `U${index + 1}`, +); + +const declarations = []; +const curried_function_names = []; + +for (let i = 0; i <= max_curry_level; i++) { + const current_variable_names = variable_names.slice(0, i); + const current_input_generics = input_generics.slice(0, i); + const current_middle_generics = middle_generics.slice(0, i); + const curried_function_name = `CurriedFunction${i}`; + curried_function_names.push(curried_function_name); + declarations.push(` + function $${i}arity<${[ + ...current_input_generics, + ...current_middle_generics, + return_generic, + ].join(',')}>( + after: (${current_variable_names + .map( + (variable_name, index) => ` + ${variable_name}: ${current_middle_generics[index]} + `, + ) + .join(',')}) => ${return_generic}, + fns: ${current_input_generics.length === 0 + ? `never[]` + : `[${current_input_generics + .map( + (input_generic, index) => ` + Morphism<${input_generic}, ${middle_generics[index]}> + `, + ) + .join(',')}]`} + ): ${curried_function_name}<${[ + ...current_input_generics, + return_generic, + ].join(',')}>; + `); +} + +export default dts.parse(` + import {${curried_function_names.join(',')}} from './$curriedFunctions'; + import {Morphism, Variadic} from './$types'; + ${declarations.join('\n')} + function $variadic<${return_generic}>( + after: Variadic<${return_generic}>, + fns: Function[] + ): Variadic<${return_generic}>; +`).members; diff --git a/templates/useWith.md b/templates/useWith.md new file mode 100644 index 0000000..b5e1d97 --- /dev/null +++ b/templates/useWith.md @@ -0,0 +1,27 @@ +Accepts a function `fn` and a list of transformer functions and returns a +new curried function. When the new function is invoked, it calls the +function `fn` with parameters consisting of the result of calling each +supplied handler on successive arguments to the new function. + +If more arguments are passed to the returned function than transformer +functions, those arguments are passed directly to `fn` as additional +parameters. If you expect additional arguments that don't need to be +transformed, although you can ignore them, it's best to pass an identity +function so that the new function reports the correct arity. + +@func +@memberOf R +@since v0.1.0 +@category Function +@sig (x1 -> x2 -> ... -> z) -> [(a -> x1), (b -> x2), ...] -> (a -> b -> ... -> z) +@param {Function} fn The function to wrap. +@param {Array} transformers A list of transformer functions +@return {Function} The wrapped function. +@see R.converge +@example + + R.useWith(Math.pow, [R.identity, R.identity])(3, 4); //=> 81 + R.useWith(Math.pow, [R.identity, R.identity])(3)(4); //=> 81 + R.useWith(Math.pow, [R.dec, R.inc])(3, 4); //=> 32 + R.useWith(Math.pow, [R.dec, R.inc])(3)(4); //=> 32 +@symb R.useWith(f, [g, h])(a, b) = f(g(a), h(b)) diff --git a/templates/utils/__tests__/__snapshots__/create-composition-declarations.ts.snap b/templates/utils/__tests__/__snapshots__/create-composition-declarations.ts.snap new file mode 100644 index 0000000..49cab13 --- /dev/null +++ b/templates/utils/__tests__/__snapshots__/create-composition-declarations.ts.snap @@ -0,0 +1,29 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should generate correctly for compose 1`] = ` +"declare const test: typeof $; +declare function $(fn1: (v1: G) => R): (v1: G) => R; +declare function $(fn1: (v1: G, v2: G) => R): (v1: G, v2: G) => R; +declare function $(fn1: (v1: G, v2: G, v3: G) => R): (v1: G, v2: G, v3: G) => R; +declare function $(fn2: (v: G) => R, fn1: (v1: G) => R): (v1: G) => R; +declare function $(fn2: (v: G) => R, fn1: (v1: G, v2: G) => R): (v1: G, v2: G) => R; +declare function $(fn2: (v: G) => R, fn1: (v1: G, v2: G, v3: G) => R): (v1: G, v2: G, v3: G) => R; +declare function $(fn3: (v: G) => R, fn2: (v: G) => R, fn1: (v1: G) => R): (v1: G) => R; +declare function $(fn3: (v: G) => R, fn2: (v: G) => R, fn1: (v1: G, v2: G) => R): (v1: G, v2: G) => R; +declare function $(fn3: (v: G) => R, fn2: (v: G) => R, fn1: (v1: G, v2: G, v3: G) => R): (v1: G, v2: G, v3: G) => R; +" +`; + +exports[`should generate correctly for pipe 1`] = ` +"declare const test: typeof $; +declare function $(fn1: (v1: G) => R): (v1: G) => R; +declare function $(fn1: (v1: G, v2: G) => R): (v1: G, v2: G) => R; +declare function $(fn1: (v1: G, v2: G, v3: G) => R): (v1: G, v2: G, v3: G) => R; +declare function $(fn1: (v1: G) => R, fn2: (v: G) => R): (v1: G) => R; +declare function $(fn1: (v1: G, v2: G) => R, fn2: (v: G) => R): (v1: G, v2: G) => R; +declare function $(fn1: (v1: G, v2: G, v3: G) => R, fn2: (v: G) => R): (v1: G, v2: G, v3: G) => R; +declare function $(fn1: (v1: G) => R, fn2: (v: G) => R, fn3: (v: G) => R): (v1: G) => R; +declare function $(fn1: (v1: G, v2: G) => R, fn2: (v: G) => R, fn3: (v: G) => R): (v1: G, v2: G) => R; +declare function $(fn1: (v1: G, v2: G, v3: G) => R, fn2: (v: G) => R, fn3: (v: G) => R): (v1: G, v2: G, v3: G) => R; +" +`; diff --git a/templates/utils/__tests__/__snapshots__/create-n-ary-declarations.ts.snap b/templates/utils/__tests__/__snapshots__/create-n-ary-declarations.ts.snap new file mode 100644 index 0000000..96a546c --- /dev/null +++ b/templates/utils/__tests__/__snapshots__/create-n-ary-declarations.ts.snap @@ -0,0 +1,18 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should generate correctly with generate_additional 1`] = ` +"declare function $0arity(n: 0, fn: (...args: any[]) => R): () => R; +declare function $1arity(n: 1, fn: (v1: T1, ...args: any[]) => R): (v1: T1) => R; +declare function $2arity(n: 2, fn: (v1: T1, v2: T2, ...args: any[]) => R): (v1: T1, v2: T2) => R; +declare function $3arity(n: 3, fn: (v1: T1, v2: T2, v3: T3, ...args: any[]) => R): (v1: T1, v2: T2, v3: T3) => R; +declare function $variadic(n: number, fn: (...args: any[]) => R): (...args: any[]) => R; +" +`; + +exports[`should generate correctly without generate_additional 1`] = ` +"declare function $0arity(n: 0, fn: (...args: any[]) => R): () => R; +declare function $1arity(n: 1, fn: (v1: T1, ...args: any[]) => R): (v1: T1) => R; +declare function $2arity(n: 2, fn: (v1: T1, v2: T2, ...args: any[]) => R): (v1: T1, v2: T2) => R; +declare function $3arity(n: 3, fn: (v1: T1, v2: T2, v3: T3, ...args: any[]) => R): (v1: T1, v2: T2, v3: T3) => R; +" +`; diff --git a/templates/utils/__tests__/create-composition-declarations.ts b/templates/utils/__tests__/create-composition-declarations.ts new file mode 100644 index 0000000..7766f27 --- /dev/null +++ b/templates/utils/__tests__/create-composition-declarations.ts @@ -0,0 +1,25 @@ +import * as dts from 'dts-element'; +import { create_composition_declarations } from '../create-composition-declarations'; + +const emit_composition_declarations = (kind: 'pipe' | 'compose') => { + const curried_interfaces = create_composition_declarations( + 'test', + kind, + 3, + 3, + x => `G<${x}>`, + x => `R<${x}>`, + ); + const top_level_element = dts.create_top_level_element({ + members: curried_interfaces, + }); + return dts.emit(top_level_element); +}; + +it('should generate correctly for pipe', () => { + expect(emit_composition_declarations('pipe')).toMatchSnapshot(); +}); + +it('should generate correctly for compose', () => { + expect(emit_composition_declarations('compose')).toMatchSnapshot(); +}); diff --git a/templates/utils/__tests__/create-n-ary-declarations.ts b/templates/utils/__tests__/create-n-ary-declarations.ts new file mode 100644 index 0000000..5a0dbfa --- /dev/null +++ b/templates/utils/__tests__/create-n-ary-declarations.ts @@ -0,0 +1,39 @@ +import * as dts from 'dts-element'; +import { create_n_ary_declarations } from '../create-n-ary-declarations'; + +it('should generate correctly without generate_additional', () => { + expect(emit_n_ary_declarations()).toMatchSnapshot(); +}); + +it('should generate correctly with generate_additional', () => { + expect( + emit_n_ary_declarations( + args => ` + function $variadic<${args.return_type}>( + n: number, + fn: (...args: any[]) => ${args.return_type} + ): (...args: any[]) => ${args.return_type}; + `, + ), + ).toMatchSnapshot(); +}); + +function emit_n_ary_declarations(generate_additional?: (args: any) => string) { + const n_ary_declarations = create_n_ary_declarations( + 0, + 3, + args => ` + function $${args.curry_level}arity<${args.generics.join(',')}>( + n: ${args.curry_level}, + fn: (${[...args.parameters, '...args: any[]'].join( + ',', + )}) => ${args.return_type} + ): (${args.parameters.join(',')}) => ${args.return_type}; + `, + generate_additional, + ); + const top_level_element = dts.create_top_level_element({ + members: n_ary_declarations, + }); + return dts.emit(top_level_element); +} diff --git a/templates/utils/constants.ts b/templates/utils/constants.ts new file mode 100644 index 0000000..f5d805c --- /dev/null +++ b/templates/utils/constants.ts @@ -0,0 +1,2 @@ +export const placeholder_name = 'Placeholder'; +export const placeholder_name_abbr = 'PH'; diff --git a/templates/utils/create-composition-declarations.ts b/templates/utils/create-composition-declarations.ts new file mode 100644 index 0000000..4e40648 --- /dev/null +++ b/templates/utils/create-composition-declarations.ts @@ -0,0 +1,100 @@ +import * as dts from 'dts-element'; +import * as R from 'ramda'; + +export const create_composition_declarations = ( + name: string, + kind: 'compose' | 'pipe', + max_function_count: number, + max_parameter_count: number, + // istanbul ignore next + generate_function_parameter_type: (generic: string) => string = x => x, + // istanbul ignore next + generate_function_return_type: (generic: string) => string = x => x, + // istanbul ignore next + generate_composed_return_type: ( + generic: string, + ) => string = generate_function_return_type, +) => { + const function_names = R.repeat(0, max_function_count).map( + (_, index) => `fn${index + 1}`, + ); + const return_generics = R.repeat(0, max_function_count).map( + (_, index) => `R${index + 1}`, + ); + + const parameter_names = R.repeat(0, max_parameter_count).map( + (_, index) => `v${index + 1}`, + ); + const parameter_generics = R.repeat(0, max_parameter_count).map( + (_, index) => `V${index + 1}`, + ); + + const declarations = [`declare const ${name}: typeof $;`]; + for ( + let function_count = 1; + function_count <= max_function_count; + function_count++ + ) { + const entry_index = kind === 'pipe' ? 0 : function_count - 1; + const current_return_generics = return_generics.slice(0, function_count); + + const current_sorted_return_generics = current_return_generics.slice(); + const current_sorted_function_names = function_names.slice( + 0, + function_count, + ); + if (kind === 'compose') { + current_sorted_return_generics.reverse(); + current_sorted_function_names.reverse(); + } + + for ( + let parameter_count = 1; + parameter_count <= max_parameter_count; + parameter_count++ + ) { + const current_parameter_names = parameter_names.slice(0, parameter_count); + const current_parameter_generics = parameter_generics.slice( + 0, + parameter_count, + ); + + const entry_parameters = current_parameter_names + .map( + (parameter_name, param_index) => ` + ${parameter_name}: ${generate_function_parameter_type( + current_parameter_generics[param_index], + )} + `, + ) + .join(','); + + declarations.push(` + declare function $<${[ + ...current_parameter_generics, + ...current_return_generics, + ].join(',')}>( + ${current_return_generics + .map((_, index) => { + const function_name = current_sorted_function_names[index]; + const return_generic = current_sorted_return_generics[index]; + return index === entry_index + ? `${function_name}: (${entry_parameters}) => ${generate_function_return_type( + return_generic, + )}` + : `${function_name}: (v: ${generate_function_parameter_type( + current_sorted_return_generics[ + index + (kind === 'compose' ? 1 : -1) + ], + )}) => ${generate_function_return_type(return_generic)}`; + }) + .join(',')} + ): (${entry_parameters}) => ${generate_composed_return_type( + current_return_generics[current_return_generics.length - 1], + )}; + `); + } + } + + return dts.parse(declarations.join('\n')).members; +}; diff --git a/templates/utils/create-n-ary-declarations.ts b/templates/utils/create-n-ary-declarations.ts new file mode 100644 index 0000000..4b955ef --- /dev/null +++ b/templates/utils/create-n-ary-declarations.ts @@ -0,0 +1,62 @@ +import * as dts from 'dts-element'; +import * as R from 'ramda'; + +interface Args { + curry_level: number; + curry_levels: number[]; + variables: string[]; + types: string[]; + return_type: string; + generics: string[]; + parameters: string[]; +} + +export const create_n_ary_declarations = ( + min_curry_level: number, + max_curry_level: number, + generate_function: (args: Args) => string, + generate_additional?: (args: Args) => string, +) => { + const return_type = 'R'; + const types = R.repeat(0, max_curry_level).map((_, index) => `T${index + 1}`); + const variables = R.repeat(0, max_curry_level).map( + (_, index) => `v${index + 1}`, + ); + const parameters = variables.map( + (variable, index) => `${variable}: ${types[index]}`, + ); + const curry_levels = []; + const declarations = []; + for ( + let curry_level = min_curry_level; + curry_level <= max_curry_level; + curry_level++ + ) { + curry_levels.push(curry_level); + declarations.push( + generate_function({ + curry_level, + curry_levels, + return_type, + types: types.slice(0, curry_level), + variables: variables.slice(0, curry_level), + parameters: parameters.slice(0, curry_level), + generics: [...types.slice(0, curry_level), return_type], + }), + ); + } + if (generate_additional !== undefined) { + declarations.push( + generate_additional({ + curry_level: -1, + curry_levels, + return_type, + types, + variables, + parameters, + generics: [...types, return_type], + }), + ); + } + return dts.parse(declarations.join('\n')).members; +}; diff --git a/templates/utils/tslint.json b/templates/utils/tslint.json new file mode 100644 index 0000000..0946f20 --- /dev/null +++ b/templates/utils/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tslint.json" +} diff --git a/templates/values.d.ts b/templates/values.d.ts new file mode 100644 index 0000000..a511396 --- /dev/null +++ b/templates/values.d.ts @@ -0,0 +1 @@ +export function $(value: T): T[keyof T][]; diff --git a/templates/values.md b/templates/values.md new file mode 100644 index 0000000..aebd2e1 --- /dev/null +++ b/templates/values.md @@ -0,0 +1,15 @@ +Returns a list of all the enumerable own properties of the supplied object. +Note that the order of the output array is not guaranteed across different +JS platforms. + +@func +@memberOf R +@since v0.1.0 +@category Object +@sig {k: v} -> [v] +@param {Object} obj The object to extract values from +@return {Array} An array of the values of the object's own properties. +@see R.valuesIn, R.keys +@example + + R.values({a: 1, b: 2, c: 3}); //=> [1, 2, 3] diff --git a/templates/valuesIn.d.ts b/templates/valuesIn.d.ts new file mode 100644 index 0000000..a511396 --- /dev/null +++ b/templates/valuesIn.d.ts @@ -0,0 +1 @@ +export function $(value: T): T[keyof T][]; diff --git a/templates/valuesIn.md b/templates/valuesIn.md new file mode 100644 index 0000000..8b99be2 --- /dev/null +++ b/templates/valuesIn.md @@ -0,0 +1,19 @@ +Returns a list of all the properties, including prototype properties, of the +supplied object. +Note that the order of the output array is not guaranteed to be consistent +across different JS platforms. + +@func +@memberOf R +@since v0.2.0 +@category Object +@sig {k: v} -> [v] +@param {Object} obj The object to extract values from +@return {Array} An array of the values of the object's own and prototype properties. +@see R.values, R.keysIn +@example + + var F = function() { this.x = 'X'; }; + F.prototype.y = 'Y'; + var f = new F(); + R.valuesIn(f); //=> ['X', 'Y'] diff --git a/templates/view.d.ts b/templates/view.d.ts new file mode 100644 index 0000000..b5ea786 --- /dev/null +++ b/templates/view.d.ts @@ -0,0 +1,16 @@ +import { NumberToString } from './$operation'; +import { ManualLens, PseudoLens } from './$types'; + +export function $number( + lens: PseudoLens, + target: U, +): U[NumberToString[N]]; +export function $string>( + lens: PseudoLens, + target: U, +): U[K]; +export function $manual(lens: ManualLens, target: U): T; +export function $general( + lens: PseudoLens | ManualLens, + target: V, +): X | V[any]; diff --git a/templates/view.md b/templates/view.md new file mode 100644 index 0000000..4b3f76f --- /dev/null +++ b/templates/view.md @@ -0,0 +1,19 @@ +Returns a "view" of the given data structure, determined by the given lens. +The lens's focus determines which portion of the data structure is visible. + +@func +@memberOf R +@since v0.16.0 +@category Object +@typedefn Lens s a = Functor f => (a -> f a) -> s -> f s +@sig Lens s a -> s -> a +@param {Lens} lens +@param {*} x +@return {*} +@see R.prop, R.lensIndex, R.lensProp +@example + + var xLens = R.lensProp('x'); + + R.view(xLens, {x: 1, y: 2}); //=> 1 + R.view(xLens, {x: 4, y: 2}); //=> 4 diff --git a/templates/when.d.ts b/templates/when.d.ts new file mode 100644 index 0000000..d5be3b0 --- /dev/null +++ b/templates/when.d.ts @@ -0,0 +1,7 @@ +import { Morphism, Predicate } from './$types'; + +export function $( + pred: Predicate, + whenTrueFn: Morphism, + value: T, +): T | U; diff --git a/templates/when.md b/templates/when.md new file mode 100644 index 0000000..3e03aa6 --- /dev/null +++ b/templates/when.md @@ -0,0 +1,26 @@ +Tests the final argument by passing it to the given predicate function. If +the predicate is satisfied, the function will return the result of calling +the `whenTrueFn` function with the same argument. If the predicate is not +satisfied, the argument is returned as is. + +@func +@memberOf R +@since v0.18.0 +@category Logic +@sig (a -> Boolean) -> (a -> a) -> a -> a +@param {Function} pred A predicate function +@param {Function} whenTrueFn A function to invoke when the `condition` + evaluates to a truthy value. +@param {*} x An object to test with the `pred` function and + pass to `whenTrueFn` if necessary. +@return {*} Either `x` or the result of applying `x` to `whenTrueFn`. +@see R.ifElse, R.unless +@example + + // truncate :: String -> String + var truncate = R.when( + R.propSatisfies(R.gt(R.__, 10), 'length'), + R.pipe(R.take(10), R.append('…'), R.join('')) + ); + truncate('12345'); //=> '12345' + truncate('0123456789ABC'); //=> '0123456789…' diff --git a/templates/where.d.ts b/templates/where.d.ts new file mode 100644 index 0000000..54a66ba --- /dev/null +++ b/templates/where.d.ts @@ -0,0 +1,6 @@ +import { Dictionary, Predicate } from './$types'; + +export function $( + spec: Dictionary>, + object: Dictionary, +): boolean; diff --git a/templates/where.md b/templates/where.md new file mode 100644 index 0000000..5027c24 --- /dev/null +++ b/templates/where.md @@ -0,0 +1,32 @@ +Takes a spec object and a test object; returns true if the test satisfies +the spec. Each of the spec's own properties must be a predicate function. +Each predicate is applied to the value of the corresponding property of the +test object. `where` returns true if all the predicates return true, false +otherwise. + +`where` is well suited to declaratively expressing constraints for other +functions such as [`filter`](#filter) and [`find`](#find). + +@func +@memberOf R +@since v0.1.1 +@category Object +@sig {String: (* -> Boolean)} -> {String: *} -> Boolean +@param {Object} spec +@param {Object} testObj +@return {Boolean} +@example + + // pred :: Object -> Boolean + var pred = R.where({ + a: R.equals('foo'), + b: R.complement(R.equals('bar')), + x: R.gt(R.__, 10), + y: R.lt(R.__, 20) + }); + + pred({a: 'foo', b: 'xxx', x: 11, y: 19}); //=> true + pred({a: 'xxx', b: 'xxx', x: 11, y: 19}); //=> false + pred({a: 'foo', b: 'bar', x: 11, y: 19}); //=> false + pred({a: 'foo', b: 'xxx', x: 10, y: 19}); //=> false + pred({a: 'foo', b: 'xxx', x: 11, y: 20}); //=> false diff --git a/templates/whereEq.d.ts b/templates/whereEq.d.ts new file mode 100644 index 0000000..8f8016b --- /dev/null +++ b/templates/whereEq.d.ts @@ -0,0 +1,3 @@ +import { Dictionary } from './$types'; + +export function $(spec: Dictionary, object: Dictionary): boolean; diff --git a/templates/whereEq.md b/templates/whereEq.md new file mode 100644 index 0000000..076082c --- /dev/null +++ b/templates/whereEq.md @@ -0,0 +1,26 @@ +Takes a spec object and a test object; returns true if the test satisfies +the spec, false otherwise. An object satisfies the spec if, for each of the +spec's own properties, accessing that property of the object gives the same +value (in [`R.equals`](#equals) terms) as accessing that property of the +spec. + +`whereEq` is a specialization of [`where`](#where). + +@func +@memberOf R +@since v0.14.0 +@category Object +@sig {String: *} -> {String: *} -> Boolean +@param {Object} spec +@param {Object} testObj +@return {Boolean} +@see R.where +@example + + // pred :: Object -> Boolean + var pred = R.whereEq({a: 1, b: 2}); + + pred({a: 1}); //=> false + pred({a: 1, b: 2}); //=> true + pred({a: 1, b: 2, c: 3}); //=> true + pred({a: 1, b: 1}); //=> false diff --git a/templates/without.d.ts b/templates/without.d.ts new file mode 100644 index 0000000..29943c3 --- /dev/null +++ b/templates/without.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(a: List, b: List): T[]; diff --git a/templates/without.md b/templates/without.md new file mode 100644 index 0000000..9f12c6d --- /dev/null +++ b/templates/without.md @@ -0,0 +1,17 @@ +Returns a new list without values in the first argument. +[`R.equals`](#equals) is used to determine equality. + +Acts as a transducer if a transformer is given in list position. + +@func +@memberOf R +@since v0.19.0 +@category List +@sig [a] -> [a] -> [a] +@param {Array} list1 The values to be removed from `list2`. +@param {Array} list2 The array to remove values from. +@return {Array} The new array without values in `list1`. +@see R.transduce, R.difference +@example + + R.without([1, 2], [1, 2, 1, 3, 4]); //=> [3, 4] diff --git a/templates/xprod.d.ts b/templates/xprod.d.ts new file mode 100644 index 0000000..cf06d30 --- /dev/null +++ b/templates/xprod.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(a: List, b: List): [T, U][]; diff --git a/templates/xprod.md b/templates/xprod.md new file mode 100644 index 0000000..f9edcbc --- /dev/null +++ b/templates/xprod.md @@ -0,0 +1,16 @@ +Creates a new list out of the two supplied by creating each possible pair +from the lists. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig [a] -> [b] -> [[a,b]] +@param {Array} as The first list. +@param {Array} bs The second list. +@return {Array} The list made by combining each possible pair from + `as` and `bs` into pairs (`[a, b]`). +@example + + R.xprod([1, 2], ['a', 'b']); //=> [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']] +@symb R.xprod([a, b], [c, d]) = [[a, c], [a, d], [b, c], [b, d]] diff --git a/templates/zip.d.ts b/templates/zip.d.ts new file mode 100644 index 0000000..cf06d30 --- /dev/null +++ b/templates/zip.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(a: List, b: List): [T, U][]; diff --git a/templates/zip.md b/templates/zip.md new file mode 100644 index 0000000..4ff3695 --- /dev/null +++ b/templates/zip.md @@ -0,0 +1,17 @@ +Creates a new list out of the two supplied by pairing up equally-positioned +items from both lists. The returned list is truncated to the length of the +shorter of the two input lists. +Note: `zip` is equivalent to `zipWith(function(a, b) { return [a, b] })`. + +@func +@memberOf R +@since v0.1.0 +@category List +@sig [a] -> [b] -> [[a,b]] +@param {Array} list1 The first array to consider. +@param {Array} list2 The second array to consider. +@return {Array} The list made by pairing up same-indexed elements of `list1` and `list2`. +@example + + R.zip([1, 2, 3], ['a', 'b', 'c']); //=> [[1, 'a'], [2, 'b'], [3, 'c']] +@symb R.zip([a, b, c], [d, e, f]) = [[a, d], [b, e], [c, f]] diff --git a/templates/zipObj.d.ts b/templates/zipObj.d.ts new file mode 100644 index 0000000..93c3f43 --- /dev/null +++ b/templates/zipObj.d.ts @@ -0,0 +1,7 @@ +import { List, Property } from './$types'; + +export function $string( + a: List, + b: List, +): Record; +export function $general(a: List, b: List): Record; diff --git a/templates/zipObj.md b/templates/zipObj.md new file mode 100644 index 0000000..b6695fa --- /dev/null +++ b/templates/zipObj.md @@ -0,0 +1,15 @@ +Creates a new object out of a list of keys and a list of values. +Key/value pairing is truncated to the length of the shorter of the two lists. +Note: `zipObj` is equivalent to `pipe(zipWith(pair), fromPairs)`. + +@func +@memberOf R +@since v0.3.0 +@category List +@sig [String] -> [*] -> {String: *} +@param {Array} keys The array that will be properties on the output object. +@param {Array} values The list of values on the output object. +@return {Object} The object made by pairing up same-indexed elements of `keys` and `values`. +@example + + R.zipObj(['a', 'b', 'c'], [1, 2, 3]); //=> {a: 1, b: 2, c: 3} diff --git a/templates/zipWith.d.ts b/templates/zipWith.d.ts new file mode 100644 index 0000000..bdec276 --- /dev/null +++ b/templates/zipWith.d.ts @@ -0,0 +1,3 @@ +import { List } from './$types'; + +export function $(fn: (x: T, y: U) => R, a: List, b: List): R[]; diff --git a/templates/zipWith.md b/templates/zipWith.md new file mode 100644 index 0000000..9f6629e --- /dev/null +++ b/templates/zipWith.md @@ -0,0 +1,22 @@ +Creates a new list out of the two supplied by applying the function to each +equally-positioned pair in the lists. The returned list is truncated to the +length of the shorter of the two input lists. + +@function +@memberOf R +@since v0.1.0 +@category List +@sig (a,b -> c) -> [a] -> [b] -> [c] +@param {Function} fn The function used to combine the two elements into one value. +@param {Array} list1 The first array to consider. +@param {Array} list2 The second array to consider. +@return {Array} The list made by combining same-indexed elements of `list1` and `list2` + using `fn`. +@example + + var f = (x, y) => { + // ... + }; + R.zipWith(f, [1, 2, 3], ['a', 'b', 'c']); + //=> [f(1, 'a'), f(2, 'b'), f(3, 'c')] +@symb R.zipWith(fn, [a, b, c], [d, e, f]) = [fn(a, d), fn(b, e), fn(c, f)] diff --git a/test.sh b/test.sh deleted file mode 100644 index 1f61d0d..0000000 --- a/test.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -for test in $(find tests -name '*.ts'); do - node ./node_modules/typings-checker/dist/index.js $test --verbose --noLines 2>&1 | perl -pe 's/\.ts:(\d+)/.ts/' | tee $test.out - rc=${PIPESTATUS[0]}; if [[ $rc != 0 ]]; then exit $rc; fi -done - -# This shows changes and sets the exit code. -set -o errexit -git status -git --no-pager diff -- tests diff --git a/tests/F.ts b/tests/F.ts new file mode 100644 index 0000000..f3b0fc7 --- /dev/null +++ b/tests/F.ts @@ -0,0 +1,4 @@ +import * as R_F from '../ramda/dist/src/F'; + +// @dts-jest:pass +R_F(); diff --git a/tests/T.ts b/tests/T.ts new file mode 100644 index 0000000..fedb486 --- /dev/null +++ b/tests/T.ts @@ -0,0 +1,4 @@ +import * as R_T from '../ramda/dist/src/T'; + +// @dts-jest:pass +R_T(); diff --git a/tests/__.ts b/tests/__.ts new file mode 100644 index 0000000..47fd0f8 --- /dev/null +++ b/tests/__.ts @@ -0,0 +1,25 @@ +import { CurriedFunction3 } from '../ramda/dist/src/$curriedFunctions'; +import * as R___ from '../ramda/dist/src/__'; + +declare const boolean: boolean; +declare const number: number; +declare const string: string; +declare const curried_string_boolean_number_to_object: CurriedFunction3< + string, + boolean, + number, + object +>; + +// @dts-jest:pass +curried_string_boolean_number_to_object(string)(boolean)(number); +// @dts-jest:pass +curried_string_boolean_number_to_object(string, boolean, number); +// @dts-jest:pass +curried_string_boolean_number_to_object(R___, boolean, number); +// @dts-jest:pass +curried_string_boolean_number_to_object(string, R___, number); +// @dts-jest:pass +curried_string_boolean_number_to_object(R___, R___, number); +// @dts-jest:pass +curried_string_boolean_number_to_object(string)(R___, number); diff --git a/tests/__snapshots__/F.ts.snap b/tests/__snapshots__/F.ts.snap new file mode 100644 index 0000000..fe400d0 --- /dev/null +++ b/tests/__snapshots__/F.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_F() 1`] = `"false"`; diff --git a/tests/__snapshots__/T.ts.snap b/tests/__snapshots__/T.ts.snap new file mode 100644 index 0000000..9a1497e --- /dev/null +++ b/tests/__snapshots__/T.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_T() 1`] = `"true"`; diff --git a/tests/__snapshots__/__.ts.snap b/tests/__snapshots__/__.ts.snap new file mode 100644 index 0000000..2590e91 --- /dev/null +++ b/tests/__snapshots__/__.ts.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`curried_string_boolean_number_to_object(R___, R___, number) 1`] = `"CurriedFunction2"`; + +exports[`curried_string_boolean_number_to_object(R___, boolean, number) 1`] = `"CurriedFunction1"`; + +exports[`curried_string_boolean_number_to_object(string)(R___, number) 1`] = `"CurriedFunction1"`; + +exports[`curried_string_boolean_number_to_object(string)(boolean)(number) 1`] = `"object"`; + +exports[`curried_string_boolean_number_to_object(string, R___, number) 1`] = `"CurriedFunction1"`; + +exports[`curried_string_boolean_number_to_object(string, boolean, number) 1`] = `"object"`; diff --git a/tests/__snapshots__/add.ts.snap b/tests/__snapshots__/add.ts.snap new file mode 100644 index 0000000..91ccca5 --- /dev/null +++ b/tests/__snapshots__/add.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_add(number)(number) 1`] = `"number"`; + +exports[`R_add(number, number) 1`] = `"number"`; diff --git a/tests/__snapshots__/addIndex.ts.snap b/tests/__snapshots__/addIndex.ts.snap new file mode 100644 index 0000000..ca8a5ff --- /dev/null +++ b/tests/__snapshots__/addIndex.ts.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_addIndex(string_to_number_list_mapper) 1`] = `"CurriedFunction2<(v1: string, index: number, target: string[] | ArrayLike) => number, string[] | ArrayLike, number[]>"`; + +exports[`R_addIndex(string_to_number_list_mapper)(string_to_number) 1`] = `"CurriedFunction1, number[]>"`; + +exports[`R_addIndex(string_to_number_list_mapper)(string_to_number, string_array) 1`] = `"number[]"`; + +exports[`R_addIndex(string_to_number_object_mapper) 1`] = `"CurriedFunction2<(v1: string, index: number, target: Record) => number, Record, Record>"`; + +exports[`R_addIndex(string_to_number_object_mapper)(string_to_number) 1`] = `"CurriedFunction1, Record>"`; + +exports[`R_addIndex(string_to_number_object_mapper)(string_to_number, string_object) 1`] = `"Record"`; diff --git a/tests/__snapshots__/adjust.ts.snap b/tests/__snapshots__/adjust.ts.snap new file mode 100644 index 0000000..6fb6e73 --- /dev/null +++ b/tests/__snapshots__/adjust.ts.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_adjust(string_to_number)(number, string_array) 1`] = `"(string | number)[]"`; + +exports[`R_adjust(string_to_number, number)(string_array) 1`] = `"(string | number)[]"`; + +exports[`R_adjust(string_to_number, number, string_array) 1`] = `"(string | number)[]"`; + +exports[`R_adjust(string_to_string)(number, string_array) 1`] = `"string[]"`; + +exports[`R_adjust(string_to_string, number)(string_array) 1`] = `"string[]"`; + +exports[`R_adjust(string_to_string, number, string_array) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/all.ts.snap b/tests/__snapshots__/all.ts.snap new file mode 100644 index 0000000..969bf62 --- /dev/null +++ b/tests/__snapshots__/all.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_all(string_predicate)(string_array) 1`] = `"boolean"`; + +exports[`R_all(string_predicate, string_array) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/allPass.ts.snap b/tests/__snapshots__/allPass.ts.snap new file mode 100644 index 0000000..4c25898 --- /dev/null +++ b/tests/__snapshots__/allPass.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_allPass([string_predicate, string_number_preficate]) 1`] = `"(x: string, y: number) => boolean"`; + +exports[`R_allPass([string_predicate, string_predicate]) 1`] = `"(value: string) => boolean"`; diff --git a/tests/__snapshots__/always.ts.snap b/tests/__snapshots__/always.ts.snap new file mode 100644 index 0000000..06f4e74 --- /dev/null +++ b/tests/__snapshots__/always.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_always(string) 1`] = `"() => string"`; + +exports[`R_always(string)() 1`] = `"string"`; diff --git a/tests/__snapshots__/and.ts.snap b/tests/__snapshots__/and.ts.snap new file mode 100644 index 0000000..8f335dc --- /dev/null +++ b/tests/__snapshots__/and.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_and(string)(number) 1`] = `"string | number"`; + +exports[`R_and(string, number) 1`] = `"string | number"`; diff --git a/tests/__snapshots__/any.ts.snap b/tests/__snapshots__/any.ts.snap new file mode 100644 index 0000000..7fd8039 --- /dev/null +++ b/tests/__snapshots__/any.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_any(string_predicate)(string_array) 1`] = `"boolean"`; + +exports[`R_any(string_predicate, string_array) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/anyPass.ts.snap b/tests/__snapshots__/anyPass.ts.snap new file mode 100644 index 0000000..a791949 --- /dev/null +++ b/tests/__snapshots__/anyPass.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_anyPass([string_predicate, string_number_preficate]) 1`] = `"(x: string, y: number) => boolean"`; + +exports[`R_anyPass([string_predicate, string_predicate]) 1`] = `"(value: string) => boolean"`; diff --git a/tests/__snapshots__/ap.ts.snap b/tests/__snapshots__/ap.ts.snap new file mode 100644 index 0000000..266fc5d --- /dev/null +++ b/tests/__snapshots__/ap.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_ap([string_to_number])(string_array) 1`] = `"number[]"`; + +exports[`R_ap([string_to_number], string_array) 1`] = `"number[]"`; diff --git a/tests/__snapshots__/aperture.ts.snap b/tests/__snapshots__/aperture.ts.snap new file mode 100644 index 0000000..7ae51f4 --- /dev/null +++ b/tests/__snapshots__/aperture.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_aperture(number)(string_array) 1`] = `"string[][]"`; + +exports[`R_aperture(number, string_array) 1`] = `"string[][]"`; diff --git a/tests/__snapshots__/append.ts.snap b/tests/__snapshots__/append.ts.snap new file mode 100644 index 0000000..a330cb8 --- /dev/null +++ b/tests/__snapshots__/append.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_append(number)(number_array) 1`] = `"number[]"`; + +exports[`R_append(number, number_array) 1`] = `"number[]"`; + +exports[`R_append(string)(number_array) 1`] = `"(string | number)[]"`; + +exports[`R_append(string, number_array) 1`] = `"(string | number)[]"`; diff --git a/tests/__snapshots__/apply.ts.snap b/tests/__snapshots__/apply.ts.snap new file mode 100644 index 0000000..e75ab06 --- /dev/null +++ b/tests/__snapshots__/apply.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_apply(number_and_string_to_boolean)(number_and_string) 1`] = `"boolean"`; + +exports[`R_apply(number_and_string_to_boolean, number_and_string) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/applySpec.ts.snap b/tests/__snapshots__/applySpec.ts.snap new file mode 100644 index 0000000..75bea4c --- /dev/null +++ b/tests/__snapshots__/applySpec.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_applySpec(name_spec) 1`] = `"(...args: any[]) => {}"`; + +exports[`R_applySpec(name_spec)(fullname) 1`] = `"{}"`; + +exports[`R_applySpec(name_spec) 1`] = `"(...args: any[]) => Name"`; + +exports[`R_applySpec(name_spec)(fullname) 1`] = `"Name"`; diff --git a/tests/__snapshots__/ascend.ts.snap b/tests/__snapshots__/ascend.ts.snap new file mode 100644 index 0000000..aac7c62 --- /dev/null +++ b/tests/__snapshots__/ascend.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_ascend(get_order_from_object)(object_a)(object_b) 1`] = `"number"`; + +exports[`R_ascend(get_order_from_object, object_a)(object_b) 1`] = `"number"`; + +exports[`R_ascend(get_order_from_object, object_a, object_b) 1`] = `"number"`; diff --git a/tests/__snapshots__/assoc.ts.snap b/tests/__snapshots__/assoc.ts.snap new file mode 100644 index 0000000..6c7d0d6 --- /dev/null +++ b/tests/__snapshots__/assoc.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_assoc(string_property)(number_value)(object) 1`] = `"object & Record"`; + +exports[`R_assoc(string_property, number_value, object) 1`] = `"object & Record"`; + +exports[`R_assoc(symbol_property)(number_value)(object) 1`] = `"object"`; + +exports[`R_assoc(symbol_property, number_value, object) 1`] = `"object"`; diff --git a/tests/__snapshots__/assocPath.ts.snap b/tests/__snapshots__/assocPath.ts.snap new file mode 100644 index 0000000..87d26f6 --- /dev/null +++ b/tests/__snapshots__/assocPath.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_assocPath(path)(number_value)(object) 1`] = `"object"`; + +exports[`R_assocPath(path, number_value, object) 1`] = `"object"`; diff --git a/tests/__snapshots__/binary.ts.snap b/tests/__snapshots__/binary.ts.snap new file mode 100644 index 0000000..40f2d62 --- /dev/null +++ b/tests/__snapshots__/binary.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_binary(object_variadic) 1`] = `"(a: any, b: any) => object"`; + +exports[`R_binary(string_number_symbol_to_boolean) 1`] = `"(a: string, b: number) => boolean"`; diff --git a/tests/__snapshots__/bind.ts.snap b/tests/__snapshots__/bind.ts.snap new file mode 100644 index 0000000..92dc94e --- /dev/null +++ b/tests/__snapshots__/bind.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_bind(object_variadic) 1`] = `"(context: any) => Variadic"`; + +exports[`R_bind(object_variadic, object) 1`] = `"Variadic"`; + +exports[`R_bind(string_number_symbol_to_boolean) 1`] = `"(context: any) => (a: string, b: number, c: symbol) => boolean"`; + +exports[`R_bind(string_number_symbol_to_boolean, object) 1`] = `"(a: string, b: number, c: symbol) => boolean"`; diff --git a/tests/__snapshots__/both.ts.snap b/tests/__snapshots__/both.ts.snap new file mode 100644 index 0000000..ec489a1 --- /dev/null +++ b/tests/__snapshots__/both.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_both(string_predicate) 1`] = `"(fn2: (value: string) => boolean) => (value: string) => boolean"`; + +exports[`R_both(string_predicate, string_predicate) 1`] = `"(value: string) => boolean"`; diff --git a/tests/__snapshots__/call.ts.snap b/tests/__snapshots__/call.ts.snap new file mode 100644 index 0000000..5b235d5 --- /dev/null +++ b/tests/__snapshots__/call.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_call(number_and_string_to_boolean, ...number_and_string) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/chain.ts.snap b/tests/__snapshots__/chain.ts.snap new file mode 100644 index 0000000..d6effd5 --- /dev/null +++ b/tests/__snapshots__/chain.ts.snap @@ -0,0 +1,19 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_chain(number_chain_to_string_chain) 1`] = `"(list: Chain) => Chain"`; + +exports[`R_chain(number_chain_to_string_chain)(number_chain) 1`] = `"Chain"`; + +exports[`R_chain(number_chain_to_string_chain, number_chain) 1`] = `"Chain"`; + +exports[`R_chain(number_to_string_string_tuple) 1`] = `"(list: List) => string[]"`; + +exports[`R_chain(number_to_string_string_tuple)(number_array) 1`] = `"string[]"`; + +exports[`R_chain(number_to_string_string_tuple, number_array) 1`] = `"string[]"`; + +exports[`R_chain(string_to_number_list_to_object) 1`] = `"(monad: (value: List) => string) => (value: List) => object"`; + +exports[`R_chain(string_to_number_list_to_object)(number_list_to_string) 1`] = `"(value: List) => object"`; + +exports[`R_chain(string_to_number_list_to_object, number_list_to_string) 1`] = `"(value: List) => object"`; diff --git a/tests/__snapshots__/clamp.ts.snap b/tests/__snapshots__/clamp.ts.snap new file mode 100644 index 0000000..ef10f5f --- /dev/null +++ b/tests/__snapshots__/clamp.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_clamp(number)(number) 1`] = `"(value: number) => number"`; + +exports[`R_clamp(number, number) 1`] = `"(value: number) => number"`; + +exports[`R_clamp(number, number, number) 1`] = `"number"`; diff --git a/tests/__snapshots__/clone.ts.snap b/tests/__snapshots__/clone.ts.snap new file mode 100644 index 0000000..c7e3524 --- /dev/null +++ b/tests/__snapshots__/clone.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_clone(number) 1`] = `"number"`; + +exports[`R_clone(string_list) 1`] = `"List"`; diff --git a/tests/__snapshots__/comparator.ts.snap b/tests/__snapshots__/comparator.ts.snap new file mode 100644 index 0000000..b560552 --- /dev/null +++ b/tests/__snapshots__/comparator.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_comparator(string_string_to_boolean) 1`] = `"(a: string, b: string) => number"`; diff --git a/tests/__snapshots__/complement.ts.snap b/tests/__snapshots__/complement.ts.snap new file mode 100644 index 0000000..a24aa7e --- /dev/null +++ b/tests/__snapshots__/complement.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_complement(string_string_to_boolean) 1`] = `"(...args: any[]) => boolean"`; + +exports[`R_complement(string_string_to_boolean)(string, string) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/compose.ts.snap b/tests/__snapshots__/compose.ts.snap new file mode 100644 index 0000000..83c5bd4 --- /dev/null +++ b/tests/__snapshots__/compose.ts.snap @@ -0,0 +1,61 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_compose( + boolean_to_number, + string_to_boolean, + number_to_string, + a_b_c_d_e_f_to_any, + ) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => number"`; + +exports[`R_compose( + boolean_to_number, + string_to_boolean, + number_to_string, + string_to_number, + a_b_c_d_e_f_to_any, + ) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => number"`; + +exports[`R_compose( + boolean_to_number, + string_to_boolean, + number_to_string, + string_to_number, + boolean_to_string, + a_b_c_d_e_f_to_any, + ) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => number"`; + +exports[`R_compose( + boolean_to_number, + string_to_boolean, + number_to_string, + string_to_number, + boolean_to_string, + number_to_boolean, + ) 1`] = `"(v1: number) => number"`; + +exports[`R_compose( + boolean_to_number, + string_to_boolean, + number_to_string, + string_to_number, + boolean_to_string, + ) 1`] = `"(v1: boolean) => number"`; + +exports[`R_compose( + boolean_to_number, + string_to_boolean, + number_to_string, + string_to_number, + ) 1`] = `"(v1: string) => number"`; + +exports[`R_compose(a_b_c_d_e_f_to_any) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => any"`; + +exports[`R_compose(boolean_to_number) 1`] = `"(v1: boolean) => number"`; + +exports[`R_compose(boolean_to_number, a_b_c_d_e_f_to_any) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => number"`; + +exports[`R_compose(boolean_to_number, string_to_boolean) 1`] = `"(v1: string) => number"`; + +exports[`R_compose(boolean_to_number, string_to_boolean, a_b_c_d_e_f_to_any) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => number"`; + +exports[`R_compose(boolean_to_number, string_to_boolean, number_to_string) 1`] = `"(v1: number) => number"`; diff --git a/tests/__snapshots__/composeK.ts.snap b/tests/__snapshots__/composeK.ts.snap new file mode 100644 index 0000000..a65151a --- /dev/null +++ b/tests/__snapshots__/composeK.ts.snap @@ -0,0 +1,35 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_composeK( + chain_boolean_to_chain_number, + chain_string_to_chain_boolean, + chain_number_to_chain_string, + chain_string_to_chain_number, + chain_boolean_to_chain_string, + chain_number_to_chain_boolean, + ) 1`] = `"(v1: Chain) => Chain"`; + +exports[`R_composeK( + chain_boolean_to_chain_number, + chain_string_to_chain_boolean, + chain_number_to_chain_string, + chain_string_to_chain_number, + chain_boolean_to_chain_string, + ) 1`] = `"(v1: Chain) => Chain"`; + +exports[`R_composeK( + chain_boolean_to_chain_number, + chain_string_to_chain_boolean, + chain_number_to_chain_string, + chain_string_to_chain_number, + ) 1`] = `"(v1: Chain) => Chain"`; + +exports[`R_composeK( + chain_boolean_to_chain_number, + chain_string_to_chain_boolean, + chain_number_to_chain_string, + ) 1`] = `"(v1: Chain) => Chain"`; + +exports[`R_composeK(chain_boolean_to_chain_number) 1`] = `"(v1: Chain) => Chain"`; + +exports[`R_composeK(chain_boolean_to_chain_number, chain_string_to_chain_boolean) 1`] = `"(v1: Chain) => Chain"`; diff --git a/tests/__snapshots__/composeP.ts.snap b/tests/__snapshots__/composeP.ts.snap new file mode 100644 index 0000000..60eac76 --- /dev/null +++ b/tests/__snapshots__/composeP.ts.snap @@ -0,0 +1,69 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + a_b_c_d_e_f_to_any_promise, + ) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike"`; + +exports[`R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + number_to_string_promise, + a_b_c_d_e_f_to_any_promise, + ) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike"`; + +exports[`R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + number_to_string_promise, + string_to_number_promise, + a_b_c_d_e_f_to_any_promise, + ) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike"`; + +exports[`R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + number_to_string_promise, + string_to_number_promise, + boolean_to_string_promise, + a_b_c_d_e_f_to_any_promise, + ) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike"`; + +exports[`R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + number_to_string_promise, + string_to_number_promise, + boolean_to_string_promise, + number_to_boolean_promise, + ) 1`] = `"(v1: number) => PromiseLike"`; + +exports[`R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + number_to_string_promise, + string_to_number_promise, + boolean_to_string_promise, + ) 1`] = `"(v1: boolean) => PromiseLike"`; + +exports[`R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + number_to_string_promise, + string_to_number_promise, + ) 1`] = `"(v1: string) => PromiseLike"`; + +exports[`R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + number_to_string_promise, + ) 1`] = `"(v1: number) => PromiseLike"`; + +exports[`R_composeP(a_b_c_d_e_f_to_any_promise) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike"`; + +exports[`R_composeP(boolean_to_number_promise) 1`] = `"(v1: boolean) => PromiseLike"`; + +exports[`R_composeP(boolean_to_number_promise, a_b_c_d_e_f_to_any_promise) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike"`; + +exports[`R_composeP(boolean_to_number_promise, string_to_boolean_promise) 1`] = `"(v1: string) => PromiseLike"`; diff --git a/tests/__snapshots__/concat.ts.snap b/tests/__snapshots__/concat.ts.snap new file mode 100644 index 0000000..1c8914d --- /dev/null +++ b/tests/__snapshots__/concat.ts.snap @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_concat(number_array, number_array) 1`] = `"number[]"`; + +exports[`R_concat(number_list, number_list) 1`] = ` +"Argument of type 'List' is not assignable to parameter of type 'string | number[]'. + Type 'ArrayLike' is not assignable to type 'string | number[]'. + Type 'ArrayLike' is not assignable to type 'number[]'. + Property 'includes' is missing in type 'ArrayLike'." +`; + +exports[`R_concat(object_array, number_array) 1`] = `"(number | object)[]"`; + +exports[`R_concat(string, string) 1`] = `"string"`; diff --git a/tests/__snapshots__/cond.ts.snap b/tests/__snapshots__/cond.ts.snap new file mode 100644 index 0000000..19988be --- /dev/null +++ b/tests/__snapshots__/cond.ts.snap @@ -0,0 +1,23 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_cond([ + [string_to_boolean, string_boolean_to_number], + [string_number_to_boolean, string_to_number], + ]) 1`] = ` +"Argument of type '([(a: string, b: number) => boolean, Morphism] | [Morphism, (a: ...' is not assignable to parameter of type '[(v1: string, v2: number, v3: {}, v4: {}, v5: {}, v6: {}) => boolean, (v1: string, v2: number, v3...'. + Type '[(a: string, b: number) => boolean, Morphism] | [Morphism, (a: s...' is not assignable to type '[(v1: string, v2: number, v3: {}, v4: {}, v5: {}, v6: {}) => boolean, (v1: string, v2: number, v3...'. + Type '[Morphism, (a: string, b: boolean) => number]' is not assignable to type '[(v1: string, v2: number, v3: {}, v4: {}, v5: {}, v6: {}) => boolean, (v1: string, v2: number, v3...'. + Type '(a: string, b: boolean) => number' is not assignable to type '(v1: string, v2: number, v3: {}, v4: {}, v5: {}, v6: {}) => number'. + Types of parameters 'b' and 'v2' are incompatible. + Type 'number' is not assignable to type 'boolean'." +`; + +exports[`R_cond([ + [string_to_boolean, string_to_number], + [string_number_to_boolean, string_to_number], + ]) 1`] = `"(v1: string, v2: number) => number"`; + +exports[`R_cond([ + [string_to_boolean, string_to_number], + [string_to_boolean, string_to_number], + ]) 1`] = `"(v1: string) => number"`; diff --git a/tests/__snapshots__/construct.ts.snap b/tests/__snapshots__/construct.ts.snap new file mode 100644 index 0000000..0cd6f83 --- /dev/null +++ b/tests/__snapshots__/construct.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_construct(new_7_string_to_number) 1`] = `"(...args: any[]) => number"`; + +exports[`R_construct(new_number_args_to_boolean) 1`] = `"() => boolean"`; + +exports[`R_construct(new_number_boolean_to_string) 1`] = `"CurriedFunction2"`; + +exports[`R_construct(new_string_to_object) 1`] = `"CurriedFunction1"`; diff --git a/tests/__snapshots__/constructN.ts.snap b/tests/__snapshots__/constructN.ts.snap new file mode 100644 index 0000000..94f9a68 --- /dev/null +++ b/tests/__snapshots__/constructN.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_constructN(0, new_string_to_object) 1`] = `"() => object"`; + +exports[`R_constructN(1, new_number_boolean_to_string) 1`] = `"CurriedFunction1"`; + +exports[`R_constructN(4, new_number_args_to_boolean) 1`] = `"CurriedFunction4"`; + +exports[`R_constructN(7, new_7_string_to_number) 1`] = `"(...args: any[]) => number"`; diff --git a/tests/__snapshots__/contains.ts.snap b/tests/__snapshots__/contains.ts.snap new file mode 100644 index 0000000..934d213 --- /dev/null +++ b/tests/__snapshots__/contains.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_contains(string) 1`] = `"(list: string[] | ArrayLike) => boolean"`; + +exports[`R_contains(string, string) 1`] = `"boolean"`; + +exports[`R_contains(string, string_array) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/converge.ts.snap b/tests/__snapshots__/converge.ts.snap new file mode 100644 index 0000000..5349221 --- /dev/null +++ b/tests/__snapshots__/converge.ts.snap @@ -0,0 +1,21 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_converge(any_args_to_object) 1`] = `"(fns: [(v1: T1) => any]) => CurriedFunction1"`; + +exports[`R_converge(string_number_boolean_to_object) 1`] = `"(fns: [(v1: T1) => string, (v1: T1) => number, (v1: T1) => boolean]) => CurriedFunction1"`; + +exports[`R_converge(string_number_boolean_to_object)([ + string_to_string, + string_to_number, + string_to_boolean, + ]) 1`] = `"CurriedFunction1"`; + +exports[`R_converge(string_number_boolean_to_object, [ + string_to_string, + string_to_number, + string_to_boolean, + ]) 1`] = `"CurriedFunction1"`; + +exports[`R_converge<'1', 'i2f2'>()(any_args_to_object) 1`] = `"(fns: [(v1: T1, v2: T2) => any, (v1: T1, v2: T2) => any]) => CurriedFunction2"`; + +exports[`R_converge<'1', 'variadic'>()(any_args_to_object) 1`] = `"(fns: ((...args: any[]) => any)[] | ArrayLike<(...args: any[]) => any>) => (...args: any[]) => object"`; diff --git a/tests/__snapshots__/countBy.ts.snap b/tests/__snapshots__/countBy.ts.snap new file mode 100644 index 0000000..b01df0d --- /dev/null +++ b/tests/__snapshots__/countBy.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_countBy(object_to_string) 1`] = `"(list: object[] | ArrayLike) => Dictionary"`; + +exports[`R_countBy(object_to_string, object_array) 1`] = `"Dictionary"`; diff --git a/tests/__snapshots__/curry.ts.snap b/tests/__snapshots__/curry.ts.snap new file mode 100644 index 0000000..2bc21e8 --- /dev/null +++ b/tests/__snapshots__/curry.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_curry(number_args_to_boolean) 1`] = `"() => boolean"`; + +exports[`R_curry(number_boolean_to_string) 1`] = `"CurriedFunction2"`; + +exports[`R_curry(seven_string_to_number) 1`] = `"(...args: any[]) => number"`; + +exports[`R_curry(string_to_object) 1`] = `"CurriedFunction1"`; diff --git a/tests/__snapshots__/curryN.ts.snap b/tests/__snapshots__/curryN.ts.snap new file mode 100644 index 0000000..2b22b9b --- /dev/null +++ b/tests/__snapshots__/curryN.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_curryN(0, string_to_object) 1`] = `"() => object"`; + +exports[`R_curryN(1, number_boolean_to_string) 1`] = `"CurriedFunction1"`; + +exports[`R_curryN(4, number_args_to_boolean) 1`] = `"CurriedFunction4"`; + +exports[`R_curryN(7, seven_string_to_number) 1`] = `"(...args: any[]) => number"`; diff --git a/tests/__snapshots__/dec.ts.snap b/tests/__snapshots__/dec.ts.snap new file mode 100644 index 0000000..2c46341 --- /dev/null +++ b/tests/__snapshots__/dec.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_dec(number) 1`] = `"number"`; diff --git a/tests/__snapshots__/defaultTo.ts.snap b/tests/__snapshots__/defaultTo.ts.snap new file mode 100644 index 0000000..f934d2a --- /dev/null +++ b/tests/__snapshots__/defaultTo.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_defaultTo(string)(number_or_undefined) 1`] = `"string | number"`; + +exports[`R_defaultTo(string)(undefined) 1`] = `"string"`; + +exports[`R_defaultTo(string, number_or_undefined) 1`] = `"string | number"`; + +exports[`R_defaultTo(string, undefined) 1`] = `"string"`; diff --git a/tests/__snapshots__/descend.ts.snap b/tests/__snapshots__/descend.ts.snap new file mode 100644 index 0000000..8912f32 --- /dev/null +++ b/tests/__snapshots__/descend.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_descend(get_order_from_object)(object_a)(object_b) 1`] = `"number"`; + +exports[`R_descend(get_order_from_object, object_a)(object_b) 1`] = `"number"`; + +exports[`R_descend(get_order_from_object, object_a, object_b) 1`] = `"number"`; diff --git a/tests/__snapshots__/difference.ts.snap b/tests/__snapshots__/difference.ts.snap new file mode 100644 index 0000000..60e55e2 --- /dev/null +++ b/tests/__snapshots__/difference.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_difference(number_array) 1`] = `"(b: number[] | ArrayLike) => number[]"`; + +exports[`R_difference(number_array, number_array) 1`] = `"number[]"`; diff --git a/tests/__snapshots__/differenceWith.ts.snap b/tests/__snapshots__/differenceWith.ts.snap new file mode 100644 index 0000000..b677ce7 --- /dev/null +++ b/tests/__snapshots__/differenceWith.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_differenceWith(number_number_to_boolean, number_array) 1`] = `"(b: number[] | ArrayLike) => number[]"`; + +exports[`R_differenceWith(number_number_to_boolean, number_array, number_array) 1`] = `"number[]"`; diff --git a/tests/__snapshots__/dissoc.ts.snap b/tests/__snapshots__/dissoc.ts.snap new file mode 100644 index 0000000..2134488 --- /dev/null +++ b/tests/__snapshots__/dissoc.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_dissoc('a')(a_1_b_2_c_3) 1`] = `"Pick<{ a: 1; b: 2; c: 3; }, \\"b\\" | \\"c\\">"`; + +exports[`R_dissoc('a', a_1_b_2_c_3) 1`] = `"Pick<{ a: 1; b: 2; c: 3; }, \\"b\\" | \\"c\\">"`; + +exports[`R_dissoc(string_property)(object) 1`] = `"Pick"`; + +exports[`R_dissoc(string_property, object) 1`] = `"Pick"`; diff --git a/tests/__snapshots__/dissocPath.ts.snap b/tests/__snapshots__/dissocPath.ts.snap new file mode 100644 index 0000000..5c59e9d --- /dev/null +++ b/tests/__snapshots__/dissocPath.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_dissocPath(path)(a_b_c_d_e) 1`] = `"{ a?: DeepPartial | undefined; }"`; + +exports[`R_dissocPath(path)(object) 1`] = `"object"`; + +exports[`R_dissocPath(path, a_b_c_d_e) 1`] = `"{ a?: DeepPartial | undefined; }"`; + +exports[`R_dissocPath(path, object) 1`] = `"object"`; diff --git a/tests/__snapshots__/divide.ts.snap b/tests/__snapshots__/divide.ts.snap new file mode 100644 index 0000000..8e253e1 --- /dev/null +++ b/tests/__snapshots__/divide.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_divide(number)(number) 1`] = `"number"`; + +exports[`R_divide(number, number) 1`] = `"number"`; diff --git a/tests/__snapshots__/drop.ts.snap b/tests/__snapshots__/drop.ts.snap new file mode 100644 index 0000000..0ff2c04 --- /dev/null +++ b/tests/__snapshots__/drop.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_drop(number, boolean_array) 1`] = `"boolean[]"`; + +exports[`R_drop(number, string) 1`] = `"string"`; diff --git a/tests/__snapshots__/dropLast.ts.snap b/tests/__snapshots__/dropLast.ts.snap new file mode 100644 index 0000000..3f59d52 --- /dev/null +++ b/tests/__snapshots__/dropLast.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_dropLast(number, boolean_array) 1`] = `"boolean[]"`; + +exports[`R_dropLast(number, string) 1`] = `"string"`; diff --git a/tests/__snapshots__/dropLastWhile.ts.snap b/tests/__snapshots__/dropLastWhile.ts.snap new file mode 100644 index 0000000..cacedc6 --- /dev/null +++ b/tests/__snapshots__/dropLastWhile.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_dropLastWhile(string_to_boolean) 1`] = `"(list: string[] | ArrayLike) => string[]"`; + +exports[`R_dropLastWhile(string_to_boolean, string_array) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/dropRepeats.ts.snap b/tests/__snapshots__/dropRepeats.ts.snap new file mode 100644 index 0000000..4e55586 --- /dev/null +++ b/tests/__snapshots__/dropRepeats.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_dropRepeats(string_array) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/dropRepeatsWith.ts.snap b/tests/__snapshots__/dropRepeatsWith.ts.snap new file mode 100644 index 0000000..a6c7dff --- /dev/null +++ b/tests/__snapshots__/dropRepeatsWith.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_dropRepeatsWith(string_to_number) 1`] = `"(list: string[] | ArrayLike) => string[]"`; + +exports[`R_dropRepeatsWith(string_to_number)(string_array) 1`] = `"string[]"`; + +exports[`R_dropRepeatsWith(string_to_number, string_array) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/dropWhile.ts.snap b/tests/__snapshots__/dropWhile.ts.snap new file mode 100644 index 0000000..aaae879 --- /dev/null +++ b/tests/__snapshots__/dropWhile.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_dropWhile(string_to_boolean) 1`] = `"(list: string[] | ArrayLike) => string[]"`; + +exports[`R_dropWhile(string_to_boolean, string_array) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/either.ts.snap b/tests/__snapshots__/either.ts.snap new file mode 100644 index 0000000..ca37479 --- /dev/null +++ b/tests/__snapshots__/either.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_either(string_predicate) 1`] = `"(fn2: (value: string) => boolean) => (value: string) => boolean"`; + +exports[`R_either(string_predicate, string_predicate) 1`] = `"(value: string) => boolean"`; diff --git a/tests/__snapshots__/empty.ts.snap b/tests/__snapshots__/empty.ts.snap new file mode 100644 index 0000000..72d01b2 --- /dev/null +++ b/tests/__snapshots__/empty.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_empty(object) 1`] = `"{}"`; + +exports[`R_empty(string) 1`] = `"string"`; + +exports[`R_empty(string_array) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/endsWith.ts.snap b/tests/__snapshots__/endsWith.ts.snap new file mode 100644 index 0000000..d303c03 --- /dev/null +++ b/tests/__snapshots__/endsWith.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_endsWith(boolean_array) 1`] = `"(list: boolean[]) => boolean"`; + +exports[`R_endsWith(boolean_array, boolean_array) 1`] = `"boolean"`; + +exports[`R_endsWith(string) 1`] = `"(list: string) => boolean"`; + +exports[`R_endsWith(string, string) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/eqBy.ts.snap b/tests/__snapshots__/eqBy.ts.snap new file mode 100644 index 0000000..02a6a77 --- /dev/null +++ b/tests/__snapshots__/eqBy.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_eqBy(string_to_number)(string)(string) 1`] = `"boolean"`; + +exports[`R_eqBy(string_to_number, string) 1`] = `"(b: string) => boolean"`; + +exports[`R_eqBy(string_to_number, string, string) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/eqProps.ts.snap b/tests/__snapshots__/eqProps.ts.snap new file mode 100644 index 0000000..b46b5aa --- /dev/null +++ b/tests/__snapshots__/eqProps.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_eqProps(property)(string, string) 1`] = `"boolean"`; + +exports[`R_eqProps(property, string) 1`] = `"(b: string) => boolean"`; + +exports[`R_eqProps(property, string, string) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/equals.ts.snap b/tests/__snapshots__/equals.ts.snap new file mode 100644 index 0000000..85c6647 --- /dev/null +++ b/tests/__snapshots__/equals.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_equals(string) 1`] = `"(b: string) => boolean"`; + +exports[`R_equals(string)(string) 1`] = `"boolean"`; + +exports[`R_equals(string, string) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/evolve.ts.snap b/tests/__snapshots__/evolve.ts.snap new file mode 100644 index 0000000..df231ac --- /dev/null +++ b/tests/__snapshots__/evolve.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_evolve(a_b_number_to_number)(a_1_b_2_c_3) 1`] = `"{ a: 1; b: 2; c: 3; }"`; + +exports[`R_evolve(a_b_number_to_number, a_1_b_2_c_3) 1`] = `"{ a: 1; b: 2; c: 3; }"`; diff --git a/tests/__snapshots__/filter.ts.snap b/tests/__snapshots__/filter.ts.snap new file mode 100644 index 0000000..0d01b9d --- /dev/null +++ b/tests/__snapshots__/filter.ts.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_filter(string_predicate)(string_array) 1`] = `"string[]"`; + +exports[`R_filter(string_predicate)(string_dictionary) 1`] = `"Partial>"`; + +exports[`R_filter(string_predicate)(string_filterable) 1`] = `"Filterable"`; + +exports[`R_filter(string_predicate, string_array) 1`] = `"string[]"`; + +exports[`R_filter(string_predicate, string_dictionary) 1`] = `"Partial>"`; + +exports[`R_filter(string_predicate, string_filterable) 1`] = `"Filterable"`; diff --git a/tests/__snapshots__/find.ts.snap b/tests/__snapshots__/find.ts.snap new file mode 100644 index 0000000..d3b7fea --- /dev/null +++ b/tests/__snapshots__/find.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_find(string_predicate) 1`] = `"(list: string[] | ArrayLike) => string | undefined"`; + +exports[`R_find(string_predicate)(string_array) 1`] = `"string | undefined"`; + +exports[`R_find(string_predicate, string_array) 1`] = `"string | undefined"`; diff --git a/tests/__snapshots__/findIndex.ts.snap b/tests/__snapshots__/findIndex.ts.snap new file mode 100644 index 0000000..f4b2e53 --- /dev/null +++ b/tests/__snapshots__/findIndex.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_findIndex(string_predicate) 1`] = `"(list: string[] | ArrayLike) => number"`; + +exports[`R_findIndex(string_predicate)(string_array) 1`] = `"number"`; + +exports[`R_findIndex(string_predicate, string_array) 1`] = `"number"`; diff --git a/tests/__snapshots__/findLast.ts.snap b/tests/__snapshots__/findLast.ts.snap new file mode 100644 index 0000000..a6d36c4 --- /dev/null +++ b/tests/__snapshots__/findLast.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_findLast(string_predicate) 1`] = `"(list: string[] | ArrayLike) => string | undefined"`; + +exports[`R_findLast(string_predicate)(string_array) 1`] = `"string | undefined"`; + +exports[`R_findLast(string_predicate, string_array) 1`] = `"string | undefined"`; diff --git a/tests/__snapshots__/findLastIndex.ts.snap b/tests/__snapshots__/findLastIndex.ts.snap new file mode 100644 index 0000000..e5c7eb3 --- /dev/null +++ b/tests/__snapshots__/findLastIndex.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_findLastIndex(string_predicate) 1`] = `"(list: string[] | ArrayLike) => number"`; + +exports[`R_findLastIndex(string_predicate)(string_array) 1`] = `"number"`; + +exports[`R_findLastIndex(string_predicate, string_array) 1`] = `"number"`; diff --git a/tests/__snapshots__/flatten.ts.snap b/tests/__snapshots__/flatten.ts.snap new file mode 100644 index 0000000..8dd9955 --- /dev/null +++ b/tests/__snapshots__/flatten.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_flatten(nested_object_list) 1`] = `"object[]"`; + +exports[`R_flatten(string_array) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/flip.ts.snap b/tests/__snapshots__/flip.ts.snap new file mode 100644 index 0000000..9c8fba4 --- /dev/null +++ b/tests/__snapshots__/flip.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_flip(number_args_to_boolean) 1`] = `"CurriedFunction2"`; + +exports[`R_flip(number_boolean_to_string) 1`] = `"CurriedFunction2"`; + +exports[`R_flip(seven_string_to_number) 1`] = `"(v2: string, v1: string, ...args: any[]) => number"`; + +exports[`R_flip(string_number_to_object) 1`] = `"CurriedFunction2"`; diff --git a/tests/__snapshots__/forEach.ts.snap b/tests/__snapshots__/forEach.ts.snap new file mode 100644 index 0000000..b985f1c --- /dev/null +++ b/tests/__snapshots__/forEach.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_forEach(number_tap) 1`] = `">(list: U) => U"`; + +exports[`R_forEach(number_tap)(number_list) 1`] = `"List"`; + +exports[`R_forEach(number_tap, number_list) 1`] = `"List"`; diff --git a/tests/__snapshots__/forEachObjIndexed.ts.snap b/tests/__snapshots__/forEachObjIndexed.ts.snap new file mode 100644 index 0000000..b3ed4ba --- /dev/null +++ b/tests/__snapshots__/forEachObjIndexed.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_forEachObjIndexed(keyed_number_dictionary_tap) 1`] = `"(list: Dictionary) => Dictionary"`; + +exports[`R_forEachObjIndexed(keyed_number_dictionary_tap)(number_dictionary) 1`] = `"Dictionary"`; + +exports[`R_forEachObjIndexed(keyed_number_dictionary_tap, number_dictionary) 1`] = `"Dictionary"`; diff --git a/tests/__snapshots__/fromPairs.ts.snap b/tests/__snapshots__/fromPairs.ts.snap new file mode 100644 index 0000000..0133413 --- /dev/null +++ b/tests/__snapshots__/fromPairs.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_fromPairs([number_object_tuple]) 1`] = `"Dictionary"`; diff --git a/tests/__snapshots__/groupBy.ts.snap b/tests/__snapshots__/groupBy.ts.snap new file mode 100644 index 0000000..49f981a --- /dev/null +++ b/tests/__snapshots__/groupBy.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_groupBy(object_to_string) 1`] = `"(list: object[] | ArrayLike) => Dictionary"`; + +exports[`R_groupBy(object_to_string)(object_array) 1`] = `"Dictionary"`; + +exports[`R_groupBy(object_to_string, object_array) 1`] = `"Dictionary"`; diff --git a/tests/__snapshots__/groupWith.ts.snap b/tests/__snapshots__/groupWith.ts.snap new file mode 100644 index 0000000..72dbd47 --- /dev/null +++ b/tests/__snapshots__/groupWith.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_groupWith(string_to_boolean) 1`] = `">(list: U) => U[]"`; + +exports[`R_groupWith(string_to_boolean, string) 1`] = `"string[]"`; + +exports[`R_groupWith(string_to_boolean, string_array) 1`] = `"string[][]"`; diff --git a/tests/__snapshots__/gt.ts.snap b/tests/__snapshots__/gt.ts.snap new file mode 100644 index 0000000..1b768ae --- /dev/null +++ b/tests/__snapshots__/gt.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_gt(number, number) 1`] = `"boolean"`; + +exports[`R_gt(string) 1`] = `"(b: string) => boolean"`; + +exports[`R_gt(string, string) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/gte.ts.snap b/tests/__snapshots__/gte.ts.snap new file mode 100644 index 0000000..c615400 --- /dev/null +++ b/tests/__snapshots__/gte.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_gte(number, number) 1`] = `"boolean"`; + +exports[`R_gte(string) 1`] = `"(b: string) => boolean"`; + +exports[`R_gte(string, string) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/has.ts.snap b/tests/__snapshots__/has.ts.snap new file mode 100644 index 0000000..113e898 --- /dev/null +++ b/tests/__snapshots__/has.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_has(property) 1`] = `"(object: {}) => boolean"`; + +exports[`R_has(property)(object) 1`] = `"boolean"`; + +exports[`R_has(property, object) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/hasIn.ts.snap b/tests/__snapshots__/hasIn.ts.snap new file mode 100644 index 0000000..284a5cc --- /dev/null +++ b/tests/__snapshots__/hasIn.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_hasIn(property) 1`] = `"(object: {}) => boolean"`; + +exports[`R_hasIn(property)(object) 1`] = `"boolean"`; + +exports[`R_hasIn(property, object) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/head.ts.snap b/tests/__snapshots__/head.ts.snap new file mode 100644 index 0000000..e21c77b --- /dev/null +++ b/tests/__snapshots__/head.ts.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_head(number_array) 1`] = `"number | undefined"`; + +exports[`R_head(number_boolean_object_tuple) 1`] = `"number"`; + +exports[`R_head(string) 1`] = `"string"`; + +exports[`R_head(string_array) 1`] = `"string | undefined"`; + +exports[`R_head(string_number_tuple) 1`] = `"string"`; diff --git a/tests/__snapshots__/identical.ts.snap b/tests/__snapshots__/identical.ts.snap new file mode 100644 index 0000000..e04be95 --- /dev/null +++ b/tests/__snapshots__/identical.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_identical(string) 1`] = `"(b: string) => boolean"`; + +exports[`R_identical(string)(string) 1`] = `"boolean"`; + +exports[`R_identical(string, string) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/identity.ts.snap b/tests/__snapshots__/identity.ts.snap new file mode 100644 index 0000000..f03f639 --- /dev/null +++ b/tests/__snapshots__/identity.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_identity(number) 1`] = `"number"`; + +exports[`R_identity(string) 1`] = `"string"`; diff --git a/tests/__snapshots__/ifElse.ts.snap b/tests/__snapshots__/ifElse.ts.snap new file mode 100644 index 0000000..b2081a2 --- /dev/null +++ b/tests/__snapshots__/ifElse.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_ifElse(string_to_boolean)(string_to_number)(string_to_object) 1`] = `"(value: string) => number | object"`; + +exports[`R_ifElse(string_to_boolean, string_to_number) 1`] = `"(onFalse: (value: string) => V) => (value: string) => number | V"`; + +exports[`R_ifElse(string_to_boolean, string_to_number, string_to_object) 1`] = `"(value: string) => number | object"`; diff --git a/tests/__snapshots__/inc.ts.snap b/tests/__snapshots__/inc.ts.snap new file mode 100644 index 0000000..3af1699 --- /dev/null +++ b/tests/__snapshots__/inc.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_inc(number) 1`] = `"number"`; diff --git a/tests/__snapshots__/indexBy.ts.snap b/tests/__snapshots__/indexBy.ts.snap new file mode 100644 index 0000000..3665dcd --- /dev/null +++ b/tests/__snapshots__/indexBy.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_indexBy(object_to_string) 1`] = `"(list: object[] | ArrayLike) => Dictionary"`; + +exports[`R_indexBy(object_to_string)(object_array) 1`] = `"Dictionary"`; + +exports[`R_indexBy(object_to_string, object_array) 1`] = `"Dictionary"`; diff --git a/tests/__snapshots__/indexOf.ts.snap b/tests/__snapshots__/indexOf.ts.snap new file mode 100644 index 0000000..afc06ea --- /dev/null +++ b/tests/__snapshots__/indexOf.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_indexOf(string) 1`] = `"(list: string[] | ArrayLike) => number"`; + +exports[`R_indexOf(string, string) 1`] = `"number"`; + +exports[`R_indexOf(string, string_array) 1`] = `"number"`; diff --git a/tests/__snapshots__/init.ts.snap b/tests/__snapshots__/init.ts.snap new file mode 100644 index 0000000..00b2b13 --- /dev/null +++ b/tests/__snapshots__/init.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_init(string) 1`] = `"string"`; + +exports[`R_init(string_array) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/innerJoin.ts.snap b/tests/__snapshots__/innerJoin.ts.snap new file mode 100644 index 0000000..62ef755 --- /dev/null +++ b/tests/__snapshots__/innerJoin.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_innerJoin(object_number_to_boolean)(object_array)(number_array) 1`] = `"object[]"`; + +exports[`R_innerJoin(object_number_to_boolean, object_array) 1`] = `"(ys: number[] | ArrayLike) => object[]"`; + +exports[`R_innerJoin(object_number_to_boolean, object_array, number_array) 1`] = `"object[]"`; diff --git a/tests/__snapshots__/insert.ts.snap b/tests/__snapshots__/insert.ts.snap new file mode 100644 index 0000000..7e020a8 --- /dev/null +++ b/tests/__snapshots__/insert.ts.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_insert(number)(object)(object_array) 1`] = `"object[]"`; + +exports[`R_insert(number)(string)(object_array) 1`] = `"(string | object)[]"`; + +exports[`R_insert(number, object) 1`] = `"(list: U[] | ArrayLike) => (object | U)[]"`; + +exports[`R_insert(number, object, object_array) 1`] = `"object[]"`; + +exports[`R_insert(number, string) 1`] = `"(list: U[] | ArrayLike) => (string | U)[]"`; + +exports[`R_insert(number, string, object_array) 1`] = `"(string | object)[]"`; diff --git a/tests/__snapshots__/insertAll.ts.snap b/tests/__snapshots__/insertAll.ts.snap new file mode 100644 index 0000000..35665db --- /dev/null +++ b/tests/__snapshots__/insertAll.ts.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_insertAll(number)(string_array)(object_array) 1`] = `"(string | object)[]"`; + +exports[`R_insertAll(number)(string_array)(string_array) 1`] = `"string[]"`; + +exports[`R_insertAll(number, string_array) 1`] = `"(list: U[] | ArrayLike) => (string | U)[]"`; + +exports[`R_insertAll(number, string_array, object_array) 1`] = `"(string | object)[]"`; + +exports[`R_insertAll(number, string_array, string_array) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/intersection.ts.snap b/tests/__snapshots__/intersection.ts.snap new file mode 100644 index 0000000..8f65340 --- /dev/null +++ b/tests/__snapshots__/intersection.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_intersection(number_array) 1`] = `"(b: number[] | ArrayLike) => number[]"`; + +exports[`R_intersection(number_array, number_array) 1`] = `"number[]"`; diff --git a/tests/__snapshots__/intersectionWith.ts.snap b/tests/__snapshots__/intersectionWith.ts.snap new file mode 100644 index 0000000..f4143c6 --- /dev/null +++ b/tests/__snapshots__/intersectionWith.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_intersectionWith(number_number_to_boolean, number_array) 1`] = `"(b: number[] | ArrayLike) => number[]"`; + +exports[`R_intersectionWith(number_number_to_boolean, number_array, number_array) 1`] = `"number[]"`; diff --git a/tests/__snapshots__/intersperse.ts.snap b/tests/__snapshots__/intersperse.ts.snap new file mode 100644 index 0000000..c55f958 --- /dev/null +++ b/tests/__snapshots__/intersperse.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_intersperse(string) 1`] = `"(list: U[] | ArrayLike) => (string | U)[]"`; + +exports[`R_intersperse(string)(object_array) 1`] = `"(string | object)[]"`; + +exports[`R_intersperse(string, object_array) 1`] = `"(string | object)[]"`; diff --git a/tests/__snapshots__/into.ts.snap b/tests/__snapshots__/into.ts.snap new file mode 100644 index 0000000..8e3040a --- /dev/null +++ b/tests/__snapshots__/into.ts.snap @@ -0,0 +1,17 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_into(num_str_transformer)(num_str_transformer_to_str_num_to_str) 1`] = `"(values: number[]) => string"`; + +exports[`R_into(num_str_transformer, num_str_transformer_to_str_num_to_str) 1`] = `"(values: number[]) => string"`; + +exports[`R_into(object)(str_obj_transformer_to_obj_str_to_obj) 1`] = `"(values: string[]) => object"`; + +exports[`R_into(object, str_obj_transformer_to_obj_str_to_obj) 1`] = `"(values: string[]) => object"`; + +exports[`R_into(str_obj_transformer)(str_obj_transformer_to_obj_str_to_obj) 1`] = `"(values: string[]) => object"`; + +exports[`R_into(str_obj_transformer, str_obj_transformer_to_obj_str_to_obj) 1`] = `"(values: string[]) => object"`; + +exports[`R_into(string)(num_str_transformer_to_str_num_to_str) 1`] = `"(values: number[]) => string"`; + +exports[`R_into(string, num_str_transformer_to_str_num_to_str) 1`] = `"(values: number[]) => string"`; diff --git a/tests/__snapshots__/invert.ts.snap b/tests/__snapshots__/invert.ts.snap new file mode 100644 index 0000000..b94977b --- /dev/null +++ b/tests/__snapshots__/invert.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_invert(number_object_record) 1`] = `"Dictionary"`; diff --git a/tests/__snapshots__/invertObj.ts.snap b/tests/__snapshots__/invertObj.ts.snap new file mode 100644 index 0000000..c400f0d --- /dev/null +++ b/tests/__snapshots__/invertObj.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_invertObj(number_object_record) 1`] = `"Dictionary"`; diff --git a/tests/__snapshots__/invoker.ts.snap b/tests/__snapshots__/invoker.ts.snap new file mode 100644 index 0000000..cbc4db3 --- /dev/null +++ b/tests/__snapshots__/invoker.ts.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_invoker(0) 1`] = `", R>(method: N) => CurriedFunction1"`; + +exports[`R_invoker(1) 1`] = `", T1, R>(method: N) => CurriedFunction2"`; + +exports[`R_invoker(2) 1`] = `", T1, T2, R>(method: N) => CurriedFunction3"`; + +exports[`R_invoker(5) 1`] = `", T1, T2, T3, T4, T5, R>(method: N) => CurriedFunction6"`; + +exports[`R_invoker(6) 1`] = `"(method: N) => (...args: any[]) => R"`; + +exports[`R_invoker(7) 1`] = `"(method: N) => (...args: any[]) => R"`; diff --git a/tests/__snapshots__/is.ts.snap b/tests/__snapshots__/is.ts.snap new file mode 100644 index 0000000..bf71abd --- /dev/null +++ b/tests/__snapshots__/is.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_is(String) 1`] = `"(value: any) => value is String"`; + +exports[`R_is(String)(string) 1`] = `"boolean"`; + +exports[`R_is(String, string) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/isEmpty.ts.snap b/tests/__snapshots__/isEmpty.ts.snap new file mode 100644 index 0000000..226d6d3 --- /dev/null +++ b/tests/__snapshots__/isEmpty.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_isEmpty(string) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/isNil.ts.snap b/tests/__snapshots__/isNil.ts.snap new file mode 100644 index 0000000..7232d3a --- /dev/null +++ b/tests/__snapshots__/isNil.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_isNil 1`] = `"(value: any) => value is null | undefined"`; + +exports[`R_isNil(string) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/join.ts.snap b/tests/__snapshots__/join.ts.snap new file mode 100644 index 0000000..b3f3431 --- /dev/null +++ b/tests/__snapshots__/join.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_join(string) 1`] = `"(list: any[]) => string"`; + +exports[`R_join(string)(number_array) 1`] = `"string"`; + +exports[`R_join(string, number_array) 1`] = `"string"`; diff --git a/tests/__snapshots__/juxt.ts.snap b/tests/__snapshots__/juxt.ts.snap new file mode 100644 index 0000000..103a765 --- /dev/null +++ b/tests/__snapshots__/juxt.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_juxt([string_string_to_number]) 1`] = `"(...args: string[]) => number[]"`; + +exports[`R_juxt([string_string_to_number])(string, string) 1`] = `"number[]"`; diff --git a/tests/__snapshots__/keys.ts.snap b/tests/__snapshots__/keys.ts.snap new file mode 100644 index 0000000..c573d91 --- /dev/null +++ b/tests/__snapshots__/keys.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_keys(a_1_b_2_c_3) 1`] = `"(\\"a\\" | \\"b\\" | \\"c\\")[]"`; + +exports[`R_keys(string_number_record) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/keysIn.ts.snap b/tests/__snapshots__/keysIn.ts.snap new file mode 100644 index 0000000..746fbb5 --- /dev/null +++ b/tests/__snapshots__/keysIn.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_keysIn(a_1_b_2_c_3) 1`] = `"(\\"a\\" | \\"b\\" | \\"c\\")[]"`; + +exports[`R_keysIn(string_number_record) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/last.ts.snap b/tests/__snapshots__/last.ts.snap new file mode 100644 index 0000000..72c7a2d --- /dev/null +++ b/tests/__snapshots__/last.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_last(number_array) 1`] = `"number | undefined"`; + +exports[`R_last(string) 1`] = `"string"`; + +exports[`R_last(string_array) 1`] = `"string | undefined"`; diff --git a/tests/__snapshots__/lastIndexOf.ts.snap b/tests/__snapshots__/lastIndexOf.ts.snap new file mode 100644 index 0000000..563141e --- /dev/null +++ b/tests/__snapshots__/lastIndexOf.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_lastIndexOf(string) 1`] = `"(list: string[] | ArrayLike) => number"`; + +exports[`R_lastIndexOf(string, string) 1`] = `"number"`; + +exports[`R_lastIndexOf(string, string_array) 1`] = `"number"`; diff --git a/tests/__snapshots__/length.ts.snap b/tests/__snapshots__/length.ts.snap new file mode 100644 index 0000000..1c52e09 --- /dev/null +++ b/tests/__snapshots__/length.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_length(string) 1`] = `"number"`; + +exports[`R_length(string_array) 1`] = `"number"`; diff --git a/tests/__snapshots__/lens.ts.snap b/tests/__snapshots__/lens.ts.snap new file mode 100644 index 0000000..ae025cd --- /dev/null +++ b/tests/__snapshots__/lens.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_lens(object_to_string) 1`] = `"(setter: (focus: string, target: object) => object) => ManualLens"`; + +exports[`R_lens(object_to_string)(string_object_to_object) 1`] = `"ManualLens"`; + +exports[`R_lens(object_to_string, string_object_to_object) 1`] = `"ManualLens"`; diff --git a/tests/__snapshots__/lensIndex.ts.snap b/tests/__snapshots__/lensIndex.ts.snap new file mode 100644 index 0000000..afda826 --- /dev/null +++ b/tests/__snapshots__/lensIndex.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_lensIndex(0) 1`] = `"PseudoLens<0>"`; + +exports[`R_lensIndex(number) 1`] = `"PseudoLens"`; diff --git a/tests/__snapshots__/lensPath.ts.snap b/tests/__snapshots__/lensPath.ts.snap new file mode 100644 index 0000000..751d566 --- /dev/null +++ b/tests/__snapshots__/lensPath.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_lensPath(path) 1`] = `"ManualLens<{}, {}>"`; + +exports[`R_lensPath(path) 1`] = `"ManualLens"`; diff --git a/tests/__snapshots__/lensProp.ts.snap b/tests/__snapshots__/lensProp.ts.snap new file mode 100644 index 0000000..f5f011b --- /dev/null +++ b/tests/__snapshots__/lensProp.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_lensProp('x') 1`] = `"PseudoLens<\\"x\\">"`; + +exports[`R_lensProp(1) 1`] = `"PseudoLens<1>"`; + +exports[`R_lensProp(property) 1`] = `"ManualLens<{}, {}>"`; + +exports[`R_lensProp(property) 1`] = `"ManualLens"`; diff --git a/tests/__snapshots__/lift.ts.snap b/tests/__snapshots__/lift.ts.snap new file mode 100644 index 0000000..ef63a6d --- /dev/null +++ b/tests/__snapshots__/lift.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_lift(number_args_to_boolean) 1`] = `"() => boolean[]"`; + +exports[`R_lift(number_boolean_to_string) 1`] = `"CurriedFunction2, boolean[] | ArrayLike, string[]>"`; + +exports[`R_lift(seven_string_to_number) 1`] = `"(...args: any[]) => number[]"`; + +exports[`R_lift(string_to_object) 1`] = `"CurriedFunction1, object[]>"`; diff --git a/tests/__snapshots__/liftN.ts.snap b/tests/__snapshots__/liftN.ts.snap new file mode 100644 index 0000000..5c4314c --- /dev/null +++ b/tests/__snapshots__/liftN.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_liftN(0, string_to_object) 1`] = `"() => object[]"`; + +exports[`R_liftN(1, number_boolean_to_string) 1`] = `"CurriedFunction1, string[]>"`; + +exports[`R_liftN(4, number_args_to_boolean) 1`] = `"CurriedFunction4, number[] | ArrayLike, number[] | ArrayLike, number[] | ArrayLike, boolean[]>"`; + +exports[`R_liftN(7, seven_string_to_number) 1`] = `"(...args: any[]) => number[]"`; diff --git a/tests/__snapshots__/lt.ts.snap b/tests/__snapshots__/lt.ts.snap new file mode 100644 index 0000000..610fa4e --- /dev/null +++ b/tests/__snapshots__/lt.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_lt(number, number) 1`] = `"boolean"`; + +exports[`R_lt(string) 1`] = `"(b: string) => boolean"`; + +exports[`R_lt(string, string) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/lte.ts.snap b/tests/__snapshots__/lte.ts.snap new file mode 100644 index 0000000..5afa4aa --- /dev/null +++ b/tests/__snapshots__/lte.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_lte(number, number) 1`] = `"boolean"`; + +exports[`R_lte(string) 1`] = `"(b: string) => boolean"`; + +exports[`R_lte(string, string) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/map.ts.snap b/tests/__snapshots__/map.ts.snap new file mode 100644 index 0000000..636768f --- /dev/null +++ b/tests/__snapshots__/map.ts.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_map(string_to_number)(string_array) 1`] = `"number[]"`; + +exports[`R_map(string_to_number)(string_functor) 1`] = `"Functor"`; + +exports[`R_map(string_to_number)(string_object) 1`] = `"Record"`; + +exports[`R_map(string_to_number, string_array) 1`] = `"number[]"`; + +exports[`R_map(string_to_number, string_functor) 1`] = `"Functor"`; + +exports[`R_map(string_to_number, string_object) 1`] = `"Record"`; diff --git a/tests/__snapshots__/mapAccum.ts.snap b/tests/__snapshots__/mapAccum.ts.snap new file mode 100644 index 0000000..3d3838e --- /dev/null +++ b/tests/__snapshots__/mapAccum.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_mapAccum(number_string_to_number_string_tuple)(number)(string_array) 1`] = `"[number, string[]]"`; + +exports[`R_mapAccum(number_string_to_number_string_tuple, number) 1`] = `"(list: string[] | ArrayLike) => [number, string[]]"`; + +exports[`R_mapAccum(number_string_to_number_string_tuple, number, string_array) 1`] = `"[number, string[]]"`; diff --git a/tests/__snapshots__/mapAccumRight.ts.snap b/tests/__snapshots__/mapAccumRight.ts.snap new file mode 100644 index 0000000..2c03b5a --- /dev/null +++ b/tests/__snapshots__/mapAccumRight.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_mapAccumRight(string_number_to_string_number_tuple)(number)(string_array) 1`] = `"[string[], number]"`; + +exports[`R_mapAccumRight(string_number_to_string_number_tuple, number) 1`] = `"(list: string[] | ArrayLike) => [string[], number]"`; + +exports[`R_mapAccumRight(string_number_to_string_number_tuple, number, string_array) 1`] = `"[string[], number]"`; diff --git a/tests/__snapshots__/mapObjIndexed.ts.snap b/tests/__snapshots__/mapObjIndexed.ts.snap new file mode 100644 index 0000000..1915ae6 --- /dev/null +++ b/tests/__snapshots__/mapObjIndexed.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_mapObjIndexed(number_string_object_to_boolean) 1`] = `"(object: Record) => Record"`; + +exports[`R_mapObjIndexed(number_string_object_to_boolean, a_1_b_2_c_3) 1`] = `"Record"`; + +exports[`R_mapObjIndexed(number_string_object_to_boolean, string_number_record) 1`] = `"Record"`; + +exports[`R_mapObjIndexed(placeholder, a_1_b_2_c_3)(number_string_object_to_boolean) 1`] = `"Record<\\"a\\" | \\"b\\" | \\"c\\", boolean>"`; diff --git a/tests/__snapshots__/match.ts.snap b/tests/__snapshots__/match.ts.snap new file mode 100644 index 0000000..8b17c88 --- /dev/null +++ b/tests/__snapshots__/match.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_match(regex) 1`] = `"(str: string) => string[]"`; + +exports[`R_match(regex)(string) 1`] = `"string[]"`; + +exports[`R_match(regex, string) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/mathMod.ts.snap b/tests/__snapshots__/mathMod.ts.snap new file mode 100644 index 0000000..240f82d --- /dev/null +++ b/tests/__snapshots__/mathMod.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_mathMod(number)(number) 1`] = `"number"`; + +exports[`R_mathMod(number, number) 1`] = `"number"`; diff --git a/tests/__snapshots__/max.ts.snap b/tests/__snapshots__/max.ts.snap new file mode 100644 index 0000000..3cd8e22 --- /dev/null +++ b/tests/__snapshots__/max.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_max(number) 1`] = `"(b: number) => number"`; + +exports[`R_max(number, number) 1`] = `"number"`; + +exports[`R_max(string) 1`] = `"(b: string) => string"`; diff --git a/tests/__snapshots__/maxBy.ts.snap b/tests/__snapshots__/maxBy.ts.snap new file mode 100644 index 0000000..46ac9b3 --- /dev/null +++ b/tests/__snapshots__/maxBy.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_maxBy(object_to_number)(object)(object) 1`] = `"object"`; + +exports[`R_maxBy(object_to_number, object) 1`] = `"(b: object) => object"`; + +exports[`R_maxBy(object_to_number, object, object) 1`] = `"object"`; diff --git a/tests/__snapshots__/mean.ts.snap b/tests/__snapshots__/mean.ts.snap new file mode 100644 index 0000000..b793876 --- /dev/null +++ b/tests/__snapshots__/mean.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_mean(number_array) 1`] = `"number"`; diff --git a/tests/__snapshots__/median.ts.snap b/tests/__snapshots__/median.ts.snap new file mode 100644 index 0000000..eda5626 --- /dev/null +++ b/tests/__snapshots__/median.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_median(number_array) 1`] = `"number"`; diff --git a/tests/__snapshots__/memoize.ts.snap b/tests/__snapshots__/memoize.ts.snap new file mode 100644 index 0000000..e75c348 --- /dev/null +++ b/tests/__snapshots__/memoize.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_memoize(T_to_T) 1`] = `"(value: T) => T"`; diff --git a/tests/__snapshots__/memoizeWith.ts.snap b/tests/__snapshots__/memoizeWith.ts.snap new file mode 100644 index 0000000..2167130 --- /dev/null +++ b/tests/__snapshots__/memoizeWith.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_memoizeWith(any_to_string) 1`] = `"(fn: T) => T"`; + +exports[`R_memoizeWith(any_to_string)(T_to_T) 1`] = `"(value: T) => T"`; + +exports[`R_memoizeWith(any_to_string, T_to_T) 1`] = `"(value: T) => T"`; diff --git a/tests/__snapshots__/merge.ts.snap b/tests/__snapshots__/merge.ts.snap new file mode 100644 index 0000000..f65397c --- /dev/null +++ b/tests/__snapshots__/merge.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_merge(a_1)(b_2) 1`] = `"Pick<{ a: 1; }, \\"a\\"> & { b: 2; }"`; + +exports[`R_merge(a_1, b_2) 1`] = `"Pick<{ a: 1; }, \\"a\\"> & { b: 2; }"`; + +exports[`R_merge(a_1_c_1)(b_2_c_2) 1`] = `"Pick<{ a: 1; c: 1; }, \\"a\\"> & { b: 2; c: 2; }"`; + +exports[`R_merge(a_1_c_1, b_2_c_2) 1`] = `"Pick<{ a: 1; c: 1; }, \\"a\\"> & { b: 2; c: 2; }"`; diff --git a/tests/__snapshots__/mergeAll.ts.snap b/tests/__snapshots__/mergeAll.ts.snap new file mode 100644 index 0000000..c2dbaf4 --- /dev/null +++ b/tests/__snapshots__/mergeAll.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_mergeAll([a_1, b_2]) 1`] = `"object"`; diff --git a/tests/__snapshots__/mergeDeepLeft.ts.snap b/tests/__snapshots__/mergeDeepLeft.ts.snap new file mode 100644 index 0000000..ab76c55 --- /dev/null +++ b/tests/__snapshots__/mergeDeepLeft.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_mergeDeepLeft(a_1) 1`] = `"(right: object) => object"`; + +exports[`R_mergeDeepLeft(a_1)(b_2) 1`] = `"object"`; + +exports[`R_mergeDeepLeft(a_1, b_2) 1`] = `"object"`; diff --git a/tests/__snapshots__/mergeDeepRight.ts.snap b/tests/__snapshots__/mergeDeepRight.ts.snap new file mode 100644 index 0000000..b7d01a5 --- /dev/null +++ b/tests/__snapshots__/mergeDeepRight.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_mergeDeepRight(a_1) 1`] = `"(right: object) => object"`; + +exports[`R_mergeDeepRight(a_1)(b_2) 1`] = `"object"`; + +exports[`R_mergeDeepRight(a_1, b_2) 1`] = `"object"`; diff --git a/tests/__snapshots__/mergeDeepWith.ts.snap b/tests/__snapshots__/mergeDeepWith.ts.snap new file mode 100644 index 0000000..6f82dac --- /dev/null +++ b/tests/__snapshots__/mergeDeepWith.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_mergeDeepWith(string_string_to_number, a_1) 1`] = `"(right: object) => object"`; + +exports[`R_mergeDeepWith(string_string_to_number, a_1)(b_2) 1`] = `"object"`; + +exports[`R_mergeDeepWith(string_string_to_number, a_1, b_2) 1`] = `"object"`; diff --git a/tests/__snapshots__/mergeDeepWithKey.ts.snap b/tests/__snapshots__/mergeDeepWithKey.ts.snap new file mode 100644 index 0000000..fc827ca --- /dev/null +++ b/tests/__snapshots__/mergeDeepWithKey.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_mergeDeepWithKey(string_string_string_to_number, a_1) 1`] = `"(right: object) => object"`; + +exports[`R_mergeDeepWithKey(string_string_string_to_number, a_1)(b_2) 1`] = `"object"`; + +exports[`R_mergeDeepWithKey(string_string_string_to_number, a_1, b_2) 1`] = `"object"`; diff --git a/tests/__snapshots__/mergeWith.ts.snap b/tests/__snapshots__/mergeWith.ts.snap new file mode 100644 index 0000000..4f78e95 --- /dev/null +++ b/tests/__snapshots__/mergeWith.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_mergeWith(number_number_to_string)(a_1_c_1)(b_2_c_2) 1`] = `"Pick<{ a: 1; c: 1; }, \\"a\\"> & Pick<{ b: 2; c: 2; }, \\"b\\"> & Record<\\"c\\", string>"`; + +exports[`R_mergeWith(number_number_to_string, a_1_c_1, b_2_c_2) 1`] = `"Pick<{ a: 1; c: 1; }, \\"a\\"> & Pick<{ b: 2; c: 2; }, \\"b\\"> & Record<\\"c\\", string>"`; diff --git a/tests/__snapshots__/mergeWithKey.ts.snap b/tests/__snapshots__/mergeWithKey.ts.snap new file mode 100644 index 0000000..afc8e2d --- /dev/null +++ b/tests/__snapshots__/mergeWithKey.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_mergeWithKey(string_number_number_to_string)(a_1_c_1)(b_2_c_2) 1`] = `"Pick<{ a: 1; c: 1; }, \\"a\\"> & Pick<{ b: 2; c: 2; }, \\"b\\"> & Record<\\"c\\", string>"`; + +exports[`R_mergeWithKey(string_number_number_to_string, a_1_c_1, b_2_c_2) 1`] = `"Pick<{ a: 1; c: 1; }, \\"a\\"> & Pick<{ b: 2; c: 2; }, \\"b\\"> & Record<\\"c\\", string>"`; diff --git a/tests/__snapshots__/min.ts.snap b/tests/__snapshots__/min.ts.snap new file mode 100644 index 0000000..ee9a545 --- /dev/null +++ b/tests/__snapshots__/min.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_min(number) 1`] = `"(b: number) => number"`; + +exports[`R_min(number, number) 1`] = `"number"`; + +exports[`R_min(string) 1`] = `"(b: string) => string"`; diff --git a/tests/__snapshots__/minBy.ts.snap b/tests/__snapshots__/minBy.ts.snap new file mode 100644 index 0000000..825905a --- /dev/null +++ b/tests/__snapshots__/minBy.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_minBy(object_to_number)(object)(object) 1`] = `"object"`; + +exports[`R_minBy(object_to_number, object) 1`] = `"(b: object) => object"`; + +exports[`R_minBy(object_to_number, object, object) 1`] = `"object"`; diff --git a/tests/__snapshots__/modulo.ts.snap b/tests/__snapshots__/modulo.ts.snap new file mode 100644 index 0000000..70d8e6c --- /dev/null +++ b/tests/__snapshots__/modulo.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_modulo(number)(number) 1`] = `"number"`; + +exports[`R_modulo(number, number) 1`] = `"number"`; diff --git a/tests/__snapshots__/multiply.ts.snap b/tests/__snapshots__/multiply.ts.snap new file mode 100644 index 0000000..0a747bd --- /dev/null +++ b/tests/__snapshots__/multiply.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_multiply(number)(number) 1`] = `"number"`; + +exports[`R_multiply(number, number) 1`] = `"number"`; diff --git a/tests/__snapshots__/nAry.ts.snap b/tests/__snapshots__/nAry.ts.snap new file mode 100644 index 0000000..f6d913b --- /dev/null +++ b/tests/__snapshots__/nAry.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_nAry(1, object_variadic) 1`] = `"(v1: any) => object"`; + +exports[`R_nAry(1, string_number_symbol_to_boolean) 1`] = `"(v1: string) => boolean"`; + +exports[`R_nAry(number, object_variadic) 1`] = `"Variadic"`; + +exports[`R_nAry(number, string_number_symbol_to_boolean) 1`] = `"Variadic"`; diff --git a/tests/__snapshots__/negate.ts.snap b/tests/__snapshots__/negate.ts.snap new file mode 100644 index 0000000..d978f0b --- /dev/null +++ b/tests/__snapshots__/negate.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_negate(number) 1`] = `"number"`; diff --git a/tests/__snapshots__/none.ts.snap b/tests/__snapshots__/none.ts.snap new file mode 100644 index 0000000..29f679b --- /dev/null +++ b/tests/__snapshots__/none.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_none(string_predicate)(string_array) 1`] = `"boolean"`; + +exports[`R_none(string_predicate, string_array) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/not.ts.snap b/tests/__snapshots__/not.ts.snap new file mode 100644 index 0000000..820e580 --- /dev/null +++ b/tests/__snapshots__/not.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_not(string) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/nth.ts.snap b/tests/__snapshots__/nth.ts.snap new file mode 100644 index 0000000..d2bcf2a --- /dev/null +++ b/tests/__snapshots__/nth.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_nth(number)(object_array) 1`] = `"object | undefined"`; + +exports[`R_nth(number)(string) 1`] = `"string"`; + +exports[`R_nth(number, object_array) 1`] = `"object | undefined"`; + +exports[`R_nth(number, string) 1`] = `"string"`; diff --git a/tests/__snapshots__/nthArg.ts.snap b/tests/__snapshots__/nthArg.ts.snap new file mode 100644 index 0000000..34127a5 --- /dev/null +++ b/tests/__snapshots__/nthArg.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_nthArg(number)(...object_array) 1`] = `"object"`; diff --git a/tests/__snapshots__/o.ts.snap b/tests/__snapshots__/o.ts.snap new file mode 100644 index 0000000..b1d658a --- /dev/null +++ b/tests/__snapshots__/o.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_o(number_to_string)(boolean_to_number)(boolean) 1`] = `"string"`; + +exports[`R_o(number_to_string, boolean_to_number) 1`] = `"(value: boolean) => string"`; + +exports[`R_o(number_to_string, boolean_to_number, boolean) 1`] = `"string"`; diff --git a/tests/__snapshots__/objOf.ts.snap b/tests/__snapshots__/objOf.ts.snap new file mode 100644 index 0000000..36ca105 --- /dev/null +++ b/tests/__snapshots__/objOf.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_objOf('key') 1`] = `"(value: V) => Record<\\"key\\", V>"`; + +exports[`R_objOf('key', object) 1`] = `"Record<\\"key\\", object>"`; + +exports[`R_objOf(string) 1`] = `"(value: V) => Record"`; + +exports[`R_objOf(string, object) 1`] = `"Record"`; diff --git a/tests/__snapshots__/of.ts.snap b/tests/__snapshots__/of.ts.snap new file mode 100644 index 0000000..e228ea0 --- /dev/null +++ b/tests/__snapshots__/of.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_of(object) 1`] = `"object[]"`; diff --git a/tests/__snapshots__/omit.ts.snap b/tests/__snapshots__/omit.ts.snap new file mode 100644 index 0000000..8935548 --- /dev/null +++ b/tests/__snapshots__/omit.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_omit([string])(object) 1`] = `"object"`; + +exports[`R_omit([string])(object) 2`] = `"object"`; + +exports[`R_omit([string], object) 1`] = `"object"`; + +exports[`R_omit([string], object) 2`] = `"object"`; diff --git a/tests/__snapshots__/once.ts.snap b/tests/__snapshots__/once.ts.snap new file mode 100644 index 0000000..f043057 --- /dev/null +++ b/tests/__snapshots__/once.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_once(T_to_T) 1`] = `"(value: T) => T"`; diff --git a/tests/__snapshots__/or.ts.snap b/tests/__snapshots__/or.ts.snap new file mode 100644 index 0000000..91b90d5 --- /dev/null +++ b/tests/__snapshots__/or.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_or(string)(number) 1`] = `"string | number"`; + +exports[`R_or(string, number) 1`] = `"string | number"`; diff --git a/tests/__snapshots__/over.ts.snap b/tests/__snapshots__/over.ts.snap new file mode 100644 index 0000000..c068ce9 --- /dev/null +++ b/tests/__snapshots__/over.ts.snap @@ -0,0 +1,23 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_over(menual_lens_number_object)(number_to_number)(object) 1`] = `"object"`; + +exports[`R_over(menual_lens_number_object, number_to_number) 1`] = `"(target: object) => object"`; + +exports[`R_over(menual_lens_number_object, number_to_number, object) 1`] = `"object"`; + +exports[`R_over(pseudo_lens_1)(number_to_number)(number_array) 1`] = `"{}"`; + +exports[`R_over(pseudo_lens_1)(number_to_number)(string_number_tuple) 1`] = `"{}"`; + +exports[`R_over(pseudo_lens_1, number_to_number) 1`] = `"(target: {}) => {}"`; + +exports[`R_over(pseudo_lens_1, number_to_number, number_array) 1`] = `"number[]"`; + +exports[`R_over(pseudo_lens_1, number_to_number, string_number_tuple) 1`] = `"[string, number]"`; + +exports[`R_over(pseudo_lens_a)(number_to_number)(a_1_b_2_c_3) 1`] = `"Record<\\"a\\", any>"`; + +exports[`R_over(pseudo_lens_a, number_to_number) 1`] = `"(target: Record<\\"a\\", any>) => Record<\\"a\\", any>"`; + +exports[`R_over(pseudo_lens_a, number_to_number, a_1_b_2_c_3) 1`] = `"{ a: 1; b: 2; c: 3; }"`; diff --git a/tests/__snapshots__/pair.ts.snap b/tests/__snapshots__/pair.ts.snap new file mode 100644 index 0000000..ec6374c --- /dev/null +++ b/tests/__snapshots__/pair.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_pair(number) 1`] = `"(value: V) => KeyValuePair"`; + +exports[`R_pair(number)(object) 1`] = `"KeyValuePair"`; + +exports[`R_pair(number, object) 1`] = `"KeyValuePair"`; diff --git a/tests/__snapshots__/partial.ts.snap b/tests/__snapshots__/partial.ts.snap new file mode 100644 index 0000000..506111e --- /dev/null +++ b/tests/__snapshots__/partial.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_partial(number_string_to_object) 1`] = `"(args: any[]) => (...args: any[]) => object"`; + +exports[`R_partial(number_string_to_object, [number]) 1`] = `"(...args: any[]) => object"`; + +exports[`R_partial(number_string_to_object, [number])(string) 1`] = `"object"`; diff --git a/tests/__snapshots__/partialRight.ts.snap b/tests/__snapshots__/partialRight.ts.snap new file mode 100644 index 0000000..f4f367b --- /dev/null +++ b/tests/__snapshots__/partialRight.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_partialRight(number_string_to_object) 1`] = `"(args: any[]) => (...args: any[]) => object"`; + +exports[`R_partialRight(number_string_to_object, [string]) 1`] = `"(...args: any[]) => object"`; + +exports[`R_partialRight(number_string_to_object, [string])(number) 1`] = `"object"`; diff --git a/tests/__snapshots__/partition.ts.snap b/tests/__snapshots__/partition.ts.snap new file mode 100644 index 0000000..0b534f9 --- /dev/null +++ b/tests/__snapshots__/partition.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_partition(number_to_boolean)(a_1_b_2_c_3) 1`] = `"[Partial<{ a: 1; b: 2; c: 3; }>, Partial<{ a: 1; b: 2; c: 3; }>]"`; + +exports[`R_partition(number_to_boolean)(number_array) 1`] = `"[number[], number[]]"`; + +exports[`R_partition(number_to_boolean, a_1_b_2_c_3) 1`] = `"[Partial<{ a: 1; b: 2; c: 3; }>, Partial<{ a: 1; b: 2; c: 3; }>]"`; + +exports[`R_partition(number_to_boolean, number_array) 1`] = `"[number[], number[]]"`; diff --git a/tests/__snapshots__/path.ts.snap b/tests/__snapshots__/path.ts.snap new file mode 100644 index 0000000..848c7cf --- /dev/null +++ b/tests/__snapshots__/path.ts.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_path(['a', 'b', 'c'])(a_1_b_2_c_3) 1`] = `"{} | undefined"`; + +exports[`R_path(['a', 'b', 'c'], a_1_b_2_c_3) 1`] = `"{} | undefined"`; + +exports[`R_path(path) 1`] = `"(object: {}) => T | undefined"`; + +exports[`R_path(path)(object) 1`] = `"{} | undefined"`; + +exports[`R_path(path, object) 1`] = `"{} | undefined"`; diff --git a/tests/__snapshots__/pathEq.ts.snap b/tests/__snapshots__/pathEq.ts.snap new file mode 100644 index 0000000..0bd8919 --- /dev/null +++ b/tests/__snapshots__/pathEq.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_pathEq(path)(number)(object) 1`] = `"boolean"`; + +exports[`R_pathEq(path, number) 1`] = `"(object: {}) => boolean"`; + +exports[`R_pathEq(path, number, object) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/pathOr.ts.snap b/tests/__snapshots__/pathOr.ts.snap new file mode 100644 index 0000000..c771fdf --- /dev/null +++ b/tests/__snapshots__/pathOr.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_pathOr(number)(path)(object) 1`] = `"number | {}"`; + +exports[`R_pathOr(number, path) 1`] = `"(object: {}) => number | U"`; + +exports[`R_pathOr(number, path, object) 1`] = `"number | {}"`; diff --git a/tests/__snapshots__/pathSatisfies.ts.snap b/tests/__snapshots__/pathSatisfies.ts.snap new file mode 100644 index 0000000..8e3a1ea --- /dev/null +++ b/tests/__snapshots__/pathSatisfies.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_pathSatisfies(string_to_boolean)(path)(object) 1`] = `"boolean"`; + +exports[`R_pathSatisfies(string_to_boolean, path) 1`] = `"(object: {}) => boolean"`; + +exports[`R_pathSatisfies(string_to_boolean, path, object) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/pick.ts.snap b/tests/__snapshots__/pick.ts.snap new file mode 100644 index 0000000..ebe28a1 --- /dev/null +++ b/tests/__snapshots__/pick.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_pick(['a', 'c'])(a_1_b_2_c_3) 1`] = `"Pick<{ a: 1; b: 2; c: 3; }, \\"a\\" | \\"c\\">"`; + +exports[`R_pick(['a', 'c'], a_1_b_2_c_3) 1`] = `"Pick<{ a: 1; b: 2; c: 3; }, \\"a\\" | \\"c\\">"`; + +exports[`R_pick([string])(object) 1`] = `"Pick"`; + +exports[`R_pick([string], object) 1`] = `"Pick"`; diff --git a/tests/__snapshots__/pickAll.ts.snap b/tests/__snapshots__/pickAll.ts.snap new file mode 100644 index 0000000..b088a1e --- /dev/null +++ b/tests/__snapshots__/pickAll.ts.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_pickAll(['a', 'c', 'f'])(a_1_b_2_c_3) 1`] = `"Partial<{ a: 1; b: 2; c: 3; }>"`; + +exports[`R_pickAll(['a', 'c', 'f'], a_1_b_2_c_3) 1`] = `"Partial<{ a: 1; b: 2; c: 3; }>"`; + +exports[`R_pickAll(['a', 'c'])(a_1_b_2_c_3) 1`] = `"Partial<{ a: 1; b: 2; c: 3; }>"`; + +exports[`R_pickAll(['a', 'c'], a_1_b_2_c_3) 1`] = `"Pick<{ a: 1; b: 2; c: 3; }, \\"a\\" | \\"c\\">"`; + +exports[`R_pickAll([string])(object) 1`] = `"object"`; + +exports[`R_pickAll([string], object) 1`] = `"object"`; diff --git a/tests/__snapshots__/pickBy.ts.snap b/tests/__snapshots__/pickBy.ts.snap new file mode 100644 index 0000000..23d1551 --- /dev/null +++ b/tests/__snapshots__/pickBy.ts.snap @@ -0,0 +1,25 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_pickBy(number_string_object_to_boolean)(a_1_b_2_c_3) 1`] = `"Partial>"`; + +exports[`R_pickBy(number_string_object_to_boolean)(string_number_record) 1`] = `"Partial>"`; + +exports[`R_pickBy(number_string_object_to_boolean, a_1_b_2_c_3) 1`] = `"Partial<{ a: 1; b: 2; c: 3; }>"`; + +exports[`R_pickBy(number_string_object_to_boolean, string_number_record) 1`] = `"Partial>"`; + +exports[`R_pickBy(string_string_object_to_boolean)(a_1_b_2_c_3) 1`] = ` +"Argument of type '{ a: 1; b: 2; c: 3; }' is not assignable to parameter of type 'Dictionary'. + Property 'a' is incompatible with index signature. + Type '1' is not assignable to type 'string'." +`; + +exports[`R_pickBy(string_string_object_to_boolean)(string_number_record) 1`] = ` +"Argument of type 'Record' is not assignable to parameter of type 'Dictionary'. + Index signatures are incompatible. + Type 'number' is not assignable to type 'string'." +`; + +exports[`R_pickBy(string_string_object_to_boolean, a_1_b_2_c_3) 1`] = `"Argument of type '{ a: 1; b: 2; c: 3; }' is not assignable to parameter of type 'Dictionary'."`; + +exports[`R_pickBy(string_string_object_to_boolean, string_number_record) 1`] = `"Argument of type 'Record' is not assignable to parameter of type 'Dictionary'."`; diff --git a/tests/__snapshots__/pipe.ts.snap b/tests/__snapshots__/pipe.ts.snap new file mode 100644 index 0000000..480b419 --- /dev/null +++ b/tests/__snapshots__/pipe.ts.snap @@ -0,0 +1,61 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_pipe( + a_b_c_d_e_f_to_any, + boolean_to_string, + string_to_number, + number_to_string, + string_to_boolean, + boolean_to_number, + ) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => number"`; + +exports[`R_pipe( + a_b_c_d_e_f_to_any, + number_to_string, + string_to_boolean, + boolean_to_number, + ) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => number"`; + +exports[`R_pipe( + a_b_c_d_e_f_to_any, + string_to_number, + number_to_string, + string_to_boolean, + boolean_to_number, + ) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => number"`; + +exports[`R_pipe( + boolean_to_string, + string_to_number, + number_to_string, + string_to_boolean, + boolean_to_number, + ) 1`] = `"(v1: boolean) => number"`; + +exports[`R_pipe( + number_to_boolean, + boolean_to_string, + string_to_number, + number_to_string, + string_to_boolean, + boolean_to_number, + ) 1`] = `"(v1: number) => number"`; + +exports[`R_pipe( + string_to_number, + number_to_string, + string_to_boolean, + boolean_to_number, + ) 1`] = `"(v1: string) => number"`; + +exports[`R_pipe(a_b_c_d_e_f_to_any) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => any"`; + +exports[`R_pipe(a_b_c_d_e_f_to_any, boolean_to_number) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => number"`; + +exports[`R_pipe(a_b_c_d_e_f_to_any, string_to_boolean, boolean_to_number) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => number"`; + +exports[`R_pipe(boolean_to_number) 1`] = `"(v1: boolean) => number"`; + +exports[`R_pipe(number_to_string, string_to_boolean, boolean_to_number) 1`] = `"(v1: number) => number"`; + +exports[`R_pipe(string_to_boolean, boolean_to_number) 1`] = `"(v1: string) => number"`; diff --git a/tests/__snapshots__/pipeK.ts.snap b/tests/__snapshots__/pipeK.ts.snap new file mode 100644 index 0000000..77a555c --- /dev/null +++ b/tests/__snapshots__/pipeK.ts.snap @@ -0,0 +1,35 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_pipeK( + chain_boolean_to_chain_string, + chain_string_to_chain_number, + chain_number_to_chain_string, + chain_string_to_chain_boolean, + chain_boolean_to_chain_number, + ) 1`] = `"(v1: Chain) => Chain"`; + +exports[`R_pipeK( + chain_number_to_chain_boolean, + chain_boolean_to_chain_string, + chain_string_to_chain_number, + chain_number_to_chain_string, + chain_string_to_chain_boolean, + chain_boolean_to_chain_number, + ) 1`] = `"(v1: Chain) => Chain"`; + +exports[`R_pipeK( + chain_number_to_chain_string, + chain_string_to_chain_boolean, + chain_boolean_to_chain_number, + ) 1`] = `"(v1: Chain) => Chain"`; + +exports[`R_pipeK( + chain_string_to_chain_number, + chain_number_to_chain_string, + chain_string_to_chain_boolean, + chain_boolean_to_chain_number, + ) 1`] = `"(v1: Chain) => Chain"`; + +exports[`R_pipeK(chain_boolean_to_chain_number) 1`] = `"(v1: Chain) => Chain"`; + +exports[`R_pipeK(chain_string_to_chain_boolean, chain_boolean_to_chain_number) 1`] = `"(v1: Chain) => Chain"`; diff --git a/tests/__snapshots__/pipeP.ts.snap b/tests/__snapshots__/pipeP.ts.snap new file mode 100644 index 0000000..97ab267 --- /dev/null +++ b/tests/__snapshots__/pipeP.ts.snap @@ -0,0 +1,69 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_pipeP( + a_b_c_d_e_f_to_any_promise, + boolean_to_string_promise, + string_to_number_promise, + number_to_string_promise, + string_to_boolean_promise, + boolean_to_number_promise, + ) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike"`; + +exports[`R_pipeP( + a_b_c_d_e_f_to_any_promise, + number_to_string_promise, + string_to_boolean_promise, + boolean_to_number_promise, + ) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike"`; + +exports[`R_pipeP( + a_b_c_d_e_f_to_any_promise, + string_to_boolean_promise, + boolean_to_number_promise, + ) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike"`; + +exports[`R_pipeP( + a_b_c_d_e_f_to_any_promise, + string_to_number_promise, + number_to_string_promise, + string_to_boolean_promise, + boolean_to_number_promise, + ) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike"`; + +exports[`R_pipeP( + boolean_to_string_promise, + string_to_number_promise, + number_to_string_promise, + string_to_boolean_promise, + boolean_to_number_promise, + ) 1`] = `"(v1: boolean) => PromiseLike"`; + +exports[`R_pipeP( + number_to_boolean_promise, + boolean_to_string_promise, + string_to_number_promise, + number_to_string_promise, + string_to_boolean_promise, + boolean_to_number_promise, + ) 1`] = `"(v1: number) => PromiseLike"`; + +exports[`R_pipeP( + number_to_string_promise, + string_to_boolean_promise, + boolean_to_number_promise, + ) 1`] = `"(v1: number) => PromiseLike"`; + +exports[`R_pipeP( + string_to_number_promise, + number_to_string_promise, + string_to_boolean_promise, + boolean_to_number_promise, + ) 1`] = `"(v1: string) => PromiseLike"`; + +exports[`R_pipeP(a_b_c_d_e_f_to_any_promise) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike"`; + +exports[`R_pipeP(a_b_c_d_e_f_to_any_promise, boolean_to_number_promise) 1`] = `"(v1: null, v2: undefined, v3: boolean, v4: number, v5: string, v6: object) => PromiseLike"`; + +exports[`R_pipeP(boolean_to_number_promise) 1`] = `"(v1: boolean) => PromiseLike"`; + +exports[`R_pipeP(string_to_boolean_promise, boolean_to_number_promise) 1`] = `"(v1: string) => PromiseLike"`; diff --git a/tests/__snapshots__/pluck.ts.snap b/tests/__snapshots__/pluck.ts.snap new file mode 100644 index 0000000..9951653 --- /dev/null +++ b/tests/__snapshots__/pluck.ts.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_pluck('a') 1`] = `">(list: T[] | ArrayLike) => T[\\"a\\"][]"`; + +exports[`R_pluck('a')([a_number_record, a_number_record]) 1`] = `"number[]"`; + +exports[`R_pluck('a', [a_number_record, a_number_record]) 1`] = `"number[]"`; + +exports[`R_pluck(0, [string_array]) 1`] = `"string[]"`; + +exports[`R_pluck(placeholder, [a_number_record, a_number_record]) 1`] = `"(key: K) => Record<\\"a\\", number>[K][]"`; + +exports[`R_pluck(placeholder, [a_number_record, a_number_record])('a') 1`] = `"number[]"`; diff --git a/tests/__snapshots__/prepend.ts.snap b/tests/__snapshots__/prepend.ts.snap new file mode 100644 index 0000000..d0c9bd5 --- /dev/null +++ b/tests/__snapshots__/prepend.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_prepend(number)(number_array) 1`] = `"number[]"`; + +exports[`R_prepend(number, number_array) 1`] = `"number[]"`; + +exports[`R_prepend(string)(number_array) 1`] = `"(string | number)[]"`; + +exports[`R_prepend(string, number_array) 1`] = `"(string | number)[]"`; diff --git a/tests/__snapshots__/product.ts.snap b/tests/__snapshots__/product.ts.snap new file mode 100644 index 0000000..b980be0 --- /dev/null +++ b/tests/__snapshots__/product.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_product(number_array) 1`] = `"number"`; diff --git a/tests/__snapshots__/project.ts.snap b/tests/__snapshots__/project.ts.snap new file mode 100644 index 0000000..4d4a6ad --- /dev/null +++ b/tests/__snapshots__/project.ts.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_project(['a']) 1`] = `">(list: T[] | ArrayLike) => Pick[]"`; + +exports[`R_project(['a'])([a_b_number_record, a_b_number_record]) 1`] = `"Pick, \\"a\\">[]"`; + +exports[`R_project(['a'], [a_b_number_record, a_b_number_record]) 1`] = `"Pick, \\"a\\">[]"`; + +exports[`R_project(placeholder, [a_b_number_record, a_b_number_record]) 1`] = `"(keys: K[] | ArrayLike) => Pick, K>[]"`; + +exports[`R_project(placeholder, [a_b_number_record, a_b_number_record])(['a']) 1`] = `"Pick, \\"a\\">[]"`; diff --git a/tests/__snapshots__/prop.ts.snap b/tests/__snapshots__/prop.ts.snap new file mode 100644 index 0000000..fe39909 --- /dev/null +++ b/tests/__snapshots__/prop.ts.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_prop('a') 1`] = `">(object: T) => T[\\"a\\"]"`; + +exports[`R_prop('a')(a_b_number_record) 1`] = `"number"`; + +exports[`R_prop('a', a_b_number_record) 1`] = `"number"`; + +exports[`R_prop(placeholder, a_b_number_record) 1`] = `"(key: K) => Record<\\"a\\" | \\"b\\", number>[K]"`; + +exports[`R_prop(placeholder, a_b_number_record)('a') 1`] = `"number"`; diff --git a/tests/__snapshots__/propEq.ts.snap b/tests/__snapshots__/propEq.ts.snap new file mode 100644 index 0000000..2dbad79 --- /dev/null +++ b/tests/__snapshots__/propEq.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_propEq(string)(string)(object) 1`] = `"boolean"`; + +exports[`R_propEq(string, string) 1`] = `"(object: {}) => boolean"`; + +exports[`R_propEq(string, string, object) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/propIs.ts.snap b/tests/__snapshots__/propIs.ts.snap new file mode 100644 index 0000000..048e579 --- /dev/null +++ b/tests/__snapshots__/propIs.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_propIs(Number)('a') 1`] = `"(object: U) => object is U & Record<\\"a\\", Number>"`; + +exports[`R_propIs(Number)('a')(object) 1`] = `"boolean"`; + +exports[`R_propIs(Number, 'a') 1`] = `"(object: U) => object is U & Record<\\"a\\", Number>"`; + +exports[`R_propIs(Number, 'a', object) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/propOr.ts.snap b/tests/__snapshots__/propOr.ts.snap new file mode 100644 index 0000000..f1c885b --- /dev/null +++ b/tests/__snapshots__/propOr.ts.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_propOr(defaults, 'a') 1`] = `">(object: T) => \\"defaults\\" | T[\\"a\\"]"`; + +exports[`R_propOr(defaults, 'a')(a_b_number_record) 1`] = `"number | \\"defaults\\""`; + +exports[`R_propOr(defaults, 'a', a_b_number_record) 1`] = `"number | \\"defaults\\""`; + +exports[`R_propOr(defaults, placeholder, a_b_number_record) 1`] = `"(key: K) => \\"defaults\\" | Record<\\"a\\" | \\"b\\", number>[K]"`; + +exports[`R_propOr(defaults, placeholder, a_b_number_record)('a') 1`] = `"number | \\"defaults\\""`; diff --git a/tests/__snapshots__/propSatisfies.ts.snap b/tests/__snapshots__/propSatisfies.ts.snap new file mode 100644 index 0000000..86aecb2 --- /dev/null +++ b/tests/__snapshots__/propSatisfies.ts.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_propSatisfies(number_to_boolean, 'a') 1`] = `"(object: Record<\\"a\\", any>) => boolean"`; + +exports[`R_propSatisfies(number_to_boolean, 'a')(a_b_number_record) 1`] = `"boolean"`; + +exports[`R_propSatisfies(number_to_boolean, 'a', a_b_number_record) 1`] = `"boolean"`; + +exports[`R_propSatisfies(number_to_boolean, placeholder, a_b_number_record) 1`] = `"(key: \\"a\\" | \\"b\\") => boolean"`; + +exports[`R_propSatisfies(number_to_boolean, placeholder, a_b_number_record)('a') 1`] = `"boolean"`; diff --git a/tests/__snapshots__/props.ts.snap b/tests/__snapshots__/props.ts.snap new file mode 100644 index 0000000..dd81a07 --- /dev/null +++ b/tests/__snapshots__/props.ts.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_props(['a', 'b']) 1`] = `">(object: T) => T[\\"a\\" | \\"b\\"][]"`; + +exports[`R_props(['a', 'b'])(a_b_c_number_record) 1`] = `"number[]"`; + +exports[`R_props(['a', 'b'], a_b_c_number_record) 1`] = `"number[]"`; + +exports[`R_props(placeholder, a_b_c_number_record) 1`] = `"(keys: K[] | ArrayLike) => Record<\\"a\\" | \\"b\\" | \\"c\\", number>[K][]"`; + +exports[`R_props(placeholder, a_b_c_number_record)(['a', 'b']) 1`] = `"number[]"`; diff --git a/tests/__snapshots__/ramda-tests.ts.snap b/tests/__snapshots__/ramda-tests.ts.snap new file mode 100644 index 0000000..d2dd5c3 --- /dev/null +++ b/tests/__snapshots__/ramda-tests.ts.snap @@ -0,0 +1,1509 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`__ greet('Alice') 1`] = `"string"`; + +exports[`F R.F() 1`] = `"false"`; + +exports[`T R.T() 1`] = `"true"`; + +exports[`add R.add(2, 3) 1`] = `"number"`; + +exports[`add R.add(7)(10) 1`] = `"number"`; + +exports[`addIndex R.addIndex(R.map)(squareEnds)([ + 8, + 5, + 3, + 0, + 9, + ]) 1`] = `"number[]"`; + +exports[`addIndex R.addIndex(R.map)(squareEnds, [ + 8, + 5, + 3, + 0, + 9, + ]) 1`] = `"number[]"`; + +exports[`addIndex R.addIndex(R.forEach)(plusFive)([ + 1, + 2, + 3, + ]) 1`] = `"number[]"`; + +exports[`addIndex filterIndexed(lastTwo)([8, 6, 7, 5, 3, 0, 9]) 1`] = `"number[]"`; + +exports[`addIndex filterIndexed(lastTwo, [8, 6, 7, 5, 3, 0, 9]) 1`] = `"number[]"`; + +exports[`addIndex reduceIndexed( + (acc: string, val: string, idx: number) => \`\${acc},\${idx}-\${val}\`, + '', + ['f', 'o', 'o', 'b', 'a', 'r'], + ) 1`] = `"any"`; + +exports[`addIndex reduceIndexed(objectify)({}, ['a', 'b', 'c']) 1`] = `"Record"`; + +exports[`addIndex reduceIndexed(objectify, {})(['a', 'b', 'c']) 1`] = `"Record"`; + +exports[`addIndex reduceIndexed(objectify, {}, ['a', 'b', 'c']) 1`] = `"Record"`; + +exports[`adjust R.adjust(R.add(10))(1)([1, 2, 3]) 1`] = `"number[]"`; + +exports[`adjust R.adjust(R.add(10), 1, [1, 2, 3]) 1`] = `"number[]"`; + +exports[`all R.all(lessThan2)([1, 2]) 1`] = `"boolean"`; + +exports[`all R.all(lessThan3)([1, 2]) 1`] = `"boolean"`; + +exports[`allPass R.allPass([gt10, even])(11) 1`] = `"boolean"`; + +exports[`allPass R.allPass([gt10, even])(12) 1`] = `"boolean"`; + +exports[`always R.always('Tee')() 1`] = `"string"`; + +exports[`and R.and(0)([]) 1`] = `"number | never[]"`; + +exports[`and R.and(0, []) 1`] = `"0 | never[]"`; + +exports[`and R.and(false, true) 1`] = `"boolean"`; + +exports[`and R.and(null, '') 1`] = `"\\"\\" | null"`; + +exports[`any R.any(lessThan0)([1, 2]) 1`] = `"boolean"`; + +exports[`any R.any(lessThan2)([1, 2]) 1`] = `"boolean"`; + +exports[`anyPass R.anyPass([gt10, even])(8) 1`] = `"boolean"`; + +exports[`anyPass R.anyPass([gt10, even])(9) 1`] = `"boolean"`; + +exports[`anyPass R.anyPass([gt10, even])(11) 1`] = `"boolean"`; + +exports[`ap R.ap([R.multiply(2), R.add(3)])([1, 2, 3]) 1`] = `"number[]"`; + +exports[`ap R.ap([R.multiply(2), R.add(3)], [1, 2, 3]) 1`] = `"number[]"`; + +exports[`aperture R.aperture(2, [1, 2, 3, 4, 5]) 1`] = `"number[][]"`; + +exports[`aperture R.aperture(3, [1, 2, 3, 4, 5]) 1`] = `"number[][]"`; + +exports[`aperture R.aperture(7)([1, 2, 3, 4, 5]) 1`] = `"number[][]"`; + +exports[`aperture R.aperture(7, [1, 2, 3, 4, 5]) 1`] = `"number[][]"`; + +exports[`append R.append('tests')(['write', 'more']) 1`] = `"string[]"`; + +exports[`append R.append('tests', ['write', 'more']) 1`] = `"string[]"`; + +exports[`append R.append('tests', []) 1`] = `"string[]"`; + +exports[`append R.append(['tests'])(['write', 'more']) 1`] = `"(string | string[])[]"`; + +exports[`append R.append(['tests'], ['write', 'more']) 1`] = `"(string | string[])[]"`; + +exports[`apply R.apply(Math.max)(nums) 1`] = `"number"`; + +exports[`apply R.apply(Math.max, nums) 1`] = `"number"`; + +exports[`applySpec getMetrics(2, 4) 1`] = `"T"`; + +exports[`ascend R.sort(R.__, people)(byAge) 1`] = `"{ name: string; age: number; }[]"`; + +exports[`ascend R.sort(byAge, people) 1`] = `"{}[]"`; + +exports[`assoc R.assoc('c')(3, { a: 1, b: 2 }) 1`] = `"{ a: number; b: number; } & Record<\\"c\\", number>"`; + +exports[`assoc R.assoc('c', 3)({ a: 1, b: 2 }) 1`] = `"{ a: number; b: number; } & Record<\\"c\\", number>"`; + +exports[`assoc R.assoc('c', 3, { a: 1, b: 2 }) 1`] = `"{ a: number; b: number; } & Record<\\"c\\", number>"`; + +exports[`assocPath R.assocPath(['a', 'b', 'c'])(42, { a: { b: { c: 0 } } }) 1`] = `"{ a: { b: { c: number; }; }; }"`; + +exports[`assocPath R.assocPath(['a', 'b', 'c'], 42)({ a: { b: { c: 0 } } }) 1`] = `"{ a: { b: { c: number; }; }; }"`; + +exports[`assocPath R.assocPath(['a', 'b', 'c'], 42, { a: { b: { c: 0 } } }) 1`] = `"{ a: { b: { c: number; }; }; }"`; + +exports[`binary takesThreeArgs(1, 2, 3) 1`] = `"number[]"`; + +exports[`binary takesThreeArgs.length 1`] = `"number"`; + +exports[`binary takesTwoArgs(1, 2, 3) 1`] = `"Expected 2 arguments, but got 3."`; + +exports[`binary takesTwoArgs.length 1`] = `"number"`; + +exports[`bind R.bind(console.log, console) 1`] = `"(message?: any, ...optionalParams: any[]) => void"`; + +exports[`both R.both(gt10)(even)(101) 1`] = `"boolean"`; + +exports[`both R.both(gt10, even)(100) 1`] = `"boolean"`; + +exports[`call R.call(R.add<'11'>(), 1, 2) 1`] = `"number"`; + +exports[`chain R.chain(duplicate)([1, 2, 3]) 1`] = `"number[]"`; + +exports[`chain R.chain(duplicate, [1, 2, 3]) 1`] = `"number[]"`; + +exports[`chain R.chain(R.append)(R.head)([1, 2, 3]) 1`] = `"number[]"`; + +exports[`chain R.chain(R.append, R.head)([1, 2, 3]) 1`] = `"number[]"`; + +exports[`clamp R.clamp('a')('d')('e') 1`] = `"string"`; + +exports[`clamp R.clamp('a', 'd', 'e') 1`] = `"\\"a\\" | \\"d\\" | \\"e\\""`; + +exports[`clamp R.clamp(1)('str')(true) 1`] = `"Argument of type '\\"str\\"' is not assignable to parameter of type 'number'."`; + +exports[`clamp R.clamp(1)(10)(-1) 1`] = `"number"`; + +exports[`clamp R.clamp(1)(10, 4) 1`] = `"number"`; + +exports[`clamp R.clamp(1, 'str', true) 1`] = `"Argument of type '\\"str\\"' is not assignable to parameter of type '1'."`; + +exports[`clamp R.clamp(1, 10)(11) 1`] = `"number"`; + +exports[`clamp R.clamp(1, 10, -1) 1`] = `"1 | 10 | -1"`; + +exports[`clamp R.clamp(new Date(0))(new Date(1))(new Date(2)) 1`] = `"Date"`; + +exports[`clamp R.clamp(new Date(0), new Date(1), new Date(2)) 1`] = `"Date"`; + +exports[`clone R.clone('foo') 1`] = `"\\"foo\\""`; + +exports[`clone R.clone([{}, {}, {}]) 1`] = `"{}[]"`; + +exports[`clone R.clone([1, 2, 3]) 1`] = `"number[]"`; + +exports[`clone R.clone({}) 1`] = `"{}"`; + +exports[`clone R.clone(10) 1`] = `"10"`; + +exports[`clone R.clone(Date.now()) 1`] = `"number"`; + +exports[`clone R.clone(obj1) 1`] = `"{}[]"`; + +exports[`clone R.clone(obj2) 1`] = `"{ a: number; }[]"`; + +exports[`comparator R.sort(R.comparator((a: Person, b: Person) => a.age < b.age), people) 1`] = `"{ name: string; age: number; }[]"`; + +exports[`complement R.complement(isEven)(21) 1`] = `"boolean"`; + +exports[`complement R.complement(isEven)(42) 1`] = `"boolean"`; + +exports[`compose R.compose(limit10, double) 1`] = `"(v1: number) => boolean"`; + +exports[`compose R.compose(limit10, double)(10) 1`] = `"boolean"`; + +exports[`compose R.compose(double, R.identity) 1`] = `"(v1: number) => number"`; + +exports[`compose f0(3, 4) 1`] = `"number"`; + +exports[`compose f1(3, 4) 1`] = `"number"`; + +exports[`compose f2(3, 4) 1`] = `"number"`; + +exports[`compose f3(3, 4) 1`] = `"number"`; + +exports[`compose f4(3, 4) 1`] = `"number"`; + +exports[`compose f5(3, 4) 1`] = `"number"`; + +exports[`compose g 1`] = `"(v1: number[]) => boolean"`; + +exports[`compose g([1, 2, 10, 13]) 1`] = `"boolean"`; + +exports[`compose gn('Hello', 4, 'world') 1`] = `"number"`; + +exports[`composeP R.composeP(lookupFollowers, lookupUser) 1`] = `"(v1: string) => PromiseLike"`; + +exports[`composeP R.composeP(lookupFollowers, lookupUser)('JOE') 1`] = `"PromiseLike"`; + +exports[`concat R.concat('ABC')('DEF') 1`] = `"string"`; + +exports[`concat R.concat([], []) 1`] = `"never[]"`; + +exports[`concat R.concat([4, 5, 6])([1, 2, 3]) 1`] = `"number[]"`; + +exports[`concat R.concat([4, 5, 6], [1, 2, 3]) 1`] = `"number[]"`; + +exports[`cond fn(0) 1`] = `"string"`; + +exports[`cond fn(50) 1`] = `"string"`; + +exports[`cond fn(100) 1`] = `"string"`; + +exports[`construct R.construct<'1', 'variadic'>()(Circle)(1, 'red') 1`] = `"Circle"`; + +exports[`constructN R.constructN(2, Circle)(1, 'red') 1`] = `"Circle"`; + +exports[`contains R.contains({})([{}, {}]) 1`] = `"boolean"`; + +exports[`contains R.contains(3)([1, 2, 3]) 1`] = `"boolean"`; + +exports[`contains R.contains(3, [1, 2, 3]) 1`] = `"boolean"`; + +exports[`contains R.contains(4)([1, 2, 3]) 1`] = `"boolean"`; + +exports[`contains R.contains(obj)([{}, obj, {}]) 1`] = `"boolean"`; + +exports[`converge R.converge(add3, [multiply, add, subtract])(1, 2) 1`] = `"number"`; + +exports[`converge R.converge(multiply, [add, subtract])(1, 2) 1`] = `"number"`; + +exports[`countBy R.countBy(Math.floor)(numbers) 1`] = `"Dictionary"`; + +exports[`countBy R.countBy(R.toLower)(letters) 1`] = `"Dictionary"`; + +exports[`curry addThree(3) 1`] = `"CurriedFunction2"`; + +exports[`curry addThree(3)(2) 1`] = `"CurriedFunction1"`; + +exports[`curry addThree(3)(2)(1) 1`] = `"number"`; + +exports[`curry addThree(3, 2) 1`] = `"CurriedFunction1"`; + +exports[`curry addThree(3, 2, 1) 1`] = `"number"`; + +exports[`curry addTwo(3) 1`] = `"CurriedFunction1"`; + +exports[`curry addTwo(3)(1) 1`] = `"number"`; + +exports[`curryN curriedAddFourNumbers 1`] = `"CurriedFunction4"`; + +exports[`curryN curriedAddFourNumbers(1, 2)(3)(4) 1`] = `"number"`; + +exports[`dec R.dec(42) 1`] = `"number"`; + +exports[`defaultTo defaultTo42('Ramda') 1`] = `"number | \\"Ramda\\""`; + +exports[`defaultTo defaultTo42(null) 1`] = `"number"`; + +exports[`defaultTo defaultTo42(undefined) 1`] = `"number"`; + +exports[`descend R.sort(R.__, people)(byAge) 1`] = `"{ name: string; age: number; }[]"`; + +exports[`descend R.sort(byAge, people) 1`] = `"{}[]"`; + +exports[`difference R.difference([1, 2, 3, 4], [7, 6, 5, 4, 3]) 1`] = `"number[]"`; + +exports[`difference R.difference([7, 6, 5, 4, 3], [1, 2, 3, 4]) 1`] = `"number[]"`; + +exports[`differenceWith R.differenceWith(cmp)(l1)(l2) 1`] = `"{ a: number; }[]"`; + +exports[`differenceWith R.differenceWith(cmp)(l1, l2) 1`] = `"{ a: number; }[]"`; + +exports[`differenceWith R.differenceWith(cmp, l1, l2) 1`] = `"{ a: number; }[]"`; + +exports[`dissoc R.dissoc('b')({ a: 1, b: 2, c: 3 }) 1`] = `"Pick<{ a: number; b: number; c: number; }, \\"a\\" | \\"c\\">"`; + +exports[`dissoc R.dissoc('b', { a: 1, b: 2, c: 3 }) 1`] = `"Pick<{ a: number; b: number; c: number; }, \\"a\\" | \\"c\\">"`; + +exports[`dissocPath R.dissocPath(['a', 'b', 'c'])({ a: { b: { c: 42 } } }) 1`] = `"{ a?: DeepPartial | undefined; }"`; + +exports[`dissocPath R.dissocPath(['a', 'b', 'c'], { a: { b: { c: 42 } } }) 1`] = `"{ a?: DeepPartial | undefined; }"`; + +exports[`divide R.divide(1)(4) 1`] = `"number"`; + +exports[`divide R.divide(71, 100) 1`] = `"number"`; + +exports[`divide R.flip(R.divide)(2)(42) 1`] = `"number"`; + +exports[`drop R.drop(3)('ramda') 1`] = `"string"`; + +exports[`drop R.drop(3)([1, 2, 3, 4, 5, 6, 7]) 1`] = `"number[]"`; + +exports[`drop R.drop(3, 'ramda') 1`] = `"string"`; + +exports[`drop R.drop(3, [1, 2, 3, 4, 5, 6, 7]) 1`] = `"number[]"`; + +exports[`dropLast R.dropLast(1, ['foo', 'bar', 'baz']) 1`] = `"string[]"`; + +exports[`dropLast R.dropLast(2)(['foo', 'bar', 'baz']) 1`] = `"string[]"`; + +exports[`dropLast R.dropLast(3)('ramda') 1`] = `"string"`; + +exports[`dropLast R.dropLast(3, 'ramda') 1`] = `"string"`; + +exports[`dropLastWhile R.dropLastWhile(lteThree, [1, 2, 3, 4, 3, 2, 1]) 1`] = `"number[]"`; + +exports[`dropRepeats R.dropRepeats([1, 1, 1, 2, 3, 4, 4, 2, 2]) 1`] = `"number[]"`; + +exports[`dropRepeatsWith R.dropRepeatsWith(R.eqBy(Math.abs), l) 1`] = `"number[]"`; + +exports[`dropWhile R.dropWhile(lteTwo)([1, 2, 3, 4]) 1`] = `"number[]"`; + +exports[`dropWhile R.dropWhile(lteTwo, [1, 2, 3, 4]) 1`] = `"number[]"`; + +exports[`either R.either(gt10)(even)(8) 1`] = `"boolean"`; + +exports[`either R.either(gt10, even)(101) 1`] = `"boolean"`; + +exports[`empty R.empty('unicorns') 1`] = `"string"`; + +exports[`empty R.empty([1, 2, 3, 4, 5]) 1`] = `"number[]"`; + +exports[`empty R.empty([1, 2, 3]) 1`] = `"number[]"`; + +exports[`empty R.empty({ x: 1, y: 2 }) 1`] = `"{}"`; + +exports[`endsWith R.endsWith('b', 'abc') 1`] = `"boolean"`; + +exports[`endsWith R.endsWith('c', 'abc') 1`] = `"boolean"`; + +exports[`endsWith R.endsWith(['b'], ['a', 'b', 'c']) 1`] = `"boolean"`; + +exports[`endsWith R.endsWith(['c'], ['a', 'b', 'c']) 1`] = `"boolean"`; + +exports[`eqBy R.eqBy(Math.abs)(5, -5) 1`] = `"boolean"`; + +exports[`eqBy R.eqBy(Math.abs, 5)(-5) 1`] = `"boolean"`; + +exports[`eqBy R.eqBy(Math.abs, 5, -5) 1`] = `"boolean"`; + +exports[`eqProps R.eqProps('a', o1, o2) 1`] = `"boolean"`; + +exports[`eqProps R.eqProps('c')(o1) 1`] = `"(b: { a: number; b: number; c: number; d: number; }) => boolean"`; + +exports[`eqProps R.eqProps('c', o1) 1`] = `"(b: { a: number; b: number; c: number; d: number; }) => boolean"`; + +exports[`eqProps R.eqProps('c', o1, o2) 1`] = `"boolean"`; + +exports[`equals R.equals('2', '1') 1`] = `"boolean"`; + +exports[`equals R.equals([1, 2, 3], [1, 2, 3]) 1`] = `"boolean"`; + +exports[`equals R.equals(1, 1) 1`] = `"boolean"`; + +exports[`equals R.equals(a, b) 1`] = `"boolean"`; + +exports[`evolve R.evolve(transformations)(tomato) 1`] = `"{ firstName: string; data: { elapsed: number; remaining: number; }; id: number; }"`; + +exports[`evolve R.evolve(transformations, tomato) 1`] = `"{ firstName: string; data: { elapsed: number; remaining: number; }; id: number; }"`; + +exports[`filter R.filter(isEven)([1, 2, 3, 4]) 1`] = `"number[]"`; + +exports[`filter R.filter(isEven)({ a: 1, b: 2, c: 3, d: 4 }) 1`] = `"Partial<{ a: number; b: number; c: number; d: number; }>"`; + +exports[`filter R.filter(isEven, [1, 2, 3, 4]) 1`] = `"number[]"`; + +exports[`filter R.filter(isEven, { a: 1, b: 2, c: 3, d: 4 }) 1`] = `"Partial<{ a: number; b: number; c: number; d: number; }>"`; + +exports[`find R.find((task: Task) => task.id === 1)(tasks) 1`] = `"Task | undefined"`; + +exports[`findIndex R.findIndex((x: number) => x === 1, [1, 2, 3]) 1`] = `"number"`; + +exports[`findIndex R.findIndex(R.propEq('a', 4))(xs) 1`] = `"number"`; + +exports[`findIndex a(xs) 1`] = `"number"`; + +exports[`findLast R.findLast(R.__, xs)(R.propEq('a', 4)) 1`] = `"{ a: number; b: number; } | undefined"`; + +exports[`findLast R.findLast(R.propEq('a', 1))(xs) 1`] = `"{ a: number; b: number; } | undefined"`; + +exports[`findLastIndex R.findLastIndex((x: number) => x === 1, [1, 2, 3]) 1`] = `"number"`; + +exports[`findLastIndex R.findLastIndex(R.propEq('a', 1))(xs) 1`] = `"number"`; + +exports[`findLastIndex R.findLastIndex(R.propEq('a', 4))(xs) 1`] = `"number"`; + +exports[`flatten R.flatten([1, 2, [3, 4], 5, [6, [7, 8, [9, [10, 11], 12]]]]) as number[] 1`] = `"number[]"`; + +exports[`flatten R.flatten([1, 2, [3, 4], 5]) 1`] = `"number[]"`; + +exports[`flip R.flip(mergeThree)(1, true, 'str') 1`] = `"[boolean, number, string]"`; + +exports[`flip mergeThree(true, 1, 'str') 1`] = `"[boolean, number, string]"`; + +exports[`forEach R.forEach(printXPlusFive)([1, 2, 3]) 1`] = `"number[]"`; + +exports[`forEach R.forEach(printXPlusFive, [1, 2, 3]) 1`] = `"number[]"`; + +exports[`forEachObjIndexed R.forEachObjIndexed(printKeyConcatValue)({ x: 1, y: 2 }) 1`] = `"Dictionary"`; + +exports[`forEachObjIndexed R.forEachObjIndexed(printKeyConcatValue, { x: 1, y: 2 }) 1`] = `"{ x: number; y: number; }"`; + +exports[`fromPairs R.fromPairs([['a', 1], ['b', 2], ['c', 3]]) 1`] = `"Dictionary"`; + +exports[`groupBy byGrade(students) 1`] = `"Dictionary<{ score: number; name: string; }[]>"`; + +exports[`groupWith R.groupWith((a: number, b: number) => a % 2 === b % 2, [ + 0, + 1, + 1, + 2, + 3, + 5, + 8, + 13, + 21, + ]) 1`] = `"number[][]"`; + +exports[`groupWith R.groupWith(R.eqBy(isVowel), 'aestiou') 1`] = `"string[]"`; + +exports[`groupWith R.groupWith(R.equals, [0, 1, 1, 2, 3, 5, 8, 13, 21]) 1`] = `"number[][]"`; + +exports[`gt R.flip(R.gt)(2)(10) 1`] = `"boolean"`; + +exports[`gt R.gt(2)(10) 1`] = `"boolean"`; + +exports[`gt R.gt(2, 0) 1`] = `"boolean"`; + +exports[`gt R.gt(2, 2) 1`] = `"boolean"`; + +exports[`gt R.gt(2, 6) 1`] = `"boolean"`; + +exports[`gte R.flip(R.gte)(2)(10) 1`] = `"boolean"`; + +exports[`gte R.gte(2)(10) 1`] = `"boolean"`; + +exports[`gte R.gte(2, 0) 1`] = `"boolean"`; + +exports[`gte R.gte(2, 2) 1`] = `"boolean"`; + +exports[`gte R.gte(2, 6) 1`] = `"boolean"`; + +exports[`has hasName({ name: 'alice' }) 1`] = `"boolean"`; + +exports[`has hasName({ name: 'bob' }) 1`] = `"boolean"`; + +exports[`has hasName({}) 1`] = `"boolean"`; + +exports[`has pointHas('x') 1`] = `"boolean"`; + +exports[`has pointHas('y') 1`] = `"boolean"`; + +exports[`has pointHas('z') 1`] = `"boolean"`; + +exports[`hasIn R.flip(R.hasIn)(square)('area') 1`] = `"boolean"`; + +exports[`hasIn R.hasIn('area', square) 1`] = `"boolean"`; + +exports[`hasIn R.hasIn('width', square) 1`] = `"boolean"`; + +exports[`head R.head(['10', 10]) 1`] = `"string"`; + +exports[`head R.head(['fi', 'fo', 'fum']) 1`] = `"string"`; + +exports[`head R.head([10, 'ten']) 1`] = `"number"`; + +exports[`head R.head(ids) 1`] = `"string | undefined"`; + +exports[`identical R.identical('2', '1') 1`] = `"boolean"`; + +exports[`identical R.identical([], []) 1`] = `"boolean"`; + +exports[`identical R.identical(0, -0) 1`] = `"boolean"`; + +exports[`identical R.identical(1, 1) 1`] = `"boolean"`; + +exports[`identical R.identical(NaN, NaN) 1`] = `"boolean"`; + +exports[`identical R.identical(o, o) 1`] = `"boolean"`; + +exports[`identity R.identity(['a', 'b', 'c']) 1`] = `"string[]"`; + +exports[`identity R.identity([1, 2, 3]) 1`] = `"number[]"`; + +exports[`identity R.identity(1) 1`] = `"1"`; + +exports[`identity R.identity(obj) === obj 1`] = `"boolean"`; + +exports[`ifElse flattenArrays([[[10], 123], [8, [10]], 'hello']) 1`] = `"any[]"`; + +exports[`ifElse flattenArrays([[0], [[10], [8]], 1234, {}]) 1`] = `"any[]"`; + +exports[`inc f(3, 4) 1`] = `"number"`; + +exports[`indexBy R.indexBy(R.prop('id'))(list) 1`] = `"Dictionary<{}>"`; + +exports[`indexBy R.indexBy(R.prop('id'), list) 1`] = `"Dictionary<{}>"`; + +exports[`indexBy R.indexBy<{ id: string }>(R.prop('id'))(list) 1`] = `"Dictionary<{ id: string; }>"`; + +exports[`indexOf R.indexOf(3, [1, 2, 3, 4]) 1`] = `"number"`; + +exports[`indexOf R.indexOf(10)([1, 2, 3, 4]) 1`] = `"number"`; + +exports[`init R.init(['fi', 'fo', 'fum']) 1`] = `"string[]"`; + +exports[`innerJoin R.innerJoin( + (data: Data, id: number) => data.id === id, + [ + { id: 824, name: 'Richie Furay' }, + { id: 956, name: 'Dewey Martin' }, + { id: 313, name: 'Bruce Palmer' }, + { id: 456, name: 'Stephen Stills' }, + { id: 177, name: 'Neil Young' }, + ], + [177, 456, 999], + ) 1`] = `"{ id: number; name: string; }[]"`; + +exports[`insert R.insert(2)(5)([1, 2, 3, 4]) 1`] = `"number[]"`; + +exports[`insert R.insert(2)(5, [1, 2, 3, 4]) 1`] = `"number[]"`; + +exports[`insert R.insert(2, 5)([1, 2, 3, 4]) 1`] = `"number[]"`; + +exports[`insert R.insert(2, 5, [1, 2, 3, 4]) 1`] = `"number[]"`; + +exports[`insertAll R.insertAll(2)([10, 11, 12])([1, 2, 3, 4]) 1`] = `"number[]"`; + +exports[`insertAll R.insertAll(2)([10, 11, 12], [1, 2, 3, 4]) 1`] = `"number[]"`; + +exports[`insertAll R.insertAll(2, [10, 11, 12])([1, 2, 3, 4]) 1`] = `"number[]"`; + +exports[`insertAll R.insertAll(2, [10, 11, 12], [1, 2, 3, 4]) 1`] = `"number[]"`; + +exports[`intersection R.intersection([1, 2, 3, 4])([7, 6, 5, 4, 3]) 1`] = `"number[]"`; + +exports[`intersection R.intersection([1, 2, 3, 4], [7, 6, 5, 4, 3]) 1`] = `"number[]"`; + +exports[`intersection R.intersection([1, 2, 4])([1, 2, 3]) 1`] = `"number[]"`; + +exports[`intersection R.intersection([1, 2, 4], [1, 2, 3]) 1`] = `"number[]"`; + +exports[`intersectionWith R.intersectionWith(R.eqBy(R.prop('id')))(buffaloSpringfield)(csny) 1`] = `"Field[]"`; + +exports[`intersectionWith R.intersectionWith(R.eqBy(R.prop('id')))(buffaloSpringfield, csny) 1`] = `"Field[]"`; + +exports[`intersectionWith R.intersectionWith(R.eqBy(R.prop('id')), buffaloSpringfield, csny) 1`] = `"Field[]"`; + +exports[`intersperse R.intersperse(',', ['foo', 'bar']) 1`] = `"string[]"`; + +exports[`intersperse R.intersperse(0, [1, 2]) 1`] = `"number[]"`; + +exports[`intersperse R.intersperse(0, [1]) 1`] = `"number[]"`; + +exports[`into R.into([], transducer)(numbers) 1`] = `"number[]"`; + +exports[`into R.into([], transducer, numbers) 1`] = `"number[]"`; + +exports[`into R.into([])(transducer, numbers) 1`] = `"number[]"`; + +exports[`into intoArray(transducer)(numbers) 1`] = `"number[]"`; + +exports[`into intoArray(transducer, numbers) 1`] = `"number[]"`; + +exports[`invert R.invert(raceResultsByFirstName) 1`] = `"Dictionary"`; + +exports[`invertObj R.invertObj(raceResults0) 1`] = `"Dictionary"`; + +exports[`invertObj R.invertObj(raceResults1) 1`] = `"Dictionary"`; + +exports[`invoker R.invoker<'charAt', string, number, string>(1, 'charAt')(1, 'foo') 1`] = `"string"`; + +exports[`invoker R.invoker<'toUpperCase', string, string>(0, 'toUpperCase')('foo') 1`] = `"string"`; + +exports[`is R.is(Number)({}) 1`] = `"boolean"`; + +exports[`is R.is(Number)(1) 1`] = `"boolean"`; + +exports[`is R.is(Number, {}) 1`] = `"boolean"`; + +exports[`is R.is(Number, 1) 1`] = `"boolean"`; + +exports[`is R.is(Object)('s') 1`] = `"boolean"`; + +exports[`is R.is(Object)({}) 1`] = `"boolean"`; + +exports[`is R.is(Object)(1) 1`] = `"boolean"`; + +exports[`is R.is(Object)(new Object()) 1`] = `"boolean"`; + +exports[`is R.is(Object, 's') 1`] = `"boolean"`; + +exports[`is R.is(Object, {}) 1`] = `"boolean"`; + +exports[`is R.is(Object, 1) 1`] = `"boolean"`; + +exports[`is R.is(Object, new Object()) 1`] = `"boolean"`; + +exports[`is R.is(String)('') 1`] = `"boolean"`; + +exports[`is R.is(String)('s') 1`] = `"boolean"`; + +exports[`is R.is(String, '') 1`] = `"boolean"`; + +exports[`is R.is(String, 's') 1`] = `"boolean"`; + +exports[`isEmpty R.isEmpty('') 1`] = `"boolean"`; + +exports[`isEmpty R.isEmpty([]) 1`] = `"boolean"`; + +exports[`isEmpty R.isEmpty([1, 2, 3]) 1`] = `"boolean"`; + +exports[`isEmpty R.isEmpty({ a: 1 }) 1`] = `"boolean"`; + +exports[`isEmpty R.isEmpty({}) 1`] = `"boolean"`; + +exports[`isEmpty R.isEmpty(null) 1`] = `"boolean"`; + +exports[`isNil R.isNil([]) 1`] = `"boolean"`; + +exports[`isNil R.isNil(0) 1`] = `"boolean"`; + +exports[`isNil R.isNil(null) 1`] = `"boolean"`; + +exports[`isNil R.isNil(undefined) 1`] = `"boolean"`; + +exports[`join R.join('|', [1, 2, 3]) 1`] = `"string"`; + +exports[`join spacer(['a', 2, 3.4]) 1`] = `"string"`; + +exports[`juxt chopped('longstring') 1`] = `"string[]"`; + +exports[`juxt range(3, 4, 9, -3) 1`] = `"number[]"`; + +exports[`keys R.keys({ a: 1, b: 2, c: 3 }) 1`] = `"(\\"a\\" | \\"b\\" | \\"c\\")[]"`; + +exports[`keysIn R.keysIn(f) 1`] = `"(\\"x\\" | \\"y\\")[]"`; + +exports[`last R.last(['fi', 'fo', 'fum']) 1`] = `"string | undefined"`; + +exports[`lastIndexOf R.lastIndexOf(3, [-1, 3, 3, 0, 1, 2, 3, 4]) 1`] = `"number"`; + +exports[`lastIndexOf R.lastIndexOf(10)([1, 2, 3, 4]) 1`] = `"number"`; + +exports[`lastIndexOf R.lastIndexOf(10, [1, 2, 3, 4]) 1`] = `"number"`; + +exports[`length R.length([]) 1`] = `"number"`; + +exports[`length R.length([1, 2, 3]) 1`] = `"number"`; + +exports[`lens R.over(xLens)(R.negate, { x: 1, y: 2 }) 1`] = `"XY"`; + +exports[`lens R.over(xLens, R.negate)({ x: 1, y: 2 }) 1`] = `"XY"`; + +exports[`lens R.over(xLens, R.negate, { x: 1, y: 2 }) 1`] = `"{ x: number; y: number; }"`; + +exports[`lens R.set(xLens)(4, { x: 1, y: 2 }) 1`] = `"XY"`; + +exports[`lens R.set(xLens, 4)({ x: 1, y: 2 }) 1`] = `"XY"`; + +exports[`lens R.set(xLens, 4, { x: 1, y: 2 }) 1`] = `"{ x: number; y: number; }"`; + +exports[`lens R.view(xLens, { x: 1, y: 2 }) 1`] = `"number"`; + +exports[`lensIndex R.over(R.__, R.toUpper, ['a', 'b', 'c'])(headLens) 1`] = `"string[]"`; + +exports[`lensIndex R.over(headLens, R.toUpper, ['a', 'b', 'c']) 1`] = `"string[]"`; + +exports[`lensIndex R.set(R.__, 'x', ['a', 'b', 'c'])(headLens) 1`] = `"string[]"`; + +exports[`lensIndex R.set(headLens, 'x', ['a', 'b', 'c']) 1`] = `"string[]"`; + +exports[`lensIndex R.view(headLens, ['a', 'b', 'c']) 1`] = `"any"`; + +exports[`lensPath R.over(xyLens, R.negate, { x: { y: 2, z: 3 } }) 1`] = `"{ x: { y: number; z: number; }; }"`; + +exports[`lensPath R.set(xyLens, 4, { x: { y: 2, z: 3 } }) 1`] = `"{ x: { y: number; z: number; }; }"`; + +exports[`lensPath R.view(xyLens, { x: { y: 2, z: 3 } }) 1`] = `"number"`; + +exports[`lensProp R.set(phraseLens, 'Ooh Betty', obj1) 1`] = `"{ phrase: string; }"`; + +exports[`lensProp R.view(phraseLens, obj1) 1`] = `"string"`; + +exports[`lensProp R.view(phraseLens, obj2) 1`] = `"string"`; + +exports[`lift madd3([1, 2, 3], [1, 2, 3], [1]) 1`] = `"number[]"`; + +exports[`lift madd5([1, 2], [3], [4, 5], [6], [7, 8]) 1`] = `"number[]"`; + +exports[`liftN madd3([1, 2, 3], [1, 2, 3], [1]) 1`] = `"number[]"`; + +exports[`lt R.flip(R.lt)(5)(10) 1`] = `"boolean"`; + +exports[`lt R.lt(2, 0) 1`] = `"boolean"`; + +exports[`lt R.lt(2, 2) 1`] = `"boolean"`; + +exports[`lt R.lt(2, 6) 1`] = `"boolean"`; + +exports[`lt R.lt(5)(10) 1`] = `"boolean"`; + +exports[`lte R.flip(R.lte)(2)(1) 1`] = `"boolean"`; + +exports[`lte R.lte(2)(10) 1`] = `"boolean"`; + +exports[`lte R.lte(2, 0) 1`] = `"boolean"`; + +exports[`lte R.lte(2, 2) 1`] = `"boolean"`; + +exports[`lte R.lte(2, 6) 1`] = `"boolean"`; + +exports[`map R.map(double)([1, 2, 3]) 1`] = `"number[]"`; + +exports[`map R.map(double)({ a: 1, b: 2, c: 3 }) 1`] = `"Record<\\"a\\" | \\"b\\" | \\"c\\", number>"`; + +exports[`map R.map(double, [1, 2, 3]) 1`] = `"number[]"`; + +exports[`map R.map(double, { a: 1, b: 2, c: 3 }) 1`] = `"Record<\\"a\\" | \\"b\\" | \\"c\\", number>"`; + +exports[`mapAccum R.mapAccum(append)('0')(digits) 1`] = `"[string, string[]]"`; + +exports[`mapAccum R.mapAccum(append)('0', digits) 1`] = `"[string, string[]]"`; + +exports[`mapAccum R.mapAccum(append, '0')(digits) 1`] = `"[string, string[]]"`; + +exports[`mapAccum R.mapAccum(append, '0', digits) 1`] = `"[string, string[]]"`; + +exports[`mapAccumRight R.mapAccumRight(append)('0')(digits) 1`] = `"[string[], string]"`; + +exports[`mapAccumRight R.mapAccumRight(append)('0', digits) 1`] = `"[string[], string]"`; + +exports[`mapAccumRight R.mapAccumRight(append, '0')(digits) 1`] = `"[string[], string]"`; + +exports[`mapAccumRight R.mapAccumRight(append, '0', digits) 1`] = `"[string[], string]"`; + +exports[`mapObjIndexed R.mapObjIndexed(prependKeyAndDouble, values) 1`] = `"Record"`; + +exports[`match R.match(/([a-z]a)/g, 'bananas') 1`] = `"string[]"`; + +exports[`match R.match(/a/, 'b') 1`] = `"string[]"`; + +exports[`match R.match(/a/, null) 1`] = `"Argument of type 'null' is not assignable to parameter of type 'string'."`; + +exports[`mathMod R.mathMod(-17, 5) 1`] = `"number"`; + +exports[`mathMod R.mathMod(17, -5) 1`] = `"number"`; + +exports[`mathMod R.mathMod(17, 0) 1`] = `"number"`; + +exports[`mathMod R.mathMod(17, 5) 1`] = `"number"`; + +exports[`mathMod R.mathMod(17, 5.3) 1`] = `"number"`; + +exports[`mathMod R.mathMod(17.2, 5) 1`] = `"number"`; + +exports[`mathMod clock(15) 1`] = `"number"`; + +exports[`mathMod clock(24) 1`] = `"number"`; + +exports[`mathMod seventeenMod(3) 1`] = `"number"`; + +exports[`max R.max('a', 'z') 1`] = `"\\"a\\" | \\"z\\""`; + +exports[`max R.max(7, 3) 1`] = `"3 | 7"`; + +exports[`maxBy R.maxBy(cmp)(a)(b) 1`] = `"{ x: number; }"`; + +exports[`maxBy R.maxBy(cmp)(a, c) 1`] = `"{ x: number; }"`; + +exports[`maxBy R.maxBy(cmp)(d)(e) 1`] = ` +"Argument of type '{ x: string; }' is not assignable to parameter of type '{ x: number; }'. + Types of property 'x' are incompatible. + Type 'string' is not assignable to type 'number'." +`; + +exports[`maxBy R.maxBy(cmp, a, c) 1`] = `"{ x: number; }"`; + +exports[`mean R.mean([]) 1`] = `"number"`; + +exports[`mean R.mean([2, 7, 9]) 1`] = `"number"`; + +exports[`median R.median([]) 1`] = `"number"`; + +exports[`median R.median([7, 2, 10, 9]) 1`] = `"number"`; + +exports[`memoize memoTrackedAdd(1, 2) 1`] = `"number"`; + +exports[`memoize memoTrackedAdd(1, 2) 2`] = `"number"`; + +exports[`memoize memoTrackedAdd(2, 1) 1`] = `"number"`; + +exports[`memoize memoTrackedAdd(2, 3) 1`] = `"number"`; + +exports[`memoize numberOfCalls 1`] = `"number"`; + +exports[`memoize numberOfCalls 2`] = `"number"`; + +exports[`memoize numberOfCalls 3`] = `"number"`; + +exports[`memoize numberOfCalls 4`] = `"number"`; + +exports[`memoizeWith count 1`] = `"number"`; + +exports[`memoizeWith factorial(5) 1`] = `"number"`; + +exports[`memoizeWith factorial(5) 2`] = `"number"`; + +exports[`memoizeWith factorial(5) 3`] = `"number"`; + +exports[`merge R.merge({ name: 'fred', age: 10 }, { age: 40 }) 1`] = `"Pick<{ name: string; age: number; }, \\"name\\"> & { age: number; }"`; + +exports[`mergeAll R.mergeAll([{ foo: 1 }, { bar: 2 }, { baz: 3 }]) 1`] = `"object"`; + +exports[`mergeAll R.mergeAll([{ foo: 1 }, { foo: 2 }, { bar: 2 }]) 1`] = `"object"`; + +exports[`mergeDeepLeft R.mergeDeepLeft( + { name: 'fred', age: 10, contact: { email: 'moo@example.com' } }, + { age: 40, contact: { email: 'baa@example.com' } }, + ) 1`] = `"object"`; + +exports[`mergeDeepRight R.mergeDeepRight( + { name: 'fred', age: 10, contact: { email: 'moo@example.com' } }, + { age: 40, contact: { email: 'baa@example.com' } }, + ) 1`] = `"object"`; + +exports[`mergeDeepWith R.mergeDeepWith( + R.concat, + { a: true, c: { values: [10, 20] } }, + { b: true, c: { values: [15, 35] } }, + ) 1`] = `"object"`; + +exports[`mergeDeepWithKey R.mergeDeepWithKey( + concatValues, + { a: true, c: { thing: 'foo', values: [10, 20] } }, + { b: true, c: { thing: 'bar', values: [15, 35] } }, + ) 1`] = `"object"`; + +exports[`mergeWith R.mergeWith( + R.concat, + { a: true, values: [10, 20] }, + { b: true, values: [15, 35] }, + ) 1`] = `"Pick<{ a: boolean; values: number[]; }, \\"a\\"> & Pick<{ b: boolean; values: number[]; }, \\"b\\"> & Record<\\"values\\", string | any[]>"`; + +exports[`mergeWithKey R.mergeWithKey( + concatValues, + { a: true, thing: 'foo', values: [10, 20] }, + { b: true, thing: 'bar', values: [15, 35] }, + ) 1`] = `"Pick<{ a: boolean; thing: string; values: number[]; }, \\"a\\"> & Pick<{ b: boolean; thing: string; values: number[]; }, \\"b\\"> & Record<\\"values\\" | \\"thing\\", string | number[]>"`; + +exports[`mergeWithKey R.mergeWithKey(concatValues)( + { a: true, thing: 'foo', values: [10, 20] }, + { b: true, thing: 'bar', values: [15, 35] }, + ) 1`] = `"Pick<{ a: boolean; thing: string; values: number[]; }, \\"a\\"> & Pick<{ b: boolean; thing: string; values: number[]; }, \\"b\\"> & Record<\\"values\\" | \\"thing\\", string | number[]>"`; + +exports[`min R.min('a', 'z') 1`] = `"\\"a\\" | \\"z\\""`; + +exports[`min R.min(9, 3) 1`] = `"3 | 9"`; + +exports[`minBy R.minBy(cmp)(a)(c) 1`] = `"{ x: number; }"`; + +exports[`minBy R.minBy(cmp)(a, b) 1`] = `"{ x: number; }"`; + +exports[`minBy R.minBy(cmp, a, b) 1`] = `"{ x: number; }"`; + +exports[`minBy R.minBy(cmp, d, e) 1`] = ` +"Argument of type '{ x: string; }' is not assignable to parameter of type '{ x: number; }'. + Types of property 'x' are incompatible. + Type 'string' is not assignable to type 'number'." +`; + +exports[`modulo R.modulo(-17, 3) 1`] = `"number"`; + +exports[`modulo R.modulo(17, -3) 1`] = `"number"`; + +exports[`modulo R.modulo(17, 3) 1`] = `"number"`; + +exports[`modulo isOdd(21) 1`] = `"number"`; + +exports[`modulo isOdd(42) 1`] = `"number"`; + +exports[`multiply R.multiply(2)(3) 1`] = `"number"`; + +exports[`multiply R.multiply(2, 5) 1`] = `"number"`; + +exports[`multiply R.multiply(3)(4) 1`] = `"number"`; + +exports[`nAry R.nAry(0, takesNoArg) 1`] = `"() => boolean"`; + +exports[`nAry R.nAry(0, takesOneArg) 1`] = `"() => number[]"`; + +exports[`nAry R.nAry(1, takesThreeArgs) 1`] = `"(v1: number) => number[]"`; + +exports[`nAry R.nAry(1, takesTwoArgs) 1`] = `"(v1: number) => number[]"`; + +exports[`negate R.negate(42) 1`] = `"number"`; + +exports[`none boolean 1`] = `"boolean"`; + +exports[`none boolean 2`] = `"boolean"`; + +exports[`none boolean 3`] = `"boolean"`; + +exports[`not R.not(0) 1`] = `"boolean"`; + +exports[`not R.not(1) 1`] = `"boolean"`; + +exports[`not R.not(false) 1`] = `"boolean"`; + +exports[`not R.not(true) 1`] = `"boolean"`; + +exports[`nth R.nth(-1, list) 1`] = `"string | undefined"`; + +exports[`nth R.nth(-99)(list) 1`] = `"string | undefined"`; + +exports[`nth R.nth(-99, list) 1`] = `"string | undefined"`; + +exports[`nth R.nth(1, list) 1`] = `"string | undefined"`; + +exports[`nthArg R.nthArg(-1)('a', 'b', 'c') 1`] = `"\\"a\\" | \\"b\\" | \\"c\\""`; + +exports[`nthArg R.nthArg(1)('a', 'b', 'c') 1`] = `"\\"a\\" | \\"b\\" | \\"c\\""`; + +exports[`o R.o(R.multiply(10), R.add(10))(-4) 1`] = `"number"`; + +exports[`o yellGreeting({ first: 'James', last: 'Bond' }) 1`] = `"string"`; + +exports[`objOf matchPhrases(['foo', 'bar', 'baz']) 1`] = `"Record<\\"must\\", {}>"`; + +exports[`of R.of([1]) 1`] = `"number[][]"`; + +exports[`of R.of(1) 1`] = `"number[]"`; + +exports[`omit R.omit(['a', 'd'])({ a: 1, b: 2, c: 3, d: 4 }) 1`] = `"Partial<{ a: number; b: number; c: number; d: number; }>"`; + +exports[`omit R.omit(['a', 'd'], { a: 1, b: 2, c: 3, d: 4 }) 1`] = `"Partial<{ a: number; b: number; c: number; d: number; }>"`; + +exports[`once addOneOnce(10) 1`] = `"number"`; + +exports[`once addOneOnce(addOneOnce(50)) 1`] = `"number"`; + +exports[`or R.or(0)([]) 1`] = `"number | never[]"`; + +exports[`or R.or(0, []) 1`] = `"0 | never[]"`; + +exports[`or R.or(false, true) 1`] = `"boolean"`; + +exports[`or R.or(null, '') 1`] = `"\\"\\" | null"`; + +exports[`over R.over(headLens, R.toUpper, ['a', 'b', 'c']) 1`] = `"string[]"`; + +exports[`pair R.pair('foo', 'bar') 1`] = `"KeyValuePair<\\"foo\\", string>"`; + +exports[`pair p[0] 1`] = `"\\"foo\\""`; + +exports[`pair p[1] 1`] = `"number"`; + +exports[`partial R.partial(multiply, [2])(2) 1`] = `"number"`; + +exports[`partial sayHelloToMs('Jane', 'Jones') 1`] = `"string"`; + +exports[`partialRight greetMsJaneJones('Hello') 1`] = `"string"`; + +exports[`partition R.partition((x: number) => x > 2)([1, 2, 3, 4]) 1`] = `"[number[], number[]]"`; + +exports[`partition R.partition((x: number) => x > 2, [1, 2, 3, 4]) 1`] = `"[number[], number[]]"`; + +exports[`partition R.partition(R.contains('s'))(['sss', 'ttt', 'foo', 'bars']) 1`] = `"[(string[] | ArrayLike)[], (string[] | ArrayLike)[]]"`; + +exports[`partition R.partition(R.contains('s'), ['sss', 'ttt', 'foo', 'bars']) 1`] = `"[(string[] | ArrayLike)[], (string[] | ArrayLike)[]]"`; + +exports[`partition R.partition(R.contains('s'), { a: 'sss', b: 'ttt', foo: 'bars' }) 1`] = `"[Partial<{ a: string; b: string; foo: string; }>, Partial<{ a: string; b: string; foo: string; }>]"`; + +exports[`path R.path(['a', 'b'])({ a: { b: 2 } }) 1`] = `"{} | undefined"`; + +exports[`path R.path(['a', 'b'], { a: { b: 2 } }) 1`] = `"number"`; + +exports[`pathEq R.filter(isFamous, users) 1`] = `"User[]"`; + +exports[`pathOr R.pathOr('N/A')(['a', 'b'], { a: { b: 2 } }) 1`] = `"string | {}"`; + +exports[`pathOr R.pathOr('N/A', ['a', 'b'])({ a: { b: 2 } }) 1`] = `"string | {}"`; + +exports[`pathSatisfies R.pathSatisfies((a: any) => a !== 1, ['a', 'b', 'c'], { a: { b: { c: 2 } } }) 1`] = `"boolean"`; + +exports[`pathSatisfies R.pathSatisfies((a: any) => a === 'bar', ['a', 'b', 'c'], { + a: { b: { c: 'foo' } }, + }) 1`] = `"boolean"`; + +exports[`pathSatisfies R.pathSatisfies((a: any) => a === 'foo', ['a', 'b', 'c'], { + a: { b: { c: 'foo' } }, + }) 1`] = `"boolean"`; + +exports[`pathSatisfies R.pathSatisfies((a: any) => a === 1)(['a', 'b', 'c'])({ a: { b: { c: 1 } } }) 1`] = `"boolean"`; + +exports[`pathSatisfies R.pathSatisfies((a: any) => a === 1)(['a', 'b', 'c'], { a: { b: { c: 1 } } }) 1`] = `"boolean"`; + +exports[`pathSatisfies R.pathSatisfies((a: any) => a === 1, ['a', 'b', 'c'])({ a: { b: { c: 1 } } }) 1`] = `"boolean"`; + +exports[`pathSatisfies R.pathSatisfies((a: any) => a === 1, ['a', 'b', 'c'], { a: { b: { c: 1 } } }) 1`] = `"boolean"`; + +exports[`pick R.pick(['0', '2', '3'], [1, 2, 3, 4]) 1`] = `"Pick, \\"2\\" | \\"0\\" | \\"3\\">"`; + +exports[`pick R.pick(['a', 'c', 'd'], { a: 1, b: 2, c: 3, d: 4 }) 1`] = `"Pick<{ a: number; b: number; c: number; d: number; }, \\"a\\" | \\"c\\" | \\"d\\">"`; + +exports[`pick R.pick(['a', 'e', 'f'])({ a: 1, b: 2, c: 3, d: 4 }) 1`] = ` +"Argument of type '{ a: number; b: number; c: number; d: number; }' is not assignable to parameter of type 'Record<\\"a\\" | \\"e\\" | \\"f\\", any>'. + Object literal may only specify known properties, and 'b' does not exist in type 'Record<\\"a\\" | \\"e\\" | \\"f\\", any>'." +`; + +exports[`pick R.pick(['a', 'e', 'f'], [1, 2, 3, 4]) 1`] = `"Partial"`; + +exports[`pick R.pick(['a', 'e', 'f'], { a: 1, b: 2, c: 3, d: 4 }) 1`] = `"Partial<{ a: number; b: number; c: number; d: number; }>"`; + +exports[`pickAll R.pickAll(['a', 'd'])({ a: 1, b: 2, c: 3, d: 4 }) 1`] = `"Partial<{ a: number; b: number; c: number; d: number; }>"`; + +exports[`pickAll R.pickAll(['a', 'd'], { a: 1, b: 2, c: 3, d: 4 }) 1`] = `"Pick<{ a: number; b: number; c: number; d: number; }, \\"a\\" | \\"d\\">"`; + +exports[`pickAll R.pickAll(['a', 'e', 'f'])({ a: 1, b: 2, c: 3, d: 4 }) 1`] = `"Partial<{ a: number; b: number; c: number; d: number; }>"`; + +exports[`pickAll R.pickAll(['a', 'e', 'f'], { a: 1, b: 2, c: 3, d: 4 }) 1`] = `"Partial<{ a: number; b: number; c: number; d: number; }>"`; + +exports[`pickBy R.pickBy(containsBackground, colors) 1`] = `"Partial<{ 1: { color: string; }; 2: { color: string; bgcolor: string; }; }>"`; + +exports[`pickBy R.pickBy(isPositive, { a: 1, b: 2, c: -1, d: 0, e: 5 }) 1`] = `"Partial<{ a: number; b: number; c: number; d: number; e: number; }>"`; + +exports[`pickBy R.pickBy(isUpperCase, { a: 1, b: 2, A: 3, B: 4 }) 1`] = `"Partial<{ a: number; b: number; A: number; B: number; }>"`; + +exports[`pipe R.pipe(R.split(''), R.adjust(R.toUpper, 0), R.join(''))('str') 1`] = `"string"`; + +exports[`pipe R.pipe(double, double, shout) 1`] = `"(v1: number) => string"`; + +exports[`pipe R.pipe(double, double, shout)(10) 1`] = `"string"`; + +exports[`pipe f(3, 4) 1`] = `"number"`; + +exports[`pipe squareThenDoubleThenTriple(5) 1`] = `"number"`; + +exports[`pipeP R.pipeP( + (m: number) => Promise.resolve(R.multiply(2, m)), + (m: number) => Promise.resolve(m / 2), + R.multiply(5), + )(10) 1`] = `"PromiseLike"`; + +exports[`pipeP R.pipeP( + (m: number) => Promise.resolve(R.multiply(2, m)), + (m: number) => Promise.resolve(m / 2), + )(10) 1`] = `"PromiseLike"`; + +exports[`pluck R.pluck('a')([{ a: 1 }, { a: 2 }]) 1`] = `"number[]"`; + +exports[`pluck R.pluck('a', [{ a: 1 }, { a: 2 }]) 1`] = `"number[]"`; + +exports[`pluck R.pluck(0)([[1, 2], [3, 4]]) 1`] = `"number[]"`; + +exports[`pluck R.pluck(0, [[1, 2], [3, 4]]) 1`] = `"number[]"`; + +exports[`prepend R.prepend('fee')(['fi', 'fo', 'fum']) 1`] = `"string[]"`; + +exports[`prepend R.prepend('fee', ['fi', 'fo', 'fum']) 1`] = `"string[]"`; + +exports[`product R.product([2, 4, 6, 8, 100, 1]) 1`] = `"number"`; + +exports[`project R.project(['name', 'grade'], kids) 1`] = `"Pick<{ name: string; age: number; hair: string; grade: number; }, \\"name\\" | \\"grade\\">[]"`; + +exports[`prop R.prop('x', { x: 100 }) 1`] = `"number"`; + +exports[`prop R.prop('x', {}) 1`] = `"{} | undefined"`; + +exports[`propEq R.propEq('a', '1', xs) 1`] = `"boolean"`; + +exports[`propEq R.propEq('a', '1', xs) 2`] = `"boolean"`; + +exports[`propEq R.propEq('a', '4', xs) 1`] = `"boolean"`; + +exports[`propEq R.propEq('a', '4', xs) 2`] = `"boolean"`; + +exports[`propEq R.propEq('a', 1, xs) 1`] = `"boolean"`; + +exports[`propEq R.propEq('a', 1, xs) 2`] = `"boolean"`; + +exports[`propEq R.propEq('a', 1, xs) 3`] = `"boolean"`; + +exports[`propEq R.propEq('a', 4, xs) 1`] = `"boolean"`; + +exports[`propEq R.propEq('a', 4, xs) 2`] = `"boolean"`; + +exports[`propEq R.propEq('a', 4, xs) 3`] = `"boolean"`; + +exports[`propIs R.propIs(Number)('x')({ x: 1, y: 2 }) 1`] = `"boolean"`; + +exports[`propIs R.propIs(Number)('x', { x: 1, y: 2 }) 1`] = `"boolean"`; + +exports[`propIs R.propIs(Number, 'x')({ x: 1, y: 2 }) 1`] = `"boolean"`; + +exports[`propIs R.propIs(Number, 'x', { x: 'foo' }) 1`] = `"boolean"`; + +exports[`propIs R.propIs(Number, 'x', { x: 1, y: 2 }) 1`] = `"boolean"`; + +exports[`propIs R.propIs(Number, 'x', {}) 1`] = `"boolean"`; + +exports[`propOr R.prop('favoriteLibrary', alice) 1`] = `"string | undefined"`; + +exports[`propSatisfies R.propSatisfies((x: number) => x > 0, 'x', { x: 1, y: 2 }) 1`] = `"boolean"`; + +exports[`propSatisfies R.propSatisfies<'x', XY>((x: number) => x > 0)('x')({ x: 1, y: 2 }) 1`] = `"boolean"`; + +exports[`propSatisfies R.propSatisfies<'x', XY>((x: number) => x > 0, 'x')({ x: 1, y: 2 }) 1`] = `"boolean"`; + +exports[`props R.props(['c', 'a', 'b'], { b: 2, a: 1 }) 1`] = `"any[]"`; + +exports[`props R.props(['x', 'y'], { x: 1, y: 2 }) 1`] = `"number[]"`; + +exports[`props fullName({ last: 'Bullet-Tooth', age: 33, first: 'Tony' }) 1`] = `"string"`; + +exports[`range R.range(1, 5) 1`] = `"number[]"`; + +exports[`range R.range(50)(53) 1`] = `"number[]"`; + +exports[`reduce R.reduce(add)(10, numbers) 1`] = `"number"`; + +exports[`reduce R.reduce(add, 10)(numbers) 1`] = `"number"`; + +exports[`reduce R.reduce(add, 10, numbers) 1`] = `"number"`; + +exports[`reduce R.reduce(add, 10, numbers) 2`] = `"number"`; + +exports[`reduceBy namesByGrade(students) 1`] = `"Partial>"`; + +exports[`reduceRight R.reduceRight(flattenPairs)([], pairs) 1`] = `"KeyValuePair[]"`; + +exports[`reduceRight R.reduceRight(flattenPairs, [])(pairs) 1`] = `"KeyValuePair[]"`; + +exports[`reduceRight R.reduceRight(flattenPairs, [], pairs) 1`] = `"KeyValuePair[]"`; + +exports[`reduceWhile R.reduceWhile(isOdd, R.add, 0, xs) 1`] = `"number"`; + +exports[`reduceWhile R.reduceWhile(isOdd, R.add, 111, ys) 1`] = `"number"`; + +exports[`reduced R.reduced(123) 1`] = `"Reduced"`; + +exports[`reject R.reject(isOdd)([1, 2, 3, 4]) 1`] = `"number[]"`; + +exports[`reject R.reject(isOdd, [1, 2, 3, 4]) 1`] = `"number[]"`; + +exports[`reject rejectIndexed(lastTwo)([8, 6, 7, 5, 3, 0, 9]) 1`] = `"number[]"`; + +exports[`reject rejectIndexed(lastTwo, [8, 6, 7, 5, 3, 0, 9]) 1`] = `"number[]"`; + +exports[`remove R.remove(2)(3, [1, 2, 3, 4, 5, 6, 7, 8]) 1`] = `"number[]"`; + +exports[`remove R.remove(2, 3)([1, 2, 3, 4, 5, 6, 7, 8]) 1`] = `"number[]"`; + +exports[`remove R.remove(2, 3, [1, 2, 3, 4, 5, 6, 7, 8]) 1`] = `"number[]"`; + +exports[`repeat R.repeat('hi', 5) 1`] = `"string[]"`; + +exports[`repeat repeatedObjs 1`] = `"{}[]"`; + +exports[`repeat repeatedObjs[0] === repeatedObjs[1] 1`] = `"boolean"`; + +exports[`replace R.replace('foo')('bar')('foo foo foo') 1`] = `"string"`; + +exports[`replace R.replace('foo', 'bar')('foo foo foo') 1`] = `"string"`; + +exports[`replace R.replace('foo', 'bar', 'foo foo foo') 1`] = `"string"`; + +exports[`replace R.replace(/foo/, 'bar', 'foo foo foo') 1`] = `"string"`; + +exports[`replace R.replace(/foo/g)('bar')('foo foo foo') 1`] = `"string"`; + +exports[`replace R.replace(/foo/g, 'bar')('foo foo foo') 1`] = `"string"`; + +exports[`replace R.replace(/foo/g, 'bar', 'foo foo foo') 1`] = `"string"`; + +exports[`reverse R.reverse([]) 1`] = `"never[]"`; + +exports[`reverse R.reverse([1, 2, 3]) 1`] = `"number[]"`; + +exports[`reverse R.reverse([1, 2]) 1`] = `"number[]"`; + +exports[`reverse R.reverse([1]) 1`] = `"number[]"`; + +exports[`scan R.scan(R.multiply)(1, numbers) 1`] = `"number[]"`; + +exports[`scan R.scan(R.multiply, 1)(numbers) 1`] = `"number[]"`; + +exports[`scan R.scan(R.multiply, 1, numbers) 1`] = `"number[]"`; + +exports[`set R.set(headLens, 'x', ['a', 'b', 'c']) 1`] = `"string[]"`; + +exports[`slice R.slice(2)(5, str) 1`] = `"string"`; + +exports[`slice R.slice(2)(5, xs) 1`] = `"number[]"`; + +exports[`slice R.slice(2, 5)(str) 1`] = `"string"`; + +exports[`slice R.slice(2, 5)(xs) 1`] = `"number[]"`; + +exports[`slice R.slice(2, 5, str) 1`] = `"string"`; + +exports[`slice R.slice(2, 5, xs) 1`] = `"number[]"`; + +exports[`sort R.sort(diff)([4, 2, 7, 5]) 1`] = `"number[]"`; + +exports[`sort R.sort(diff, [4, 2, 7, 5]) 1`] = `"number[]"`; + +exports[`sortBy sortByAgeAscending(people) 1`] = `"Person[]"`; + +exports[`sortBy sortByAgeDescending(people) 1`] = `"Person[]"`; + +exports[`sortBy sortByNameCaseInsensitive(people) 1`] = `"Person[]"`; + +exports[`sortWith R.sortWith( + [R.descend(R.prop('age')), R.ascend(R.prop('name'))], + people, + ) 1`] = `"Person[]"`; + +exports[`sortWith ageNameSort(people) 1`] = `"Person[]"`; + +exports[`split R.split('.', 'a.b.c.xyz.d') 1`] = `"string[]"`; + +exports[`split R.tail(pathComponents('/usr/local/bin/node')) 1`] = `"string[]"`; + +exports[`splitAt R.splitAt(-1, 'foobar') 1`] = `"[string, string]"`; + +exports[`splitAt R.splitAt(1)([1, 2, 3]) 1`] = `"[number[], number[]]"`; + +exports[`splitAt R.splitAt(1, [1, 2, 3]) 1`] = `"[number[], number[]]"`; + +exports[`splitAt R.splitAt(5, 'hello world') 1`] = `"[string, string]"`; + +exports[`splitEvery R.splitEvery(3, 'foobarbaz') 1`] = `"string[]"`; + +exports[`splitEvery R.splitEvery(3, [1, 2, 3, 4, 5, 6, 7]) 1`] = `"number[][]"`; + +exports[`splitWhen R.splitWhen(R.equals(2))([1, 2, 3, 1, 2, 3]) 1`] = `"[number[], number[]]"`; + +exports[`splitWhen R.splitWhen(R.equals(2), [1, 2, 3, 1, 2, 3]) 1`] = `"[number[], number[]]"`; + +exports[`startsWith R.startsWith('a', 'abc') 1`] = `"boolean"`; + +exports[`startsWith R.startsWith('b', 'abc') 1`] = `"boolean"`; + +exports[`startsWith R.startsWith(['a'], ['a', 'b', 'c']) 1`] = `"boolean"`; + +exports[`startsWith R.startsWith(['b'], ['a', 'b', 'c']) 1`] = `"boolean"`; + +exports[`subtract R.subtract(10, 8) 1`] = `"number"`; + +exports[`subtract complementaryAngle(30) 1`] = `"number"`; + +exports[`subtract complementaryAngle(72) 1`] = `"number"`; + +exports[`subtract minus5(17) 1`] = `"number"`; + +exports[`sum R.sum([2, 4, 6, 8, 100, 1]) 1`] = `"number"`; + +exports[`symmetricDifference R.symmetricDifference([1, 2, 3, 4], [7, 6, 5, 4, 3]) 1`] = `"number[]"`; + +exports[`symmetricDifference R.symmetricDifference([7, 6, 5, 4, 3])([1, 2, 3, 4]) 1`] = `"number[]"`; + +exports[`symmetricDifferenceWith R.symmetricDifferenceWith(eqA)(l1)(l2) 1`] = `"A[]"`; + +exports[`symmetricDifferenceWith R.symmetricDifferenceWith(eqA)(l1, l2) 1`] = `"A[]"`; + +exports[`symmetricDifferenceWith R.symmetricDifferenceWith(eqA, l1, l2) 1`] = `"A[]"`; + +exports[`tail R.tail(['fi', 'fo', 'fum']) 1`] = `"string[]"`; + +exports[`tail R.tail([1, 2, 3]) 1`] = `"number[]"`; + +exports[`take R.take(3, 'Example') 1`] = `"string"`; + +exports[`take R.take(3, [1, 2, 3, 4, 5]) 1`] = `"number[]"`; + +exports[`take takeFive(members) 1`] = `"string[]"`; + +exports[`take takeThree('Example') 1`] = `"string"`; + +exports[`takeLast R.takeLast(1, ['foo', 'bar', 'baz']) 1`] = `"string[]"`; + +exports[`takeLast R.takeLast(2)(['foo', 'bar', 'baz']) 1`] = `"string[]"`; + +exports[`takeLast R.takeLast(3)('ramda') 1`] = `"string"`; + +exports[`takeLast R.takeLast(3, 'ramda') 1`] = `"string"`; + +exports[`takeLastWhile R.takeLastWhile(isNotOne)([1, 2, 3, 4]) 1`] = `"number[]"`; + +exports[`takeLastWhile R.takeLastWhile(isNotOne, [1, 2, 3, 4]) 1`] = `"number[]"`; + +exports[`takeWhile R.takeWhile(isNotFour)([1, 2, 3, 4]) 1`] = `"number[]"`; + +exports[`takeWhile R.takeWhile(isNotFour, [1, 2, 3, 4]) 1`] = `"number[]"`; + +exports[`tap R.tap(sayX, 100) 1`] = `"number"`; + +exports[`test R.test(/^x/, 'xyz') 1`] = `"boolean"`; + +exports[`test R.test(/^y/)('xyz') 1`] = `"boolean"`; + +exports[`times R.times(R.identity)(5) 1`] = `"number[]"`; + +exports[`times R.times(R.identity, 5) 1`] = `"number[]"`; + +exports[`times R.times(i, 5) 1`] = `"number[]"`; + +exports[`toLower R.toLower('XYZ') 1`] = `"string"`; + +exports[`toPairs R.toPairs({ a: 1, b: 2, c: 3 }) 1`] = `"[\\"a\\" | \\"b\\" | \\"c\\", number][]"`; + +exports[`toPairsIn R.toPairsIn(f) 1`] = `"[\\"x\\" | \\"y\\", string][]"`; + +exports[`toPairsIn R.toPairsIn(f) 2`] = `"[\\"x\\" | \\"y\\", string][]"`; + +exports[`toString R.toString('abc') 1`] = `"string"`; + +exports[`toString R.toString([1, 2, 3]) 1`] = `"string"`; + +exports[`toString R.toString({ foo: 1, bar: 2, baz: 3 }) 1`] = `"string"`; + +exports[`toString R.toString(42) 1`] = `"string"`; + +exports[`toString R.toString(new Date('2001-02-03T04: 05: 06Z')) 1`] = `"string"`; + +exports[`toString R.toString(new Point(1, 2)) 1`] = `"string"`; + +exports[`toUpper R.toUpper('abc') 1`] = `"string"`; + +exports[`transduce R.transduce(transducer)(fn, [] as number[], numbers) 1`] = `"number[]"`; + +exports[`transduce R.transduce(transducer, fn)([] as number[], numbers) 1`] = `"number[]"`; + +exports[`transduce R.transduce(transducer, fn, [] as number[])(numbers) 1`] = `"number[]"`; + +exports[`transduce R.transduce(transducer, fn, [] as number[], numbers) 1`] = `"number[]"`; + +exports[`transpose R.transpose([[1, 'a'], [2, 'b'], [3, 'c']]) 1`] = `"(string | number)[][]"`; + +exports[`transpose R.transpose([[10, 11], [20], [], [30, 31, 32]]) 1`] = `"number[][]"`; + +exports[`transpose R.transpose([[1, 2, 3], ['a', 'b', 'c']]) 1`] = `"(string | number)[][]"`; + +exports[`trim R.map(R.trim, R.split(',', 'x, y, z')) 1`] = `"string[]"`; + +exports[`trim R.trim(' xyz ') 1`] = `"string"`; + +exports[`tryCatch R.tryCatch(R.prop('x'), R.F)({ x: true }) 1`] = `"boolean"`; + +exports[`tryCatch R.tryCatch(R.prop('x'), R.F)(null) 1`] = `"any"`; + +exports[`type R.type('s') 1`] = `"\\"String\\""`; + +exports[`type R.type(/[A-z]/) 1`] = `"string"`; + +exports[`type R.type([]) 1`] = `"string"`; + +exports[`type R.type({}) 1`] = `"string"`; + +exports[`type R.type(1) 1`] = `"\\"Number\\""`; + +exports[`type R.type(false) 1`] = `"\\"Boolean\\""`; + +exports[`type R.type(null) 1`] = `"\\"Null\\""`; + +exports[`unapply R.unapply(JSON.stringify) 1`] = `"(...args: any[]) => string"`; + +exports[`unapply R.unapply(JSON.stringify)(1, 2, 3) 1`] = `"string"`; + +exports[`unary R.unary(takesOneArg) 1`] = `"(a: number) => number[]"`; + +exports[`unary R.unary(takesThreeArgs) 1`] = `"(a: number) => number[]"`; + +exports[`unary R.unary(takesTwoArgs) 1`] = `"(a: number) => number[]"`; + +exports[`uncurryN uncurriedAddFour(1, 2, 3, 4) 1`] = `"number"`; + +exports[`unfold R.unfold(f, 10) 1`] = `"number[]"`; + +exports[`unfold b 1`] = `"(initial: number) => number[]"`; + +exports[`unfold b(10) 1`] = `"number[]"`; + +exports[`union R.union([1, 2, 3], [2, 3, 4]) 1`] = `"number[]"`; + +exports[`unionWith R.unionWith(R.eqBy(R.prop('a')), l1, l2) 1`] = `"A[]"`; + +exports[`uniq R.uniq([{}, {}]) 1`] = `"{}[]"`; + +exports[`uniq R.uniq([1, '1']) 1`] = `"(string | number)[]"`; + +exports[`uniq R.uniq([1, 1, 2, 1]) 1`] = `"number[]"`; + +exports[`uniqBy R.uniqBy(Math.abs, [-1, -5, 2, 10, 1, 2]) 1`] = `"number[]"`; + +exports[`uniqWith R.uniqWith<{}>(strEq)([{}, {}]) 1`] = `"{}[]"`; + +exports[`uniqWith R.uniqWith(strEq)(['1', 1, 1]) 1`] = `"(string | number)[]"`; + +exports[`uniqWith R.uniqWith(strEq)([1, '1', 1]) 1`] = `"(string | number)[]"`; + +exports[`uniqWith R.uniqWith(strEq)([1, '1', 2, 1]) 1`] = `"(string | number)[]"`; + +exports[`uniqWith R.uniqWith(strEq, [1, '1', 2, 1]) 1`] = `"(string | number)[]"`; + +exports[`unless R.unless(R.gt(R.__, 100), R.multiply(2))(1) 1`] = `"number"`; + +exports[`unless coerceArray([1, 2, 3]) 1`] = `"any[] | ArrayLike"`; + +exports[`unless coerceArray(1) 1`] = `"any[] | ArrayLike"`; + +exports[`unnest R.equals(R.unnest([[1, 2], [3, 4], [5, 6]]), [1, 2, 3, 4, 5, 6]) 1`] = `"boolean"`; + +exports[`unnest R.equals(R.unnest([1, [2], [[3]]]), [1, 2, [3]]) 1`] = `"boolean"`; + +exports[`until R.until(R.gt(R.__, 100), R.multiply(2))(1) 1`] = `"number"`; + +exports[`update R.update(1)(11)([0, 1, 2]) 1`] = `"number[]"`; + +exports[`update R.update(1, 11, [0, 1, 2]) 1`] = `"number[]"`; + +exports[`useWith R.useWith(Math.pow, [R.dec, R.inc])(3)(4) 1`] = `"number"`; + +exports[`useWith R.useWith(Math.pow, [R.dec, R.inc])(3, 4) 1`] = `"number"`; + +exports[`useWith R.useWith(Math.pow, [R.identity, R.identity])(3, 4) 1`] = `"number"`; + +exports[`useWith R.useWith<'11', '2arity'>()(Math.pow, [R.identity, R.identity])(3)(4) 1`] = `"number"`; + +exports[`values R.values({ a: 1, b: 2, c: 3 }) 1`] = `"number[]"`; + +exports[`valuesIn R.valuesIn(f) 1`] = `"string[]"`; + +exports[`view R.view(headLens, ['a', 'b', 'c']) 1`] = `"any"`; + +exports[`when truncate('0123456789ABC') 1`] = `"string"`; + +exports[`when truncate('12345') 1`] = `"string"`; + +exports[`where R.filter(R.where({ x: R.equals(10) }))(xs) 1`] = `"Dictionary[]"`; + +exports[`where R.filter(R.where({ x: R.equals(10) }), xs) 1`] = `"Dictionary[]"`; + +exports[`where R.where(spec)({ w: 10, x: 2, y: 300 }) 1`] = `"boolean"`; + +exports[`where R.where(spec)({ x: 1, y: 'moo', z: true }) 1`] = `"boolean"`; + +exports[`where R.where(spec, { w: 10, x: 2, y: 300 }) 1`] = `"boolean"`; + +exports[`where R.where(spec, { x: 1, y: 'moo', z: true }) 1`] = `"boolean"`; + +exports[`where R.where(spec2, { x: 2, y: 7 }) 1`] = `"boolean"`; + +exports[`where R.where(spec2, { x: 3, y: 8 }) 1`] = `"boolean"`; + +exports[`whereEq R.whereEq({ a: 'one' }, { a: 'one' }) 1`] = `"boolean"`; + +exports[`whereEq pred 1`] = `"(object: Dictionary) => boolean"`; + +exports[`whereEq pred({ a: 1 }) 1`] = `"boolean"`; + +exports[`whereEq pred({ a: 1, b: 1 }) 1`] = `"boolean"`; + +exports[`whereEq pred({ a: 1, b: 2 }) 1`] = `"boolean"`; + +exports[`whereEq pred({ a: 1, b: 2, c: 3 }) 1`] = `"boolean"`; + +exports[`without R.without([1, 2], [1, 2, 1, 3, 4]) 1`] = `"number[]"`; + +exports[`xprod R.xprod([1, 2])(['a', 'b']) 1`] = `"[number, string][]"`; + +exports[`xprod R.xprod([1, 2], ['a', 'b']) 1`] = `"[number, string][]"`; + +exports[`zip R.zip([1, 2, 3])(['a', 'b', 'c']) 1`] = `"[number, string][]"`; + +exports[`zip R.zip([1, 2, 3], ['a', 'b', 'c']) 1`] = `"[number, string][]"`; + +exports[`zipObj R.zipObj(['a', 'b', 'c'])([1, 2, 3]) 1`] = `"Record<\\"a\\" | \\"b\\" | \\"c\\", number>"`; + +exports[`zipObj R.zipObj(['a', 'b', 'c'], [1, 2, 3]) 1`] = `"Record<\\"a\\" | \\"b\\" | \\"c\\", number>"`; + +exports[`zipWith R.zipWith(f)([1, 2, 3], ['a', 'b', 'c']) 1`] = `"void[]"`; + +exports[`zipWith R.zipWith(f, [1, 2, 3])(['a', 'b', 'c']) 1`] = `"void[]"`; + +exports[`zipWith R.zipWith(f, [1, 2, 3], ['a', 'b', 'c']) 1`] = `"void[]"`; diff --git a/tests/__snapshots__/range.ts.snap b/tests/__snapshots__/range.ts.snap new file mode 100644 index 0000000..7d6c0a7 --- /dev/null +++ b/tests/__snapshots__/range.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_range(number) 1`] = `"(to: number) => number[]"`; + +exports[`R_range(number)(number) 1`] = `"number[]"`; + +exports[`R_range(number, number) 1`] = `"number[]"`; diff --git a/tests/__snapshots__/reduce.ts.snap b/tests/__snapshots__/reduce.ts.snap new file mode 100644 index 0000000..ece5621 --- /dev/null +++ b/tests/__snapshots__/reduce.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_reduce(object_number_to_object)(object)(number_array) 1`] = `"object"`; + +exports[`R_reduce(object_number_to_object, object) 1`] = `"(values: number[] | ArrayLike) => object"`; + +exports[`R_reduce(object_number_to_object, object, number_array) 1`] = `"object"`; diff --git a/tests/__snapshots__/reduceBy.ts.snap b/tests/__snapshots__/reduceBy.ts.snap new file mode 100644 index 0000000..6cf22ec --- /dev/null +++ b/tests/__snapshots__/reduceBy.ts.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_reduceBy(object_number_to_object)(object)(number_to_a_b_c)(number_array) 1`] = `"Partial>"`; + +exports[`R_reduceBy(object_number_to_object)(object)(number_to_string)(number_array) 1`] = `"Partial>"`; + +exports[`R_reduceBy(object_number_to_object, object, number_to_a_b_c) 1`] = `"(values: number[] | ArrayLike) => Partial>"`; + +exports[`R_reduceBy(object_number_to_object, object, number_to_a_b_c, number_array) 1`] = `"Partial>"`; + +exports[`R_reduceBy(object_number_to_object, object, number_to_string) 1`] = `"(values: number[] | ArrayLike) => Partial>"`; + +exports[`R_reduceBy(object_number_to_object, object, number_to_string, number_array) 1`] = `"Partial>"`; diff --git a/tests/__snapshots__/reduceRight.ts.snap b/tests/__snapshots__/reduceRight.ts.snap new file mode 100644 index 0000000..024e24d --- /dev/null +++ b/tests/__snapshots__/reduceRight.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_reduceRight(number_object_to_object)(object)(number_array) 1`] = `"object"`; + +exports[`R_reduceRight(number_object_to_object, object) 1`] = `"(values: number[] | ArrayLike) => object"`; + +exports[`R_reduceRight(number_object_to_object, object, number_array) 1`] = `"object"`; diff --git a/tests/__snapshots__/reduceWhile.ts.snap b/tests/__snapshots__/reduceWhile.ts.snap new file mode 100644 index 0000000..4ee3695 --- /dev/null +++ b/tests/__snapshots__/reduceWhile.ts.snap @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_reduceWhile( + object_number_to_boolean, + object_number_to_object, + object, + number_array, + ) 1`] = `"object"`; + +exports[`R_reduceWhile(object_number_to_boolean)(object_number_to_object)(object)( + number_array, + ) 1`] = `"object"`; + +exports[`R_reduceWhile(object_number_to_boolean, object_number_to_object, object) 1`] = `"(values: number[] | ArrayLike) => object"`; diff --git a/tests/__snapshots__/reduced.ts.snap b/tests/__snapshots__/reduced.ts.snap new file mode 100644 index 0000000..0911ce1 --- /dev/null +++ b/tests/__snapshots__/reduced.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_reduced(object) 1`] = `"Reduced"`; + +exports[`R_reduced(reduced_object) 1`] = `"Reduced"`; diff --git a/tests/__snapshots__/reject.ts.snap b/tests/__snapshots__/reject.ts.snap new file mode 100644 index 0000000..9807b1e --- /dev/null +++ b/tests/__snapshots__/reject.ts.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_reject(string_predicate)(string_array) 1`] = `"string[]"`; + +exports[`R_reject(string_predicate)(string_dictionary) 1`] = `"Partial>"`; + +exports[`R_reject(string_predicate)(string_filterable) 1`] = `"Filterable"`; + +exports[`R_reject(string_predicate, string_array) 1`] = `"string[]"`; + +exports[`R_reject(string_predicate, string_dictionary) 1`] = `"Partial>"`; + +exports[`R_reject(string_predicate, string_filterable) 1`] = `"Filterable"`; diff --git a/tests/__snapshots__/remove.ts.snap b/tests/__snapshots__/remove.ts.snap new file mode 100644 index 0000000..dec0505 --- /dev/null +++ b/tests/__snapshots__/remove.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_remove(number)(number)(boolean_array) 1`] = `"boolean[]"`; + +exports[`R_remove(number, number) 1`] = `"(list: T[]) => T[]"`; + +exports[`R_remove(number, number, boolean_array) 1`] = `"boolean[]"`; diff --git a/tests/__snapshots__/repeat.ts.snap b/tests/__snapshots__/repeat.ts.snap new file mode 100644 index 0000000..06eac3d --- /dev/null +++ b/tests/__snapshots__/repeat.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_repeat(string) 1`] = `"(count: number) => string[]"`; + +exports[`R_repeat(string)(number) 1`] = `"string[]"`; + +exports[`R_repeat(string, number) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/replace.ts.snap b/tests/__snapshots__/replace.ts.snap new file mode 100644 index 0000000..9350168 --- /dev/null +++ b/tests/__snapshots__/replace.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_replace(regex)(string)(string) 1`] = `"string"`; + +exports[`R_replace(regex, string) 1`] = `"(str: string) => string"`; + +exports[`R_replace(regex, string, string) 1`] = `"string"`; diff --git a/tests/__snapshots__/reverse.ts.snap b/tests/__snapshots__/reverse.ts.snap new file mode 100644 index 0000000..20f4614 --- /dev/null +++ b/tests/__snapshots__/reverse.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_reverse(number_list) 1`] = `"number[]"`; + +exports[`R_reverse(string) 1`] = `"string"`; diff --git a/tests/__snapshots__/scan.ts.snap b/tests/__snapshots__/scan.ts.snap new file mode 100644 index 0000000..61e12d9 --- /dev/null +++ b/tests/__snapshots__/scan.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_scan(object_number_to_object)(object)(number_array) 1`] = `"object[]"`; + +exports[`R_scan(object_number_to_object, object) 1`] = `"(values: number[] | ArrayLike) => object[]"`; + +exports[`R_scan(object_number_to_object, object, number_array) 1`] = `"object[]"`; diff --git a/tests/__snapshots__/sequence.ts.snap b/tests/__snapshots__/sequence.ts.snap new file mode 100644 index 0000000..af6e1f7 --- /dev/null +++ b/tests/__snapshots__/sequence.ts.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_sequence(any_applicative.of, [any_applicative]) 1`] = `"Applicative<{}[]>"`; + +exports[`R_sequence(any_applicative.of, any_applicative_traverable) 1`] = `"Applicative>"`; + +exports[`R_sequence(number_applicative.of, [number_applicative]) 1`] = `"Applicative<{}[]>"`; + +exports[`R_sequence(number_applicative.of, any_applicative_traverable) 1`] = `"Applicative>"`; + +exports[`R_sequence(any_applicative.of, [any_applicative]) 1`] = `"Applicative"`; + +exports[`R_sequence(any_applicative.of, any_applicative_traverable) 1`] = `"Applicative>"`; diff --git a/tests/__snapshots__/set.ts.snap b/tests/__snapshots__/set.ts.snap new file mode 100644 index 0000000..d45ebb0 --- /dev/null +++ b/tests/__snapshots__/set.ts.snap @@ -0,0 +1,23 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_set(menual_lens_number_object)(number)(object) 1`] = `"object"`; + +exports[`R_set(menual_lens_number_object, number) 1`] = `"(target: object) => object"`; + +exports[`R_set(menual_lens_number_object, number, object) 1`] = `"object"`; + +exports[`R_set(pseudo_lens_1)(number)(number_array) 1`] = `"{}"`; + +exports[`R_set(pseudo_lens_1)(number)(string_number_tuple) 1`] = `"{}"`; + +exports[`R_set(pseudo_lens_1, number) 1`] = `"(target: {}) => {}"`; + +exports[`R_set(pseudo_lens_1, number, number_array) 1`] = `"number[]"`; + +exports[`R_set(pseudo_lens_1, number, string_number_tuple) 1`] = `"[string, number]"`; + +exports[`R_set(pseudo_lens_a)(number)(a_1_b_2_c_3) 1`] = `"Record<\\"a\\", any>"`; + +exports[`R_set(pseudo_lens_a, number) 1`] = `"(target: Record<\\"a\\", any>) => Record<\\"a\\", any>"`; + +exports[`R_set(pseudo_lens_a, number, a_1_b_2_c_3) 1`] = `"{ a: 1; b: 2; c: 3; }"`; diff --git a/tests/__snapshots__/slice.ts.snap b/tests/__snapshots__/slice.ts.snap new file mode 100644 index 0000000..bd16606 --- /dev/null +++ b/tests/__snapshots__/slice.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_slice(number)(number)(object_list) 1`] = `"object[]"`; + +exports[`R_slice(number)(number)(string) 1`] = `"string"`; + +exports[`R_slice(number, number, object_list) 1`] = `"object[]"`; + +exports[`R_slice(number, number, string) 1`] = `"string"`; diff --git a/tests/__snapshots__/sort.ts.snap b/tests/__snapshots__/sort.ts.snap new file mode 100644 index 0000000..943da84 --- /dev/null +++ b/tests/__snapshots__/sort.ts.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_sort(object_object_to_number) 1`] = `"(list: List) => object[]"`; + +exports[`R_sort(object_object_to_number)(object_list) 1`] = `"object[]"`; + +exports[`R_sort(object_object_to_number, object_list) 1`] = `"object[]"`; + +exports[`R_sort(string_string_to_number) 1`] = `"(list: List) => string[]"`; + +exports[`R_sort(string_string_to_number)(string) 1`] = `"string[]"`; + +exports[`R_sort(string_string_to_number, string) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/sortBy.ts.snap b/tests/__snapshots__/sortBy.ts.snap new file mode 100644 index 0000000..983f038 --- /dev/null +++ b/tests/__snapshots__/sortBy.ts.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_sortBy(object_to_number) 1`] = `"(list: List) => object[]"`; + +exports[`R_sortBy(object_to_number)(object_list) 1`] = `"object[]"`; + +exports[`R_sortBy(object_to_number, object_list) 1`] = `"object[]"`; + +exports[`R_sortBy(string_to_number) 1`] = `"(list: List) => string[]"`; + +exports[`R_sortBy(string_to_number)(string) 1`] = `"string[]"`; + +exports[`R_sortBy(string_to_number, string) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/sortWith.ts.snap b/tests/__snapshots__/sortWith.ts.snap new file mode 100644 index 0000000..0180c7a --- /dev/null +++ b/tests/__snapshots__/sortWith.ts.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_sortWith([object_object_to_number]) 1`] = `"(list: List) => object[]"`; + +exports[`R_sortWith([object_object_to_number])(object_list) 1`] = `"object[]"`; + +exports[`R_sortWith([object_object_to_number], object_list) 1`] = `"object[]"`; + +exports[`R_sortWith([string_string_to_number]) 1`] = `"(list: List) => string[]"`; + +exports[`R_sortWith([string_string_to_number])(string) 1`] = `"string[]"`; + +exports[`R_sortWith([string_string_to_number], string) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/split.ts.snap b/tests/__snapshots__/split.ts.snap new file mode 100644 index 0000000..15ecf35 --- /dev/null +++ b/tests/__snapshots__/split.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_split(regex) 1`] = `"(str: string) => string[]"`; + +exports[`R_split(regex)(string) 1`] = `"string[]"`; + +exports[`R_split(regex, string) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/splitAt.ts.snap b/tests/__snapshots__/splitAt.ts.snap new file mode 100644 index 0000000..d29502d --- /dev/null +++ b/tests/__snapshots__/splitAt.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_splitAt(number)(object_list) 1`] = `"[object[], object[]]"`; + +exports[`R_splitAt(number)(string) 1`] = `"[string, string]"`; + +exports[`R_splitAt(number, object_list) 1`] = `"[object[], object[]]"`; + +exports[`R_splitAt(number, string) 1`] = `"[string, string]"`; diff --git a/tests/__snapshots__/splitEvery.ts.snap b/tests/__snapshots__/splitEvery.ts.snap new file mode 100644 index 0000000..a240e0f --- /dev/null +++ b/tests/__snapshots__/splitEvery.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_splitEvery(number)(object_list) 1`] = `"object[][]"`; + +exports[`R_splitEvery(number)(string) 1`] = `"string[]"`; + +exports[`R_splitEvery(number, object_list) 1`] = `"object[][]"`; + +exports[`R_splitEvery(number, string) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/splitWhen.ts.snap b/tests/__snapshots__/splitWhen.ts.snap new file mode 100644 index 0000000..8c0d875 --- /dev/null +++ b/tests/__snapshots__/splitWhen.ts.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_splitWhen(object_to_boolean) 1`] = `"(list: List) => [object[], object[]]"`; + +exports[`R_splitWhen(object_to_boolean)(object_list) 1`] = `"[object[], object[]]"`; + +exports[`R_splitWhen(object_to_boolean, object_list) 1`] = `"[object[], object[]]"`; + +exports[`R_splitWhen(string_to_boolean) 1`] = `"(list: List) => [string[], string[]]"`; + +exports[`R_splitWhen(string_to_boolean)(string) 1`] = `"[string[], string[]]"`; + +exports[`R_splitWhen(string_to_boolean, string) 1`] = `"[string[], string[]]"`; diff --git a/tests/__snapshots__/startsWith.ts.snap b/tests/__snapshots__/startsWith.ts.snap new file mode 100644 index 0000000..dff7add --- /dev/null +++ b/tests/__snapshots__/startsWith.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_startsWith(boolean_array) 1`] = `"(list: boolean[]) => boolean"`; + +exports[`R_startsWith(boolean_array, boolean_array) 1`] = `"boolean"`; + +exports[`R_startsWith(string) 1`] = `"(list: string) => boolean"`; + +exports[`R_startsWith(string, string) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/subtract.ts.snap b/tests/__snapshots__/subtract.ts.snap new file mode 100644 index 0000000..da0d032 --- /dev/null +++ b/tests/__snapshots__/subtract.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_subtract(number)(number) 1`] = `"number"`; + +exports[`R_subtract(number, number) 1`] = `"number"`; diff --git a/tests/__snapshots__/sum.ts.snap b/tests/__snapshots__/sum.ts.snap new file mode 100644 index 0000000..d59df97 --- /dev/null +++ b/tests/__snapshots__/sum.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_sum(number_array) 1`] = `"number"`; diff --git a/tests/__snapshots__/symmetricDifference.ts.snap b/tests/__snapshots__/symmetricDifference.ts.snap new file mode 100644 index 0000000..4a32249 --- /dev/null +++ b/tests/__snapshots__/symmetricDifference.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_symmetricDifference(number_array) 1`] = `"(b: number[] | ArrayLike) => number[]"`; + +exports[`R_symmetricDifference(number_array, number_array) 1`] = `"number[]"`; diff --git a/tests/__snapshots__/symmetricDifferenceWith.ts.snap b/tests/__snapshots__/symmetricDifferenceWith.ts.snap new file mode 100644 index 0000000..4120bbd --- /dev/null +++ b/tests/__snapshots__/symmetricDifferenceWith.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_symmetricDifferenceWith(number_number_to_boolean, number_array) 1`] = `"(b: number[] | ArrayLike) => number[]"`; + +exports[`R_symmetricDifferenceWith(number_number_to_boolean, number_array, number_array) 1`] = `"number[]"`; diff --git a/tests/__snapshots__/tail.ts.snap b/tests/__snapshots__/tail.ts.snap new file mode 100644 index 0000000..7b56058 --- /dev/null +++ b/tests/__snapshots__/tail.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_tail(string) 1`] = `"string"`; + +exports[`R_tail(string_array) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/take.ts.snap b/tests/__snapshots__/take.ts.snap new file mode 100644 index 0000000..0616ee9 --- /dev/null +++ b/tests/__snapshots__/take.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_take(number, boolean_array) 1`] = `"boolean[]"`; + +exports[`R_take(number, string) 1`] = `"string"`; diff --git a/tests/__snapshots__/takeLast.ts.snap b/tests/__snapshots__/takeLast.ts.snap new file mode 100644 index 0000000..dd09e2e --- /dev/null +++ b/tests/__snapshots__/takeLast.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_takeLast(number, boolean_array) 1`] = `"boolean[]"`; + +exports[`R_takeLast(number, string) 1`] = `"string"`; diff --git a/tests/__snapshots__/takeLastWhile.ts.snap b/tests/__snapshots__/takeLastWhile.ts.snap new file mode 100644 index 0000000..0ee5169 --- /dev/null +++ b/tests/__snapshots__/takeLastWhile.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_takeLastWhile(string_to_boolean) 1`] = `"(list: string[] | ArrayLike) => string[]"`; + +exports[`R_takeLastWhile(string_to_boolean, string_array) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/takeWhile.ts.snap b/tests/__snapshots__/takeWhile.ts.snap new file mode 100644 index 0000000..cdd1840 --- /dev/null +++ b/tests/__snapshots__/takeWhile.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_takeWhile(string_to_boolean) 1`] = `"(list: string[] | ArrayLike) => string[]"`; + +exports[`R_takeWhile(string_to_boolean, string_array) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/tap.ts.snap b/tests/__snapshots__/tap.ts.snap new file mode 100644 index 0000000..b1aeb30 --- /dev/null +++ b/tests/__snapshots__/tap.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_tap(string_to_void) 1`] = `"(value: string) => string"`; + +exports[`R_tap(string_to_void, string) 1`] = `"string"`; diff --git a/tests/__snapshots__/test.ts.snap b/tests/__snapshots__/test.ts.snap new file mode 100644 index 0000000..9e31b54 --- /dev/null +++ b/tests/__snapshots__/test.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_test(regex) 1`] = `"(str: string) => boolean"`; + +exports[`R_test(regex, string) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/times.ts.snap b/tests/__snapshots__/times.ts.snap new file mode 100644 index 0000000..caba4fa --- /dev/null +++ b/tests/__snapshots__/times.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_times(number_to_object) 1`] = `"(n: number) => object[]"`; + +exports[`R_times(number_to_object, number) 1`] = `"object[]"`; diff --git a/tests/__snapshots__/toLower.ts.snap b/tests/__snapshots__/toLower.ts.snap new file mode 100644 index 0000000..acb58b9 --- /dev/null +++ b/tests/__snapshots__/toLower.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_toLower(string) 1`] = `"string"`; diff --git a/tests/__snapshots__/toPairs.ts.snap b/tests/__snapshots__/toPairs.ts.snap new file mode 100644 index 0000000..4b451fd --- /dev/null +++ b/tests/__snapshots__/toPairs.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_toPairs(a_1_b_2_c_3) 1`] = `"[\\"a\\" | \\"b\\" | \\"c\\", 1 | 2 | 3][]"`; + +exports[`R_toPairs(string_number_record) 1`] = `"[string, number][]"`; diff --git a/tests/__snapshots__/toPairsIn.ts.snap b/tests/__snapshots__/toPairsIn.ts.snap new file mode 100644 index 0000000..bebdbe6 --- /dev/null +++ b/tests/__snapshots__/toPairsIn.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_toPairsIn(a_1_b_2_c_3) 1`] = `"[\\"a\\" | \\"b\\" | \\"c\\", 1 | 2 | 3][]"`; + +exports[`R_toPairsIn(string_number_record) 1`] = `"[string, number][]"`; diff --git a/tests/__snapshots__/toString.ts.snap b/tests/__snapshots__/toString.ts.snap new file mode 100644 index 0000000..1b47b71 --- /dev/null +++ b/tests/__snapshots__/toString.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_toString(number) 1`] = `"string"`; + +exports[`R_toString(object) 1`] = `"string"`; diff --git a/tests/__snapshots__/toUpper.ts.snap b/tests/__snapshots__/toUpper.ts.snap new file mode 100644 index 0000000..32f2485 --- /dev/null +++ b/tests/__snapshots__/toUpper.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_toUpper(string) 1`] = `"string"`; diff --git a/tests/__snapshots__/transduce.ts.snap b/tests/__snapshots__/transduce.ts.snap new file mode 100644 index 0000000..57bf10c --- /dev/null +++ b/tests/__snapshots__/transduce.ts.snap @@ -0,0 +1,18 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_transduce( + number_object_transformer_identity, + object_number_to_object, + object, + number_array, + ) 1`] = `"object"`; + +exports[`R_transduce( + number_object_transformer_identity, + object_number_to_object, + object, + ) 1`] = `"(values: number[]) => object"`; + +exports[`R_transduce(number_object_transformer_identity)(object_number_to_object)( + object, + )(number_array) 1`] = `"object"`; diff --git a/tests/__snapshots__/transpose.ts.snap b/tests/__snapshots__/transpose.ts.snap new file mode 100644 index 0000000..a4bbd06 --- /dev/null +++ b/tests/__snapshots__/transpose.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_transpose(boolean_array_array) 1`] = `"boolean[][]"`; + +exports[`R_transpose(number_array_array) 1`] = `"number[][]"`; + +exports[`R_transpose(number_list_list) 1`] = `"number[][]"`; diff --git a/tests/__snapshots__/traverse.ts.snap b/tests/__snapshots__/traverse.ts.snap new file mode 100644 index 0000000..e9afc04 --- /dev/null +++ b/tests/__snapshots__/traverse.ts.snap @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_traverse( + number_applicative.of, + number_to_string_applicative, + number_traverable, + ) 1`] = `"Applicative>"`; + +exports[`R_traverse(number_applicative.of)(number_to_string_applicative)( + number_traverable, + ) 1`] = `"Applicative>"`; + +exports[`R_traverse(number_applicative.of)(number_to_string_applicative)(number_array) 1`] = `"Applicative"`; + +exports[`R_traverse(number_applicative.of, number_to_string_applicative, number_array) 1`] = `"Applicative"`; diff --git a/tests/__snapshots__/trim.ts.snap b/tests/__snapshots__/trim.ts.snap new file mode 100644 index 0000000..f506480 --- /dev/null +++ b/tests/__snapshots__/trim.ts.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_trim(string) 1`] = `"string"`; diff --git a/tests/__snapshots__/tryCatch.ts.snap b/tests/__snapshots__/tryCatch.ts.snap new file mode 100644 index 0000000..4e7ed75 --- /dev/null +++ b/tests/__snapshots__/tryCatch.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_tryCatch(T_to_T) 1`] = `"(catcher: (x: T) => T) => (x: T) => T"`; + +exports[`R_tryCatch(T_to_T)(T_to_T) 1`] = `"(x: T) => T"`; + +exports[`R_tryCatch(T_to_T, T_to_T) 1`] = `"(x: T) => T"`; diff --git a/tests/__snapshots__/type.ts.snap b/tests/__snapshots__/type.ts.snap new file mode 100644 index 0000000..79ff39b --- /dev/null +++ b/tests/__snapshots__/type.ts.snap @@ -0,0 +1,9 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_type(any) 1`] = `"string"`; + +exports[`R_type(boolean) 1`] = `"\\"Boolean\\""`; + +exports[`R_type(number) 1`] = `"\\"Number\\""`; + +exports[`R_type(object) 1`] = `"string"`; diff --git a/tests/__snapshots__/unapply.ts.snap b/tests/__snapshots__/unapply.ts.snap new file mode 100644 index 0000000..670cee1 --- /dev/null +++ b/tests/__snapshots__/unapply.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_unapply(number_array_to_string) 1`] = `"(...args: any[]) => string"`; + +exports[`R_unapply(number_array_to_string)(...number_array) 1`] = `"string"`; diff --git a/tests/__snapshots__/unary.ts.snap b/tests/__snapshots__/unary.ts.snap new file mode 100644 index 0000000..a7317a5 --- /dev/null +++ b/tests/__snapshots__/unary.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_unary(object_variadic) 1`] = `"(a: any) => object"`; + +exports[`R_unary(string_number_symbol_to_boolean) 1`] = `"(a: string) => boolean"`; diff --git a/tests/__snapshots__/uncurryN.ts.snap b/tests/__snapshots__/uncurryN.ts.snap new file mode 100644 index 0000000..3a03cd8 --- /dev/null +++ b/tests/__snapshots__/uncurryN.ts.snap @@ -0,0 +1,17 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_uncurryN(0, string_to_object) 1`] = `"() => any"`; + +exports[`R_uncurryN(1, number_boolean_to_string) 1`] = `"CurriedFunction1"`; + +exports[`R_uncurryN(4, number_args_to_boolean) 1`] = `"CurriedFunction4"`; + +exports[`R_uncurryN(7, seven_string_to_number) 1`] = `"(...args: any[]) => any"`; + +exports[`R_uncurryN(4, number_args_to_boolean) 1`] = `"CurriedFunction4"`; + +exports[`R_uncurryN(7, seven_string_to_number) 1`] = `"(...args: any[]) => number"`; + +exports[`R_uncurryN(0, string_to_object) 1`] = `"() => object"`; + +exports[`R_uncurryN(1, number_boolean_to_string) 1`] = `"CurriedFunction1"`; diff --git a/tests/__snapshots__/unfold.ts.snap b/tests/__snapshots__/unfold.ts.snap new file mode 100644 index 0000000..c6d80bd --- /dev/null +++ b/tests/__snapshots__/unfold.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_unfold(string_to_object_string_tuple_or_false) 1`] = `"(initial: string) => object[]"`; + +exports[`R_unfold(string_to_object_string_tuple_or_false)(string) 1`] = `"object[]"`; + +exports[`R_unfold(string_to_object_string_tuple_or_false, string) 1`] = `"object[]"`; diff --git a/tests/__snapshots__/union.ts.snap b/tests/__snapshots__/union.ts.snap new file mode 100644 index 0000000..79ab0be --- /dev/null +++ b/tests/__snapshots__/union.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_union(number_array) 1`] = `"(b: number[] | ArrayLike) => number[]"`; + +exports[`R_union(number_array, number_array) 1`] = `"number[]"`; diff --git a/tests/__snapshots__/unionWith.ts.snap b/tests/__snapshots__/unionWith.ts.snap new file mode 100644 index 0000000..771c416 --- /dev/null +++ b/tests/__snapshots__/unionWith.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_unionWith(number_number_to_boolean, number_array) 1`] = `"(b: number[] | ArrayLike) => number[]"`; + +exports[`R_unionWith(number_number_to_boolean, number_array, number_array) 1`] = `"number[]"`; diff --git a/tests/__snapshots__/uniq.ts.snap b/tests/__snapshots__/uniq.ts.snap new file mode 100644 index 0000000..54d7de6 --- /dev/null +++ b/tests/__snapshots__/uniq.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_uniq(number_array) 1`] = `"number[]"`; + +exports[`R_uniq(string_array) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/uniqBy.ts.snap b/tests/__snapshots__/uniqBy.ts.snap new file mode 100644 index 0000000..5f4765b --- /dev/null +++ b/tests/__snapshots__/uniqBy.ts.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_uniqBy(number_to_object) 1`] = `"(list: number[] | ArrayLike) => number[]"`; + +exports[`R_uniqBy(number_to_object)(number_array) 1`] = `"number[]"`; + +exports[`R_uniqBy(number_to_object, number_array) 1`] = `"number[]"`; + +exports[`R_uniqBy(string_to_any) 1`] = `"(list: string[] | ArrayLike) => string[]"`; + +exports[`R_uniqBy(string_to_any)(string_array) 1`] = `"string[]"`; + +exports[`R_uniqBy(string_to_any, string_array) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/uniqWith.ts.snap b/tests/__snapshots__/uniqWith.ts.snap new file mode 100644 index 0000000..7f59fbc --- /dev/null +++ b/tests/__snapshots__/uniqWith.ts.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_uniqWith(number_number_to_boolean) 1`] = `"(list: number[] | ArrayLike) => number[]"`; + +exports[`R_uniqWith(number_number_to_boolean)(number_array) 1`] = `"number[]"`; + +exports[`R_uniqWith(number_number_to_boolean, number_array) 1`] = `"number[]"`; + +exports[`R_uniqWith(string_string_to_boolean) 1`] = `"(list: string[] | ArrayLike) => string[]"`; + +exports[`R_uniqWith(string_string_to_boolean)(string_array) 1`] = `"string[]"`; + +exports[`R_uniqWith(string_string_to_boolean, string_array) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/unless.ts.snap b/tests/__snapshots__/unless.ts.snap new file mode 100644 index 0000000..b2b38f8 --- /dev/null +++ b/tests/__snapshots__/unless.ts.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_unless(number_is_1)(number_to_string)(number) 1`] = `"string | 1"`; + +exports[`R_unless(number_is_1, number_to_string) 1`] = `"(value: number) => string | 1"`; + +exports[`R_unless(number_is_1, number_to_string, number) 1`] = `"string | 1"`; + +exports[`R_unless(number_to_boolean)(number_to_string)(number) 1`] = `"string | number"`; + +exports[`R_unless(number_to_boolean, number_to_string) 1`] = `"(value: number) => string | number"`; + +exports[`R_unless(number_to_boolean, number_to_string, number) 1`] = `"string | number"`; diff --git a/tests/__snapshots__/unnest.ts.snap b/tests/__snapshots__/unnest.ts.snap new file mode 100644 index 0000000..32c127e --- /dev/null +++ b/tests/__snapshots__/unnest.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_unnest(number_array) 1`] = `"number[]"`; + +exports[`R_unnest(number_array_array) 1`] = `"number[]"`; diff --git a/tests/__snapshots__/until.ts.snap b/tests/__snapshots__/until.ts.snap new file mode 100644 index 0000000..9de8fcc --- /dev/null +++ b/tests/__snapshots__/until.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_until(number_to_boolean)(number_to_number)(number) 1`] = `"number"`; + +exports[`R_until(number_to_boolean, number_to_number) 1`] = `"(initial: number) => number"`; + +exports[`R_until(number_to_boolean, number_to_number, number) 1`] = `"number"`; diff --git a/tests/__snapshots__/update.ts.snap b/tests/__snapshots__/update.ts.snap new file mode 100644 index 0000000..9698b8b --- /dev/null +++ b/tests/__snapshots__/update.ts.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_update(number)(boolean)(string_array) 1`] = `"(string | boolean)[]"`; + +exports[`R_update(number)(string)(string_array) 1`] = `"string[]"`; + +exports[`R_update(number, boolean) 1`] = `"(list: U[] | ArrayLike) => (boolean | U)[]"`; + +exports[`R_update(number, boolean, string_array) 1`] = `"(string | boolean)[]"`; + +exports[`R_update(number, string, string_array) 1`] = `"string[]"`; diff --git a/tests/__snapshots__/useWith.ts.snap b/tests/__snapshots__/useWith.ts.snap new file mode 100644 index 0000000..5575b65 --- /dev/null +++ b/tests/__snapshots__/useWith.ts.snap @@ -0,0 +1,21 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_useWith(any_args_to_object) 1`] = `"(fns: never[]) => () => object"`; + +exports[`R_useWith(string_number_boolean_to_object) 1`] = `"(fns: [(value: T1) => string, (value: T2) => number, (value: T3) => boolean]) => CurriedFunction3"`; + +exports[`R_useWith(string_number_boolean_to_object)([ + number_to_string, + symbol_to_number, + number_to_boolean, + ]) 1`] = `"CurriedFunction3"`; + +exports[`R_useWith(string_number_boolean_to_object, [ + number_to_string, + symbol_to_number, + number_to_boolean, + ]) 1`] = `"CurriedFunction3"`; + +exports[`R_useWith<'1', '2arity'>()(any_args_to_object) 1`] = `"(fns: [(value: T1) => any, (value: T2) => any]) => CurriedFunction2"`; + +exports[`R_useWith<'1', 'variadic'>()(any_args_to_object) 1`] = `"(fns: Function[]) => (...args: any[]) => object"`; diff --git a/tests/__snapshots__/values.ts.snap b/tests/__snapshots__/values.ts.snap new file mode 100644 index 0000000..ea7ca53 --- /dev/null +++ b/tests/__snapshots__/values.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_values(a_1_b_2_c_3) 1`] = `"(1 | 2 | 3)[]"`; + +exports[`R_values(object) 1`] = `"any[]"`; diff --git a/tests/__snapshots__/valuesIn.ts.snap b/tests/__snapshots__/valuesIn.ts.snap new file mode 100644 index 0000000..f3a8d69 --- /dev/null +++ b/tests/__snapshots__/valuesIn.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_valuesIn(a_1_b_2_c_3) 1`] = `"(1 | 2 | 3)[]"`; + +exports[`R_valuesIn(object) 1`] = `"any[]"`; diff --git a/tests/__snapshots__/view.ts.snap b/tests/__snapshots__/view.ts.snap new file mode 100644 index 0000000..ac2bb55 --- /dev/null +++ b/tests/__snapshots__/view.ts.snap @@ -0,0 +1,23 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_view(menual_lens_number_object) 1`] = `"(target: object) => number"`; + +exports[`R_view(menual_lens_number_object)(object) 1`] = `"number"`; + +exports[`R_view(menual_lens_number_object, object) 1`] = `"number"`; + +exports[`R_view(pseudo_lens_1) 1`] = `"(target: U) => U[\\"1\\"]"`; + +exports[`R_view(pseudo_lens_1)(number_array) 1`] = `"any"`; + +exports[`R_view(pseudo_lens_1)(string_number_tuple) 1`] = `"number"`; + +exports[`R_view(pseudo_lens_1, number_array) 1`] = `"any"`; + +exports[`R_view(pseudo_lens_1, string_number_tuple) 1`] = `"number"`; + +exports[`R_view(pseudo_lens_a) 1`] = `">(target: U) => U[\\"a\\"]"`; + +exports[`R_view(pseudo_lens_a)(a_1_b_2_c_3) 1`] = `"1"`; + +exports[`R_view(pseudo_lens_a, a_1_b_2_c_3) 1`] = `"1"`; diff --git a/tests/__snapshots__/when.ts.snap b/tests/__snapshots__/when.ts.snap new file mode 100644 index 0000000..dead1e7 --- /dev/null +++ b/tests/__snapshots__/when.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_when(number_to_boolean)(number_to_string)(number) 1`] = `"string | number"`; + +exports[`R_when(number_to_boolean, number_to_string) 1`] = `"(value: number) => string | number"`; + +exports[`R_when(number_to_boolean, number_to_string, number) 1`] = `"string | number"`; diff --git a/tests/__snapshots__/where.ts.snap b/tests/__snapshots__/where.ts.snap new file mode 100644 index 0000000..9fe35ee --- /dev/null +++ b/tests/__snapshots__/where.ts.snap @@ -0,0 +1,21 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_where(a_b_c_number_to_boolean) 1`] = `"(object: Dictionary) => boolean"`; + +exports[`R_where(a_b_c_number_to_boolean)(a_1_b_2_c_3) 1`] = `"boolean"`; + +exports[`R_where(a_b_c_number_to_boolean)(number_dictionary) 1`] = `"boolean"`; + +exports[`R_where(a_b_c_number_to_boolean, a_1_b_2_c_3) 1`] = `"boolean"`; + +exports[`R_where(a_b_c_number_to_boolean, number_dictionary) 1`] = `"boolean"`; + +exports[`R_where(dictionary_of_number_to_boolean) 1`] = `"(object: Dictionary) => boolean"`; + +exports[`R_where(dictionary_of_number_to_boolean)(a_1_b_2_c_3) 1`] = `"boolean"`; + +exports[`R_where(dictionary_of_number_to_boolean)(number_dictionary) 1`] = `"boolean"`; + +exports[`R_where(dictionary_of_number_to_boolean, a_1_b_2_c_3) 1`] = `"boolean"`; + +exports[`R_where(dictionary_of_number_to_boolean, number_dictionary) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/whereEq.ts.snap b/tests/__snapshots__/whereEq.ts.snap new file mode 100644 index 0000000..4b312ff --- /dev/null +++ b/tests/__snapshots__/whereEq.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_whereEq(number_dictionary) 1`] = `"(object: Dictionary) => boolean"`; + +exports[`R_whereEq(number_dictionary)(a_1_b_2_c_3) 1`] = `"boolean"`; + +exports[`R_whereEq(number_dictionary, a_1_b_2_c_3) 1`] = `"boolean"`; diff --git a/tests/__snapshots__/without.ts.snap b/tests/__snapshots__/without.ts.snap new file mode 100644 index 0000000..2683f21 --- /dev/null +++ b/tests/__snapshots__/without.ts.snap @@ -0,0 +1,5 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_without(number_array) 1`] = `"(b: number[] | ArrayLike) => number[]"`; + +exports[`R_without(number_array, number_array) 1`] = `"number[]"`; diff --git a/tests/__snapshots__/xprod.ts.snap b/tests/__snapshots__/xprod.ts.snap new file mode 100644 index 0000000..21571d7 --- /dev/null +++ b/tests/__snapshots__/xprod.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_xprod(number_array) 1`] = `"(b: U[] | ArrayLike) => [number, U][]"`; + +exports[`R_xprod(number_array)(string_array) 1`] = `"[number, string][]"`; + +exports[`R_xprod(number_array, string_array) 1`] = `"[number, string][]"`; diff --git a/tests/__snapshots__/zip.ts.snap b/tests/__snapshots__/zip.ts.snap new file mode 100644 index 0000000..7b265b7 --- /dev/null +++ b/tests/__snapshots__/zip.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_zip(number_array) 1`] = `"(b: U[] | ArrayLike) => [number, U][]"`; + +exports[`R_zip(number_array)(string_array) 1`] = `"[number, string][]"`; + +exports[`R_zip(number_array, string_array) 1`] = `"[number, string][]"`; diff --git a/tests/__snapshots__/zipObj.ts.snap b/tests/__snapshots__/zipObj.ts.snap new file mode 100644 index 0000000..3cc6199 --- /dev/null +++ b/tests/__snapshots__/zipObj.ts.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_zipObj(['a', 'b']) 1`] = `"(b: U[] | ArrayLike) => Record<\\"a\\" | \\"b\\", U>"`; + +exports[`R_zipObj(['a', 'b'])(number_array) 1`] = `"Record<\\"a\\" | \\"b\\", number>"`; + +exports[`R_zipObj(['a', 'b'], number_array) 1`] = `"Record<\\"a\\" | \\"b\\", number>"`; + +exports[`R_zipObj(number_array) 1`] = `"(b: U[] | ArrayLike) => Record"`; + +exports[`R_zipObj(number_array)(string_array) 1`] = `"Record"`; + +exports[`R_zipObj(number_array, string_array) 1`] = `"Record"`; diff --git a/tests/__snapshots__/zipWith.ts.snap b/tests/__snapshots__/zipWith.ts.snap new file mode 100644 index 0000000..16f1573 --- /dev/null +++ b/tests/__snapshots__/zipWith.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`R_zipWith(number_string_to_object)(number_array)(string_array) 1`] = `"object[]"`; + +exports[`R_zipWith(number_string_to_object, number_array) 1`] = `"(b: string[] | ArrayLike) => object[]"`; + +exports[`R_zipWith(number_string_to_object, number_array, string_array) 1`] = `"object[]"`; diff --git a/tests/add.ts b/tests/add.ts new file mode 100644 index 0000000..35feabb --- /dev/null +++ b/tests/add.ts @@ -0,0 +1,8 @@ +import * as R_add from '../ramda/dist/src/add'; + +declare const number: number; + +// @dts-jest:pass +R_add(number, number); +// @dts-jest:pass +R_add(number)(number); diff --git a/tests/addIndex.ts b/tests/addIndex.ts new file mode 100644 index 0000000..25c1897 --- /dev/null +++ b/tests/addIndex.ts @@ -0,0 +1,27 @@ +import { ListMapper, Morphism, ObjectMapper } from '../ramda/dist/src/$types'; +import * as R_addIndex from '../ramda/dist/src/addIndex'; + +declare const string_to_number_list_mapper: ListMapper; +declare const string_to_number_object_mapper: ObjectMapper< + string, + number, + string +>; + +declare const string_to_number: Morphism; +declare const string_array: string[]; +declare const string_object: Record; + +// @dts-jest:pass +R_addIndex(string_to_number_list_mapper); +// @dts-jest:pass +R_addIndex(string_to_number_list_mapper)(string_to_number); +// @dts-jest:pass +R_addIndex(string_to_number_list_mapper)(string_to_number, string_array); + +// @dts-jest:pass +R_addIndex(string_to_number_object_mapper); +// @dts-jest:pass +R_addIndex(string_to_number_object_mapper)(string_to_number); +// @dts-jest:pass +R_addIndex(string_to_number_object_mapper)(string_to_number, string_object); diff --git a/tests/adjust.ts b/tests/adjust.ts new file mode 100644 index 0000000..bc08ef3 --- /dev/null +++ b/tests/adjust.ts @@ -0,0 +1,20 @@ +import { Morphism } from '../ramda/dist/src/$types'; +import * as R_adjust from '../ramda/dist/src/adjust'; + +declare const string_to_string: Morphism; +declare const string_to_number: Morphism; +declare const string_array: string[]; +declare const number: number; + +// @dts-jest:pass +R_adjust(string_to_number)(number, string_array); +// @dts-jest:pass +R_adjust(string_to_number, number)(string_array); +// @dts-jest:pass +R_adjust(string_to_number, number, string_array); +// @dts-jest:pass +R_adjust(string_to_string)(number, string_array); +// @dts-jest:pass +R_adjust(string_to_string, number)(string_array); +// @dts-jest:pass +R_adjust(string_to_string, number, string_array); diff --git a/tests/all.ts b/tests/all.ts new file mode 100644 index 0000000..63c7112 --- /dev/null +++ b/tests/all.ts @@ -0,0 +1,10 @@ +import { Predicate } from '../ramda/dist/src/$types'; +import * as R_all from '../ramda/dist/src/all'; + +declare const string_predicate: Predicate; +declare const string_array: string[]; + +// @dts-jest:pass +R_all(string_predicate)(string_array); +// @dts-jest:pass +R_all(string_predicate, string_array); diff --git a/tests/allPass.ts b/tests/allPass.ts new file mode 100644 index 0000000..e6d243f --- /dev/null +++ b/tests/allPass.ts @@ -0,0 +1,10 @@ +import { Predicate } from '../ramda/dist/src/$types'; +import * as R_allPass from '../ramda/dist/src/allPass'; + +declare const string_predicate: Predicate; +declare const string_number_preficate: (x: string, y: number) => boolean; + +// @dts-jest:pass +R_allPass([string_predicate, string_predicate]); +// @dts-jest:pass +R_allPass([string_predicate, string_number_preficate]); diff --git a/tests/always.ts b/tests/always.ts new file mode 100644 index 0000000..3274293 --- /dev/null +++ b/tests/always.ts @@ -0,0 +1,8 @@ +import * as R_always from '../ramda/dist/src/always'; + +declare const string: string; + +// @dts-jest:pass +R_always(string); +// @dts-jest:pass +R_always(string)(); diff --git a/tests/and.ts b/tests/and.ts new file mode 100644 index 0000000..72ab6cc --- /dev/null +++ b/tests/and.ts @@ -0,0 +1,9 @@ +import * as R_and from '../ramda/dist/src/and'; + +declare const string: string; +declare const number: number; + +// @dts-jest:pass +R_and(string)(number); +// @dts-jest:pass +R_and(string, number); diff --git a/tests/any.ts b/tests/any.ts new file mode 100644 index 0000000..678b950 --- /dev/null +++ b/tests/any.ts @@ -0,0 +1,10 @@ +import { Predicate } from '../ramda/dist/src/$types'; +import * as R_any from '../ramda/dist/src/any'; + +declare const string_predicate: Predicate; +declare const string_array: string[]; + +// @dts-jest:pass +R_any(string_predicate)(string_array); +// @dts-jest:pass +R_any(string_predicate, string_array); diff --git a/tests/anyPass.ts b/tests/anyPass.ts new file mode 100644 index 0000000..3858029 --- /dev/null +++ b/tests/anyPass.ts @@ -0,0 +1,10 @@ +import { Predicate } from '../ramda/dist/src/$types'; +import * as R_anyPass from '../ramda/dist/src/anyPass'; + +declare const string_predicate: Predicate; +declare const string_number_preficate: (x: string, y: number) => boolean; + +// @dts-jest:pass +R_anyPass([string_predicate, string_predicate]); +// @dts-jest:pass +R_anyPass([string_predicate, string_number_preficate]); diff --git a/tests/ap.ts b/tests/ap.ts new file mode 100644 index 0000000..0ba91c1 --- /dev/null +++ b/tests/ap.ts @@ -0,0 +1,10 @@ +import { Morphism } from '../ramda/dist/src/$types'; +import * as R_ap from '../ramda/dist/src/ap'; + +declare const string_to_number: Morphism; +declare const string_array: string[]; + +// @dts-jest:pass +R_ap([string_to_number])(string_array); +// @dts-jest:pass +R_ap([string_to_number], string_array); diff --git a/tests/aperture.ts b/tests/aperture.ts new file mode 100644 index 0000000..d18bd4e --- /dev/null +++ b/tests/aperture.ts @@ -0,0 +1,9 @@ +import * as R_aperture from '../ramda/dist/src/aperture'; + +declare const number: number; +declare const string_array: string[]; + +// @dts-jest:pass +R_aperture(number)(string_array); +// @dts-jest:pass +R_aperture(number, string_array); diff --git a/tests/append.ts b/tests/append.ts new file mode 100644 index 0000000..14640fc --- /dev/null +++ b/tests/append.ts @@ -0,0 +1,14 @@ +import * as R_append from '../ramda/dist/src/append'; + +declare const string: string; +declare const number: number; +declare const number_array: number[]; + +// @dts-jest:pass +R_append(string)(number_array); +// @dts-jest:pass +R_append(string, number_array); +// @dts-jest:pass +R_append(number)(number_array); +// @dts-jest:pass +R_append(number, number_array); diff --git a/tests/apply.ts b/tests/apply.ts new file mode 100644 index 0000000..a30d514 --- /dev/null +++ b/tests/apply.ts @@ -0,0 +1,9 @@ +import * as R_apply from '../ramda/dist/src/apply'; + +declare const number_and_string_to_boolean: (a: number, b: string) => boolean; +declare const number_and_string: [number, string]; + +// @dts-jest:pass +R_apply(number_and_string_to_boolean)(number_and_string); +// @dts-jest:pass +R_apply(number_and_string_to_boolean, number_and_string); diff --git a/tests/applySpec.ts b/tests/applySpec.ts new file mode 100644 index 0000000..07f4997 --- /dev/null +++ b/tests/applySpec.ts @@ -0,0 +1,20 @@ +import * as R_applySpec from '../ramda/dist/src/applySpec'; + +interface Name { + firstname: string; + lastname: string; +} + +declare const name_spec: { [K in keyof Name]: (fullname: string) => Name[K] }; + +declare const fullname: string; + +// @dts-jest:pass +R_applySpec(name_spec); +// @dts-jest:pass +R_applySpec(name_spec)(fullname); + +// @dts-jest:pass +R_applySpec(name_spec); +// @dts-jest:pass +R_applySpec(name_spec)(fullname); diff --git a/tests/ascend.ts b/tests/ascend.ts new file mode 100644 index 0000000..e3c6bff --- /dev/null +++ b/tests/ascend.ts @@ -0,0 +1,13 @@ +import { Morphism, Ordered } from '../ramda/dist/src/$types'; +import * as R_ascend from '../ramda/dist/src/ascend'; + +declare const get_order_from_object: Morphism; +declare const object_a: object; +declare const object_b: object; + +// @dts-jest:pass +R_ascend(get_order_from_object)(object_a)(object_b); +// @dts-jest:pass +R_ascend(get_order_from_object, object_a)(object_b); +// @dts-jest:pass +R_ascend(get_order_from_object, object_a, object_b); diff --git a/tests/assoc.ts b/tests/assoc.ts new file mode 100644 index 0000000..4dcbd41 --- /dev/null +++ b/tests/assoc.ts @@ -0,0 +1,16 @@ +import * as R_assoc from '../ramda/dist/src/assoc'; + +declare const symbol_property: symbol; +declare const string_property: string; +declare const number_value: number; +declare const object: object; + +// @dts-jest:pass +R_assoc(symbol_property, number_value, object); +// @dts-jest:pass +R_assoc(symbol_property)(number_value)(object); + +// @dts-jest:pass +R_assoc(string_property, number_value, object); +// @dts-jest:pass +R_assoc(string_property)(number_value)(object); diff --git a/tests/assocPath.ts b/tests/assocPath.ts new file mode 100644 index 0000000..dd6af8e --- /dev/null +++ b/tests/assocPath.ts @@ -0,0 +1,11 @@ +import { Path } from '../ramda/dist/src/$types'; +import * as R_assocPath from '../ramda/dist/src/assocPath'; + +declare const path: Path; +declare const number_value: number; +declare const object: object; + +// @dts-jest:pass +R_assocPath(path, number_value, object); +// @dts-jest:pass +R_assocPath(path)(number_value)(object); diff --git a/tests/binary.ts b/tests/binary.ts new file mode 100644 index 0000000..20bcf28 --- /dev/null +++ b/tests/binary.ts @@ -0,0 +1,14 @@ +import { Variadic } from '../ramda/dist/src/$types'; +import * as R_binary from '../ramda/dist/src/binary'; + +declare const string_number_symbol_to_boolean: ( + a: string, + b: number, + c: symbol, +) => boolean; +declare const object_variadic: Variadic; + +// @dts-jest:pass +R_binary(string_number_symbol_to_boolean); +// @dts-jest:pass +R_binary(object_variadic); diff --git a/tests/bind.ts b/tests/bind.ts new file mode 100644 index 0000000..75c0be0 --- /dev/null +++ b/tests/bind.ts @@ -0,0 +1,20 @@ +import { Variadic } from '../ramda/dist/src/$types'; +import * as R_bind from '../ramda/dist/src/bind'; + +declare const object: object; +declare const string_number_symbol_to_boolean: ( + a: string, + b: number, + c: symbol, +) => boolean; +declare const object_variadic: Variadic; + +// @dts-jest:pass +R_bind(string_number_symbol_to_boolean); +// @dts-jest:pass +R_bind(string_number_symbol_to_boolean, object); + +// @dts-jest:pass +R_bind(object_variadic); +// @dts-jest:pass +R_bind(object_variadic, object); diff --git a/tests/both.ts b/tests/both.ts new file mode 100644 index 0000000..7df26c4 --- /dev/null +++ b/tests/both.ts @@ -0,0 +1,9 @@ +import { Predicate } from '../ramda/dist/src/$types'; +import * as R_both from '../ramda/dist/src/both'; + +declare const string_predicate: Predicate; + +// @dts-jest:pass +R_both(string_predicate); +// @dts-jest:pass +R_both(string_predicate, string_predicate); diff --git a/tests/call.ts b/tests/call.ts new file mode 100644 index 0000000..bd208e9 --- /dev/null +++ b/tests/call.ts @@ -0,0 +1,7 @@ +import * as R_call from '../ramda/dist/src/call'; + +declare const number_and_string_to_boolean: (a: number, b: string) => boolean; +declare const number_and_string: [number, string]; + +// @dts-jest:pass +R_call(number_and_string_to_boolean, ...number_and_string); diff --git a/tests/chain.ts b/tests/chain.ts new file mode 100644 index 0000000..1a2a9af --- /dev/null +++ b/tests/chain.ts @@ -0,0 +1,32 @@ +import { Chain, List } from '../ramda/dist/src/$types'; +import * as R_chain from '../ramda/dist/src/chain'; + +declare const number_array: number[]; +declare const number_to_string_string_tuple: (x: number) => [string, string]; +declare const number_chain: Chain; +declare const number_chain_to_string_chain: (x: number) => Chain; +declare const string_to_number_list_to_object: ( + x: string, +) => (list: List) => object; +declare const number_list_to_string: (list: List) => string; + +// @dts-jest:pass +R_chain(number_to_string_string_tuple); +// @dts-jest:pass +R_chain(number_to_string_string_tuple)(number_array); +// @dts-jest:pass +R_chain(number_to_string_string_tuple, number_array); + +// @dts-jest:pass +R_chain(number_chain_to_string_chain); +// @dts-jest:pass +R_chain(number_chain_to_string_chain)(number_chain); +// @dts-jest:pass +R_chain(number_chain_to_string_chain, number_chain); + +// @dts-jest:pass +R_chain(string_to_number_list_to_object); +// @dts-jest:pass +R_chain(string_to_number_list_to_object)(number_list_to_string); +// @dts-jest:pass +R_chain(string_to_number_list_to_object, number_list_to_string); diff --git a/tests/clamp.ts b/tests/clamp.ts new file mode 100644 index 0000000..9f8110c --- /dev/null +++ b/tests/clamp.ts @@ -0,0 +1,10 @@ +import * as R_clamp from '../ramda/dist/src/clamp'; + +declare const number: number; + +// @dts-jest:pass +R_clamp(number, number); +// @dts-jest:pass +R_clamp(number)(number); +// @dts-jest:pass +R_clamp(number, number, number); diff --git a/tests/clone.ts b/tests/clone.ts new file mode 100644 index 0000000..2f3649e --- /dev/null +++ b/tests/clone.ts @@ -0,0 +1,10 @@ +import { List } from '../ramda/dist/src/$types'; +import * as R_clone from '../ramda/dist/src/clone'; + +declare const number: number; +declare const string_list: List; + +// @dts-jest:pass +R_clone(number); +// @dts-jest:pass +R_clone(string_list); diff --git a/tests/comparator.ts b/tests/comparator.ts new file mode 100644 index 0000000..5a35448 --- /dev/null +++ b/tests/comparator.ts @@ -0,0 +1,6 @@ +import * as R_comparator from '../ramda/dist/src/comparator'; + +declare const string_string_to_boolean: (a: string, b: string) => boolean; + +// @dts-jest:pass +R_comparator(string_string_to_boolean); diff --git a/tests/complement.ts b/tests/complement.ts new file mode 100644 index 0000000..7b7c862 --- /dev/null +++ b/tests/complement.ts @@ -0,0 +1,9 @@ +import * as R_complement from '../ramda/dist/src/complement'; + +declare const string: string; +declare const string_string_to_boolean: (a: string, b: string) => boolean; + +// @dts-jest:pass +R_complement(string_string_to_boolean); +// @dts-jest:pass +R_complement(string_string_to_boolean)(string, string); diff --git a/tests/compose.ts b/tests/compose.ts new file mode 100644 index 0000000..87cb5fa --- /dev/null +++ b/tests/compose.ts @@ -0,0 +1,83 @@ +import * as R_compose from '../ramda/dist/src/compose'; + +declare const boolean_to_number: (x: boolean) => number; +declare const boolean_to_string: (x: boolean) => string; +declare const number_to_boolean: (x: number) => boolean; +declare const number_to_string: (x: number) => string; +declare const string_to_boolean: (x: string) => boolean; +declare const string_to_number: (x: string) => number; + +declare const a_b_c_d_e_f_to_any: ( + a: null, + b: undefined, + c: boolean, + d: number, + e: string, + f: object, +) => any; + +// @dts-jest:pass +R_compose(boolean_to_number); +// @dts-jest:pass +R_compose(a_b_c_d_e_f_to_any); + +// @dts-jest:pass +R_compose(boolean_to_number, string_to_boolean); +// @dts-jest:pass +R_compose(boolean_to_number, a_b_c_d_e_f_to_any); + +// @dts-jest:pass +R_compose(boolean_to_number, string_to_boolean, number_to_string); +// @dts-jest:pass +R_compose(boolean_to_number, string_to_boolean, a_b_c_d_e_f_to_any); + +// @dts-jest:pass +R_compose( + boolean_to_number, + string_to_boolean, + number_to_string, + string_to_number, +); +// @dts-jest:pass +R_compose( + boolean_to_number, + string_to_boolean, + number_to_string, + a_b_c_d_e_f_to_any, +); + +// @dts-jest:pass +R_compose( + boolean_to_number, + string_to_boolean, + number_to_string, + string_to_number, + boolean_to_string, +); +// @dts-jest:pass +R_compose( + boolean_to_number, + string_to_boolean, + number_to_string, + string_to_number, + a_b_c_d_e_f_to_any, +); + +// @dts-jest:pass +R_compose( + boolean_to_number, + string_to_boolean, + number_to_string, + string_to_number, + boolean_to_string, + number_to_boolean, +); +// @dts-jest:pass +R_compose( + boolean_to_number, + string_to_boolean, + number_to_string, + string_to_number, + boolean_to_string, + a_b_c_d_e_f_to_any, +); diff --git a/tests/composeK.ts b/tests/composeK.ts new file mode 100644 index 0000000..2b66236 --- /dev/null +++ b/tests/composeK.ts @@ -0,0 +1,52 @@ +import { Chain } from '../ramda/dist/src/$types'; +import * as R_composeK from '../ramda/dist/src/composeK'; + +declare const chain_boolean_to_chain_number: ( + x: Chain, +) => Chain; +declare const chain_boolean_to_chain_string: ( + x: Chain, +) => Chain; +declare const chain_number_to_chain_boolean: ( + x: Chain, +) => Chain; +declare const chain_number_to_chain_string: (x: Chain) => Chain; +declare const chain_string_to_chain_boolean: ( + x: Chain, +) => Chain; +declare const chain_string_to_chain_number: (x: Chain) => Chain; + +// @dts-jest:pass +R_composeK(chain_boolean_to_chain_number); +// @dts-jest:pass +R_composeK(chain_boolean_to_chain_number, chain_string_to_chain_boolean); +// @dts-jest:pass +R_composeK( + chain_boolean_to_chain_number, + chain_string_to_chain_boolean, + chain_number_to_chain_string, +); +// @dts-jest:pass +R_composeK( + chain_boolean_to_chain_number, + chain_string_to_chain_boolean, + chain_number_to_chain_string, + chain_string_to_chain_number, +); +// @dts-jest:pass +R_composeK( + chain_boolean_to_chain_number, + chain_string_to_chain_boolean, + chain_number_to_chain_string, + chain_string_to_chain_number, + chain_boolean_to_chain_string, +); +// @dts-jest:pass +R_composeK( + chain_boolean_to_chain_number, + chain_string_to_chain_boolean, + chain_number_to_chain_string, + chain_string_to_chain_number, + chain_boolean_to_chain_string, + chain_number_to_chain_boolean, +); diff --git a/tests/composeP.ts b/tests/composeP.ts new file mode 100644 index 0000000..45b0acf --- /dev/null +++ b/tests/composeP.ts @@ -0,0 +1,91 @@ +import * as R_composeP from '../ramda/dist/src/composeP'; + +declare const boolean_to_number_promise: (x: boolean) => Promise; +declare const boolean_to_string_promise: (x: boolean) => Promise; +declare const number_to_boolean_promise: (x: number) => Promise; +declare const number_to_string_promise: (x: number) => Promise; +declare const string_to_boolean_promise: (x: string) => Promise; +declare const string_to_number_promise: (x: string) => Promise; + +declare const a_b_c_d_e_f_to_any_promise: ( + a: null, + b: undefined, + c: boolean, + d: number, + e: string, + f: object, +) => Promise; + +// @dts-jest:pass +R_composeP(boolean_to_number_promise); +// @dts-jest:pass +R_composeP(a_b_c_d_e_f_to_any_promise); + +// @dts-jest:pass +R_composeP(boolean_to_number_promise, string_to_boolean_promise); +// @dts-jest:pass +R_composeP(boolean_to_number_promise, a_b_c_d_e_f_to_any_promise); + +// @dts-jest:pass +R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + number_to_string_promise, +); +// @dts-jest:pass +R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + a_b_c_d_e_f_to_any_promise, +); + +// @dts-jest:pass +R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + number_to_string_promise, + string_to_number_promise, +); +// @dts-jest:pass +R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + number_to_string_promise, + a_b_c_d_e_f_to_any_promise, +); + +// @dts-jest:pass +R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + number_to_string_promise, + string_to_number_promise, + boolean_to_string_promise, +); +// @dts-jest:pass +R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + number_to_string_promise, + string_to_number_promise, + a_b_c_d_e_f_to_any_promise, +); + +// @dts-jest:pass +R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + number_to_string_promise, + string_to_number_promise, + boolean_to_string_promise, + number_to_boolean_promise, +); +// @dts-jest:pass +R_composeP( + boolean_to_number_promise, + string_to_boolean_promise, + number_to_string_promise, + string_to_number_promise, + boolean_to_string_promise, + a_b_c_d_e_f_to_any_promise, +); diff --git a/tests/concat.ts b/tests/concat.ts new file mode 100644 index 0000000..c150168 --- /dev/null +++ b/tests/concat.ts @@ -0,0 +1,16 @@ +import { List } from '../ramda/dist/src/$types'; +import * as R_concat from '../ramda/dist/src/concat'; + +declare const string: string; +declare const object_array: object[]; +declare const number_array: number[]; +declare const number_list: List; + +// @dts-jest:pass +R_concat(string, string); +// @dts-jest:pass +R_concat(number_array, number_array); +// @dts-jest:pass +R_concat(object_array, number_array); +// @dts-jest:fail +R_concat(number_list, number_list); diff --git a/tests/cond.ts b/tests/cond.ts new file mode 100644 index 0000000..a4ee1e0 --- /dev/null +++ b/tests/cond.ts @@ -0,0 +1,25 @@ +import { Morphism } from '../ramda/dist/src/$types'; +import * as R_cond from '../ramda/dist/src/cond'; + +declare const string_number_to_boolean: (a: string, b: number) => boolean; +declare const string_to_boolean: Morphism; +declare const string_to_number: Morphism; +declare const string_boolean_to_number: (a: string, b: boolean) => number; + +// @dts-jest:pass +R_cond([ + [string_to_boolean, string_to_number], + [string_to_boolean, string_to_number], +]); + +// @dts-jest:pass +R_cond([ + [string_to_boolean, string_to_number], + [string_number_to_boolean, string_to_number], +]); + +// @dts-jest:fail +R_cond([ + [string_to_boolean, string_boolean_to_number], + [string_number_to_boolean, string_to_number], +]); diff --git a/tests/construct.ts b/tests/construct.ts new file mode 100644 index 0000000..05b383d --- /dev/null +++ b/tests/construct.ts @@ -0,0 +1,26 @@ +import * as R_construct from '../ramda/dist/src/construct'; + +declare const new_string_to_object: new (x: string) => object; +declare const new_number_boolean_to_string: new ( + x: number, + y: boolean, +) => string; +declare const new_number_args_to_boolean: new (...args: number[]) => boolean; +declare const new_7_string_to_number: new ( + v1: string, + v2: string, + v3: string, + v4: string, + v5: string, + v6: string, + v7: string, +) => number; + +// @dts-jest:pass +R_construct(new_string_to_object); +// @dts-jest:pass +R_construct(new_number_boolean_to_string); +// @dts-jest:pass +R_construct(new_number_args_to_boolean); +// @dts-jest:pass +R_construct(new_7_string_to_number); diff --git a/tests/constructN.ts b/tests/constructN.ts new file mode 100644 index 0000000..9eec562 --- /dev/null +++ b/tests/constructN.ts @@ -0,0 +1,26 @@ +import * as R_constructN from '../ramda/dist/src/constructN'; + +declare const new_string_to_object: new (x: string) => object; +declare const new_number_boolean_to_string: new ( + x: number, + y: boolean, +) => string; +declare const new_number_args_to_boolean: new (...args: number[]) => boolean; +declare const new_7_string_to_number: new ( + v1: string, + v2: string, + v3: string, + v4: string, + v5: string, + v6: string, + v7: string, +) => number; + +// @dts-jest:pass +R_constructN(0, new_string_to_object); +// @dts-jest:pass +R_constructN(1, new_number_boolean_to_string); +// @dts-jest:pass +R_constructN(4, new_number_args_to_boolean); +// @dts-jest:pass +R_constructN(7, new_7_string_to_number); diff --git a/tests/contains.ts b/tests/contains.ts new file mode 100644 index 0000000..8ed78eb --- /dev/null +++ b/tests/contains.ts @@ -0,0 +1,11 @@ +import * as R_contains from '../ramda/dist/src/contains'; + +declare const string: string; +declare const string_array: string[]; + +// @dts-jest:pass +R_contains(string); +// @dts-jest:pass +R_contains(string, string); +// @dts-jest:pass +R_contains(string, string_array); diff --git a/tests/converge.ts b/tests/converge.ts new file mode 100644 index 0000000..08b99d6 --- /dev/null +++ b/tests/converge.ts @@ -0,0 +1,33 @@ +import * as R_converge from '../ramda/dist/src/converge'; + +declare const any_args_to_object: (...args: any[]) => object; +declare const string_number_boolean_to_object: ( + x: string, + y: number, + z: boolean, +) => object; +declare const string_to_boolean: (x: string) => boolean; +declare const string_to_number: (x: string) => number; +declare const string_to_string: (x: string) => string; + +// @dts-jest:pass +R_converge(string_number_boolean_to_object); +// @dts-jest:pass +R_converge(string_number_boolean_to_object)([ + string_to_string, + string_to_number, + string_to_boolean, +]); +// @dts-jest:pass +R_converge(string_number_boolean_to_object, [ + string_to_string, + string_to_number, + string_to_boolean, +]); + +// @dts-jest:pass +R_converge(any_args_to_object); +// @dts-jest:pass +R_converge<'1', 'i2f2'>()(any_args_to_object); +// @dts-jest:pass +R_converge<'1', 'variadic'>()(any_args_to_object); diff --git a/tests/countBy.ts b/tests/countBy.ts new file mode 100644 index 0000000..d8ff0a3 --- /dev/null +++ b/tests/countBy.ts @@ -0,0 +1,10 @@ +import { Morphism } from '../ramda/dist/src/$types'; +import * as R_countBy from '../ramda/dist/src/countBy'; + +declare const object_to_string: Morphism; +declare const object_array: object[]; + +// @dts-jest:pass +R_countBy(object_to_string); +// @dts-jest:pass +R_countBy(object_to_string, object_array); diff --git a/tests/curry.ts b/tests/curry.ts new file mode 100644 index 0000000..f0adeb6 --- /dev/null +++ b/tests/curry.ts @@ -0,0 +1,23 @@ +import * as R_curry from '../ramda/dist/src/curry'; + +declare const string_to_object: (x: string) => object; +declare const number_boolean_to_string: (x: number, y: boolean) => string; +declare const number_args_to_boolean: (...args: number[]) => boolean; +declare const seven_string_to_number: ( + v1: string, + v2: string, + v3: string, + v4: string, + v5: string, + v6: string, + v7: string, +) => number; + +// @dts-jest:pass +R_curry(string_to_object); +// @dts-jest:pass +R_curry(number_boolean_to_string); +// @dts-jest:pass +R_curry(number_args_to_boolean); +// @dts-jest:pass +R_curry(seven_string_to_number); diff --git a/tests/curryN.ts b/tests/curryN.ts new file mode 100644 index 0000000..210ce0c --- /dev/null +++ b/tests/curryN.ts @@ -0,0 +1,23 @@ +import * as R_curryN from '../ramda/dist/src/curryN'; + +declare const string_to_object: (x: string) => object; +declare const number_boolean_to_string: (x: number, y: boolean) => string; +declare const number_args_to_boolean: (...args: number[]) => boolean; +declare const seven_string_to_number: ( + v1: string, + v2: string, + v3: string, + v4: string, + v5: string, + v6: string, + v7: string, +) => number; + +// @dts-jest:pass +R_curryN(0, string_to_object); +// @dts-jest:pass +R_curryN(1, number_boolean_to_string); +// @dts-jest:pass +R_curryN(4, number_args_to_boolean); +// @dts-jest:pass +R_curryN(7, seven_string_to_number); diff --git a/tests/dec.ts b/tests/dec.ts new file mode 100644 index 0000000..98c3eea --- /dev/null +++ b/tests/dec.ts @@ -0,0 +1,6 @@ +import * as R_dec from '../ramda/dist/src/dec'; + +declare const number: number; + +// @dts-jest:pass +R_dec(number); diff --git a/tests/defaultTo.ts b/tests/defaultTo.ts new file mode 100644 index 0000000..f8fa9f3 --- /dev/null +++ b/tests/defaultTo.ts @@ -0,0 +1,13 @@ +import * as R_defaultTo from '../ramda/dist/src/defaultTo'; + +declare const string: string; +declare const number_or_undefined: number | undefined; + +// @dts-jest:pass +R_defaultTo(string)(undefined); +// @dts-jest:pass +R_defaultTo(string, undefined); +// @dts-jest:pass +R_defaultTo(string)(number_or_undefined); +// @dts-jest:pass +R_defaultTo(string, number_or_undefined); diff --git a/tests/descend.ts b/tests/descend.ts new file mode 100644 index 0000000..8056515 --- /dev/null +++ b/tests/descend.ts @@ -0,0 +1,13 @@ +import { Morphism, Ordered } from '../ramda/dist/src/$types'; +import * as R_descend from '../ramda/dist/src/descend'; + +declare const get_order_from_object: Morphism; +declare const object_a: object; +declare const object_b: object; + +// @dts-jest:pass +R_descend(get_order_from_object)(object_a)(object_b); +// @dts-jest:pass +R_descend(get_order_from_object, object_a)(object_b); +// @dts-jest:pass +R_descend(get_order_from_object, object_a, object_b); diff --git a/tests/difference.ts b/tests/difference.ts new file mode 100644 index 0000000..c875ced --- /dev/null +++ b/tests/difference.ts @@ -0,0 +1,8 @@ +import * as R_difference from '../ramda/dist/src/difference'; + +declare const number_array: number[]; + +// @dts-jest:pass +R_difference(number_array); +// @dts-jest:pass +R_difference(number_array, number_array); diff --git a/tests/differenceWith.ts b/tests/differenceWith.ts new file mode 100644 index 0000000..bdfc5a5 --- /dev/null +++ b/tests/differenceWith.ts @@ -0,0 +1,9 @@ +import * as R_differenceWith from '../ramda/dist/src/differenceWith'; + +declare const number_number_to_boolean: (a: number, b: number) => boolean; +declare const number_array: number[]; + +// @dts-jest:pass +R_differenceWith(number_number_to_boolean, number_array); +// @dts-jest:pass +R_differenceWith(number_number_to_boolean, number_array, number_array); diff --git a/tests/dissoc.ts b/tests/dissoc.ts new file mode 100644 index 0000000..94daeaa --- /dev/null +++ b/tests/dissoc.ts @@ -0,0 +1,19 @@ +import * as R_dissoc from '../ramda/dist/src/dissoc'; + +declare const string_property: string; +declare const object: object; +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; + +// @dts-jest:pass +R_dissoc(string_property, object); +// @dts-jest:pass +R_dissoc(string_property)(object); + +// @dts-jest:pass +R_dissoc('a', a_1_b_2_c_3); +// @dts-jest:pass +R_dissoc('a')(a_1_b_2_c_3); diff --git a/tests/dissocPath.ts b/tests/dissocPath.ts new file mode 100644 index 0000000..ac6f95d --- /dev/null +++ b/tests/dissocPath.ts @@ -0,0 +1,16 @@ +import { Path } from '../ramda/dist/src/$types'; +import * as R_dissocPath from '../ramda/dist/src/dissocPath'; + +declare const path: Path; +declare const object: object; +declare const a_b_c_d_e: { a: { b: { c: { d: { e: number } } } } }; + +// @dts-jest:pass +R_dissocPath(path, object); +// @dts-jest:pass +R_dissocPath(path)(object); + +// @dts-jest:pass +R_dissocPath(path, a_b_c_d_e); +// @dts-jest:pass +R_dissocPath(path)(a_b_c_d_e); diff --git a/tests/divide.ts b/tests/divide.ts new file mode 100644 index 0000000..212e26b --- /dev/null +++ b/tests/divide.ts @@ -0,0 +1,8 @@ +import * as R_divide from '../ramda/dist/src/divide'; + +declare const number: number; + +// @dts-jest:pass +R_divide(number, number); +// @dts-jest:pass +R_divide(number)(number); diff --git a/tests/drop.ts b/tests/drop.ts new file mode 100644 index 0000000..8c1b061 --- /dev/null +++ b/tests/drop.ts @@ -0,0 +1,10 @@ +import * as R_drop from '../ramda/dist/src/drop'; + +declare const number: number; +declare const string: string; +declare const boolean_array: boolean[]; + +// @dts-jest:pass +R_drop(number, string); +// @dts-jest:pass +R_drop(number, boolean_array); diff --git a/tests/dropLast.ts b/tests/dropLast.ts new file mode 100644 index 0000000..626c53c --- /dev/null +++ b/tests/dropLast.ts @@ -0,0 +1,10 @@ +import * as R_dropLast from '../ramda/dist/src/dropLast'; + +declare const number: number; +declare const string: string; +declare const boolean_array: boolean[]; + +// @dts-jest:pass +R_dropLast(number, string); +// @dts-jest:pass +R_dropLast(number, boolean_array); diff --git a/tests/dropLastWhile.ts b/tests/dropLastWhile.ts new file mode 100644 index 0000000..8beb1a6 --- /dev/null +++ b/tests/dropLastWhile.ts @@ -0,0 +1,9 @@ +import * as R_dropLastWhile from '../ramda/dist/src/dropLastWhile'; + +declare const string_to_boolean: (x: string) => boolean; +declare const string_array: string[]; + +// @dts-jest:pass +R_dropLastWhile(string_to_boolean); +// @dts-jest:pass +R_dropLastWhile(string_to_boolean, string_array); diff --git a/tests/dropRepeats.ts b/tests/dropRepeats.ts new file mode 100644 index 0000000..3aae7c1 --- /dev/null +++ b/tests/dropRepeats.ts @@ -0,0 +1,6 @@ +import * as R_dropRepeats from '../ramda/dist/src/dropRepeats'; + +declare const string_array: string[]; + +// @dts-jest:pass +R_dropRepeats(string_array); diff --git a/tests/dropRepeatsWith.ts b/tests/dropRepeatsWith.ts new file mode 100644 index 0000000..28ed0a3 --- /dev/null +++ b/tests/dropRepeatsWith.ts @@ -0,0 +1,11 @@ +import * as R_dropRepeatsWith from '../ramda/dist/src/dropRepeatsWith'; + +declare const string_to_number: (x: string) => number; +declare const string_array: string[]; + +// @dts-jest:pass +R_dropRepeatsWith(string_to_number); +// @dts-jest:pass +R_dropRepeatsWith(string_to_number)(string_array); +// @dts-jest:pass +R_dropRepeatsWith(string_to_number, string_array); diff --git a/tests/dropWhile.ts b/tests/dropWhile.ts new file mode 100644 index 0000000..3fe7058 --- /dev/null +++ b/tests/dropWhile.ts @@ -0,0 +1,9 @@ +import * as R_dropWhile from '../ramda/dist/src/dropWhile'; + +declare const string_to_boolean: (x: string) => boolean; +declare const string_array: string[]; + +// @dts-jest:pass +R_dropWhile(string_to_boolean); +// @dts-jest:pass +R_dropWhile(string_to_boolean, string_array); diff --git a/tests/either.ts b/tests/either.ts new file mode 100644 index 0000000..79966a6 --- /dev/null +++ b/tests/either.ts @@ -0,0 +1,9 @@ +import { Predicate } from '../ramda/dist/src/$types'; +import * as R_either from '../ramda/dist/src/either'; + +declare const string_predicate: Predicate; + +// @dts-jest:pass +R_either(string_predicate); +// @dts-jest:pass +R_either(string_predicate, string_predicate); diff --git a/tests/empty.ts b/tests/empty.ts new file mode 100644 index 0000000..5df9e99 --- /dev/null +++ b/tests/empty.ts @@ -0,0 +1,12 @@ +import * as R_empty from '../ramda/dist/src/empty'; + +declare const object: object; +declare const string: string; +declare const string_array: string[]; + +// @dts-jest:pass +R_empty(object); +// @dts-jest:pass +R_empty(string); +// @dts-jest:pass +R_empty(string_array); diff --git a/tests/endsWith.ts b/tests/endsWith.ts new file mode 100644 index 0000000..d847fab --- /dev/null +++ b/tests/endsWith.ts @@ -0,0 +1,13 @@ +import * as R_endsWith from '../ramda/dist/src/endsWith'; + +declare const string: string; +declare const boolean_array: boolean[]; + +// @dts-jest:pass +R_endsWith(string); +// @dts-jest:pass +R_endsWith(string, string); +// @dts-jest:pass +R_endsWith(boolean_array); +// @dts-jest:pass +R_endsWith(boolean_array, boolean_array); diff --git a/tests/eqBy.ts b/tests/eqBy.ts new file mode 100644 index 0000000..28b1747 --- /dev/null +++ b/tests/eqBy.ts @@ -0,0 +1,11 @@ +import * as R_eqBy from '../ramda/dist/src/eqBy'; + +declare const string_to_number: (x: string) => number; +declare const string: string; + +// @dts-jest:pass +R_eqBy(string_to_number, string); +// @dts-jest:pass +R_eqBy(string_to_number)(string)(string); +// @dts-jest:pass +R_eqBy(string_to_number, string, string); diff --git a/tests/eqProps.ts b/tests/eqProps.ts new file mode 100644 index 0000000..799c957 --- /dev/null +++ b/tests/eqProps.ts @@ -0,0 +1,12 @@ +import { Property } from '../ramda/dist/src/$types'; +import * as R_eqProps from '../ramda/dist/src/eqProps'; + +declare const property: Property; +declare const string: string; + +// @dts-jest:pass +R_eqProps(property, string); +// @dts-jest:pass +R_eqProps(property)(string, string); +// @dts-jest:pass +R_eqProps(property, string, string); diff --git a/tests/equals.ts b/tests/equals.ts new file mode 100644 index 0000000..ab20958 --- /dev/null +++ b/tests/equals.ts @@ -0,0 +1,10 @@ +import * as R_equals from '../ramda/dist/src/equals'; + +declare const string: string; + +// @dts-jest:pass +R_equals(string); +// @dts-jest:pass +R_equals(string)(string); +// @dts-jest:pass +R_equals(string, string); diff --git a/tests/evolve.ts b/tests/evolve.ts new file mode 100644 index 0000000..fbf1a99 --- /dev/null +++ b/tests/evolve.ts @@ -0,0 +1,13 @@ +import { Morphism } from '../ramda/dist/src/$types'; +import * as R_evolve from '../ramda/dist/src/evolve'; + +declare const a_1_b_2_c_3: { a: 1; b: 2; c: 3 }; +declare const a_b_number_to_number: { + a: Morphism; + b: Morphism; +}; + +// @dts-jest:pass +R_evolve(a_b_number_to_number)(a_1_b_2_c_3); +// @dts-jest:pass +R_evolve(a_b_number_to_number, a_1_b_2_c_3); diff --git a/tests/filter.ts b/tests/filter.ts new file mode 100644 index 0000000..345f9aa --- /dev/null +++ b/tests/filter.ts @@ -0,0 +1,22 @@ +import { Dictionary, Filterable, Predicate } from '../ramda/dist/src/$types'; +import * as R_filter from '../ramda/dist/src/filter'; + +declare const string_predicate: Predicate; +declare const string_array: string[]; +declare const string_dictionary: Dictionary; +declare const string_filterable: Filterable; + +// @dts-jest:pass +R_filter(string_predicate, string_array); +// @dts-jest:pass +R_filter(string_predicate)(string_array); + +// @dts-jest:pass +R_filter(string_predicate, string_dictionary); +// @dts-jest:pass +R_filter(string_predicate)(string_dictionary); + +// @dts-jest:pass +R_filter(string_predicate, string_filterable); +// @dts-jest:pass +R_filter(string_predicate)(string_filterable); diff --git a/tests/find.ts b/tests/find.ts new file mode 100644 index 0000000..9be6891 --- /dev/null +++ b/tests/find.ts @@ -0,0 +1,12 @@ +import { Predicate } from '../ramda/dist/src/$types'; +import * as R_find from '../ramda/dist/src/find'; + +declare const string_predicate: Predicate; +declare const string_array: string[]; + +// @dts-jest:pass +R_find(string_predicate); +// @dts-jest:pass +R_find(string_predicate)(string_array); +// @dts-jest:pass +R_find(string_predicate, string_array); diff --git a/tests/findIndex.ts b/tests/findIndex.ts new file mode 100644 index 0000000..6e7de9f --- /dev/null +++ b/tests/findIndex.ts @@ -0,0 +1,12 @@ +import { Predicate } from '../ramda/dist/src/$types'; +import * as R_findIndex from '../ramda/dist/src/findIndex'; + +declare const string_predicate: Predicate; +declare const string_array: string[]; + +// @dts-jest:pass +R_findIndex(string_predicate); +// @dts-jest:pass +R_findIndex(string_predicate)(string_array); +// @dts-jest:pass +R_findIndex(string_predicate, string_array); diff --git a/tests/findLast.ts b/tests/findLast.ts new file mode 100644 index 0000000..f5ec365 --- /dev/null +++ b/tests/findLast.ts @@ -0,0 +1,12 @@ +import { Predicate } from '../ramda/dist/src/$types'; +import * as R_findLast from '../ramda/dist/src/findLast'; + +declare const string_predicate: Predicate; +declare const string_array: string[]; + +// @dts-jest:pass +R_findLast(string_predicate); +// @dts-jest:pass +R_findLast(string_predicate)(string_array); +// @dts-jest:pass +R_findLast(string_predicate, string_array); diff --git a/tests/findLastIndex.ts b/tests/findLastIndex.ts new file mode 100644 index 0000000..14f474e --- /dev/null +++ b/tests/findLastIndex.ts @@ -0,0 +1,12 @@ +import { Predicate } from '../ramda/dist/src/$types'; +import * as R_findLastIndex from '../ramda/dist/src/findLastIndex'; + +declare const string_predicate: Predicate; +declare const string_array: string[]; + +// @dts-jest:pass +R_findLastIndex(string_predicate); +// @dts-jest:pass +R_findLastIndex(string_predicate)(string_array); +// @dts-jest:pass +R_findLastIndex(string_predicate, string_array); diff --git a/tests/flatten.ts b/tests/flatten.ts new file mode 100644 index 0000000..2f2e761 --- /dev/null +++ b/tests/flatten.ts @@ -0,0 +1,10 @@ +import { NestedList } from '../ramda/dist/src/$types'; +import * as R_flatten from '../ramda/dist/src/flatten'; + +declare const string_array: string[]; +declare const nested_object_list: NestedList; + +// @dts-jest:pass +R_flatten(string_array); +// @dts-jest:pass +R_flatten(nested_object_list); diff --git a/tests/flip.ts b/tests/flip.ts new file mode 100644 index 0000000..0ff14e4 --- /dev/null +++ b/tests/flip.ts @@ -0,0 +1,23 @@ +import * as R_flip from '../ramda/dist/src/flip'; + +declare const string_number_to_object: (x: string, y: number) => object; +declare const number_boolean_to_string: (x: number, y: boolean) => string; +declare const number_args_to_boolean: (...args: number[]) => boolean; +declare const seven_string_to_number: ( + v1: string, + v2: string, + v3: string, + v4: string, + v5: string, + v6: string, + v7: string, +) => number; + +// @dts-jest:pass +R_flip(string_number_to_object); +// @dts-jest:pass +R_flip(number_boolean_to_string); +// @dts-jest:pass +R_flip(number_args_to_boolean); +// @dts-jest:pass +R_flip(seven_string_to_number); diff --git a/tests/forEach.ts b/tests/forEach.ts new file mode 100644 index 0000000..b89488b --- /dev/null +++ b/tests/forEach.ts @@ -0,0 +1,12 @@ +import { List, Tap } from '../ramda/dist/src/$types'; +import * as R_forEach from '../ramda/dist/src/forEach'; + +declare const number_list: List; +declare const number_tap: Tap; + +// @dts-jest:pass +R_forEach(number_tap); +// @dts-jest:pass +R_forEach(number_tap)(number_list); +// @dts-jest:pass +R_forEach(number_tap, number_list); diff --git a/tests/forEachObjIndexed.ts b/tests/forEachObjIndexed.ts new file mode 100644 index 0000000..7ccd262 --- /dev/null +++ b/tests/forEachObjIndexed.ts @@ -0,0 +1,15 @@ +import { Dictionary, KeyedObjectTap } from '../ramda/dist/src/$types'; +import * as R_forEachObjIndexed from '../ramda/dist/src/forEachObjIndexed'; + +declare const number_dictionary: Dictionary; +declare const keyed_number_dictionary_tap: KeyedObjectTap< + number, + Dictionary +>; + +// @dts-jest:pass +R_forEachObjIndexed(keyed_number_dictionary_tap); +// @dts-jest:pass +R_forEachObjIndexed(keyed_number_dictionary_tap)(number_dictionary); +// @dts-jest:pass +R_forEachObjIndexed(keyed_number_dictionary_tap, number_dictionary); diff --git a/tests/fromPairs.ts b/tests/fromPairs.ts new file mode 100644 index 0000000..40e949a --- /dev/null +++ b/tests/fromPairs.ts @@ -0,0 +1,6 @@ +import * as R_fromPairs from '../ramda/dist/src/fromPairs'; + +declare const number_object_tuple: [number, object]; + +// @dts-jest:pass +R_fromPairs([number_object_tuple]); diff --git a/tests/groupBy.ts b/tests/groupBy.ts new file mode 100644 index 0000000..d0e888b --- /dev/null +++ b/tests/groupBy.ts @@ -0,0 +1,11 @@ +import * as R_groupBy from '../ramda/dist/src/groupBy'; + +declare const object_to_string: (x: object) => string; +declare const object_array: object[]; + +// @dts-jest:pass +R_groupBy(object_to_string); +// @dts-jest:pass +R_groupBy(object_to_string)(object_array); +// @dts-jest:pass +R_groupBy(object_to_string, object_array); diff --git a/tests/groupWith.ts b/tests/groupWith.ts new file mode 100644 index 0000000..d07f32e --- /dev/null +++ b/tests/groupWith.ts @@ -0,0 +1,12 @@ +import * as R_groupWith from '../ramda/dist/src/groupWith'; + +declare const string_to_boolean: (x: string) => boolean; +declare const string_array: string[]; +declare const string: string; + +// @dts-jest:pass +R_groupWith(string_to_boolean); +// @dts-jest:pass +R_groupWith(string_to_boolean, string); +// @dts-jest:pass +R_groupWith(string_to_boolean, string_array); diff --git a/tests/gt.ts b/tests/gt.ts new file mode 100644 index 0000000..c3e1ab1 --- /dev/null +++ b/tests/gt.ts @@ -0,0 +1,11 @@ +import * as R_gt from '../ramda/dist/src/gt'; + +declare const string: string; +declare const number: number; + +// @dts-jest:pass +R_gt(string); +// @dts-jest:pass +R_gt(string, string); +// @dts-jest:pass +R_gt(number, number); diff --git a/tests/gte.ts b/tests/gte.ts new file mode 100644 index 0000000..492b082 --- /dev/null +++ b/tests/gte.ts @@ -0,0 +1,11 @@ +import * as R_gte from '../ramda/dist/src/gte'; + +declare const string: string; +declare const number: number; + +// @dts-jest:pass +R_gte(string); +// @dts-jest:pass +R_gte(string, string); +// @dts-jest:pass +R_gte(number, number); diff --git a/tests/has.ts b/tests/has.ts new file mode 100644 index 0000000..83635be --- /dev/null +++ b/tests/has.ts @@ -0,0 +1,12 @@ +import { Property } from '../ramda/dist/src/$types'; +import * as R_has from '../ramda/dist/src/has'; + +declare const property: Property; +declare const object: object; + +// @dts-jest:pass +R_has(property); +// @dts-jest:pass +R_has(property)(object); +// @dts-jest:pass +R_has(property, object); diff --git a/tests/hasIn.ts b/tests/hasIn.ts new file mode 100644 index 0000000..e560252 --- /dev/null +++ b/tests/hasIn.ts @@ -0,0 +1,12 @@ +import { Property } from '../ramda/dist/src/$types'; +import * as R_hasIn from '../ramda/dist/src/hasIn'; + +declare const property: Property; +declare const object: object; + +// @dts-jest:pass +R_hasIn(property); +// @dts-jest:pass +R_hasIn(property)(object); +// @dts-jest:pass +R_hasIn(property, object); diff --git a/tests/head.ts b/tests/head.ts new file mode 100644 index 0000000..2c265d5 --- /dev/null +++ b/tests/head.ts @@ -0,0 +1,18 @@ +import * as R_head from '../ramda/dist/src/head'; + +declare const string: string; +declare const string_array: string[]; +declare const number_array: number[]; +declare const string_number_tuple: [string, number]; +declare const number_boolean_object_tuple: [number, boolean, object]; + +// @dts-jest:pass +R_head(string); +// @dts-jest:pass +R_head(string_array); +// @dts-jest:pass +R_head(number_array); +// @dts-jest:pass +R_head(string_number_tuple); +// @dts-jest:pass +R_head(number_boolean_object_tuple); diff --git a/tests/identical.ts b/tests/identical.ts new file mode 100644 index 0000000..40662ed --- /dev/null +++ b/tests/identical.ts @@ -0,0 +1,10 @@ +import * as R_identical from '../ramda/dist/src/identical'; + +declare const string: string; + +// @dts-jest:pass +R_identical(string); +// @dts-jest:pass +R_identical(string)(string); +// @dts-jest:pass +R_identical(string, string); diff --git a/tests/identity.ts b/tests/identity.ts new file mode 100644 index 0000000..ff29ea8 --- /dev/null +++ b/tests/identity.ts @@ -0,0 +1,9 @@ +import * as R_identity from '../ramda/dist/src/identity'; + +declare const string: string; +declare const number: number; + +// @dts-jest:pass +R_identity(string); +// @dts-jest:pass +R_identity(number); diff --git a/tests/ifElse.ts b/tests/ifElse.ts new file mode 100644 index 0000000..cff4219 --- /dev/null +++ b/tests/ifElse.ts @@ -0,0 +1,12 @@ +import * as R_ifElse from '../ramda/dist/src/ifElse'; + +declare const string_to_boolean: (x: string) => boolean; +declare const string_to_number: (x: string) => number; +declare const string_to_object: (x: string) => object; + +// @dts-jest:pass +R_ifElse(string_to_boolean, string_to_number); +// @dts-jest:pass +R_ifElse(string_to_boolean, string_to_number, string_to_object); +// @dts-jest:pass +R_ifElse(string_to_boolean)(string_to_number)(string_to_object); diff --git a/tests/inc.ts b/tests/inc.ts new file mode 100644 index 0000000..6d40900 --- /dev/null +++ b/tests/inc.ts @@ -0,0 +1,6 @@ +import * as R_inc from '../ramda/dist/src/inc'; + +declare const number: number; + +// @dts-jest:pass +R_inc(number); diff --git a/tests/indexBy.ts b/tests/indexBy.ts new file mode 100644 index 0000000..c688f73 --- /dev/null +++ b/tests/indexBy.ts @@ -0,0 +1,11 @@ +import * as R_indexBy from '../ramda/dist/src/indexBy'; + +declare const object_to_string: (x: object) => string; +declare const object_array: object[]; + +// @dts-jest:pass +R_indexBy(object_to_string); +// @dts-jest:pass +R_indexBy(object_to_string)(object_array); +// @dts-jest:pass +R_indexBy(object_to_string, object_array); diff --git a/tests/indexOf.ts b/tests/indexOf.ts new file mode 100644 index 0000000..3f01eb9 --- /dev/null +++ b/tests/indexOf.ts @@ -0,0 +1,11 @@ +import * as R_indexOf from '../ramda/dist/src/indexOf'; + +declare const string: string; +declare const string_array: string[]; + +// @dts-jest:pass +R_indexOf(string); +// @dts-jest:pass +R_indexOf(string, string); +// @dts-jest:pass +R_indexOf(string, string_array); diff --git a/tests/init.ts b/tests/init.ts new file mode 100644 index 0000000..da3b223 --- /dev/null +++ b/tests/init.ts @@ -0,0 +1,9 @@ +import * as R_init from '../ramda/dist/src/init'; + +declare const string: string; +declare const string_array: string[]; + +// @dts-jest:pass +R_init(string); +// @dts-jest:pass +R_init(string_array); diff --git a/tests/innerJoin.ts b/tests/innerJoin.ts new file mode 100644 index 0000000..a4356a5 --- /dev/null +++ b/tests/innerJoin.ts @@ -0,0 +1,12 @@ +import * as R_innerJoin from '../ramda/dist/src/innerJoin'; + +declare const object_number_to_boolean: (x: object, y: number) => boolean; +declare const object_array: object[]; +declare const number_array: number[]; + +// @dts-jest:pass +R_innerJoin(object_number_to_boolean, object_array); +// @dts-jest:pass +R_innerJoin(object_number_to_boolean, object_array, number_array); +// @dts-jest:pass +R_innerJoin(object_number_to_boolean)(object_array)(number_array); diff --git a/tests/insert.ts b/tests/insert.ts new file mode 100644 index 0000000..3368f0f --- /dev/null +++ b/tests/insert.ts @@ -0,0 +1,20 @@ +import * as R_insert from '../ramda/dist/src/insert'; + +declare const object: object; +declare const object_array: object[]; +declare const string: string; +declare const number: number; + +// @dts-jest:pass +R_insert(number, string); +// @dts-jest:pass +R_insert(number, string, object_array); +// @dts-jest:pass +R_insert(number)(string)(object_array); + +// @dts-jest:pass +R_insert(number, object); +// @dts-jest:pass +R_insert(number, object, object_array); +// @dts-jest:pass +R_insert(number)(object)(object_array); diff --git a/tests/insertAll.ts b/tests/insertAll.ts new file mode 100644 index 0000000..03d6af3 --- /dev/null +++ b/tests/insertAll.ts @@ -0,0 +1,16 @@ +import * as R_insertAll from '../ramda/dist/src/insertAll'; + +declare const object_array: object[]; +declare const string_array: string[]; +declare const number: number; + +// @dts-jest:pass +R_insertAll(number, string_array); +// @dts-jest:pass +R_insertAll(number, string_array, object_array); +// @dts-jest:pass +R_insertAll(number)(string_array)(object_array); +// @dts-jest:pass +R_insertAll(number, string_array, string_array); +// @dts-jest:pass +R_insertAll(number)(string_array)(string_array); diff --git a/tests/intersection.ts b/tests/intersection.ts new file mode 100644 index 0000000..0e1ecfd --- /dev/null +++ b/tests/intersection.ts @@ -0,0 +1,8 @@ +import * as R_intersection from '../ramda/dist/src/intersection'; + +declare const number_array: number[]; + +// @dts-jest:pass +R_intersection(number_array); +// @dts-jest:pass +R_intersection(number_array, number_array); diff --git a/tests/intersectionWith.ts b/tests/intersectionWith.ts new file mode 100644 index 0000000..ffcc5e1 --- /dev/null +++ b/tests/intersectionWith.ts @@ -0,0 +1,9 @@ +import * as R_intersectionWith from '../ramda/dist/src/intersectionWith'; + +declare const number_number_to_boolean: (a: number, b: number) => boolean; +declare const number_array: number[]; + +// @dts-jest:pass +R_intersectionWith(number_number_to_boolean, number_array); +// @dts-jest:pass +R_intersectionWith(number_number_to_boolean, number_array, number_array); diff --git a/tests/intersperse.ts b/tests/intersperse.ts new file mode 100644 index 0000000..dc6dd10 --- /dev/null +++ b/tests/intersperse.ts @@ -0,0 +1,11 @@ +import * as R_intersperse from '../ramda/dist/src/intersperse'; + +declare const object_array: object[]; +declare const string: string; + +// @dts-jest:pass +R_intersperse(string); +// @dts-jest:pass +R_intersperse(string, object_array); +// @dts-jest:pass +R_intersperse(string)(object_array); diff --git a/tests/into.ts b/tests/into.ts new file mode 100644 index 0000000..7ddb8a5 --- /dev/null +++ b/tests/into.ts @@ -0,0 +1,32 @@ +import { Transformer } from '../ramda/dist/src/$types'; +import * as R_into from '../ramda/dist/src/into'; + +declare const object: object; +declare const str_obj_transformer: Transformer; +declare const str_obj_transformer_to_obj_str_to_obj: ( + x: Transformer, +) => (x: object, y: string) => object; + +declare const string: string; +declare const num_str_transformer: Transformer; +declare const num_str_transformer_to_str_num_to_str: ( + x: Transformer, +) => (x: string, y: number) => string; + +// @dts-jest:pass +R_into(object, str_obj_transformer_to_obj_str_to_obj); +// @dts-jest:pass +R_into(object)(str_obj_transformer_to_obj_str_to_obj); +// @dts-jest:pass +R_into(str_obj_transformer, str_obj_transformer_to_obj_str_to_obj); +// @dts-jest:pass +R_into(str_obj_transformer)(str_obj_transformer_to_obj_str_to_obj); + +// @dts-jest:skip +R_into(string, num_str_transformer_to_str_num_to_str); +// @dts-jest:pass +R_into(string)(num_str_transformer_to_str_num_to_str); +// @dts-jest:skip +R_into(num_str_transformer, num_str_transformer_to_str_num_to_str); +// @dts-jest:pass +R_into(num_str_transformer)(num_str_transformer_to_str_num_to_str); diff --git a/tests/invert.ts b/tests/invert.ts new file mode 100644 index 0000000..cedc357 --- /dev/null +++ b/tests/invert.ts @@ -0,0 +1,6 @@ +import * as R_invert from '../ramda/dist/src/invert'; + +declare const number_object_record: { [number: number]: object }; + +// @dts-jest:pass +R_invert(number_object_record); diff --git a/tests/invertObj.ts b/tests/invertObj.ts new file mode 100644 index 0000000..1d0529d --- /dev/null +++ b/tests/invertObj.ts @@ -0,0 +1,6 @@ +import * as R_invertObj from '../ramda/dist/src/invertObj'; + +declare const number_object_record: { [number: number]: object }; + +// @dts-jest:pass +R_invertObj(number_object_record); diff --git a/tests/invoker.ts b/tests/invoker.ts new file mode 100644 index 0000000..78a4c7b --- /dev/null +++ b/tests/invoker.ts @@ -0,0 +1,14 @@ +import * as R_invoker from '../ramda/dist/src/invoker'; + +// @dts-jest:pass +R_invoker(0); +// @dts-jest:pass +R_invoker(1); +// @dts-jest:pass +R_invoker(2); +// @dts-jest:pass +R_invoker(5); +// @dts-jest:pass +R_invoker(6); +// @dts-jest:pass +R_invoker(7); diff --git a/tests/is.ts b/tests/is.ts new file mode 100644 index 0000000..52e4577 --- /dev/null +++ b/tests/is.ts @@ -0,0 +1,10 @@ +import * as R_is from '../ramda/dist/src/is'; + +declare const string: string; + +// @dts-jest:pass +R_is(String); +// @dts-jest:pass +R_is(String)(string); +// @dts-jest:pass +R_is(String, string); diff --git a/tests/isEmpty.ts b/tests/isEmpty.ts new file mode 100644 index 0000000..e58b683 --- /dev/null +++ b/tests/isEmpty.ts @@ -0,0 +1,6 @@ +import * as R_isEmpty from '../ramda/dist/src/isEmpty'; + +declare const string: string; + +// @dts-jest:pass +R_isEmpty(string); diff --git a/tests/isNil.ts b/tests/isNil.ts new file mode 100644 index 0000000..c0df606 --- /dev/null +++ b/tests/isNil.ts @@ -0,0 +1,9 @@ +import * as R_isNil from '../ramda/dist/src/isNil'; + +declare const string: string; + +// @dts-jest:pass +R_isNil; + +// @dts-jest:pass +R_isNil(string); diff --git a/tests/join.ts b/tests/join.ts new file mode 100644 index 0000000..37dce19 --- /dev/null +++ b/tests/join.ts @@ -0,0 +1,11 @@ +import * as R_join from '../ramda/dist/src/join'; + +declare const string: string; +declare const number_array: string[]; + +// @dts-jest:pass +R_join(string); +// @dts-jest:pass +R_join(string)(number_array); +// @dts-jest:pass +R_join(string, number_array); diff --git a/tests/juxt.ts b/tests/juxt.ts new file mode 100644 index 0000000..b5a8db1 --- /dev/null +++ b/tests/juxt.ts @@ -0,0 +1,9 @@ +import * as R_juxt from '../ramda/dist/src/juxt'; + +declare const string_string_to_number: (x: string, y: string) => number; +declare const string: string; + +// @dts-jest:pass +R_juxt([string_string_to_number]); +// @dts-jest:pass +R_juxt([string_string_to_number])(string, string); diff --git a/tests/keys.ts b/tests/keys.ts new file mode 100644 index 0000000..dcefb96 --- /dev/null +++ b/tests/keys.ts @@ -0,0 +1,13 @@ +import * as R_keys from '../ramda/dist/src/keys'; + +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; +declare const string_number_record: Record; + +// @dts-jest:pass +R_keys(a_1_b_2_c_3); +// @dts-jest:pass +R_keys(string_number_record); diff --git a/tests/keysIn.ts b/tests/keysIn.ts new file mode 100644 index 0000000..0dc7159 --- /dev/null +++ b/tests/keysIn.ts @@ -0,0 +1,13 @@ +import * as R_keysIn from '../ramda/dist/src/keysIn'; + +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; +declare const string_number_record: Record; + +// @dts-jest:pass +R_keysIn(a_1_b_2_c_3); +// @dts-jest:pass +R_keysIn(string_number_record); diff --git a/tests/last.ts b/tests/last.ts new file mode 100644 index 0000000..cc6802b --- /dev/null +++ b/tests/last.ts @@ -0,0 +1,12 @@ +import * as R_last from '../ramda/dist/src/last'; + +declare const string: string; +declare const string_array: string[]; +declare const number_array: number[]; + +// @dts-jest:pass +R_last(string); +// @dts-jest:pass +R_last(string_array); +// @dts-jest:pass +R_last(number_array); diff --git a/tests/lastIndexOf.ts b/tests/lastIndexOf.ts new file mode 100644 index 0000000..f8a86ce --- /dev/null +++ b/tests/lastIndexOf.ts @@ -0,0 +1,11 @@ +import * as R_lastIndexOf from '../ramda/dist/src/lastIndexOf'; + +declare const string: string; +declare const string_array: string[]; + +// @dts-jest:pass +R_lastIndexOf(string); +// @dts-jest:pass +R_lastIndexOf(string, string); +// @dts-jest:pass +R_lastIndexOf(string, string_array); diff --git a/tests/length.ts b/tests/length.ts new file mode 100644 index 0000000..ca1c085 --- /dev/null +++ b/tests/length.ts @@ -0,0 +1,9 @@ +import * as R_length from '../ramda/dist/src/length'; + +declare const string: string; +declare const string_array: string[]; + +// @dts-jest:pass +R_length(string); +// @dts-jest:pass +R_length(string_array); diff --git a/tests/lens.ts b/tests/lens.ts new file mode 100644 index 0000000..f130cc0 --- /dev/null +++ b/tests/lens.ts @@ -0,0 +1,11 @@ +import * as R_lens from '../ramda/dist/src/lens'; + +declare const object_to_string: (x: object) => string; +declare const string_object_to_object: (x: string, y: object) => object; + +// @dts-jest:pass +R_lens(object_to_string); +// @dts-jest:pass +R_lens(object_to_string)(string_object_to_object); +// @dts-jest:pass +R_lens(object_to_string, string_object_to_object); diff --git a/tests/lensIndex.ts b/tests/lensIndex.ts new file mode 100644 index 0000000..2f266b1 --- /dev/null +++ b/tests/lensIndex.ts @@ -0,0 +1,8 @@ +import * as R_lensIndex from '../ramda/dist/src/lensIndex'; + +declare const number: number; + +// @dts-jest:pass +R_lensIndex(0); +// @dts-jest:pass +R_lensIndex(number); diff --git a/tests/lensPath.ts b/tests/lensPath.ts new file mode 100644 index 0000000..8dda085 --- /dev/null +++ b/tests/lensPath.ts @@ -0,0 +1,9 @@ +import { Path } from '../ramda/dist/src/$types'; +import * as R_lensPath from '../ramda/dist/src/lensPath'; + +declare const path: Path; + +// @dts-jest:pass +R_lensPath(path); +// @dts-jest:pass +R_lensPath(path); diff --git a/tests/lensProp.ts b/tests/lensProp.ts new file mode 100644 index 0000000..c07ebbb --- /dev/null +++ b/tests/lensProp.ts @@ -0,0 +1,13 @@ +import { Property } from '../ramda/dist/src/$types'; +import * as R_lensProp from '../ramda/dist/src/lensProp'; + +declare const property: Property; + +// @dts-jest:pass +R_lensProp(1); +// @dts-jest:pass +R_lensProp('x'); +// @dts-jest:pass +R_lensProp(property); +// @dts-jest:pass +R_lensProp(property); diff --git a/tests/lift.ts b/tests/lift.ts new file mode 100644 index 0000000..63c88e3 --- /dev/null +++ b/tests/lift.ts @@ -0,0 +1,23 @@ +import * as R_lift from '../ramda/dist/src/lift'; + +declare const string_to_object: (x: string) => object; +declare const number_boolean_to_string: (x: number, y: boolean) => string; +declare const number_args_to_boolean: (...args: number[]) => boolean; +declare const seven_string_to_number: ( + v1: string, + v2: string, + v3: string, + v4: string, + v5: string, + v6: string, + v7: string, +) => number; + +// @dts-jest:pass +R_lift(string_to_object); +// @dts-jest:pass +R_lift(number_boolean_to_string); +// @dts-jest:pass +R_lift(number_args_to_boolean); +// @dts-jest:pass +R_lift(seven_string_to_number); diff --git a/tests/liftN.ts b/tests/liftN.ts new file mode 100644 index 0000000..324cf95 --- /dev/null +++ b/tests/liftN.ts @@ -0,0 +1,23 @@ +import * as R_liftN from '../ramda/dist/src/liftN'; + +declare const string_to_object: (x: string) => object; +declare const number_boolean_to_string: (x: number, y: boolean) => string; +declare const number_args_to_boolean: (...args: number[]) => boolean; +declare const seven_string_to_number: ( + v1: string, + v2: string, + v3: string, + v4: string, + v5: string, + v6: string, + v7: string, +) => number; + +// @dts-jest:pass +R_liftN(0, string_to_object); +// @dts-jest:pass +R_liftN(1, number_boolean_to_string); +// @dts-jest:pass +R_liftN(4, number_args_to_boolean); +// @dts-jest:pass +R_liftN(7, seven_string_to_number); diff --git a/tests/lt.ts b/tests/lt.ts new file mode 100644 index 0000000..6348bc9 --- /dev/null +++ b/tests/lt.ts @@ -0,0 +1,11 @@ +import * as R_lt from '../ramda/dist/src/lt'; + +declare const string: string; +declare const number: number; + +// @dts-jest:pass +R_lt(string); +// @dts-jest:pass +R_lt(string, string); +// @dts-jest:pass +R_lt(number, number); diff --git a/tests/lte.ts b/tests/lte.ts new file mode 100644 index 0000000..d7a91b4 --- /dev/null +++ b/tests/lte.ts @@ -0,0 +1,11 @@ +import * as R_lte from '../ramda/dist/src/lte'; + +declare const string: string; +declare const number: number; + +// @dts-jest:pass +R_lte(string); +// @dts-jest:pass +R_lte(string, string); +// @dts-jest:pass +R_lte(number, number); diff --git a/tests/map.ts b/tests/map.ts new file mode 100644 index 0000000..35739ff --- /dev/null +++ b/tests/map.ts @@ -0,0 +1,22 @@ +import { Functor, Morphism } from '../ramda/dist/src/$types'; +import * as R_map from '../ramda/dist/src/map'; + +declare const string_to_number: Morphism; +declare const string_array: string[]; +declare const string_object: Record; +declare const string_functor: Functor; + +// @dts-jest:pass +R_map(string_to_number, string_array); +// @dts-jest:pass +R_map(string_to_number)(string_array); + +// @dts-jest:pass +R_map(string_to_number, string_object); +// @dts-jest:pass +R_map(string_to_number)(string_object); + +// @dts-jest:pass +R_map(string_to_number, string_functor); +// @dts-jest:pass +R_map(string_to_number)(string_functor); diff --git a/tests/mapAccum.ts b/tests/mapAccum.ts new file mode 100644 index 0000000..1f5dfdb --- /dev/null +++ b/tests/mapAccum.ts @@ -0,0 +1,15 @@ +import * as R_mapAccum from '../ramda/dist/src/mapAccum'; + +declare const number: number; +declare const number_string_to_number_string_tuple: ( + x: number, + y: string, +) => [number, string]; +declare const string_array: string[]; + +// @dts-jest:pass +R_mapAccum(number_string_to_number_string_tuple, number); +// @dts-jest:pass +R_mapAccum(number_string_to_number_string_tuple)(number)(string_array); +// @dts-jest:pass +R_mapAccum(number_string_to_number_string_tuple, number, string_array); diff --git a/tests/mapAccumRight.ts b/tests/mapAccumRight.ts new file mode 100644 index 0000000..361708c --- /dev/null +++ b/tests/mapAccumRight.ts @@ -0,0 +1,15 @@ +import * as R_mapAccumRight from '../ramda/dist/src/mapAccumRight'; + +declare const number: number; +declare const string_number_to_string_number_tuple: ( + x: string, + y: number, +) => [string, number]; +declare const string_array: string[]; + +// @dts-jest:pass +R_mapAccumRight(string_number_to_string_number_tuple, number); +// @dts-jest:pass +R_mapAccumRight(string_number_to_string_number_tuple)(number)(string_array); +// @dts-jest:pass +R_mapAccumRight(string_number_to_string_number_tuple, number, string_array); diff --git a/tests/mapObjIndexed.ts b/tests/mapObjIndexed.ts new file mode 100644 index 0000000..8d46f08 --- /dev/null +++ b/tests/mapObjIndexed.ts @@ -0,0 +1,25 @@ +import { Placeholder } from '../ramda/dist/src/$placeholder'; +import * as R_mapObjIndexed from '../ramda/dist/src/mapObjIndexed'; + +declare const placeholder: Placeholder; +declare const number_string_object_to_boolean: ( + a: number, + b: string, + c: object, +) => boolean; + +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; +declare const string_number_record: Record; + +// @dts-jest:pass +R_mapObjIndexed(number_string_object_to_boolean); +// @dts-jest:pass +R_mapObjIndexed(number_string_object_to_boolean, string_number_record); +// @dts-jest:pass +R_mapObjIndexed(number_string_object_to_boolean, a_1_b_2_c_3); +// @dts-jest:pass +R_mapObjIndexed(placeholder, a_1_b_2_c_3)(number_string_object_to_boolean); diff --git a/tests/match.ts b/tests/match.ts new file mode 100644 index 0000000..fe403d9 --- /dev/null +++ b/tests/match.ts @@ -0,0 +1,11 @@ +import * as R_match from '../ramda/dist/src/match'; + +declare const regex: RegExp; +declare const string: string; + +// @dts-jest:pass +R_match(regex); +// @dts-jest:pass +R_match(regex)(string); +// @dts-jest:pass +R_match(regex, string); diff --git a/tests/mathMod.ts b/tests/mathMod.ts new file mode 100644 index 0000000..f81de69 --- /dev/null +++ b/tests/mathMod.ts @@ -0,0 +1,8 @@ +import * as R_mathMod from '../ramda/dist/src/mathMod'; + +declare const number: number; + +// @dts-jest:pass +R_mathMod(number, number); +// @dts-jest:pass +R_mathMod(number)(number); diff --git a/tests/max.ts b/tests/max.ts new file mode 100644 index 0000000..1822478 --- /dev/null +++ b/tests/max.ts @@ -0,0 +1,11 @@ +import * as R_max from '../ramda/dist/src/max'; + +declare const number: number; +declare const string: string; + +// @dts-jest:pass +R_max(string); +// @dts-jest:pass +R_max(number); +// @dts-jest:pass +R_max(number, number); diff --git a/tests/maxBy.ts b/tests/maxBy.ts new file mode 100644 index 0000000..77c5a6b --- /dev/null +++ b/tests/maxBy.ts @@ -0,0 +1,11 @@ +import * as R_maxBy from '../ramda/dist/src/maxBy'; + +declare const object_to_number: (x: object) => number; +declare const object: object; + +// @dts-jest:pass +R_maxBy(object_to_number, object); +// @dts-jest:pass +R_maxBy(object_to_number)(object)(object); +// @dts-jest:pass +R_maxBy(object_to_number, object, object); diff --git a/tests/mean.ts b/tests/mean.ts new file mode 100644 index 0000000..622ceb0 --- /dev/null +++ b/tests/mean.ts @@ -0,0 +1,6 @@ +import * as R_mean from '../ramda/dist/src/mean'; + +declare const number_array: number[]; + +// @dts-jest:pass +R_mean(number_array); diff --git a/tests/median.ts b/tests/median.ts new file mode 100644 index 0000000..898f989 --- /dev/null +++ b/tests/median.ts @@ -0,0 +1,6 @@ +import * as R_median from '../ramda/dist/src/median'; + +declare const number_array: number[]; + +// @dts-jest:pass +R_median(number_array); diff --git a/tests/memoize.ts b/tests/memoize.ts new file mode 100644 index 0000000..0905b83 --- /dev/null +++ b/tests/memoize.ts @@ -0,0 +1,6 @@ +import * as R_memoize from '../ramda/dist/src/memoize'; + +declare const T_to_T: (value: T) => T; + +// @dts-jest:pass +R_memoize(T_to_T); diff --git a/tests/memoizeWith.ts b/tests/memoizeWith.ts new file mode 100644 index 0000000..b3e005a --- /dev/null +++ b/tests/memoizeWith.ts @@ -0,0 +1,11 @@ +import * as R_memoizeWith from '../ramda/dist/src/memoizeWith'; + +declare const any_to_string: (x: any) => string; +declare const T_to_T: (value: T) => T; + +// @dts-jest:pass +R_memoizeWith(any_to_string); +// @dts-jest:pass +R_memoizeWith(any_to_string)(T_to_T); +// @dts-jest:pass +R_memoizeWith(any_to_string, T_to_T); diff --git a/tests/merge.ts b/tests/merge.ts new file mode 100644 index 0000000..3a199eb --- /dev/null +++ b/tests/merge.ts @@ -0,0 +1,15 @@ +import * as R_merge from '../ramda/dist/src/merge'; + +declare const a_1: { a: 1 }; +declare const b_2: { b: 2 }; +declare const a_1_c_1: { a: 1; c: 1 }; +declare const b_2_c_2: { b: 2; c: 2 }; + +// @dts-jest:pass +R_merge(a_1)(b_2); +// @dts-jest:pass +R_merge(a_1, b_2); +// @dts-jest:pass +R_merge(a_1_c_1)(b_2_c_2); +// @dts-jest:pass +R_merge(a_1_c_1, b_2_c_2); diff --git a/tests/mergeAll.ts b/tests/mergeAll.ts new file mode 100644 index 0000000..f40f200 --- /dev/null +++ b/tests/mergeAll.ts @@ -0,0 +1,7 @@ +import * as R_mergeAll from '../ramda/dist/src/mergeAll'; + +declare const a_1: { a: 1 }; +declare const b_2: { b: 2 }; + +// @dts-jest:pass +R_mergeAll([a_1, b_2]); diff --git a/tests/mergeDeepLeft.ts b/tests/mergeDeepLeft.ts new file mode 100644 index 0000000..f25b383 --- /dev/null +++ b/tests/mergeDeepLeft.ts @@ -0,0 +1,12 @@ +import * as R_mergeDeepLeft from '../ramda/dist/src/mergeDeepLeft'; + +declare const a_1: { a: 1 }; +declare const b_2: { b: 2 }; + +// @dts-jest:pass +R_mergeDeepLeft(a_1); + +// @dts-jest:pass +R_mergeDeepLeft(a_1)(b_2); +// @dts-jest:pass +R_mergeDeepLeft(a_1, b_2); diff --git a/tests/mergeDeepRight.ts b/tests/mergeDeepRight.ts new file mode 100644 index 0000000..3b66a7e --- /dev/null +++ b/tests/mergeDeepRight.ts @@ -0,0 +1,12 @@ +import * as R_mergeDeepRight from '../ramda/dist/src/mergeDeepRight'; + +declare const a_1: { a: 1 }; +declare const b_2: { b: 2 }; + +// @dts-jest:pass +R_mergeDeepRight(a_1); + +// @dts-jest:pass +R_mergeDeepRight(a_1)(b_2); +// @dts-jest:pass +R_mergeDeepRight(a_1, b_2); diff --git a/tests/mergeDeepWith.ts b/tests/mergeDeepWith.ts new file mode 100644 index 0000000..70361ed --- /dev/null +++ b/tests/mergeDeepWith.ts @@ -0,0 +1,13 @@ +import * as R_mergeDeepWith from '../ramda/dist/src/mergeDeepWith'; + +declare const string_string_to_number: (a: string, b: string) => number; +declare const a_1: { a: 1 }; +declare const b_2: { b: 2 }; + +// @dts-jest:pass +R_mergeDeepWith(string_string_to_number, a_1); + +// @dts-jest:pass +R_mergeDeepWith(string_string_to_number, a_1)(b_2); +// @dts-jest:pass +R_mergeDeepWith(string_string_to_number, a_1, b_2); diff --git a/tests/mergeDeepWithKey.ts b/tests/mergeDeepWithKey.ts new file mode 100644 index 0000000..7bf6111 --- /dev/null +++ b/tests/mergeDeepWithKey.ts @@ -0,0 +1,17 @@ +import * as R_mergeDeepWithKey from '../ramda/dist/src/mergeDeepWithKey'; + +declare const string_string_string_to_number: ( + key: string, + a: string, + b: string, +) => number; +declare const a_1: { a: 1 }; +declare const b_2: { b: 2 }; + +// @dts-jest:pass +R_mergeDeepWithKey(string_string_string_to_number, a_1); + +// @dts-jest:pass +R_mergeDeepWithKey(string_string_string_to_number, a_1)(b_2); +// @dts-jest:pass +R_mergeDeepWithKey(string_string_string_to_number, a_1, b_2); diff --git a/tests/mergeWith.ts b/tests/mergeWith.ts new file mode 100644 index 0000000..84c41ed --- /dev/null +++ b/tests/mergeWith.ts @@ -0,0 +1,10 @@ +import * as R_mergeWith from '../ramda/dist/src/mergeWith'; + +declare const number_number_to_string: (a: number, b: number) => string; +declare const a_1_c_1: { a: 1; c: 1 }; +declare const b_2_c_2: { b: 2; c: 2 }; + +// @dts-jest:pass +R_mergeWith(number_number_to_string)(a_1_c_1)(b_2_c_2); +// @dts-jest:pass +R_mergeWith(number_number_to_string, a_1_c_1, b_2_c_2); diff --git a/tests/mergeWithKey.ts b/tests/mergeWithKey.ts new file mode 100644 index 0000000..eecbc13 --- /dev/null +++ b/tests/mergeWithKey.ts @@ -0,0 +1,14 @@ +import * as R_mergeWithKey from '../ramda/dist/src/mergeWithKey'; + +declare const string_number_number_to_string: ( + key: string, + a: number, + b: number, +) => string; +declare const a_1_c_1: { a: 1; c: 1 }; +declare const b_2_c_2: { b: 2; c: 2 }; + +// @dts-jest:pass +R_mergeWithKey(string_number_number_to_string)(a_1_c_1)(b_2_c_2); +// @dts-jest:pass +R_mergeWithKey(string_number_number_to_string, a_1_c_1, b_2_c_2); diff --git a/tests/min.ts b/tests/min.ts new file mode 100644 index 0000000..c848e03 --- /dev/null +++ b/tests/min.ts @@ -0,0 +1,11 @@ +import * as R_min from '../ramda/dist/src/min'; + +declare const number: number; +declare const string: string; + +// @dts-jest:pass +R_min(string); +// @dts-jest:pass +R_min(number); +// @dts-jest:pass +R_min(number, number); diff --git a/tests/minBy.ts b/tests/minBy.ts new file mode 100644 index 0000000..8e51809 --- /dev/null +++ b/tests/minBy.ts @@ -0,0 +1,11 @@ +import * as R_minBy from '../ramda/dist/src/minBy'; + +declare const object_to_number: (x: object) => number; +declare const object: object; + +// @dts-jest:pass +R_minBy(object_to_number, object); +// @dts-jest:pass +R_minBy(object_to_number)(object)(object); +// @dts-jest:pass +R_minBy(object_to_number, object, object); diff --git a/tests/modulo.ts b/tests/modulo.ts new file mode 100644 index 0000000..c7412ed --- /dev/null +++ b/tests/modulo.ts @@ -0,0 +1,8 @@ +import * as R_modulo from '../ramda/dist/src/modulo'; + +declare const number: number; + +// @dts-jest:pass +R_modulo(number, number); +// @dts-jest:pass +R_modulo(number)(number); diff --git a/tests/multiply.ts b/tests/multiply.ts new file mode 100644 index 0000000..83e6e74 --- /dev/null +++ b/tests/multiply.ts @@ -0,0 +1,8 @@ +import * as R_multiply from '../ramda/dist/src/multiply'; + +declare const number: number; + +// @dts-jest:pass +R_multiply(number, number); +// @dts-jest:pass +R_multiply(number)(number); diff --git a/tests/nAry.ts b/tests/nAry.ts new file mode 100644 index 0000000..121333c --- /dev/null +++ b/tests/nAry.ts @@ -0,0 +1,20 @@ +import { Variadic } from '../ramda/dist/src/$types'; +import * as R_nAry from '../ramda/dist/src/nAry'; + +declare const number: number; +declare const string_number_symbol_to_boolean: ( + a: string, + b: number, + c: symbol, +) => boolean; +declare const object_variadic: Variadic; + +// @dts-jest:pass +R_nAry(1, string_number_symbol_to_boolean); +// @dts-jest:pass +R_nAry(1, object_variadic); + +// @dts-jest:pass +R_nAry(number, string_number_symbol_to_boolean); +// @dts-jest:pass +R_nAry(number, object_variadic); diff --git a/tests/negate.ts b/tests/negate.ts new file mode 100644 index 0000000..ac46603 --- /dev/null +++ b/tests/negate.ts @@ -0,0 +1,6 @@ +import * as R_negate from '../ramda/dist/src/negate'; + +declare const number: number; + +// @dts-jest:pass +R_negate(number); diff --git a/tests/none.ts b/tests/none.ts new file mode 100644 index 0000000..0cbfa30 --- /dev/null +++ b/tests/none.ts @@ -0,0 +1,10 @@ +import { Predicate } from '../ramda/dist/src/$types'; +import * as R_none from '../ramda/dist/src/none'; + +declare const string_predicate: Predicate; +declare const string_array: string[]; + +// @dts-jest:pass +R_none(string_predicate)(string_array); +// @dts-jest:pass +R_none(string_predicate, string_array); diff --git a/tests/not.ts b/tests/not.ts new file mode 100644 index 0000000..a4070e2 --- /dev/null +++ b/tests/not.ts @@ -0,0 +1,6 @@ +import * as R_not from '../ramda/dist/src/not'; + +declare const string: string; + +// @dts-jest:pass +R_not(string); diff --git a/tests/nth.ts b/tests/nth.ts new file mode 100644 index 0000000..c83cbce --- /dev/null +++ b/tests/nth.ts @@ -0,0 +1,15 @@ +import * as R_nth from '../ramda/dist/src/nth'; + +declare const number: number; +declare const string: string; +declare const object_array: object[]; + +// @dts-jest:pass +R_nth(number)(string); +// @dts-jest:pass +R_nth(number, string); + +// @dts-jest:pass +R_nth(number)(object_array); +// @dts-jest:pass +R_nth(number, object_array); diff --git a/tests/nthArg.ts b/tests/nthArg.ts new file mode 100644 index 0000000..a4713d3 --- /dev/null +++ b/tests/nthArg.ts @@ -0,0 +1,7 @@ +import * as R_nthArg from '../ramda/dist/src/nthArg'; + +declare const number: number; +declare const object_array: object[]; + +// @dts-jest:pass +R_nthArg(number)(...object_array); diff --git a/tests/o.ts b/tests/o.ts new file mode 100644 index 0000000..da8ff1d --- /dev/null +++ b/tests/o.ts @@ -0,0 +1,12 @@ +import * as R_o from '../ramda/dist/src/o'; + +declare const number_to_string: (x: number) => string; +declare const boolean_to_number: (x: boolean) => number; +declare const boolean: boolean; + +// @dts-jest:pass +R_o(number_to_string, boolean_to_number); +// @dts-jest:pass +R_o(number_to_string)(boolean_to_number)(boolean); +// @dts-jest:pass +R_o(number_to_string, boolean_to_number, boolean); diff --git a/tests/objOf.ts b/tests/objOf.ts new file mode 100644 index 0000000..ae348d0 --- /dev/null +++ b/tests/objOf.ts @@ -0,0 +1,13 @@ +import * as R_objOf from '../ramda/dist/src/objOf'; + +declare const string: string; +declare const object: object; + +// @dts-jest:pass +R_objOf(string); +// @dts-jest:pass +R_objOf(string, object); +// @dts-jest:pass +R_objOf('key'); +// @dts-jest:pass +R_objOf('key', object); diff --git a/tests/of.ts b/tests/of.ts new file mode 100644 index 0000000..ba56701 --- /dev/null +++ b/tests/of.ts @@ -0,0 +1,6 @@ +import * as R_of from '../ramda/dist/src/of'; + +declare const object: object; + +// @dts-jest:pass +R_of(object); diff --git a/tests/omit.ts b/tests/omit.ts new file mode 100644 index 0000000..8efa6c3 --- /dev/null +++ b/tests/omit.ts @@ -0,0 +1,14 @@ +import * as R_omit from '../ramda/dist/src/omit'; + +declare const object: object; +declare const string: string; + +// @dts-jest:pass +R_omit([string])(object); +// @dts-jest:pass +R_omit([string], object); + +// @dts-jest:pass +R_omit([string])(object); +// @dts-jest:pass +R_omit([string], object); diff --git a/tests/once.ts b/tests/once.ts new file mode 100644 index 0000000..2ac15c5 --- /dev/null +++ b/tests/once.ts @@ -0,0 +1,6 @@ +import * as R_once from '../ramda/dist/src/once'; + +declare const T_to_T: (value: T) => T; + +// @dts-jest:pass +R_once(T_to_T); diff --git a/tests/or.ts b/tests/or.ts new file mode 100644 index 0000000..ba6028d --- /dev/null +++ b/tests/or.ts @@ -0,0 +1,9 @@ +import * as R_or from '../ramda/dist/src/or'; + +declare const string: string; +declare const number: number; + +// @dts-jest:pass +R_or(string)(number); +// @dts-jest:pass +R_or(string, number); diff --git a/tests/over.ts b/tests/over.ts new file mode 100644 index 0000000..41668b0 --- /dev/null +++ b/tests/over.ts @@ -0,0 +1,37 @@ +import { ManualLens, PseudoLens } from '../ramda/dist/src/$types'; +import * as R_over from '../ramda/dist/src/over'; + +declare const menual_lens_number_object: ManualLens; +declare const pseudo_lens_a: PseudoLens<'a'>; +declare const pseudo_lens_1: PseudoLens<1>; + +declare const number_to_number: (x: number) => number; +declare const object: object; +declare const a_1_b_2_c_3: { a: 1; b: 2; c: 3 }; +declare const number_array: number[]; +declare const string_number_tuple: [string, number]; + +// @dts-jest:pass +R_over(menual_lens_number_object, number_to_number); +// @dts-jest:pass +R_over(menual_lens_number_object)(number_to_number)(object); +// @dts-jest:pass +R_over(menual_lens_number_object, number_to_number, object); + +// @dts-jest:pass +R_over(pseudo_lens_a, number_to_number); +// @dts-jest:pass +R_over(pseudo_lens_a)(number_to_number)(a_1_b_2_c_3); +// @dts-jest:pass +R_over(pseudo_lens_a, number_to_number, a_1_b_2_c_3); + +// @dts-jest:pass +R_over(pseudo_lens_1, number_to_number); +// @dts-jest:pass +R_over(pseudo_lens_1)(number_to_number)(string_number_tuple); +// @dts-jest:pass +R_over(pseudo_lens_1, number_to_number, string_number_tuple); +// @dts-jest:pass +R_over(pseudo_lens_1)(number_to_number)(number_array); +// @dts-jest:pass +R_over(pseudo_lens_1, number_to_number, number_array); diff --git a/tests/pair.ts b/tests/pair.ts new file mode 100644 index 0000000..3e63332 --- /dev/null +++ b/tests/pair.ts @@ -0,0 +1,11 @@ +import * as R_pair from '../ramda/dist/src/pair'; + +declare const number: number; +declare const object: object; + +// @dts-jest:pass +R_pair(number); +// @dts-jest:pass +R_pair(number)(object); +// @dts-jest:pass +R_pair(number, object); diff --git a/tests/partial.ts b/tests/partial.ts new file mode 100644 index 0000000..eaac198 --- /dev/null +++ b/tests/partial.ts @@ -0,0 +1,12 @@ +import * as R_partial from '../ramda/dist/src/partial'; + +declare const number_string_to_object: (a: number, b: string) => object; +declare const number: number; +declare const string: string; + +// @dts-jest:pass +R_partial(number_string_to_object); +// @dts-jest:pass +R_partial(number_string_to_object, [number]); +// @dts-jest:pass +R_partial(number_string_to_object, [number])(string); diff --git a/tests/partialRight.ts b/tests/partialRight.ts new file mode 100644 index 0000000..ff8b4e2 --- /dev/null +++ b/tests/partialRight.ts @@ -0,0 +1,12 @@ +import * as R_partialRight from '../ramda/dist/src/partialRight'; + +declare const number_string_to_object: (a: number, b: string) => object; +declare const number: number; +declare const string: string; + +// @dts-jest:pass +R_partialRight(number_string_to_object); +// @dts-jest:pass +R_partialRight(number_string_to_object, [string]); +// @dts-jest:pass +R_partialRight(number_string_to_object, [string])(number); diff --git a/tests/partition.ts b/tests/partition.ts new file mode 100644 index 0000000..48c2488 --- /dev/null +++ b/tests/partition.ts @@ -0,0 +1,19 @@ +import * as R_partition from '../ramda/dist/src/partition'; + +declare const number_to_boolean: (x: number) => boolean; +declare const number_array: number[]; +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; + +// @dts-jest:pass +R_partition(number_to_boolean)(number_array); +// @dts-jest:pass +R_partition(number_to_boolean, number_array); + +// @dts-jest:pass +R_partition(number_to_boolean)(a_1_b_2_c_3); +// @dts-jest:pass +R_partition(number_to_boolean, a_1_b_2_c_3); diff --git a/tests/path.ts b/tests/path.ts new file mode 100644 index 0000000..733ff9f --- /dev/null +++ b/tests/path.ts @@ -0,0 +1,23 @@ +import { Path } from '../ramda/dist/src/$types'; +import * as R_path from '../ramda/dist/src/path'; + +declare const path: Path; +declare const object: object; +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; + +// @dts-jest:pass +R_path(path); + +// @dts-jest:pass +R_path(path)(object); +// @dts-jest:pass +R_path(path, object); + +// @dts-jest:pass +R_path(['a', 'b', 'c'])(a_1_b_2_c_3); +// @dts-jest:pass +R_path(['a', 'b', 'c'], a_1_b_2_c_3); diff --git a/tests/pathEq.ts b/tests/pathEq.ts new file mode 100644 index 0000000..158be8a --- /dev/null +++ b/tests/pathEq.ts @@ -0,0 +1,13 @@ +import { Path } from '../ramda/dist/src/$types'; +import * as R_pathEq from '../ramda/dist/src/pathEq'; + +declare const path: Path; +declare const number: number; +declare const object: object; + +// @dts-jest:pass +R_pathEq(path, number); +// @dts-jest:pass +R_pathEq(path)(number)(object); +// @dts-jest:pass +R_pathEq(path, number, object); diff --git a/tests/pathOr.ts b/tests/pathOr.ts new file mode 100644 index 0000000..83c2a13 --- /dev/null +++ b/tests/pathOr.ts @@ -0,0 +1,14 @@ +import { Path } from '../ramda/dist/src/$types'; +import * as R_pathOr from '../ramda/dist/src/pathOr'; + +declare const path: Path; +declare const number: number; +declare const object: object; + +// @dts-jest:pass +R_pathOr(number, path); + +// @dts-jest:pass +R_pathOr(number)(path)(object); +// @dts-jest:pass +R_pathOr(number, path, object); diff --git a/tests/pathSatisfies.ts b/tests/pathSatisfies.ts new file mode 100644 index 0000000..dd0535c --- /dev/null +++ b/tests/pathSatisfies.ts @@ -0,0 +1,13 @@ +import { Path } from '../ramda/dist/src/$types'; +import * as R_pathSatisfies from '../ramda/dist/src/pathSatisfies'; + +declare const string_to_boolean: (x: string) => boolean; +declare const path: Path; +declare const object: object; + +// @dts-jest:pass +R_pathSatisfies(string_to_boolean, path); +// @dts-jest:pass +R_pathSatisfies(string_to_boolean)(path)(object); +// @dts-jest:pass +R_pathSatisfies(string_to_boolean, path, object); diff --git a/tests/pick.ts b/tests/pick.ts new file mode 100644 index 0000000..570d63b --- /dev/null +++ b/tests/pick.ts @@ -0,0 +1,19 @@ +import * as R_pick from '../ramda/dist/src/pick'; + +declare const object: object; +declare const string: string; +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; + +// @dts-jest:pass +R_pick([string])(object); +// @dts-jest:pass +R_pick([string], object); + +// @dts-jest:pass +R_pick(['a', 'c'])(a_1_b_2_c_3); +// @dts-jest:pass +R_pick(['a', 'c'], a_1_b_2_c_3); diff --git a/tests/pickAll.ts b/tests/pickAll.ts new file mode 100644 index 0000000..995ed5d --- /dev/null +++ b/tests/pickAll.ts @@ -0,0 +1,24 @@ +import * as R_pickAll from '../ramda/dist/src/pickAll'; + +declare const object: object; +declare const string: string; +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; + +// @dts-jest:pass +R_pickAll([string])(object); +// @dts-jest:pass +R_pickAll([string], object); + +// @dts-jest:pass +R_pickAll(['a', 'c'])(a_1_b_2_c_3); +// @dts-jest:pass +R_pickAll(['a', 'c'], a_1_b_2_c_3); + +// @dts-jest:pass +R_pickAll(['a', 'c', 'f'])(a_1_b_2_c_3); +// @dts-jest:pass +R_pickAll(['a', 'c', 'f'], a_1_b_2_c_3); diff --git a/tests/pickBy.ts b/tests/pickBy.ts new file mode 100644 index 0000000..65880b2 --- /dev/null +++ b/tests/pickBy.ts @@ -0,0 +1,38 @@ +import * as R_pickBy from '../ramda/dist/src/pickBy'; + +declare const number_string_object_to_boolean: ( + x: number, + k: string, + o: object, +) => boolean; +declare const string_string_object_to_boolean: ( + x: string, + k: string, + o: object, +) => boolean; +declare const string_number_record: Record; +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; + +// @dts-jest:fail +R_pickBy(string_string_object_to_boolean)(string_number_record); +// @dts-jest:fail +R_pickBy(string_string_object_to_boolean, string_number_record); + +// @dts-jest:fail +R_pickBy(string_string_object_to_boolean)(a_1_b_2_c_3); +// @dts-jest:fail +R_pickBy(string_string_object_to_boolean, a_1_b_2_c_3); + +// @dts-jest:pass +R_pickBy(number_string_object_to_boolean)(string_number_record); +// @dts-jest:pass +R_pickBy(number_string_object_to_boolean, string_number_record); + +// @dts-jest:pass +R_pickBy(number_string_object_to_boolean)(a_1_b_2_c_3); +// @dts-jest:pass +R_pickBy(number_string_object_to_boolean, a_1_b_2_c_3); diff --git a/tests/pipe.ts b/tests/pipe.ts new file mode 100644 index 0000000..9c1fdcc --- /dev/null +++ b/tests/pipe.ts @@ -0,0 +1,83 @@ +import * as R_pipe from '../ramda/dist/src/pipe'; + +declare const boolean_to_number: (x: boolean) => number; +declare const boolean_to_string: (x: boolean) => string; +declare const number_to_boolean: (x: number) => boolean; +declare const number_to_string: (x: number) => string; +declare const string_to_boolean: (x: string) => boolean; +declare const string_to_number: (x: string) => number; + +declare const a_b_c_d_e_f_to_any: ( + a: null, + b: undefined, + c: boolean, + d: number, + e: string, + f: object, +) => any; + +// @dts-jest:pass +R_pipe(boolean_to_number); +// @dts-jest:pass +R_pipe(a_b_c_d_e_f_to_any); + +// @dts-jest:pass +R_pipe(string_to_boolean, boolean_to_number); +// @dts-jest:pass +R_pipe(a_b_c_d_e_f_to_any, boolean_to_number); + +// @dts-jest:pass +R_pipe(number_to_string, string_to_boolean, boolean_to_number); +// @dts-jest:pass +R_pipe(a_b_c_d_e_f_to_any, string_to_boolean, boolean_to_number); + +// @dts-jest:pass +R_pipe( + string_to_number, + number_to_string, + string_to_boolean, + boolean_to_number, +); +// @dts-jest:pass +R_pipe( + a_b_c_d_e_f_to_any, + number_to_string, + string_to_boolean, + boolean_to_number, +); + +// @dts-jest:pass +R_pipe( + boolean_to_string, + string_to_number, + number_to_string, + string_to_boolean, + boolean_to_number, +); +// @dts-jest:pass +R_pipe( + a_b_c_d_e_f_to_any, + string_to_number, + number_to_string, + string_to_boolean, + boolean_to_number, +); + +// @dts-jest:pass +R_pipe( + number_to_boolean, + boolean_to_string, + string_to_number, + number_to_string, + string_to_boolean, + boolean_to_number, +); +// @dts-jest:pass +R_pipe( + a_b_c_d_e_f_to_any, + boolean_to_string, + string_to_number, + number_to_string, + string_to_boolean, + boolean_to_number, +); diff --git a/tests/pipeK.ts b/tests/pipeK.ts new file mode 100644 index 0000000..a997d35 --- /dev/null +++ b/tests/pipeK.ts @@ -0,0 +1,52 @@ +import { Chain } from '../ramda/dist/src/$types'; +import * as R_pipeK from '../ramda/dist/src/pipeK'; + +declare const chain_boolean_to_chain_number: ( + x: Chain, +) => Chain; +declare const chain_boolean_to_chain_string: ( + x: Chain, +) => Chain; +declare const chain_number_to_chain_boolean: ( + x: Chain, +) => Chain; +declare const chain_number_to_chain_string: (x: Chain) => Chain; +declare const chain_string_to_chain_boolean: ( + x: Chain, +) => Chain; +declare const chain_string_to_chain_number: (x: Chain) => Chain; + +// @dts-jest:pass +R_pipeK(chain_boolean_to_chain_number); +// @dts-jest:pass +R_pipeK(chain_string_to_chain_boolean, chain_boolean_to_chain_number); +// @dts-jest:pass +R_pipeK( + chain_number_to_chain_string, + chain_string_to_chain_boolean, + chain_boolean_to_chain_number, +); +// @dts-jest:pass +R_pipeK( + chain_string_to_chain_number, + chain_number_to_chain_string, + chain_string_to_chain_boolean, + chain_boolean_to_chain_number, +); +// @dts-jest:pass +R_pipeK( + chain_boolean_to_chain_string, + chain_string_to_chain_number, + chain_number_to_chain_string, + chain_string_to_chain_boolean, + chain_boolean_to_chain_number, +); +// @dts-jest:pass +R_pipeK( + chain_number_to_chain_boolean, + chain_boolean_to_chain_string, + chain_string_to_chain_number, + chain_number_to_chain_string, + chain_string_to_chain_boolean, + chain_boolean_to_chain_number, +); diff --git a/tests/pipeP.ts b/tests/pipeP.ts new file mode 100644 index 0000000..d72899f --- /dev/null +++ b/tests/pipeP.ts @@ -0,0 +1,91 @@ +import * as R_pipeP from '../ramda/dist/src/pipeP'; + +declare const boolean_to_number_promise: (x: boolean) => Promise; +declare const boolean_to_string_promise: (x: boolean) => Promise; +declare const number_to_boolean_promise: (x: number) => Promise; +declare const number_to_string_promise: (x: number) => Promise; +declare const string_to_boolean_promise: (x: string) => Promise; +declare const string_to_number_promise: (x: string) => Promise; + +declare const a_b_c_d_e_f_to_any_promise: ( + a: null, + b: undefined, + c: boolean, + d: number, + e: string, + f: object, +) => Promise; + +// @dts-jest:pass +R_pipeP(boolean_to_number_promise); +// @dts-jest:pass +R_pipeP(a_b_c_d_e_f_to_any_promise); + +// @dts-jest:pass +R_pipeP(string_to_boolean_promise, boolean_to_number_promise); +// @dts-jest:pass +R_pipeP(a_b_c_d_e_f_to_any_promise, boolean_to_number_promise); + +// @dts-jest:pass +R_pipeP( + number_to_string_promise, + string_to_boolean_promise, + boolean_to_number_promise, +); +// @dts-jest:pass +R_pipeP( + a_b_c_d_e_f_to_any_promise, + string_to_boolean_promise, + boolean_to_number_promise, +); + +// @dts-jest:pass +R_pipeP( + string_to_number_promise, + number_to_string_promise, + string_to_boolean_promise, + boolean_to_number_promise, +); +// @dts-jest:pass +R_pipeP( + a_b_c_d_e_f_to_any_promise, + number_to_string_promise, + string_to_boolean_promise, + boolean_to_number_promise, +); + +// @dts-jest:pass +R_pipeP( + boolean_to_string_promise, + string_to_number_promise, + number_to_string_promise, + string_to_boolean_promise, + boolean_to_number_promise, +); +// @dts-jest:pass +R_pipeP( + a_b_c_d_e_f_to_any_promise, + string_to_number_promise, + number_to_string_promise, + string_to_boolean_promise, + boolean_to_number_promise, +); + +// @dts-jest:pass +R_pipeP( + number_to_boolean_promise, + boolean_to_string_promise, + string_to_number_promise, + number_to_string_promise, + string_to_boolean_promise, + boolean_to_number_promise, +); +// @dts-jest:pass +R_pipeP( + a_b_c_d_e_f_to_any_promise, + boolean_to_string_promise, + string_to_number_promise, + number_to_string_promise, + string_to_boolean_promise, + boolean_to_number_promise, +); diff --git a/tests/pluck.ts b/tests/pluck.ts new file mode 100644 index 0000000..c0bf398 --- /dev/null +++ b/tests/pluck.ts @@ -0,0 +1,22 @@ +import { Placeholder } from '../ramda/dist/src/$placeholder'; +import * as R_pluck from '../ramda/dist/src/pluck'; + +declare const placeholder: Placeholder; +declare const a_number_record: Record<'a', number>; +declare const string_array: string[]; + +// @dts-jest:pass +R_pluck('a'); +// @dts-jest:pass +R_pluck('a')([a_number_record, a_number_record]); + +// @dts-jest:pass +R_pluck('a', [a_number_record, a_number_record]); + +// @dts-jest:pass +R_pluck(placeholder, [a_number_record, a_number_record]); +// @dts-jest:pass +R_pluck(placeholder, [a_number_record, a_number_record])('a'); + +// @dts-jest:pass +R_pluck(0, [string_array]); diff --git a/tests/prepend.ts b/tests/prepend.ts new file mode 100644 index 0000000..13c2097 --- /dev/null +++ b/tests/prepend.ts @@ -0,0 +1,14 @@ +import * as R_prepend from '../ramda/dist/src/prepend'; + +declare const string: string; +declare const number: number; +declare const number_array: number[]; + +// @dts-jest:pass +R_prepend(string)(number_array); +// @dts-jest:pass +R_prepend(string, number_array); +// @dts-jest:pass +R_prepend(number)(number_array); +// @dts-jest:pass +R_prepend(number, number_array); diff --git a/tests/product.ts b/tests/product.ts new file mode 100644 index 0000000..51760c0 --- /dev/null +++ b/tests/product.ts @@ -0,0 +1,6 @@ +import * as R_product from '../ramda/dist/src/product'; + +declare const number_array: number[]; + +// @dts-jest:pass +R_product(number_array); diff --git a/tests/project.ts b/tests/project.ts new file mode 100644 index 0000000..c0188db --- /dev/null +++ b/tests/project.ts @@ -0,0 +1,18 @@ +import { Placeholder } from '../ramda/dist/src/$placeholder'; +import * as R_project from '../ramda/dist/src/project'; + +declare const placeholder: Placeholder; +declare const a_b_number_record: Record<'a' | 'b', number>; + +// @dts-jest:pass +R_project(['a']); +// @dts-jest:pass +R_project(['a'])([a_b_number_record, a_b_number_record]); + +// @dts-jest:pass +R_project(['a'], [a_b_number_record, a_b_number_record]); + +// @dts-jest:pass +R_project(placeholder, [a_b_number_record, a_b_number_record]); +// @dts-jest:pass +R_project(placeholder, [a_b_number_record, a_b_number_record])(['a']); diff --git a/tests/prop.ts b/tests/prop.ts new file mode 100644 index 0000000..9e31be5 --- /dev/null +++ b/tests/prop.ts @@ -0,0 +1,18 @@ +import { Placeholder } from '../ramda/dist/src/$placeholder'; +import * as R_prop from '../ramda/dist/src/prop'; + +declare const placeholder: Placeholder; +declare const a_b_number_record: Record<'a' | 'b', number>; + +// @dts-jest:pass +R_prop('a'); +// @dts-jest:pass +R_prop('a')(a_b_number_record); + +// @dts-jest:pass +R_prop('a', a_b_number_record); + +// @dts-jest:pass +R_prop(placeholder, a_b_number_record); +// @dts-jest:pass +R_prop(placeholder, a_b_number_record)('a'); diff --git a/tests/propEq.ts b/tests/propEq.ts new file mode 100644 index 0000000..8cdf88f --- /dev/null +++ b/tests/propEq.ts @@ -0,0 +1,11 @@ +import * as R_propEq from '../ramda/dist/src/propEq'; + +declare const string: string; +declare const object: object; + +// @dts-jest:pass +R_propEq(string, string); +// @dts-jest:pass +R_propEq(string)(string)(object); +// @dts-jest:pass +R_propEq(string, string, object); diff --git a/tests/propIs.ts b/tests/propIs.ts new file mode 100644 index 0000000..45e94a2 --- /dev/null +++ b/tests/propIs.ts @@ -0,0 +1,12 @@ +import * as R_propIs from '../ramda/dist/src/propIs'; + +declare const object: object; + +// @dts-jest:pass +R_propIs(Number)('a'); +// @dts-jest:pass +R_propIs(Number, 'a'); +// @dts-jest:pass +R_propIs(Number)('a')(object); +// @dts-jest:pass +R_propIs(Number, 'a', object); diff --git a/tests/propOr.ts b/tests/propOr.ts new file mode 100644 index 0000000..34ba6ec --- /dev/null +++ b/tests/propOr.ts @@ -0,0 +1,19 @@ +import { Placeholder } from '../ramda/dist/src/$placeholder'; +import * as R_propOr from '../ramda/dist/src/propOr'; + +declare const placeholder: Placeholder; +declare const a_b_number_record: Record<'a' | 'b', number>; +declare const defaults: 'defaults'; + +// @dts-jest:pass +R_propOr(defaults, 'a'); +// @dts-jest:pass +R_propOr(defaults, 'a')(a_b_number_record); + +// @dts-jest:pass +R_propOr(defaults, 'a', a_b_number_record); + +// @dts-jest:pass +R_propOr(defaults, placeholder, a_b_number_record); +// @dts-jest:pass +R_propOr(defaults, placeholder, a_b_number_record)('a'); diff --git a/tests/propSatisfies.ts b/tests/propSatisfies.ts new file mode 100644 index 0000000..cd495bb --- /dev/null +++ b/tests/propSatisfies.ts @@ -0,0 +1,19 @@ +import { Placeholder } from '../ramda/dist/src/$placeholder'; +import * as R_propSatisfies from '../ramda/dist/src/propSatisfies'; + +declare const number_to_boolean: (x: number) => boolean; +declare const placeholder: Placeholder; +declare const a_b_number_record: Record<'a' | 'b', number>; + +// @dts-jest:pass +R_propSatisfies(number_to_boolean, 'a'); +// @dts-jest:pass +R_propSatisfies(number_to_boolean, 'a')(a_b_number_record); + +// @dts-jest:pass +R_propSatisfies(number_to_boolean, 'a', a_b_number_record); + +// @dts-jest:pass +R_propSatisfies(number_to_boolean, placeholder, a_b_number_record); +// @dts-jest:pass +R_propSatisfies(number_to_boolean, placeholder, a_b_number_record)('a'); diff --git a/tests/props.ts b/tests/props.ts new file mode 100644 index 0000000..48252a0 --- /dev/null +++ b/tests/props.ts @@ -0,0 +1,18 @@ +import { Placeholder } from '../ramda/dist/src/$placeholder'; +import * as R_props from '../ramda/dist/src/props'; + +declare const placeholder: Placeholder; +declare const a_b_c_number_record: Record<'a' | 'b' | 'c', number>; + +// @dts-jest:pass +R_props(['a', 'b']); +// @dts-jest:pass +R_props(['a', 'b'])(a_b_c_number_record); + +// @dts-jest:pass +R_props(['a', 'b'], a_b_c_number_record); + +// @dts-jest:pass +R_props(placeholder, a_b_c_number_record); +// @dts-jest:pass +R_props(placeholder, a_b_c_number_record)(['a', 'b']); diff --git a/tests/ramda-tests.ts b/tests/ramda-tests.ts new file mode 100644 index 0000000..6ce8d76 --- /dev/null +++ b/tests/ramda-tests.ts @@ -0,0 +1,3295 @@ +import * as R from '../ramda/dist/index'; + +// https://github.com/types/npm-ramda/blob/master/tests/test.ts + +// tslint:disable max-file-line-count comment-format naming-convention + +// @dts-jest:group __ +(() => { + const greet = R.replace('{name}', R.__, 'Hello, {name}!'); + // @dts-jest:pass + greet('Alice'); //=> 'Hello, Alice!' +})(); + +// @dts-jest:group add +(() => { + // @dts-jest:pass + R.add(2, 3); //=> 5 + // @dts-jest:pass + R.add(7)(10); //=> 17 +})(); + +// @dts-jest:group addIndex +(() => { + (() => { + const lastTwo = (_val: number, idx: number, list: number[]) => + list.length - idx <= 2; + const filterIndexed = R.addIndex( + R.filter, + ); + + // @dts-jest:pass + filterIndexed(lastTwo, [8, 6, 7, 5, 3, 0, 9]); //=> [0, 9] + // @dts-jest:pass + filterIndexed(lastTwo)([8, 6, 7, 5, 3, 0, 9]); //=> [0, 9] + })(); + (() => { + const plusFive = (num: number, idx: number, list: number[]) => { + list[idx] = num + 5; + }; + + // @dts-jest:pass + R.addIndex(R.forEach)(plusFive)([ + 1, + 2, + 3, + ]); //=> [6, 7, 8] + })(); + (() => { + const squareEnds = (elt: number, idx: number, list: number[]) => + idx === 0 || idx === list.length - 1 ? elt * elt : elt; + + // @dts-jest:pass + R.addIndex(R.map)(squareEnds, [ + 8, + 5, + 3, + 0, + 9, + ]); //=> [64, 5, 3, 0, 81] + // @dts-jest:pass + R.addIndex(R.map)(squareEnds)([ + 8, + 5, + 3, + 0, + 9, + ]); //=> [64, 5, 3, 0, 81] + })(); + (() => { + const reduceIndexed = R.addIndex< + Record, + string, + Record, + Record, + string[], + Record + >(R.reduce); + const objectify = ( + accObject: Record, + elem: string, + idx: number, + _list: string[], + ) => { + accObject[elem] = idx; + return accObject; + }; + + // @dts-jest:pass + reduceIndexed(objectify, {}, ['a', 'b', 'c']); //=> {a: 0, b: 1, c: 2} + // @dts-jest:pass + reduceIndexed(objectify)({}, ['a', 'b', 'c']); //=> {a: 0, b: 1, c: 2} + // @dts-jest:pass + reduceIndexed(objectify, {})(['a', 'b', 'c']); //=> {a: 0, b: 1, c: 2} + })(); + (() => { + const reduceIndexed = R.addIndex<'1', 'v2x1'>()(R.reduce); + + // @dts-jest:pass + reduceIndexed( + (acc: string, val: string, idx: number) => `${acc},${idx}-${val}`, + '', + ['f', 'o', 'o', 'b', 'a', 'r'], + ); //=> ',0-f,1-o,2-o,3-b,4-a,5-r' + })(); +})(); + +// @dts-jest:group adjust +(() => { + // @dts-jest:pass + R.adjust(R.add(10), 1, [1, 2, 3]); //=> [1, 12, 3] + // @dts-jest:pass + R.adjust(R.add(10))(1)([1, 2, 3]); //=> [1, 12, 3] +})(); + +// @dts-jest:group all +(() => { + const lessThan2 = R.flip(R.lt)(2); + const lessThan3 = R.flip(R.lt)(3); + + // @dts-jest:pass + R.all(lessThan2)([1, 2]); //=> false + // @dts-jest:pass + R.all(lessThan3)([1, 2]); //=> true +})(); + +// @dts-jest:group allPass +(() => { + const gt10 = (x: number) => x > 10; + const even = (x: number) => x % 2 === 0; + + // @dts-jest:pass + R.allPass([gt10, even])(11); //=> false + // @dts-jest:pass + R.allPass([gt10, even])(12); //=> true +})(); + +// @dts-jest:group always +(() => { + // @dts-jest:pass + R.always('Tee')(); //=> 'Tee' +})(); + +// @dts-jest:group and +(() => { + // @dts-jest:pass + R.and(false, true); //=> false + // @dts-jest:pass + R.and(0, []); //=> 0 + // @dts-jest:pass + R.and(0)([]); //=> 0 + // @dts-jest:pass + R.and(null, ''); //=> null +})(); + +// @dts-jest:group any +(() => { + const lessThan0 = R.flip(R.lt)(0); + const lessThan2 = R.flip(R.lt)(2); + + // @dts-jest:pass + R.any(lessThan0)([1, 2]); //=> false + // @dts-jest:pass + R.any(lessThan2)([1, 2]); //=> true +})(); + +// @dts-jest:group anyPass +(() => { + const gt10 = (x: number) => x > 10; + const even = (x: number) => x % 2 === 0; + + // @dts-jest:pass + R.anyPass([gt10, even])(11); //=> true + // @dts-jest:pass + R.anyPass([gt10, even])(8); //=> true + // @dts-jest:pass + R.anyPass([gt10, even])(9); //=> false +})(); + +// @dts-jest:group ap +(() => { + // @dts-jest:pass + R.ap([R.multiply(2), R.add(3)], [1, 2, 3]); //=> [2, 4, 6, 4, 5, 6] + // @dts-jest:pass + R.ap([R.multiply(2), R.add(3)])([1, 2, 3]); //=> [2, 4, 6, 4, 5, 6] +})(); + +// @dts-jest:group aperture +(() => { + // @dts-jest:pass + R.aperture(2, [1, 2, 3, 4, 5]); //=> [[1, 2], [2, 3], [3, 4], [4, 5]] + // @dts-jest:pass + R.aperture(3, [1, 2, 3, 4, 5]); //=> [[1, 2, 3], [2, 3, 4], [3, 4, 5]] + // @dts-jest:pass + R.aperture(7, [1, 2, 3, 4, 5]); //=> [] + // @dts-jest:pass + R.aperture(7)([1, 2, 3, 4, 5]); //=> [] +})(); + +// @dts-jest:group append +(() => { + // @dts-jest:pass + R.append('tests', ['write', 'more']); //=> ['write', 'more', 'tests'] + // @dts-jest:pass + R.append('tests')(['write', 'more']); //=> ['write', 'more', 'tests'] + // @dts-jest:pass + R.append('tests', []); //=> ['tests'] + // @dts-jest:pass + R.append(['tests'], ['write', 'more']); //=> ['write', 'more', ['tests']] + // @dts-jest:pass + R.append(['tests'])(['write', 'more']); //=> ['write', 'more', ['tests']] +})(); + +// @dts-jest:group apply +(() => { + const nums = [1, 2, 3, -99, 42, 6, 7]; + + // @dts-jest:pass + R.apply(Math.max, nums); //=> 42 + // @dts-jest:pass + R.apply(Math.max)(nums); //=> 42 +})(); + +// @dts-jest:group applySpec +(() => { + interface T { + sum: number; + nested: { + mul: number; + }; + } + const getMetrics = R.applySpec({ + sum: R.add, + nested: { + mul: R.multiply, + }, + }); + // @dts-jest:pass + getMetrics(2, 4); //=> {sum: 6, nested: {mul: 8}} +})(); + +// @dts-jest:group ascend +(() => { + const byAge = R.ascend(R.prop('age')); + const alice = { + name: 'ALICE', + age: 101, + }; + const bob = { + name: 'Bob', + age: -10, + }; + const clara = { + name: 'clara', + age: 314.159, + }; + const people = [clara, bob, alice]; + + // @dts-jest:pass + R.sort(byAge, people); + // @dts-jest:pass + R.sort(R.__, people)(byAge); +})(); + +// @dts-jest:group assoc +(() => { + // @dts-jest:pass + R.assoc('c', 3, { a: 1, b: 2 }); //=> {a: 1, b: 2, c: 3} + // @dts-jest:pass + R.assoc('c')(3, { a: 1, b: 2 }); //=> {a: 1, b: 2, c: 3} + // @dts-jest:pass + R.assoc('c', 3)({ a: 1, b: 2 }); //=> {a: 1, b: 2, c: 3} +})(); + +// @dts-jest:group assocPath +(() => { + // @dts-jest:pass + R.assocPath(['a', 'b', 'c'], 42, { a: { b: { c: 0 } } }); //=> {a: {b: {c: 42}}} + // @dts-jest:pass + R.assocPath(['a', 'b', 'c'])(42, { a: { b: { c: 0 } } }); //=> {a: {b: {c: 42}}} + // @dts-jest:pass + R.assocPath(['a', 'b', 'c'], 42)({ a: { b: { c: 0 } } }); //=> {a: {b: {c: 42}}} +})(); + +// @dts-jest:group binary +(() => { + const takesThreeArgs = (a: number, b: number, c: number) => [a, b, c]; + const takesTwoArgs = R.binary(takesThreeArgs); + + // @dts-jest:pass + takesThreeArgs.length; //=> 3 + // @dts-jest:pass + takesThreeArgs(1, 2, 3); //=> [1, 2, 3] + + // @dts-jest:pass + takesTwoArgs.length; //=> 2 + // @dts-jest:fail + takesTwoArgs(1, 2, 3); +})(); + +// @dts-jest:group bind +(() => { + // @dts-jest:pass + R.bind(console.log, console); +})(); + +// @dts-jest:group both +(() => { + const gt10 = (x: number) => x > 10; + const even = (x: number) => x % 2 === 0; + + // @dts-jest:pass + R.both(gt10, even)(100); //=> true + // @dts-jest:pass + R.both(gt10)(even)(101); //=> false +})(); + +// @dts-jest:group call +(() => { + // @dts-jest:pass + R.call(R.add<'11'>(), 1, 2); //=> 3 +})(); + +// @dts-jest:group chain +(() => { + const duplicate = (n: number) => [n, n]; + + // @dts-jest:pass + R.chain(duplicate, [1, 2, 3]); //=> [1, 1, 2, 2, 3, 3] + // @dts-jest:pass + R.chain(duplicate)([1, 2, 3]); //=> [1, 1, 2, 2, 3, 3] + // @dts-jest:pass + R.chain(R.append, R.head)([1, 2, 3]); //=> [1, 2, 3, 1] + // @dts-jest:pass + R.chain(R.append)(R.head)([1, 2, 3]); //=> [1, 2, 3, 1] +})(); + +// @dts-jest:group clamp +(() => { + // @dts-jest:pass + R.clamp(1, 10, -1); //=> 1 + // @dts-jest:pass + R.clamp(1)(10)(-1); //=> 1 + // @dts-jest:pass + R.clamp(1, 10)(11); //=> 10 + // @dts-jest:pass + R.clamp(1)(10, 4); //=> 4 + // @dts-jest:pass + R.clamp('a', 'd', 'e'); //=> 'd' + // @dts-jest:pass + R.clamp('a')('d')('e'); //=> 'd' + // @dts-jest:fail + R.clamp(1, 'str', true); + // @dts-jest:fail + R.clamp(1)('str')(true); + // @dts-jest:pass + R.clamp(new Date(0), new Date(1), new Date(2)); //=> new Date(1) + // @dts-jest:pass + R.clamp(new Date(0))(new Date(1))(new Date(2)); //=> new Date(1) +})(); + +// @dts-jest:group clone +(() => { + const obj1 = [{}, {}, {}]; + const obj2 = [{ a: 1 }, { a: 2 }, { a: 3 }]; + + // @dts-jest:pass + R.clone(obj1); + // @dts-jest:pass + R.clone(obj2); + + // @dts-jest:pass + R.clone([{}, {}, {}]); + // @dts-jest:pass + R.clone([1, 2, 3]); + // @dts-jest:pass + R.clone({}); + // @dts-jest:pass + R.clone(10); + // @dts-jest:pass + R.clone('foo'); + // @dts-jest:pass + R.clone(Date.now()); +})(); + +// @dts-jest:group comparator +(() => { + interface Person { + age: number; + name: string; + } + const people = [ + { name: 'Agy', age: 33 }, + { name: 'Bib', age: 15 }, + { name: 'Cari', age: 16 }, + ]; + + // @dts-jest:pass + R.sort(R.comparator((a: Person, b: Person) => a.age < b.age), people); +})(); + +// @dts-jest:group complement +(() => { + const isEven = (n: number) => n % 2 === 0; + + // @dts-jest:pass + R.complement(isEven)(21); //=> true + // @dts-jest:pass + R.complement(isEven)(42); //=> false +})(); + +// @dts-jest:group compose +(() => { + const double = (x: number): number => x + x; + (() => { + const f0 = R.compose(Math.pow); + const f1 = R.compose(R.negate, Math.pow); + const f2 = R.compose(R.inc, R.negate, Math.pow); + const f3 = R.compose(R.inc, R.inc, R.negate, Math.pow); + const f4 = R.compose(R.inc, R.inc, R.inc, R.negate, Math.pow); + const f5 = R.compose(R.inc, R.inc, R.inc, R.inc, R.negate, Math.pow); + + // @dts-jest:pass + f0(3, 4); // -(3^4) + 1 + // @dts-jest:pass + f1(3, 4); // -(3^4) + 1 + // @dts-jest:pass + f2(3, 4); // -(3^4) + 1 + // @dts-jest:pass + f3(3, 4); // -(3^4) + 1 + // @dts-jest:pass + f4(3, 4); // -(3^4) + 1 + // @dts-jest:pass + f5(3, 4); // -(3^4) + 1 + })(); + (() => { + // @dts-jest:pass + R.compose(double, R.identity); + })(); + (() => { + const fn = (a: string, b: number, c: string) => [a, b, c]; + const gn = R.compose(R.length, fn); + + // @dts-jest:pass + gn('Hello', 4, 'world'); + })(); + (() => { + const limit10 = (x: number): boolean => x >= 10; + // @dts-jest:pass + R.compose(limit10, double); + // @dts-jest:pass + R.compose(limit10, double)(10); + + // akward example that bounces types between number and string + const g0 = (list: number[]) => R.map(R.inc, list); + const g1 = R.dropWhile(R.gt(10)); + const g2 = R.map((i: number) => (i > 5 ? 'bigger' : 'smaller')); + const g3 = R.all((i: string) => i === 'smaller'); + const g = R.compose( + g3, + g2, + g1, + g0, + ); + + // @dts-jest:pass + g; + // @dts-jest:pass + g([1, 2, 10, 13]); + })(); +})(); + +// @dts-jest:group:skip composeK +(() => { + // TODO +})(); + +// @dts-jest:group composeP +(() => { + interface User { + name: string; + followers: string[]; + } + interface DateBase { + users: { + [userId: string]: User; + }; + } + const db: DateBase = { + users: { + JOE: { + name: 'Joe', + followers: ['STEVE', 'SUZY'], + }, + }, + }; + + const lookupUser = (userId: string) => Promise.resolve(db.users[userId]); + const lookupFollowers = (user: User) => Promise.resolve(user.followers); + + // @dts-jest:pass + R.composeP(lookupFollowers, lookupUser); + // @dts-jest:pass + R.composeP(lookupFollowers, lookupUser)('JOE'); +})(); + +// @dts-jest:group concat +(() => { + // @dts-jest:pass + R.concat([], []); //=> [] + // @dts-jest:pass + R.concat([4, 5, 6], [1, 2, 3]); //=> [4, 5, 6, 1, 2, 3] + // @dts-jest:pass + R.concat([4, 5, 6])([1, 2, 3]); //=> [4, 5, 6, 1, 2, 3] + // @dts-jest:pass + R.concat('ABC')('DEF'); // 'ABCDEF' +})(); + +// @dts-jest:group cond +(() => { + const fn = R.cond([ + [R.equals(0), R.always('water freezes at 0°C')], + [R.equals(100), R.always('water boils at 100°C')], + [R.T, (temp: number) => `nothing special happens at ${temp}°C`], + ]); + + // @dts-jest:pass + fn(0); //=> 'water freezes at 0°C' + // @dts-jest:pass + fn(50); //=> 'nothing special happens at 50°C' + // @dts-jest:pass + fn(100); //=> 'water boils at 100°C' +})(); + +(() => { + class Circle { + public r: number; + public colors: string[]; + constructor(r: number, ...colors: string[]) { + this.r = r; + this.colors = colors; + } + public area() { + return Math.PI * Math.pow(this.r, 2); + } + } + // @dts-jest:group construct + (() => { + // @dts-jest:pass + R.construct<'1', 'variadic'>()(Circle)(1, 'red'); + })(); + // @dts-jest:group constructN + (() => { + // @dts-jest:pass + R.constructN(2, Circle)(1, 'red'); + })(); +})(); + +// @dts-jest:group contains +(() => { + const obj = {}; + + // @dts-jest:pass + R.contains(obj)([{}, obj, {}]); //=> true + // @dts-jest:pass + R.contains(3)([1, 2, 3]); //=> true + // @dts-jest:pass + R.contains(3, [1, 2, 3]); //=> true + // @dts-jest:pass + R.contains(4)([1, 2, 3]); //=> false + // @dts-jest:pass + R.contains({})([{}, {}]); //=> true +})(); + +// @dts-jest:group converge +(() => { + const add = (a: number, b: number) => a + b; + const add3 = (a: number, b: number, c: number) => a + b + c; + + const subtract = (a: number, b: number) => a - b; + const multiply = (a: number, b: number) => a * b; + + // @dts-jest:pass + R.converge(multiply, [add, subtract])(1, 2); //=> -3 + + // @dts-jest:pass + R.converge(add3, [multiply, add, subtract])(1, 2); //=> 4 +})(); + +// @dts-jest:group countBy +(() => { + const numbers = [1, 1.1, 1.2, 2, 3, 2.2]; + const letters = R.split('', 'abcABCaaaBBc'); + // @dts-jest:pass + R.countBy(Math.floor)(numbers); //=> {'1': 3, '2': 2, '3': 1} + // @dts-jest:pass + R.countBy(R.toLower)(letters); //=> {'a': 5, 'b': 4, 'c': 3} +})(); + +// @dts-jest:group curry +(() => { + const addTwo = R.curry((x: number, y: number) => x + y); + // @dts-jest:pass + addTwo(3); + // @dts-jest:pass + addTwo(3)(1); + + const addThree = R.curry((x: number, y: number, z: number) => x + y + z); + // @dts-jest:pass + addThree(3, 2, 1); + // @dts-jest:pass + addThree(3)(2)(1); + // @dts-jest:pass + addThree(3, 2); + // @dts-jest:pass + addThree(3)(2); + // @dts-jest:pass + addThree(3); + + const xy = R.curry((x: X, y: Y) => ({ x, y })); + + // @dts-jest:skip (v2: Y) => { x: number; y: Y; } + xy(3); + // @dts-jest:skip { x: number; y: number; } + xy(3)(1); + + const xyz = R.curry((x: X, y: Y, z: Z) => ({ x, y, z })); + // @dts-jest:skip { x: number; y: number; z: number; } + xyz(3, 2, 1); + // @dts-jest:skip { x: number; y: number; z: number; } + xyz(3)(2)(1); + // @dts-jest:skip (v3: Z) => ({ x: number; y: number; z: Z; }) + xyz(3, 2); + // @dts-jest:skip (v3: Z) => ({ x: number; y: number; z: Z; }) + xyz(3)(2); + // @dts-jest:skip (v2: Y, v3: Z) => ({ x: number; y: Y; z: Z; }) + xyz(3); +})(); + +// @dts-jest:group curryN +(() => { + const sumArgs = (...args: number[]) => R.sum(args); + const curriedAddFourNumbers = R.curryN(4, sumArgs); + + // @dts-jest:pass + curriedAddFourNumbers; + // @dts-jest:pass + curriedAddFourNumbers(1, 2)(3)(4); //=> 10 +})(); + +// @dts-jest:group dec +(() => { + // @dts-jest:pass + R.dec(42); //=> 41 +})(); + +// @dts-jest:group defaultTo +(() => { + const defaultTo42 = R.defaultTo(42); + // @dts-jest:pass + defaultTo42(null); //=> 42 + // @dts-jest:pass + defaultTo42(undefined); //=> 42 + // @dts-jest:pass + defaultTo42('Ramda'); //=> 'Ramda' +})(); + +// @dts-jest:group descend +(() => { + const byAge = R.descend(R.prop('age')); + const alice = { + name: 'ALICE', + age: 101, + }; + const bob = { + name: 'Bob', + age: -10, + }; + const clara = { + name: 'clara', + age: 314.159, + }; + const people = [clara, bob, alice]; + // @dts-jest:pass + R.sort(byAge, people); + // @dts-jest:pass + R.sort(R.__, people)(byAge); +})(); + +// @dts-jest:group difference +(() => { + // @dts-jest:pass + R.difference([1, 2, 3, 4], [7, 6, 5, 4, 3]); //=> [1,2] + // @dts-jest:pass + R.difference([7, 6, 5, 4, 3], [1, 2, 3, 4]); //=> [7,6,5] +})(); + +// @dts-jest:group differenceWith +(() => { + function cmp(x: { a: number }, y: { a: number }) { + return x.a === y.a; + } + const l1 = [{ a: 1 }, { a: 2 }, { a: 3 }]; + const l2 = [{ a: 3 }, { a: 4 }]; + // @dts-jest:pass + R.differenceWith(cmp, l1, l2); //=> [{a: 1}, {a: 2}] + // @dts-jest:pass + R.differenceWith(cmp)(l1, l2); //=> [{a: 1}, {a: 2}] + // @dts-jest:pass + R.differenceWith(cmp)(l1)(l2); //=> [{a: 1}, {a: 2}] +})(); + +// @dts-jest:group dissoc +(() => { + // @dts-jest:pass + R.dissoc('b', { a: 1, b: 2, c: 3 }); //=> {a: 1, c: 3} + // @dts-jest:pass + R.dissoc('b')({ a: 1, b: 2, c: 3 }); //=> {a: 1, c: 3} +})(); + +// @dts-jest:group dissocPath +(() => { + // @dts-jest:pass + R.dissocPath(['a', 'b', 'c'], { a: { b: { c: 42 } } }); //=> {a: {b: {}}} + // @dts-jest:pass + R.dissocPath(['a', 'b', 'c'])({ a: { b: { c: 42 } } }); //=> {a: {b: {}}} +})(); + +// @dts-jest:group divide +(() => { + // @dts-jest:pass + R.divide(71, 100); //=> 0.71 + // @dts-jest:pass + R.flip(R.divide)(2)(42); //=> 21 + // @dts-jest:pass + R.divide(1)(4); //=> 0.25 +})(); + +// @dts-jest:group drop +(() => { + // @dts-jest:pass + R.drop(3, [1, 2, 3, 4, 5, 6, 7]); //=> [4,5,6,7] + // @dts-jest:pass + R.drop(3)([1, 2, 3, 4, 5, 6, 7]); //=> [4,5,6,7] + // @dts-jest:pass + R.drop(3, 'ramda'); //=> 'da' + // @dts-jest:pass + R.drop(3)('ramda'); //=> 'da' +})(); + +// @dts-jest:group dropLast +(() => { + // @dts-jest:pass + R.dropLast(1, ['foo', 'bar', 'baz']); //=> ['foo', 'bar'] + // @dts-jest:pass + R.dropLast(2)(['foo', 'bar', 'baz']); //=> ['foo'] + // @dts-jest:pass + R.dropLast(3, 'ramda'); //=> 'ra' + // @dts-jest:pass + R.dropLast(3)('ramda'); //=> 'ra' +})(); + +// @dts-jest:group dropLastWhile +(() => { + const lteThree = (x: number) => x <= 3; + // @dts-jest:pass + R.dropLastWhile(lteThree, [1, 2, 3, 4, 3, 2, 1]); //=> [1, 2, 3, 4] +})(); + +// @dts-jest:group dropRepeats +(() => { + // @dts-jest:pass + R.dropRepeats([1, 1, 1, 2, 3, 4, 4, 2, 2]); //=> [1, 2, 3, 4, 2] +})(); + +// @dts-jest:group dropRepeatsWith +(() => { + const l = [1, -1, 1, 3, 4, -4, -4, -5, 5, 3, 3]; + // @dts-jest:pass + R.dropRepeatsWith(R.eqBy(Math.abs), l); //=> [1, 3, 4, -5, 3] +})(); + +// @dts-jest:group dropWhile +(() => { + const lteTwo = (x: number) => x <= 2; + // @dts-jest:pass + R.dropWhile(lteTwo, [1, 2, 3, 4]); //=> [3, 4] + // @dts-jest:pass + R.dropWhile(lteTwo)([1, 2, 3, 4]); //=> [3, 4] +})(); + +// @dts-jest:group either +(() => { + const gt10 = (x: number) => x > 10; + const even = (x: number) => x % 2 === 0; + // @dts-jest:pass + R.either(gt10, even)(101); //=> true + // @dts-jest:pass + R.either(gt10)(even)(8); //=> true +})(); + +// @dts-jest:group empty +(() => { + // @dts-jest:pass + R.empty([1, 2, 3, 4, 5]); //=> [] + // @dts-jest:pass + R.empty([1, 2, 3]); //=> [] + // @dts-jest:pass + R.empty('unicorns'); //=> '' + // @dts-jest:pass + R.empty({ x: 1, y: 2 }); //=> {} +})(); + +// @dts-jest:group endsWith +(() => { + // @dts-jest:pass + R.endsWith('c', 'abc'); //=> true + // @dts-jest:pass + R.endsWith('b', 'abc'); //=> false + // @dts-jest:pass + R.endsWith(['c'], ['a', 'b', 'c']); //=> true + // @dts-jest:pass + R.endsWith(['b'], ['a', 'b', 'c']); //=> false +})(); + +// @dts-jest:group eqBy +(() => { + // @dts-jest:pass + R.eqBy(Math.abs, 5, -5); //=> true + // @dts-jest:pass + R.eqBy(Math.abs)(5, -5); //=> true + // @dts-jest:pass + R.eqBy(Math.abs, 5)(-5); //=> true +})(); + +// @dts-jest:group eqProps +(() => { + const o1 = { a: 1, b: 2, c: 3, d: 4 }; + const o2 = { a: 10, b: 20, c: 3, d: 40 }; + // @dts-jest:pass + R.eqProps('a', o1, o2); //=> false + // @dts-jest:pass + R.eqProps('c', o1, o2); //=> true + // @dts-jest:pass + R.eqProps('c')(o1); + // @dts-jest:pass + R.eqProps('c', o1); +})(); + +// @dts-jest:group equals +(() => { + // @dts-jest:pass + R.equals(1, 1); //=> true + // @dts-jest:pass + R.equals('2', '1'); //=> false + // @dts-jest:pass + R.equals([1, 2, 3], [1, 2, 3]); //=> true + + const a: any = {}; + a.v = a; + const b: any = {}; + b.v = b; + // @dts-jest:pass + R.equals(a, b); //=> true +})(); + +// @dts-jest:group evolve +(() => { + const tomato = { + firstName: 'Tomato ', + data: { elapsed: 100, remaining: 1400 }, + id: 123, + }; + const transformations = { + firstName: R.trim, + data: { elapsed: R.add(1), remaining: R.add(-1) }, + }; + // @dts-jest:pass + R.evolve(transformations, tomato); //=> {firstName: 'Tomato', data: {elapsed: 101, remaining: 1399}, id: 123} + // @dts-jest:pass + R.evolve(transformations)(tomato); //=> {firstName: 'Tomato', data: {elapsed: 101, remaining: 1399}, id: 123} +})(); + +// @dts-jest:group F +(() => { + // @dts-jest:pass + R.F(); +})(); + +// @dts-jest:group filter +(() => { + const isEven = (n: number) => n % 2 === 0; + + // @dts-jest:pass + R.filter(isEven, [1, 2, 3, 4]); //=> [2, 4] + // @dts-jest:pass + R.filter(isEven)([1, 2, 3, 4]); + // @dts-jest:pass + R.filter(isEven, { a: 1, b: 2, c: 3, d: 4 }); //=> {b: 2, d: 4} + // @dts-jest:pass + R.filter(isEven)({ a: 1, b: 2, c: 3, d: 4 }); +})(); + +// @dts-jest:group find +(() => { + interface Task { + id: number; + } + const tasks: Task[] = []; + + // @dts-jest:pass + R.find((task: Task) => task.id === 1)(tasks); +})(); + +// @dts-jest:group findIndex +(() => { + interface Task { + a: number; + } + const xs = [{ a: 1 }, { a: 2 }, { a: 3 }]; + const a: (list: Task[]) => number = R.findIndex(R.propEq('a', 2)); + // @dts-jest:pass + a(xs); //=> 1 + // @dts-jest:pass + R.findIndex(R.propEq('a', 4))(xs); //=> -1 + + // @dts-jest:pass + R.findIndex((x: number) => x === 1, [1, 2, 3]); +})(); + +// @dts-jest:group findLast +(() => { + const xs = [{ a: 1, b: 0 }, { a: 1, b: 1 }]; + // @dts-jest:pass + R.findLast(R.propEq('a', 1))(xs); //=> {a: 1, b: 1} + // @dts-jest:pass + R.findLast(R.__, xs)(R.propEq('a', 4)); //=> undefined +})(); + +// @dts-jest:group findLastIndex +(() => { + const xs = [{ a: 1, b: 0 }, { a: 1, b: 1 }]; + // @dts-jest:pass + R.findLastIndex(R.propEq('a', 1))(xs); //=> 1 + // @dts-jest:pass + R.findLastIndex(R.propEq('a', 4))(xs); //=> -1 + // @dts-jest:pass + R.findLastIndex((x: number) => x === 1, [1, 2, 3]); +})(); + +// @dts-jest:group flatten +(() => { + // @dts-jest:pass + R.flatten([1, 2, [3, 4], 5]); //=> [1, 2, 3, 4, 5] + // @dts-jest:pass + R.flatten([1, 2, [3, 4], 5, [6, [7, 8, [9, [10, 11], 12]]]]) as number[]; //=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] +})(); + +// @dts-jest:group flip +(() => { + const mergeThree = ( + a: boolean, + b: number, + c: string, + ): [boolean, number, string] => [a, b, c]; + + // @dts-jest:pass + mergeThree(true, 1, 'str'); //=> [true, 1, 'str'] + + // @dts-jest:pass + R.flip(mergeThree)(1, true, 'str'); //=> [true, 1, 'str'] +})(); + +// @dts-jest:group forEach +(() => { + const printXPlusFive = (_x: number) => { + /* console.log(x + 5); */ + }; + // @dts-jest:pass + R.forEach(printXPlusFive, [1, 2, 3]); //=> [1, 2, 3] + // @dts-jest:pass + R.forEach(printXPlusFive)([1, 2, 3]); //=> [1, 2, 3] +})(); + +// @dts-jest:group forEachObjIndexed +(() => { + const printKeyConcatValue = (_value: number, _key: string) => { + /* console.log(`${key}:${value}`); */ + }; + // @dts-jest:pass + R.forEachObjIndexed(printKeyConcatValue, { x: 1, y: 2 }); + // @dts-jest:pass + R.forEachObjIndexed(printKeyConcatValue)({ x: 1, y: 2 }); +})(); + +// @dts-jest:group fromPairs +(() => { + // @dts-jest:pass + R.fromPairs([['a', 1], ['b', 2], ['c', 3]]); //=> {a: 1, b: 2, c: 3} +})(); + +// @dts-jest:group groupBy +(() => { + const byGrade = R.groupBy((student: { score: number; name: string }) => { + const score = student.score; + return score < 65 + ? 'F' + : score < 70 ? 'D' : score < 80 ? 'C' : score < 90 ? 'B' : 'A'; + }); + const students = [ + { name: 'Abby', score: 84 }, + { name: 'Eddy', score: 58 }, + { name: 'Jack', score: 69 }, + ]; + // @dts-jest:pass + byGrade(students); +})(); + +// @dts-jest:group groupWith +(() => { + // @dts-jest:pass + R.groupWith(R.equals, [0, 1, 1, 2, 3, 5, 8, 13, 21]); + // [[0], [1, 1], [2, 3, 5, 8, 13, 21]] + + // @dts-jest:pass + R.groupWith((a: number, b: number) => a % 2 === b % 2, [ + 0, + 1, + 1, + 2, + 3, + 5, + 8, + 13, + 21, + ]); + // [[0], [1, 1], [2], [3, 5], [8], [13, 21]] + + const isVowel = (a: string) => (R.contains(a, 'aeiou') ? a : ''); + // @dts-jest:pass + R.groupWith(R.eqBy(isVowel), 'aestiou'); + // ['ae', 'st', 'iou'] +})(); + +// @dts-jest:group gt +(() => { + // @dts-jest:pass + R.gt(2, 6); //=> false + // @dts-jest:pass + R.gt(2, 0); //=> true + // @dts-jest:pass + R.gt(2, 2); //=> false + // @dts-jest:pass + R.flip(R.gt)(2)(10); //=> true + // @dts-jest:pass + R.gt(2)(10); //=> false +})(); + +// @dts-jest:group gte +(() => { + // @dts-jest:pass + R.gte(2, 6); //=> false + // @dts-jest:pass + R.gte(2, 0); //=> true + // @dts-jest:pass + R.gte(2, 2); //=> true + // @dts-jest:pass + R.flip(R.gte)(2)(10); //=> true + // @dts-jest:pass + R.gte(2)(10); //=> false +})(); + +// @dts-jest:group has +(() => { + const hasName = R.has('name'); + // @dts-jest:pass + hasName({ name: 'alice' }); //=> true + // @dts-jest:pass + hasName({ name: 'bob' }); //=> true + // @dts-jest:pass + hasName({}); //=> false + + const point = { x: 0, y: 0 }; + const pointHas = R.flip(R.has)(point); + // @dts-jest:pass + pointHas('x'); //=> true + // @dts-jest:pass + pointHas('y'); //=> true + // @dts-jest:pass + pointHas('z'); //=> false +})(); + +// @dts-jest:group hasIn +(() => { + class Rectangle { + public width: number; + public height: number; + constructor(width: number, height: number) { + this.width = width; + this.height = height; + } + public area(): number { + return this.width * this.height; + } + } + const square = new Rectangle(2, 2); + // @dts-jest:pass + R.hasIn('width', square); //=> true + // @dts-jest:pass + R.hasIn('area', square); //=> true + // @dts-jest:pass + R.flip(R.hasIn)(square)('area'); //=> true +})(); + +// @dts-jest:group head +(() => { + // @dts-jest:pass + R.head(['fi', 'fo', 'fum']); //=> 'fi' + // @dts-jest:pass + R.head([10, 'ten']); //=> 10 + // @dts-jest:pass + R.head(['10', 10]); //=> '10' + + const ids = ['id1', 'id2', 'id3']; + // @dts-jest:pass + R.head(ids); //=> 'id1' +})(); + +// @dts-jest:group identical +(() => { + const o = {}; + // @dts-jest:pass + R.identical(o, o); //=> true + // @dts-jest:pass + R.identical(1, 1); //=> true + // @dts-jest:pass + R.identical('2', '1'); //=> false + // @dts-jest:pass + R.identical([], []); //=> false + // @dts-jest:pass + R.identical(0, -0); //=> false + // @dts-jest:pass + R.identical(NaN, NaN); //=> true +})(); + +// @dts-jest:group identity +(() => { + const obj = {}; + + // @dts-jest:pass + R.identity(obj) === obj; //=> true + // @dts-jest:pass + R.identity(1); //=> 1 + // @dts-jest:pass + R.identity([1, 2, 3]); + // @dts-jest:pass + R.identity(['a', 'b', 'c']); +})(); + +// @dts-jest:group ifElse +(() => { + // Flatten all arrays in the list but leave other values alone. + const flattenArrays = R.map(R.ifElse(Array.isArray, R.flatten, R.identity)); + + // @dts-jest:pass + flattenArrays([[0], [[10], [8]], 1234, {}]); //=> [[0], [10, 8], 1234, {}] + // @dts-jest:pass + flattenArrays([[[10], 123], [8, [10]], 'hello']); //=> [[10, 123], [8, 10], 'hello'] +})(); + +// @dts-jest:group inc +(() => { + const f = R.pipe(Math.pow, R.negate, R.inc); + // @dts-jest:pass + f(3, 4); // -(3^4) + 1 +})(); + +// @dts-jest:group indexBy +(() => { + const list = [{ id: 'xyz', title: 'A' }, { id: 'abc', title: 'B' }]; + // @dts-jest:pass + R.indexBy(R.prop('id'), list); + // @dts-jest:pass + R.indexBy(R.prop('id'))(list); + // @dts-jest:pass + R.indexBy<{ id: string }>(R.prop('id'))(list); +})(); + +// @dts-jest:group indexOf +(() => { + // @dts-jest:pass + R.indexOf(3, [1, 2, 3, 4]); //=> 2 + // @dts-jest:pass + R.indexOf(10)([1, 2, 3, 4]); //=> -1 +})(); + +// @dts-jest:group init +(() => { + // @dts-jest:pass + R.init(['fi', 'fo', 'fum']); //=> ['fi', 'fo'] +})(); + +// @dts-jest:group innerJoin +(() => { + interface Data { + id: number; + name: string; + } + // @dts-jest:pass + R.innerJoin( + (data: Data, id: number) => data.id === id, + [ + { id: 824, name: 'Richie Furay' }, + { id: 956, name: 'Dewey Martin' }, + { id: 313, name: 'Bruce Palmer' }, + { id: 456, name: 'Stephen Stills' }, + { id: 177, name: 'Neil Young' }, + ], + [177, 456, 999], + ); //=> [{id: 456, name: 'Stephen Stills'}, {id: 177, name: 'Neil Young'}] +})(); + +// @dts-jest:group insert +(() => { + // @dts-jest:pass + R.insert(2, 5, [1, 2, 3, 4]); //=> [1,2,5,3,4] + // @dts-jest:pass + R.insert(2)(5, [1, 2, 3, 4]); //=> [1,2,5,3,4] + // @dts-jest:pass + R.insert(2, 5)([1, 2, 3, 4]); //=> [1,2,5,3,4] + // @dts-jest:pass + R.insert(2)(5)([1, 2, 3, 4]); //=> [1,2,5,3,4] +})(); + +// @dts-jest:group insertAll +(() => { + // @dts-jest:pass + R.insertAll(2, [10, 11, 12], [1, 2, 3, 4]); + // @dts-jest:pass + R.insertAll(2)([10, 11, 12], [1, 2, 3, 4]); + // @dts-jest:pass + R.insertAll(2, [10, 11, 12])([1, 2, 3, 4]); + // @dts-jest:pass + R.insertAll(2)([10, 11, 12])([1, 2, 3, 4]); +})(); + +// @dts-jest:group intersection +(() => { + // @dts-jest:pass + R.intersection([1, 2, 3, 4], [7, 6, 5, 4, 3]); //=> [3, 4] + // @dts-jest:pass + R.intersection([1, 2, 3, 4])([7, 6, 5, 4, 3]); //=> [3, 4] + // @dts-jest:pass + R.intersection([1, 2, 4], [1, 2, 3]); //=> [1,2] + // @dts-jest:pass + R.intersection([1, 2, 4])([1, 2, 3]); //=> [1,2] +})(); + +// @dts-jest:group intersectionWith +(() => { + interface Field { + id: number; + name: string; + } + const buffaloSpringfield = [ + { id: 824, name: 'Richie Furay' }, + { id: 956, name: 'Dewey Martin' }, + { id: 313, name: 'Bruce Palmer' }, + { id: 456, name: 'Stephen Stills' }, + { id: 177, name: 'Neil Young' }, + ]; + const csny = [ + { id: 204, name: 'David Crosby' }, + { id: 456, name: 'Stephen Stills' }, + { id: 539, name: 'Graham Nash' }, + { id: 177, name: 'Neil Young' }, + ]; + + // @dts-jest:pass + R.intersectionWith(R.eqBy(R.prop('id')), buffaloSpringfield, csny); + // @dts-jest:pass + R.intersectionWith(R.eqBy(R.prop('id')))(buffaloSpringfield, csny); + // @dts-jest:pass + R.intersectionWith(R.eqBy(R.prop('id')))(buffaloSpringfield)(csny); //=> [{id: 456, name: 'Stephen Stills'}, {id: 177, name: 'Neil Young'}] +})(); + +// @dts-jest:group intersperse +(() => { + // @dts-jest:pass + R.intersperse(',', ['foo', 'bar']); //=> ['foo', ',', 'bar'] + // @dts-jest:pass + R.intersperse(0, [1, 2]); //=> [1, 0, 2] + // @dts-jest:pass + R.intersperse(0, [1]); //=> [1] +})(); + +// @dts-jest:group into +(() => { + const numbers = [1, 2, 3, 4]; + const transducer = R.compose( + R.map(R.add(1))<'1', 'list'>(), + R.take(2), + ); + + // @dts-jest:pass + R.into([], transducer, numbers); //=> [2, 3] + // @dts-jest:pass + R.into([])(transducer, numbers); //=> [2, 3] + // @dts-jest:pass + R.into([], transducer)(numbers); //=> [2, 3] + + const intoArray = R.into([]); + // @dts-jest:pass + intoArray(transducer, numbers); //=> [2, 3] + // @dts-jest:pass + intoArray(transducer)(numbers); //=> [2, 3] +})(); + +// @dts-jest:group invert +(() => { + const raceResultsByFirstName = { + first: 'alice', + second: 'jake', + third: 'alice', + }; + // @dts-jest:pass + R.invert(raceResultsByFirstName); //=> { 'alice': ['first', 'third'], 'jake': ['second'] } +})(); + +// @dts-jest:group invertObj +(() => { + const raceResults0 = { + first: 'alice', + second: 'jake', + }; + // @dts-jest:pass + R.invertObj(raceResults0); //=> { 'alice': 'first', 'jake': 'second' } + + // Alternatively: + const raceResults1 = ['alice', 'jake']; + // @dts-jest:pass + R.invertObj(raceResults1); //=> { 'alice': '0', 'jake': '1' } +})(); + +// @dts-jest:group invoker +(() => { + // @dts-jest:pass + R.invoker<'toUpperCase', string, string>(0, 'toUpperCase')('foo'); //=> 'FOO' + // @dts-jest:pass + R.invoker<'charAt', string, number, string>(1, 'charAt')(1, 'foo'); //=> 'o' +})(); + +// @dts-jest:group is +(() => { + // @dts-jest:pass + R.is(Object, {}); //=> true + // @dts-jest:pass + R.is(Object)({}); //=> true + // @dts-jest:pass + R.is(Number, 1); //=> true + // @dts-jest:pass + R.is(Number)(1); //=> true + // @dts-jest:pass + R.is(Object, 1); //=> false + // @dts-jest:pass + R.is(Object)(1); //=> false + // @dts-jest:pass + R.is(String, 's'); //=> true + // @dts-jest:pass + R.is(String)('s'); //=> true + // @dts-jest:pass + R.is(String, ''); //=> true + // @dts-jest:pass + R.is(String)(''); //=> true + // @dts-jest:pass + R.is(Object, new Object()); //=> true + // @dts-jest:pass + R.is(Object)(new Object()); //=> true + // @dts-jest:pass + R.is(Object, 's'); //=> false + // @dts-jest:pass + R.is(Object)('s'); //=> false + // @dts-jest:pass + R.is(Number, {}); //=> false + // @dts-jest:pass + R.is(Number)({}); //=> false +})(); + +// @dts-jest:group isEmpty +(() => { + // @dts-jest:pass + R.isEmpty([1, 2, 3]); //=> false + // @dts-jest:pass + R.isEmpty([]); //=> true + // @dts-jest:pass + R.isEmpty(''); //=> true + // @dts-jest:pass + R.isEmpty(null); //=> false + // @dts-jest:pass + R.isEmpty({}); //=>true + // @dts-jest:pass + R.isEmpty({ a: 1 }); //=> false +})(); + +// @dts-jest:group isNil +(() => { + // @dts-jest:pass + R.isNil(null); //=> true + // @dts-jest:pass + R.isNil(undefined); //=> true + // @dts-jest:pass + R.isNil(0); //=> false + // @dts-jest:pass + R.isNil([]); //=> false +})(); + +// @dts-jest:group join +(() => { + const spacer = R.join(' '); + // @dts-jest:pass + spacer(['a', 2, 3.4]); //=> 'a 2 3.4' + // @dts-jest:pass + R.join('|', [1, 2, 3]); //=> '1|2|3' +})(); + +// @dts-jest:group juxt +(() => { + const range = R.juxt([Math.min, Math.max]); + // @dts-jest:pass + range(3, 4, 9, -3); //=> [-3, 9] + + const chopped = R.juxt([R.head, R.last]); + // @dts-jest:pass + chopped('longstring'); //=> ['l', 'g'] +})(); + +// @dts-jest:group keys +(() => { + // @dts-jest:pass + R.keys({ a: 1, b: 2, c: 3 }); //=> ['a', 'b', 'c'] +})(); + +// @dts-jest:group keysIn +(() => { + class F { + public x = 'x'; + public y = 'y'; + } + const f = new F(); + // @dts-jest:pass + R.keysIn(f); //=> ['x', 'y'] +})(); + +// @dts-jest:group last +(() => { + // @dts-jest:pass + R.last(['fi', 'fo', 'fum']); //=> 'fum' +})(); + +// @dts-jest:group lastIndexOf +(() => { + // @dts-jest:pass + R.lastIndexOf(3, [-1, 3, 3, 0, 1, 2, 3, 4]); //=> 6 + // @dts-jest:pass + R.lastIndexOf(10, [1, 2, 3, 4]); //=> -1 + // @dts-jest:pass + R.lastIndexOf(10)([1, 2, 3, 4]); //=> -1 +})(); + +// @dts-jest:group length +(() => { + // @dts-jest:pass + R.length([]); //=> 0 + // @dts-jest:pass + R.length([1, 2, 3]); //=> 3 +})(); + +// @dts-jest:group lens +(() => { + interface XY { + x: number; + y: number; + } + const xLens = R.lens(R.prop('x'))(R.assoc('x')); + + // @dts-jest:pass + R.view(xLens, { x: 1, y: 2 }); //=> 1 + // @dts-jest:pass + R.set(xLens, 4, { x: 1, y: 2 }); //=> {x: 4, y: 2} + // @dts-jest:pass + R.set(xLens)(4, { x: 1, y: 2 }); //=> {x: 4, y: 2} + // @dts-jest:pass + R.set(xLens, 4)({ x: 1, y: 2 }); //=> {x: 4, y: 2} + // @dts-jest:pass + R.over(xLens, R.negate, { x: 1, y: 2 }); //=> {x: -1, y: 2} + // @dts-jest:pass + R.over(xLens, R.negate)({ x: 1, y: 2 }); //=> {x: -1, y: 2} + // @dts-jest:pass + R.over(xLens)(R.negate, { x: 1, y: 2 }); //=> {x: -1, y: 2} +})(); + +// @dts-jest:group lensIndex +(() => { + const headLens = R.lensIndex(0); + // @dts-jest:pass + R.view(headLens, ['a', 'b', 'c']); //=> 'a' + + // @dts-jest:pass + R.set(headLens, 'x', ['a', 'b', 'c']); //=> ['x', 'b', 'c'] + // @dts-jest:pass + R.set(R.__, 'x', ['a', 'b', 'c'])(headLens); //=> ['x', 'b', 'c'] + + // @dts-jest:pass + R.over(headLens, R.toUpper, ['a', 'b', 'c']); //=> ['A', 'b', 'c'] + // @dts-jest:pass + R.over(R.__, R.toUpper, ['a', 'b', 'c'])(headLens); //=> ['A', 'b', 'c'] +})(); + +// @dts-jest:group lensPath +(() => { + interface XYZ { + x: { + y: number; + z: number; + }; + } + const xyLens = R.lensPath(['x', 'y']); + // @dts-jest:pass + R.view(xyLens, { x: { y: 2, z: 3 } }); //=> 2 + // @dts-jest:pass + R.set(xyLens, 4, { x: { y: 2, z: 3 } }); //=> {x: {y: 4, z: 3}} + // @dts-jest:pass + R.over(xyLens, R.negate, { x: { y: 2, z: 3 } }); //=> {x: {y: -2, z: 3}} +})(); + +// @dts-jest:group lensProp +(() => { + const phraseLens = R.lensProp('phrase'); + const obj1 = { phrase: 'Absolute filth . . . and I LOVED it!' }; + const obj2 = { phrase: "What's all this, then?" }; + // @dts-jest:pass + R.view(phraseLens, obj1); //=> 'Absolute filth . . . and I LOVED it!' + // @dts-jest:pass + R.view(phraseLens, obj2); //=> "What's all this, then?" + // @dts-jest:pass + R.set(phraseLens, 'Ooh Betty', obj1); //=> { phrase: 'Ooh Betty'} +})(); + +// @dts-jest:group lift +(() => { + const madd3 = R.lift((a: number, b: number, c: number) => a + b + c); + const madd5 = R.lift( + (a: number, b: number, c: number, d: number, e: number) => + a + b + c + d + e, + ); + + // @dts-jest:pass + madd3([1, 2, 3], [1, 2, 3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7] + // @dts-jest:pass + madd5([1, 2], [3], [4, 5], [6], [7, 8]); //=> [21, 22, 22, 23, 22, 23, 23, 24] +})(); + +// @dts-jest:group liftN +(() => { + const madd3 = R.liftN(3, (...args: number[]) => R.sum(args)); + // @dts-jest:pass + madd3([1, 2, 3], [1, 2, 3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7] +})(); + +// @dts-jest:group lt +(() => { + // @dts-jest:pass + R.lt(2, 6); //=> true + // @dts-jest:pass + R.lt(2, 0); //=> false + // @dts-jest:pass + R.lt(2, 2); //=> false + // @dts-jest:pass + R.lt(5)(10); //=> true + // @dts-jest:pass + R.flip(R.lt)(5)(10); //=> false +})(); + +// @dts-jest:group lte +(() => { + // @dts-jest:pass + R.lte(2, 6); //=> true + // @dts-jest:pass + R.lte(2, 0); //=> false + // @dts-jest:pass + R.lte(2, 2); //=> true + // @dts-jest:pass + R.lte(2)(10); //=> true + // @dts-jest:pass + R.flip(R.lte)(2)(1); //=> true +})(); + +// @dts-jest:group map +(() => { + const double = (x: number): number => x + x; + const arrayify = (v: T): T[] => [v]; + // homogeneous array + // @dts-jest:pass + R.map(double, [1, 2, 3]); //=> [2, 4, 6] + // @dts-jest:pass + R.map(double)([1, 2, 3]); //=> [2, 4, 6] + // homogeneous object + // @dts-jest:pass + R.map(double, { a: 1, b: 2, c: 3 }); //=> { a: 2, b: 4, c: 6 } + // @dts-jest:pass + R.map(double)({ a: 1, b: 2, c: 3 }); //=> { a: 2, b: 4, c: 6 } + + // heterogeneous array + // @dts-jest:skip [number[], string[]] + R.map(arrayify, [1, 'a']); //=> [[1], ['a']] + // @dts-jest:skip [number[], string[]] + R.map(arrayify)([1, 'a']); //=> [[1], ['a']] + // heterogeneous object + // @dts-jest:skip { a: number[], b: string[] } + R.map(arrayify, { a: 1, b: 'c' }); //=> { a: [1], b: ['c'] } + // @dts-jest:skip { a: number[], b: string[] } + R.map(arrayify)({ a: 1, b: 'c' }); //=> { a: [1], b: ['c'] } +})(); + +// @dts-jest:group mapAccum +(() => { + const digits = ['1', '2', '3', '4']; + const append = (a: string, b: string): [string, string] => [a + b, a + b]; + // @dts-jest:pass + R.mapAccum(append, '0', digits); //=> ['01234', ['01', '012', '0123', '01234']] + // @dts-jest:pass + R.mapAccum(append)('0', digits); //=> ['01234', ['01', '012', '0123', '01234']] + // @dts-jest:pass + R.mapAccum(append, '0')(digits); //=> ['01234', ['01', '012', '0123', '01234']] + // @dts-jest:pass + R.mapAccum(append)('0')(digits); //=> ['01234', ['01', '012', '0123', '01234']] +})(); + +// @dts-jest:group mapAccumRight +(() => { + const digits = ['1', '2', '3', '4']; + const append = (a: string, b: string): [string, string] => [a + b, a + b]; + // @dts-jest:pass + R.mapAccumRight(append, '0', digits); //=> [["12340", "2340", "340", "40"], "12340"] + // @dts-jest:pass + R.mapAccumRight(append)('0', digits); //=> [["12340", "2340", "340", "40"], "12340"] + // @dts-jest:pass + R.mapAccumRight(append, '0')(digits); //=> [["12340", "2340", "340", "40"], "12340"] + // @dts-jest:pass + R.mapAccumRight(append)('0')(digits); //=> [["12340", "2340", "340", "40"], "12340"] +})(); + +// @dts-jest:group mapObjIndexed +(() => { + const values = { x: 1, y: 2, z: 3 }; + const prependKeyAndDouble = (num: number, key: string, _obj: any) => + key + (num * 2).toString(); + // @dts-jest:pass + R.mapObjIndexed(prependKeyAndDouble, values); //=> { x: 'x2', y: 'y4', z: 'z6' } +})(); + +// @dts-jest:group match +(() => { + // @dts-jest:pass + R.match(/([a-z]a)/g, 'bananas'); //=> ['ba', 'na', 'na'] + // @dts-jest:pass + R.match(/a/, 'b'); //=> [] + // @dts-jest:fail + R.match(/a/, null); //=> error with strict null checks +})(); + +// @dts-jest:group mathMod +(() => { + // @dts-jest:pass + R.mathMod(-17, 5); //=> 3 + // @dts-jest:pass + R.mathMod(17, 5); //=> 2 + // @dts-jest:pass + R.mathMod(17, -5); //=> NaN + // @dts-jest:pass + R.mathMod(17, 0); //=> NaN + // @dts-jest:pass + R.mathMod(17.2, 5); //=> NaN + // @dts-jest:pass + R.mathMod(17, 5.3); //=> NaN + + const clock = R.flip(R.mathMod)(12); + // @dts-jest:pass + clock(15); //=> 3 + // @dts-jest:pass + clock(24); //=> 0 + + const seventeenMod = R.mathMod(17); + // @dts-jest:pass + seventeenMod(3); //=> 2 +})(); + +// @dts-jest:group max +(() => { + // @dts-jest:pass + R.max(7, 3); //=> 7 + // @dts-jest:pass + R.max('a', 'z'); //=> 'z' +})(); + +// @dts-jest:group maxBy +(() => { + function cmp(obj: { x: number }) { + return obj.x; + } + const a = { x: 1 }; + const b = { x: 2 }; + const c = { x: 3 }; + const d = { x: 'a' }; + const e = { x: 'z' }; + // @dts-jest:pass + R.maxBy(cmp, a, c); //=> {x: 3} + // @dts-jest:pass + R.maxBy(cmp)(a, c); //=> {x: 3} + // @dts-jest:pass + R.maxBy(cmp)(a)(b); + // @dts-jest:fail + R.maxBy(cmp)(d)(e); +})(); + +// @dts-jest:group mean +(() => { + // @dts-jest:pass + R.mean([2, 7, 9]); //=> 6 + // @dts-jest:pass + R.mean([]); //=> NaN +})(); + +// @dts-jest:group median +(() => { + // @dts-jest:pass + R.median([7, 2, 10, 9]); //=> 8 + // @dts-jest:pass + R.median([]); //=> NaN +})(); + +// @dts-jest:group memoize +(() => { + // tslint:disable-next-line:no-unused + let numberOfCalls = 0; + const trackedAdd = (a: number, b: number) => { + numberOfCalls += 1; + return a + b; + }; + const memoTrackedAdd = R.memoize(trackedAdd); + + // @dts-jest:pass + memoTrackedAdd(1, 2); //=> 3 + // @dts-jest:pass + numberOfCalls; //=> 1 + // @dts-jest:pass + memoTrackedAdd(1, 2); //=> 3 + // @dts-jest:pass + numberOfCalls; //=> 1 + // @dts-jest:pass + memoTrackedAdd(2, 3); //=> 5 + // @dts-jest:pass + numberOfCalls; //=> 2 + + // Note that argument order matters + // @dts-jest:pass + memoTrackedAdd(2, 1); //=> 3 + // @dts-jest:pass + numberOfCalls; //=> 3 +})(); + +// @dts-jest:group memoizeWith +(() => { + // tslint:disable-next-line:no-unused + let count = 0; + const factorial = R.memoizeWith(R.identity, (n: number) => { + count += 1; + return R.product(R.range(1, n + 1)); + }); + // @dts-jest:pass + factorial(5); //=> 120 + // @dts-jest:pass + factorial(5); //=> 120 + // @dts-jest:pass + factorial(5); //=> 120 + // @dts-jest:pass + count; //=> 1 +})(); + +// @dts-jest:group merge +(() => { + // @dts-jest:pass + R.merge({ name: 'fred', age: 10 }, { age: 40 }); //=> { 'name': 'fred', 'age': 40 } + + const resetToDefault = R.flip(R.merge)({ x: 0 }); + // @dts-jest:skip Dictionary + resetToDefault({ x: 5, y: 2 }); //=> {x: 0, y: 2} +})(); + +// @dts-jest:group mergeAll +(() => { + // @dts-jest:pass + R.mergeAll([{ foo: 1 }, { bar: 2 }, { baz: 3 }]); //=> {foo: 1,bar: 2,baz: 3} + // @dts-jest:pass + R.mergeAll([{ foo: 1 }, { foo: 2 }, { bar: 2 }]); //=> {foo: 2,bar: 2} +})(); + +// @dts-jest:group mergeDeepLeft +(() => { + // @dts-jest:pass + R.mergeDeepLeft( + { name: 'fred', age: 10, contact: { email: 'moo@example.com' } }, + { age: 40, contact: { email: 'baa@example.com' } }, + ); //=> { name: 'fred', age: 10, contact: { email: 'moo@example.com' }} +})(); + +// @dts-jest:group mergeDeepRight +(() => { + // @dts-jest:pass + R.mergeDeepRight( + { name: 'fred', age: 10, contact: { email: 'moo@example.com' } }, + { age: 40, contact: { email: 'baa@example.com' } }, + ); //=> { name: 'fred', age: 40, contact: { email: 'baa@example.com' }} +})(); + +// @dts-jest:group mergeDeepWith +(() => { + // @dts-jest:pass + R.mergeDeepWith( + R.concat, + { a: true, c: { values: [10, 20] } }, + { b: true, c: { values: [15, 35] } }, + ); //=> { a: true, b: true, c: { values: [10, 20, 15, 35] }} +})(); + +// @dts-jest:group mergeDeepWithKey +(() => { + const concatValues = (k: string, l: number[], r: number[]) => + k === 'values' ? R.concat(l, r) : r; + // @dts-jest:pass + R.mergeDeepWithKey( + concatValues, + { a: true, c: { thing: 'foo', values: [10, 20] } }, + { b: true, c: { thing: 'bar', values: [15, 35] } }, + ); //=> { a: true, b: true, c: { thing: 'bar', values: [10, 20, 15, 35] }} +})(); + +// @dts-jest:group mergeWith +(() => { + // @dts-jest:pass + R.mergeWith( + R.concat, + { a: true, values: [10, 20] }, + { b: true, values: [15, 35] }, + ); //=> { a: true, b: true, values: [10, 20, 15, 35] } +})(); + +// @dts-jest:group mergeWithKey +(() => { + const concatValues = ( + k: string, + l: string | number[], + r: string | number[], + ) => (k === 'values' ? R.concat(l, r) : r); + // @dts-jest:pass + R.mergeWithKey( + concatValues, + { a: true, thing: 'foo', values: [10, 20] }, + { b: true, thing: 'bar', values: [15, 35] }, + ); //=> { a: true, b: true, values: [10, 20, 15, 35], thing: 'bar' } + // @dts-jest:pass + R.mergeWithKey(concatValues)( + { a: true, thing: 'foo', values: [10, 20] }, + { b: true, thing: 'bar', values: [15, 35] }, + ); //=> { a: true, b: true, values: [10, 20, 15, 35], thing: 'bar' } +})(); + +// @dts-jest:group min +(() => { + // @dts-jest:pass + R.min(9, 3); //=> 3 + // @dts-jest:pass + R.min('a', 'z'); //=> 'a' +})(); + +// @dts-jest:group minBy +(() => { + function cmp(obj: { x: number }) { + return obj.x; + } + const a = { x: 1 }; + const b = { x: 2 }; + const c = { x: 3 }; + const d = { x: 'a' }; + const e = { x: 'z' }; + // @dts-jest:pass + R.minBy(cmp, a, b); //=> {x: 1} + // @dts-jest:pass + R.minBy(cmp)(a, b); //=> {x: 1} + // @dts-jest:pass + R.minBy(cmp)(a)(c); + // @dts-jest:fail + R.minBy(cmp, d, e); +})(); + +// @dts-jest:group modulo +(() => { + // @dts-jest:pass + R.modulo(17, 3); //=> 2 + // JS behavior: + // @dts-jest:pass + R.modulo(-17, 3); //=> -2 + // @dts-jest:pass + R.modulo(17, -3); //=> 2 + + const isOdd = R.flip(R.modulo)(2); + // @dts-jest:pass + isOdd(42); //=> 0 + // @dts-jest:pass + isOdd(21); //=> 1 +})(); + +// @dts-jest:group multiply +(() => { + // @dts-jest:pass + R.multiply(2)(3); //=> 6 + // @dts-jest:pass + R.multiply(3)(4); //=> 12 + // @dts-jest:pass + R.multiply(2, 5); //=> 10 +})(); + +// @dts-jest:group nAry +(() => { + const takesNoArg = () => true; + const takesOneArg = (a: number) => [a]; + const takesTwoArgs = (a: number, b: number) => [a, b]; + const takesThreeArgs = (a: number, b: number, c: number) => [a, b, c]; + + // @dts-jest:pass + R.nAry(0, takesNoArg); + // @dts-jest:pass + R.nAry(0, takesOneArg); + // @dts-jest:pass + R.nAry(1, takesTwoArgs); + // @dts-jest:pass + R.nAry(1, takesThreeArgs); +})(); + +// @dts-jest:group negate +(() => { + // @dts-jest:pass + R.negate(42); //=> -42 +})(); + +// @dts-jest:group none +(() => { + // @dts-jest:pass boolean + R.none(isNaN, [1, 2, 3]); //=> true + // @dts-jest:pass boolean + R.none(isNaN, [1, 2, 3, NaN]); //=> false + // @dts-jest:pass boolean + R.none(isNaN)([1, 2, 3, NaN]); //=> false +})(); + +// @dts-jest:group not +(() => { + // @dts-jest:pass + R.not(true); //=> false + // @dts-jest:pass + R.not(false); //=> true + // @dts-jest:pass + R.not(0); //=> true + // @dts-jest:pass + R.not(1); //=> false +})(); + +// @dts-jest:group nth +(() => { + const list = ['foo', 'bar', 'baz', 'quux']; + // @dts-jest:pass + R.nth(1, list); //=> 'bar' + // @dts-jest:pass + R.nth(-1, list); //=> 'quux' + // @dts-jest:pass + R.nth(-99, list); //=> undefined + // @dts-jest:pass + R.nth(-99)(list); //=> undefined +})(); + +// @dts-jest:group nthArg +(() => { + // @dts-jest:pass + R.nthArg(1)('a', 'b', 'c'); //=> 'b' + // @dts-jest:pass + R.nthArg(-1)('a', 'b', 'c'); //=> 'c' +})(); + +// @dts-jest:group o +(() => { + interface Name { + first: string; + last: string; + } + const classyGreeting = (name: Name) => + `The name's ${name.last}, ${name.first} ${name.last}`; + const yellGreeting = R.o(R.toUpper, classyGreeting); + + // @dts-jest:pass + yellGreeting({ first: 'James', last: 'Bond' }); //=> "THE NAME'S BOND, JAMES BOND" + // @dts-jest:pass + R.o(R.multiply(10), R.add(10))(-4); //=> 60 +})(); + +// @dts-jest:group objOf +(() => { + const matchPhrases = R.compose( + R.objOf('must'), + R.map(R.objOf('match_phrase')), + ); + // @dts-jest:pass + matchPhrases(['foo', 'bar', 'baz']); +})(); + +// @dts-jest:group of +(() => { + // @dts-jest:pass + R.of([1]); //=> [[1]] + // @dts-jest:pass + R.of(1); +})(); + +// @dts-jest:group omit +(() => { + // @dts-jest:pass + R.omit(['a', 'd'], { a: 1, b: 2, c: 3, d: 4 }); //=> {b: 2, c: 3} + // @dts-jest:pass + R.omit(['a', 'd'])({ a: 1, b: 2, c: 3, d: 4 }); //=> {b: 2, c: 3} +})(); + +// @dts-jest:group once +(() => { + const addOneOnce = R.once((x: number) => x + 1); + // @dts-jest:pass + addOneOnce(10); //=> 11 + // @dts-jest:pass + addOneOnce(addOneOnce(50)); //=> 11 +})(); + +// @dts-jest:group or +(() => { + // @dts-jest:pass + R.or(false, true); //=> true + // @dts-jest:pass + R.or(0, []); //=> [] + // @dts-jest:pass + R.or(0)([]); //=> [] + // @dts-jest:pass + R.or(null, ''); //=> '' +})(); + +// @dts-jest:group over +(() => { + const headLens = R.lensIndex(0); + // @dts-jest:pass + R.over(headLens, R.toUpper, ['a', 'b', 'c']); //=> ['A', 'b', 'c'] +})(); + +// @dts-jest:group pair +(() => { + // @dts-jest:pass + R.pair('foo', 'bar'); //=> ['foo', 'bar'] + + const p = R.pair('foo', 1); + // @dts-jest:pass + p[0]; //=> 'foo' + // @dts-jest:pass + p[1]; //=> 1 +})(); + +// @dts-jest:group partial +(() => { + const multiply = (a: number, b: number) => a * b; + + // @dts-jest:pass + R.partial(multiply, [2])(2); //=> 4 + + const greet = ( + salutation: string, + title: string, + firstName: string, + lastName: string, + ) => `${salutation}, ${title} ${firstName} ${lastName}!`; + const sayHello = R.partial(greet, ['Hello']); + const sayHelloToMs = R.partial(sayHello, ['Ms.']); + + // @dts-jest:pass + sayHelloToMs('Jane', 'Jones'); //=> 'Hello, Ms. Jane Jones!' +})(); + +// @dts-jest:group partialRight +(() => { + const greet = ( + salutation: string, + title: string, + firstName: string, + lastName: string, + ) => `${salutation}, ${title} ${firstName} ${lastName}!`; + const greetMsJaneJones = R.partialRight(greet, ['Ms.', 'Jane', 'Jones']); + + // @dts-jest:pass + greetMsJaneJones('Hello'); //=> 'Hello, Ms. Jane Jones!' +})(); + +// @dts-jest:group partition +(() => { + // @dts-jest:pass + R.partition(R.contains('s'), ['sss', 'ttt', 'foo', 'bars']); + // @dts-jest:pass + R.partition(R.contains('s'))(['sss', 'ttt', 'foo', 'bars']); + // @dts-jest:pass + R.partition((x: number) => x > 2, [1, 2, 3, 4]); + // @dts-jest:pass + R.partition((x: number) => x > 2)([1, 2, 3, 4]); + // @dts-jest:pass + R.partition(R.contains('s'), { a: 'sss', b: 'ttt', foo: 'bars' }); //=> [ { a: 'sss', foo: 'bars' }, { b: 'ttt' } ] +})(); + +// @dts-jest:group path +(() => { + // @dts-jest:pass + R.path(['a', 'b'], { a: { b: 2 } }); //=> 2 + // @dts-jest:pass + R.path(['a', 'b'])({ a: { b: 2 } }); //=> 2 +})(); + +// @dts-jest:group pathEq +(() => { + interface User { + address?: { zipCode: number }; + name?: string; + } + const user1 = { address: { zipCode: 90210 } }; + const user2 = { address: { zipCode: 55555 } }; + const user3 = { name: 'Bob' }; + const users = [user1, user2, user3]; + const isFamous = R.pathEq(['address', 'zipCode'], 90210); + // @dts-jest:pass + R.filter(isFamous, users); //=> [ user1 ] +})(); + +// @dts-jest:group pathOr +(() => { + // @dts-jest:pass + R.pathOr('N/A', ['a', 'b'])({ a: { b: 2 } }); //=> 2 + // @dts-jest:pass + R.pathOr('N/A')(['a', 'b'], { a: { b: 2 } }); //=> 2 +})(); + +// @dts-jest:group pathSatisfies +(() => { + // @dts-jest:pass + R.pathSatisfies((a: any) => a === 'foo', ['a', 'b', 'c'], { + a: { b: { c: 'foo' } }, + }); //=> true + // @dts-jest:pass + R.pathSatisfies((a: any) => a === 'bar', ['a', 'b', 'c'], { + a: { b: { c: 'foo' } }, + }); //=> false + // @dts-jest:pass + R.pathSatisfies((a: any) => a === 1, ['a', 'b', 'c'], { a: { b: { c: 1 } } }); //=> true + // @dts-jest:pass + R.pathSatisfies((a: any) => a !== 1, ['a', 'b', 'c'], { a: { b: { c: 2 } } }); //=> true + // @dts-jest:pass + R.pathSatisfies((a: any) => a === 1)(['a', 'b', 'c'], { a: { b: { c: 1 } } }); //=> true + // @dts-jest:pass + R.pathSatisfies((a: any) => a === 1, ['a', 'b', 'c'])({ a: { b: { c: 1 } } }); //=> true + // @dts-jest:pass + R.pathSatisfies((a: any) => a === 1)(['a', 'b', 'c'])({ a: { b: { c: 1 } } }); //=> true +})(); + +// @dts-jest:group pick +(() => { + // @dts-jest:pass + R.pick(['a', 'e', 'f'], { a: 1, b: 2, c: 3, d: 4 }); //=> {a: 1} + // @dts-jest:fail + R.pick(['a', 'e', 'f'])({ a: 1, b: 2, c: 3, d: 4 }); // runtime correct but type error => {a: 1} + // @dts-jest:pass + R.pick(['a', 'e', 'f'], [1, 2, 3, 4]); //=> {} + // @dts-jest:pass + R.pick(['a', 'c', 'd'], { a: 1, b: 2, c: 3, d: 4 }); //=> {a: 1, c: 3, d: 4} + // @dts-jest:pass + R.pick(['0', '2', '3'], [1, 2, 3, 4]); //=> {0: 1, 2: 3, 3: 4} +})(); + +// @dts-jest:group pickAll +(() => { + // @dts-jest:pass + R.pickAll(['a', 'd'], { a: 1, b: 2, c: 3, d: 4 }); //=> {a: 1, d: 4} + // @dts-jest:pass + R.pickAll(['a', 'd'])({ a: 1, b: 2, c: 3, d: 4 }); //=> {a: 1, d: 4} + // @dts-jest:pass + R.pickAll(['a', 'e', 'f'], { a: 1, b: 2, c: 3, d: 4 }); //=> {a: 1, e: undefined, f: undefined} + // @dts-jest:pass + R.pickAll(['a', 'e', 'f'])({ a: 1, b: 2, c: 3, d: 4 }); //=> {a: 1, e: undefined, f: undefined} +})(); + +// @dts-jest:group pickBy +(() => { + const colors = { + 1: { color: 'read' }, + 2: { color: 'black', bgcolor: 'yellow' }, + }; + const isPositive = (n: number) => n > 0; + const containsBackground = (val: any) => val.bgcolor; + const isUpperCase = (_val: number, key: string) => key.toUpperCase() === key; + + // @dts-jest:pass + R.pickBy(isPositive, { a: 1, b: 2, c: -1, d: 0, e: 5 }); //=> {a: 1, b: 2, e: 5} + // @dts-jest:pass + R.pickBy(containsBackground, colors); //=> {2: {color: 'black', bgcolor: 'yellow'}} + // @dts-jest:pass + R.pickBy(isUpperCase, { a: 1, b: 2, A: 3, B: 4 }); //=> {A: 3, B: 4} +})(); + +// @dts-jest:group pipe +(() => { + (() => { + const shout = (x: number): string => (x >= 10 ? 'big' : 'small'); + const double = (x: number): number => x + x; + // @dts-jest:pass + R.pipe(double, double, shout); + // @dts-jest:pass + R.pipe(double, double, shout)(10); + + // @dts-jest:pass + R.pipe(R.split(''), R.adjust(R.toUpper, 0), R.join(''))('str'); + + const f = R.pipe(Math.pow, R.negate, R.inc); + // @dts-jest:pass + f(3, 4); // -(3^4) + 1 + + // test for type degeneration if the first function has generics + // @dts-jest:skip (x0: number) => number + R.pipe(R.identity, double); + })(); + (() => { + const double = (x: number): number => x + x; + const triple = (x: number): number => x * 3; + const square = (x: number): number => x * x; + const squareThenDoubleThenTriple = R.pipe(square, double, triple); + // @dts-jest:pass + squareThenDoubleThenTriple(5); //=> 150 + })(); +})(); + +// @dts-jest:group:skip pipeK +(() => { + // TODO +})(); + +// @dts-jest:group pipeP +(() => { + // @dts-jest:pass + R.pipeP( + (m: number) => Promise.resolve(R.multiply(2, m)), + (m: number) => Promise.resolve(m / 2), + )(10); + // @dts-jest:pass + R.pipeP( + (m: number) => Promise.resolve(R.multiply(2, m)), + (m: number) => Promise.resolve(m / 2), + R.multiply(5), + )(10); +})(); + +// @dts-jest:group pluck +(() => { + // @dts-jest:pass + R.pluck('a', [{ a: 1 }, { a: 2 }]); //=> [1, 2] + // @dts-jest:pass + R.pluck(0, [[1, 2], [3, 4]]); //=> [1, 3] + // @dts-jest:pass + R.pluck('a')([{ a: 1 }, { a: 2 }]); //=> [1, 2] + // @dts-jest:pass + R.pluck(0)([[1, 2], [3, 4]]); //=> [1, 3] +})(); + +// @dts-jest:group prepend +(() => { + // @dts-jest:pass + R.prepend('fee', ['fi', 'fo', 'fum']); //=> ['fee', 'fi', 'fo', 'fum'] + // @dts-jest:pass + R.prepend('fee')(['fi', 'fo', 'fum']); //=> ['fee', 'fi', 'fo', 'fum'] +})(); + +// @dts-jest:group product +(() => { + // @dts-jest:pass + R.product([2, 4, 6, 8, 100, 1]); //=> 38400 +})(); + +// @dts-jest:group project +(() => { + const abby = { name: 'Abby', age: 7, hair: 'blond', grade: 2 }; + const fred = { name: 'Fred', age: 12, hair: 'brown', grade: 7 }; + const kids = [abby, fred]; + // @dts-jest:pass + R.project(['name', 'grade'], kids); //=> [{name: 'Abby', grade: 2}, {name: 'Fred', grade: 7}] +})(); + +// @dts-jest:group prop +(() => { + // @dts-jest:pass + R.prop('x', { x: 100 }); //=> 100 + // @dts-jest:pass + R.prop('x', {}); //=> undefined +})(); + +// @dts-jest:group propEq +(() => { + (() => { + const xs: { [key: string]: string } = { a: '1', b: '0' }; + // @dts-jest:pass + R.propEq('a', '1', xs); //=> true + // @dts-jest:pass + R.propEq('a', '4', xs); //=> false + })(); + (() => { + const xs: { [key: string]: number } = { a: 1, b: 0 }; + // @dts-jest:pass + R.propEq('a', 1, xs); //=> true + // @dts-jest:pass + R.propEq('a', 4, xs); //=> false + })(); + (() => { + const xs = { a: '1', b: '0' }; + // @dts-jest:pass + R.propEq('a', '1', xs); //=> true + // @dts-jest:pass + R.propEq('a', '4', xs); //=> false + })(); + (() => { + const xs = { a: 1, b: 0 }; + // @dts-jest:pass + R.propEq('a', 1, xs); //=> true + // @dts-jest:pass + R.propEq('a', 4, xs); //=> false + })(); + (() => { + interface Obj { + a: number; + b: number; + } + const xs: Obj = { a: 1, b: 0 }; + // @dts-jest:pass + R.propEq('a', 1, xs); //=> true + // @dts-jest:pass + R.propEq('a', 4, xs); //=> false + })(); +})(); + +// @dts-jest:group propIs +(() => { + // @dts-jest:pass + R.propIs(Number, 'x', { x: 1, y: 2 }); //=> true + // @dts-jest:pass + R.propIs(Number, 'x')({ x: 1, y: 2 }); //=> true + // @dts-jest:pass + R.propIs(Number)('x', { x: 1, y: 2 }); //=> true + // @dts-jest:pass + R.propIs(Number)('x')({ x: 1, y: 2 }); //=> true + // @dts-jest:pass + R.propIs(Number, 'x', { x: 'foo' }); //=> false + // @dts-jest:pass + R.propIs(Number, 'x', {}); //=> false +})(); + +// @dts-jest:group propOr +(() => { + interface Person { + name: string; + age: number; + favoriteLibrary?: string; + } + const alice: Person = { + name: 'ALICE', + age: 101, + }; + + // @dts-jest:pass + R.prop('favoriteLibrary', alice); //=> undefined + // @dts-jest:skip string + R.propOr('Ramda', 'favoriteLibrary', alice); //=> 'Ramda' +})(); + +// @dts-jest:group propSatisfies +(() => { + interface XY { + x: number; + y: number; + } + + // @dts-jest:pass + R.propSatisfies((x: number) => x > 0, 'x', { x: 1, y: 2 }); //=> true + // @dts-jest:pass + R.propSatisfies<'x', XY>((x: number) => x > 0, 'x')({ x: 1, y: 2 }); //=> true + // @dts-jest:pass + R.propSatisfies<'x', XY>((x: number) => x > 0)('x')({ x: 1, y: 2 }); //=> true +})(); + +// @dts-jest:group props +(() => { + // @dts-jest:pass + R.props(['x', 'y'], { x: 1, y: 2 }); //=> [1, 2] + // @dts-jest:pass + R.props(['c', 'a', 'b'], { b: 2, a: 1 }); //=> [undefined, 1, 2] + + const fullName = R.compose(R.join(' '), R.props(['first', 'last'])); + // @dts-jest:pass + fullName({ last: 'Bullet-Tooth', age: 33, first: 'Tony' }); //=> 'Tony Bullet-Tooth' +})(); + +// @dts-jest:group range +(() => { + // @dts-jest:pass + R.range(1, 5); //=> [1, 2, 3, 4] + // @dts-jest:pass + R.range(50)(53); //=> [50, 51, 52] +})(); + +// @dts-jest:group reduce +(() => { + const numbers = [1, 2, 3]; + const add = (a: number, b: number) => a + b; + // @dts-jest:pass + R.reduce(add, 10, numbers); //=> 16 +})(); + +// @dts-jest:group reduce +(() => { + const numbers = [1, 2, 3]; + const add = (a: number, b: number) => a + b; + // @dts-jest:pass + R.reduce(add, 10, numbers); //=> 16 + // @dts-jest:pass + R.reduce(add)(10, numbers); //=> 16 + // @dts-jest:pass + R.reduce(add, 10)(numbers); //=> 16 +})(); + +// @dts-jest:group reduceBy +(() => { + interface Student { + name: string; + score: number; + } + const reduceToNamesBy = R.reduceBy( + (acc: string[], student: Student) => acc.concat(student.name), + [], + ); + const namesByGrade = reduceToNamesBy((student: Student) => { + const score = student.score; + return score < 65 + ? 'F' + : score < 70 ? 'D' : score < 80 ? 'C' : score < 90 ? 'B' : 'A'; + }); + const students = [ + { name: 'Lucy', score: 92 }, + { name: 'Drew', score: 85 }, + { name: 'Bart', score: 62 }, + ]; + // @dts-jest:pass + namesByGrade(students); + // { + // 'A': ['Lucy'], + // 'B': ['Drew'] + // 'F': ['Bart'] + // } +})(); + +// @dts-jest:group reduced +(() => { + // @dts-jest:pass + R.reduced(123); +})(); + +// @dts-jest:group reduceRight +(() => { + interface KeyValuePair extends Array { + 0: K; + 1: V; + } + type Pair = KeyValuePair; + const pairs: Pair[] = [['a', 1], ['b', 2], ['c', 3]]; + const flattenPairs = (pair: Pair, acc: Pair[]): Pair[] => acc.concat(pair); + // @dts-jest:pass + R.reduceRight(flattenPairs, [], pairs); //=> [ 'c', 3, 'b', 2, 'a', 1 ] + // @dts-jest:pass + R.reduceRight(flattenPairs, [])(pairs); //=> [ 'c', 3, 'b', 2, 'a', 1 ] + // @dts-jest:pass + R.reduceRight(flattenPairs)([], pairs); //=> [ 'c', 3, 'b', 2, 'a', 1 ] +})(); + +// @dts-jest:group reduceWhile +(() => { + const isOdd = (_acc: number, x: number) => x % 2 === 1; + const xs = [1, 3, 5, 60, 777, 800]; + // @dts-jest:pass + R.reduceWhile(isOdd, R.add, 0, xs); //=> 9 + + const ys = [2, 4, 6]; + // @dts-jest:pass + R.reduceWhile(isOdd, R.add, 111, ys); //=> 111 +})(); + +// @dts-jest:group reject +(() => { + const isOdd = (n: number) => n % 2 === 1; + // @dts-jest:pass + R.reject(isOdd, [1, 2, 3, 4]); //=> [2, 4] + // @dts-jest:pass + R.reject(isOdd)([1, 2, 3, 4]); //=> [2, 4] + + const lastTwo = (_val: number, idx: number, list: number[]) => + list.length - idx <= 2; + const rejectIndexed = R.addIndex( + R.reject<'11', 'list'>(), + ); + // @dts-jest:pass + rejectIndexed(lastTwo, [8, 6, 7, 5, 3, 0, 9]); //=> [8, 6, 7, 5, 3] + // @dts-jest:pass + rejectIndexed(lastTwo)([8, 6, 7, 5, 3, 0, 9]); //=> [8, 6, 7, 5, 3] +})(); + +// @dts-jest:group remove +(() => { + // @dts-jest:pass + R.remove(2, 3, [1, 2, 3, 4, 5, 6, 7, 8]); //=> [1,2,6,7,8] + // @dts-jest:pass + R.remove(2, 3)([1, 2, 3, 4, 5, 6, 7, 8]); //=> [1,2,6,7,8] + // @dts-jest:pass + R.remove(2)(3, [1, 2, 3, 4, 5, 6, 7, 8]); //=> [1,2,6,7,8] +})(); + +// @dts-jest:group repeat +(() => { + // @dts-jest:pass + R.repeat('hi', 5); //=> ['hi', 'hi', 'hi', 'hi', 'hi'] + const obj = {}; + const repeatedObjs = R.repeat(obj, 5); + // @dts-jest:pass + repeatedObjs; //=> [{}, {}, {}, {}, {}] + // @dts-jest:pass + repeatedObjs[0] === repeatedObjs[1]; //=> true +})(); + +// @dts-jest:group replace +(() => { + // @dts-jest:pass + R.replace('foo', 'bar', 'foo foo foo'); //=> 'bar foo foo' + // @dts-jest:pass + R.replace('foo', 'bar')('foo foo foo'); //=> 'bar foo foo' + // @dts-jest:pass + R.replace('foo')('bar')('foo foo foo'); //=> 'bar foo foo' + // @dts-jest:pass + R.replace(/foo/, 'bar', 'foo foo foo'); //=> 'bar foo foo' + + // Use the 'g' (global) flag to replace all occurrences: + // @dts-jest:pass + R.replace(/foo/g, 'bar', 'foo foo foo'); //=> 'bar bar bar' + // @dts-jest:pass + R.replace(/foo/g, 'bar')('foo foo foo'); //=> 'bar bar bar' + // @dts-jest:pass + R.replace(/foo/g)('bar')('foo foo foo'); //=> 'bar bar bar' +})(); + +// @dts-jest:group reverse +(() => { + // @dts-jest:pass + R.reverse([1, 2, 3]); //=> [3, 2, 1] + // @dts-jest:pass + R.reverse([1, 2]); //=> [2, 1] + // @dts-jest:pass + R.reverse([1]); //=> [1] + // @dts-jest:pass + R.reverse([]); //=> [] +})(); + +// @dts-jest:group scan +(() => { + const numbers = [1, 2, 3, 4]; + // @dts-jest:pass + R.scan(R.multiply, 1, numbers); //=> [1, 1, 2, 6, 24] + // @dts-jest:pass + R.scan(R.multiply, 1)(numbers); //=> [1, 1, 2, 6, 24] + // @dts-jest:pass + R.scan(R.multiply)(1, numbers); //=> [1, 1, 2, 6, 24] +})(); + +// @dts-jest:group:skip sequence +(() => { + // TODO +})(); + +// @dts-jest:group set +(() => { + const headLens = R.lensIndex(0); + // @dts-jest:pass + R.set(headLens, 'x', ['a', 'b', 'c']); //=> ['x', 'b', 'c'] +})(); + +// @dts-jest:group slice +(() => { + const xs = R.range(0, 10); + // @dts-jest:pass + R.slice(2, 5, xs); //=> [2, 3, 4] + // @dts-jest:pass + R.slice(2, 5)(xs); //=> [2, 3, 4] + // @dts-jest:pass + R.slice(2)(5, xs); //=> [2, 3, 4] + + const str = 'Hello World'; + // @dts-jest:pass + R.slice(2, 5, str); //=> 'llo' + // @dts-jest:pass + R.slice(2, 5)(str); //=> 'llo' + // @dts-jest:pass + R.slice(2)(5, str); //=> 'llo' +})(); + +// @dts-jest:group sort +(() => { + const diff = (a: number, b: number) => a - b; + // @dts-jest:pass + R.sort(diff, [4, 2, 7, 5]); //=> [2, 4, 5, 7] + // @dts-jest:pass + R.sort(diff)([4, 2, 7, 5]); //=> [2, 4, 5, 7] +})(); + +// @dts-jest:group sortBy +(() => { + interface Person { + name: string; + age: number; + } + const sortByNameCaseInsensitive = R.sortBy( + R.compose(R.toLower, R.prop('name')), + ); + const sortByAgeDescending = R.sortBy( + R.compose(R.negate, R.prop('age')), + ); + const sortByAgeAscending = R.sortBy(R.prop('age')); + const alice = { + name: 'ALICE', + age: 101, + }; + const bob = { + name: 'Bob', + age: -10, + }; + const clara = { + name: 'clara', + age: 314.159, + }; + const people = [clara, bob, alice]; + // @dts-jest:pass + sortByAgeDescending(people); //=> [clara, alice, bob] + // @dts-jest:pass + sortByNameCaseInsensitive(people); //=> [alice, bob, clara] + // @dts-jest:pass + sortByAgeAscending(people); //=> [bob, alice, clara] +})(); + +// @dts-jest:group sortWith +(() => { + interface Person { + name: string; + age: number; + } + const alice = { + name: 'alice', + age: 40, + }; + const bob = { + name: 'bob', + age: 30, + }; + const clara = { + name: 'clara', + age: 40, + }; + const people = [clara, bob, alice]; + // @dts-jest:pass + R.sortWith( + [R.descend(R.prop('age')), R.ascend(R.prop('name'))], + people, + ); + const ageNameSort = R.sortWith([ + R.descend(R.prop('age')), + R.ascend(R.prop('name')), + ]); + // @dts-jest:pass + ageNameSort(people); //=> [alice, clara, bob] +})(); + +// @dts-jest:group split +(() => { + const pathComponents = R.split('/'); + + // @dts-jest:pass + R.tail(pathComponents('/usr/local/bin/node')); //=> ['usr', 'local', 'bin', 'node'] + // @dts-jest:pass + R.split('.', 'a.b.c.xyz.d'); //=> ['a', 'b', 'c', 'xyz', 'd'] +})(); + +// @dts-jest:group splitAt +(() => { + // @dts-jest:pass + R.splitAt(1, [1, 2, 3]); //=> [[1], [2, 3]] + // @dts-jest:pass + R.splitAt(1)([1, 2, 3]); //=> [[1], [2, 3]] + // @dts-jest:pass + R.splitAt(5, 'hello world'); //=> ['hello', ' world'] + // @dts-jest:pass + R.splitAt(-1, 'foobar'); //=> ['fooba', 'r'] +})(); + +// @dts-jest:group splitEvery +(() => { + // @dts-jest:pass + R.splitEvery(3, [1, 2, 3, 4, 5, 6, 7]); //=> [[1, 2, 3], [4, 5, 6], [7]] + // @dts-jest:pass + R.splitEvery(3, 'foobarbaz'); //=> ['foo', 'bar', 'baz'] +})(); + +// @dts-jest:group splitWhen +(() => { + // @dts-jest:pass + R.splitWhen(R.equals(2), [1, 2, 3, 1, 2, 3]); //=> [[1], [2, 3, 1, 2, 3]] + // @dts-jest:pass + R.splitWhen(R.equals(2))([1, 2, 3, 1, 2, 3]); //=> [[1], [2, 3, 1, 2, 3]] +})(); + +// @dts-jest:group startsWith +(() => { + // @dts-jest:pass + R.startsWith('a', 'abc'); //=> true + // @dts-jest:pass + R.startsWith('b', 'abc'); //=> false + // @dts-jest:pass + R.startsWith(['a'], ['a', 'b', 'c']); //=> true + // @dts-jest:pass + R.startsWith(['b'], ['a', 'b', 'c']); //=> false +})(); + +// @dts-jest:group subtract +(() => { + // @dts-jest:pass + R.subtract(10, 8); //=> 2 + + const minus5 = R.flip(R.subtract)(5); + // @dts-jest:pass + minus5(17); //=> 12 + + const complementaryAngle = R.subtract(90); + // @dts-jest:pass + complementaryAngle(30); //=> 60 + // @dts-jest:pass + complementaryAngle(72); //=> 18 +})(); + +// @dts-jest:group sum +(() => { + // @dts-jest:pass + R.sum([2, 4, 6, 8, 100, 1]); //=> 121 +})(); + +// @dts-jest:group symmetricDifference +(() => { + // @dts-jest:pass + R.symmetricDifference([1, 2, 3, 4], [7, 6, 5, 4, 3]); //=> [1,2,7,6,5] + // @dts-jest:pass + R.symmetricDifference([7, 6, 5, 4, 3])([1, 2, 3, 4]); //=> [7,6,5,1,2] +})(); + +// @dts-jest:group symmetricDifferenceWith +(() => { + interface A { + a: number; + } + const eqA = R.eqBy(R.prop('a')); + const l1 = [{ a: 1 }, { a: 2 }, { a: 3 }, { a: 4 }]; + const l2 = [{ a: 3 }, { a: 4 }, { a: 5 }, { a: 6 }]; + // @dts-jest:pass + R.symmetricDifferenceWith(eqA, l1, l2); //=> [{a: 1}, {a: 2}, {a: 5}, {a: 6}] + // @dts-jest:pass + R.symmetricDifferenceWith(eqA)(l1, l2); //=> [{a: 1}, {a: 2}, {a: 5}, {a: 6}] + // @dts-jest:pass + R.symmetricDifferenceWith(eqA)(l1)(l2); //=> [{a: 1}, {a: 2}, {a: 5}, {a: 6}] +})(); + +// @dts-jest:group T +(() => { + // @dts-jest:pass + R.T(); +})(); + +// @dts-jest:group tail +(() => { + // @dts-jest:pass + R.tail(['fi', 'fo', 'fum']); //=> ['fo', 'fum'] + // @dts-jest:pass + R.tail([1, 2, 3]); //=> [2, 3] +})(); + +// @dts-jest:group take +(() => { + // @dts-jest:pass + R.take(3, [1, 2, 3, 4, 5]); //=> [1,2,3] + + const members = [ + 'Paul Desmond', + 'Bob Bates', + 'Joe Dodge', + 'Ron Crotty', + 'Lloyd Davis', + 'Joe Morello', + 'Norman Bates', + 'Eugene Wright', + 'Gerry Mulligan', + 'Jack Six', + 'Alan Dawson', + 'Darius Brubeck', + 'Chris Brubeck', + 'Dan Brubeck', + 'Bobby Militello', + 'Michael Moore', + 'Randy Jones', + ]; + const takeFive = R.take(5); + // @dts-jest:pass + takeFive(members); //=> ['Paul Desmond','Bob Bates','Joe Dodge','Ron Crotty','Lloyd Davis'] + + // @dts-jest:pass + R.take(3, 'Example'); //=> 'Exa' + + const takeThree = R.take(3); + // @dts-jest:pass + takeThree('Example'); //=> 'Exa' +})(); + +// @dts-jest:group takeLast +(() => { + // @dts-jest:pass + R.takeLast(1, ['foo', 'bar', 'baz']); //=> ['baz'] + // @dts-jest:pass + R.takeLast(2)(['foo', 'bar', 'baz']); //=> ['bar', 'baz'] + // @dts-jest:pass + R.takeLast(3, 'ramda'); //=> 'mda' + // @dts-jest:pass + R.takeLast(3)('ramda'); //=> 'mda' +})(); + +// @dts-jest:group takeLastWhile +(() => { + const isNotOne = (x: number) => x !== 1; + // @dts-jest:pass + R.takeLastWhile(isNotOne, [1, 2, 3, 4]); //=> [2, 3, 4] + // @dts-jest:pass + R.takeLastWhile(isNotOne)([1, 2, 3, 4]); //=> [2, 3, 4] +})(); + +// @dts-jest:group takeWhile +(() => { + const isNotFour = (x: number) => !(x === 4); + // @dts-jest:pass + R.takeWhile(isNotFour, [1, 2, 3, 4]); //=> [1, 2, 3] + // @dts-jest:pass + R.takeWhile(isNotFour)([1, 2, 3, 4]); //=> [1, 2, 3] +})(); + +// @dts-jest:group tap +(() => { + const sayX = (_x: number) => { + /* console.log(`x is ${x}` */ + }; + // @dts-jest:pass + R.tap(sayX, 100); //=> 100 +})(); + +// @dts-jest:group test +(() => { + // @dts-jest:pass + R.test(/^x/, 'xyz'); //=> true + // @dts-jest:pass + R.test(/^y/)('xyz'); //=> false +})(); + +// @dts-jest:group times +(() => { + const i = (x: number) => x; + // @dts-jest:pass + R.times(i, 5); + // @dts-jest:pass + R.times(R.identity, 5); //=> [0, 1, 2, 3, 4] + // @dts-jest:pass + R.times(R.identity)(5); //=> [0, 1, 2, 3, 4] +})(); + +// @dts-jest:group toLower +(() => { + // @dts-jest:pass + R.toLower('XYZ'); //=> 'xyz' +})(); + +// @dts-jest:group toPairs +(() => { + // @dts-jest:pass + R.toPairs({ a: 1, b: 2, c: 3 }); //=> [['a', 1], ['b', 2], ['c', 3]] +})(); + +// @dts-jest:group toPairsIn +(() => { + class F { + public x = 'X'; + public y = 'Y'; + } + const f = new F(); + // @dts-jest:pass + R.toPairsIn(f); //=> [['x','X'], ['y','Y']] + // @dts-jest:pass + R.toPairsIn(f); //=> [['x','X'], ['y','Y']] +})(); + +// @dts-jest:group toString +(() => { + class Point { + public x: number; + public y: number; + constructor(x: number, y: number) { + this.x = x; + this.y = y; + } + public toString() { + return `new Point(${this.x}, ${this.y})`; + } + } + // @dts-jest:pass + R.toString(new Point(1, 2)); //=> 'new Point(1, 2)' + // @dts-jest:pass + R.toString(42); //=> '42' + // @dts-jest:pass + R.toString('abc'); //=> 'abc' + // @dts-jest:pass + R.toString([1, 2, 3]); //=> '[1, 2, 3]' + // @dts-jest:pass + R.toString({ foo: 1, bar: 2, baz: 3 }); //=> '{"bar": 2, "baz": 3, "foo": 1}' + // @dts-jest:pass + R.toString(new Date('2001-02-03T04: 05: 06Z')); //=> "new Date('2001-02-03T04: 05: 06.000Z')"" +})(); + +// @dts-jest:group toUpper +(() => { + // @dts-jest:pass + R.toUpper('abc'); //=> 'ABC' +})(); + +// @dts-jest:group transduce +(() => { + const numbers = [1, 2, 3, 4]; + const transducer = R.compose( + R.map(R.add(1)), + R.take(2), + ); + const fn = R.flip(R.append); + // @dts-jest:pass + R.transduce(transducer, fn, [] as number[], numbers); //=> [2, 3] // strictNullChecks: must annotate empty array type + // @dts-jest:pass + R.transduce(transducer, fn, [] as number[])(numbers); //=> [2, 3] + // @dts-jest:pass + R.transduce(transducer, fn)([] as number[], numbers); //=> [2, 3] + // @dts-jest:pass + R.transduce(transducer)(fn, [] as number[], numbers); //=> [2, 3] +})(); + +// @dts-jest:group transpose +(() => { + // @dts-jest:pass + R.transpose([[1, 'a'], [2, 'b'], [3, 'c']]); //=> [[1, 2, 3], ['a', 'b', 'c']] + // @dts-jest:pass + R.transpose([[1, 2, 3], ['a', 'b', 'c']]); //=> [[1, 'a'], [2, 'b'], [3, 'c']] + // @dts-jest:pass + R.transpose([[10, 11], [20], [], [30, 31, 32]]); //=> [[10, 20, 30], [11, 31], [32]] +})(); + +// @dts-jest:group:skip traverse +(() => { + // TODO +})(); + +// @dts-jest:group trim +(() => { + // @dts-jest:pass + R.trim(' xyz '); //=> 'xyz' + // @dts-jest:pass + R.map(R.trim, R.split(',', 'x, y, z')); //=> ['x', 'y', 'z'] +})(); + +// @dts-jest:group tryCatch +(() => { + // @dts-jest:pass + R.tryCatch(R.prop('x'), R.F)({ x: true }); //=> true + // @dts-jest:pass + R.tryCatch(R.prop('x'), R.F)(null); //=> false +})(); + +// @dts-jest:group type +(() => { + // @dts-jest:pass + R.type({}); //=> 'Object' + // @dts-jest:pass + R.type(1); //=> 'Number' + // @dts-jest:pass + R.type(false); //=> 'Boolean' + // @dts-jest:pass + R.type('s'); //=> 'String' + // @dts-jest:pass + R.type(null); //=> 'Null' + // @dts-jest:pass + R.type([]); //=> 'Array' + // @dts-jest:pass + R.type(/[A-z]/); //=> 'RegExp' +})(); + +// @dts-jest:group unapply +(() => { + // @dts-jest:pass + R.unapply(JSON.stringify); + // @dts-jest:pass + R.unapply(JSON.stringify)(1, 2, 3); //=> '[1,2,3]' +})(); + +// @dts-jest:group unary +(() => { + const takesOneArg = (a: number) => [a]; + const takesTwoArgs = (a: number, b: number) => [a, b]; + const takesThreeArgs = (a: number, b: number, c: number) => [a, b, c]; + + // @dts-jest:pass + R.unary(takesOneArg); + // @dts-jest:pass + R.unary(takesTwoArgs); + // @dts-jest:pass + R.unary(takesThreeArgs); +})(); + +// @dts-jest:group uncurryN +(() => { + const addFour = (a: number) => (b: number) => (c: number) => (d: number) => + a + b + c + d; + const uncurriedAddFour = R.uncurryN(4, addFour); + // @dts-jest:pass + uncurriedAddFour(1, 2, 3, 4); //=> 10 +})(); + +// @dts-jest:group unfold +(() => { + const f = (n: number) => (n > 50 ? false : [-n, n + 10] as [number, number]); + // @dts-jest:pass + R.unfold(f, 10); //=> [-10, -20, -30, -40, -50] + const b = R.unfold(f); + // @dts-jest:pass + b; //=> [-10, -20, -30, -40, -50] + // @dts-jest:pass + b(10); +})(); + +// @dts-jest:group union +(() => { + // @dts-jest:pass + R.union([1, 2, 3], [2, 3, 4]); //=> [1, 2, 3, 4] +})(); + +// @dts-jest:group unionWith +(() => { + interface A { + a: number; + } + const l1 = [{ a: 1 }, { a: 2 }]; + const l2 = [{ a: 1 }, { a: 4 }]; + // @dts-jest:pass + R.unionWith(R.eqBy(R.prop('a')), l1, l2); //=> [{a: 1}, {a: 2}, {a: 4}] +})(); + +// @dts-jest:group uniq +(() => { + // @dts-jest:pass + R.uniq([1, 1, 2, 1]); //=> [1, 2] + // @dts-jest:pass + R.uniq([{}, {}]); //=> [{}, {}] + // @dts-jest:pass + R.uniq([1, '1']); //=> [1, '1'] +})(); + +// @dts-jest:group uniqBy +(() => { + // @dts-jest:pass + R.uniqBy(Math.abs, [-1, -5, 2, 10, 1, 2]); //=> [-1, -5, 2, 10] +})(); + +// @dts-jest:group uniqWith +(() => { + const strEq = (a: any, b: any) => String(a) === String(b); + // @dts-jest:pass + R.uniqWith(strEq, [1, '1', 2, 1]); //=> [1, 2] + // @dts-jest:pass + R.uniqWith(strEq)([1, '1', 2, 1]); //=> [1, 2] + // @dts-jest:pass + R.uniqWith<{}>(strEq)([{}, {}]); //=> [{}] + // @dts-jest:pass + R.uniqWith(strEq)([1, '1', 1]); //=> [1] + // @dts-jest:pass + R.uniqWith(strEq)(['1', 1, 1]); //=> ['1'] +})(); + +// @dts-jest:group unless +(() => { + // @dts-jest:pass + R.unless(R.gt(R.__, 100), R.multiply(2))(1); //=> 2 + + function isArrayLike(x: any): x is R.List { + return x && typeof x.length === 'number'; + } + + const coerceArray = R.unless(isArrayLike, R.of); + // @dts-jest:pass + coerceArray([1, 2, 3]); //=> [1, 2, 3] + // @dts-jest:pass + coerceArray(1); //=> [1] +})(); + +// @dts-jest:group unnest +(() => { + // @dts-jest:pass + R.equals(R.unnest([1, [2], [[3]]]), [1, 2, [3]]); //=> true + // @dts-jest:pass + R.equals(R.unnest([[1, 2], [3, 4], [5, 6]]), [1, 2, 3, 4, 5, 6]); //=> true +})(); + +// @dts-jest:group until +(() => { + // @dts-jest:pass + R.until(R.gt(R.__, 100), R.multiply(2))(1); //=> 128 +})(); + +// @dts-jest:group update +(() => { + // @dts-jest:pass + R.update(1, 11, [0, 1, 2]); //=> [0, 11, 2] + // @dts-jest:pass + R.update(1)(11)([0, 1, 2]); //=> [0, 11, 2] +})(); + +// @dts-jest:group useWith +(() => { + // @dts-jest:pass + R.useWith(Math.pow, [R.identity, R.identity])(3, 4); //=> 81 + // @dts-jest:pass + R.useWith<'11', '2arity'>()(Math.pow, [R.identity, R.identity])(3)(4); //=> 81 + // @dts-jest:pass + R.useWith(Math.pow, [R.dec, R.inc])(3, 4); //=> 32 + // @dts-jest:pass + R.useWith(Math.pow, [R.dec, R.inc])(3)(4); //=> 32 +})(); + +// @dts-jest:group values +(() => { + // @dts-jest:pass + R.values({ a: 1, b: 2, c: 3 }); //=> [1, 2, 3] +})(); + +// @dts-jest:group valuesIn +(() => { + class F { + public x = 'X'; + public y = 'Y'; + } + const f = new F(); + // @dts-jest:pass + R.valuesIn(f); //=> ['X', 'Y'] +})(); + +// @dts-jest:group view +(() => { + const headLens = R.lensIndex(0); + // @dts-jest:pass + R.view(headLens, ['a', 'b', 'c']); //=> 'a' +})(); + +// @dts-jest:group when +(() => { + const truncate = R.when( + R.propSatisfies(R.gt(R.__, 10), 'length'), + R.pipe(R.take(10), R.append('…'), R.join('')), + ); + // @dts-jest:pass + truncate('12345'); //=> '12345' + // @dts-jest:pass + truncate('0123456789ABC'); //=> '0123456789…' +})(); + +// @dts-jest:group where +(() => { + const spec = { x: R.equals(2) }; + // @dts-jest:pass + R.where(spec, { w: 10, x: 2, y: 300 }); //=> true + // @dts-jest:pass + R.where(spec, { x: 1, y: 'moo', z: true }); //=> false + // @dts-jest:pass + R.where(spec)({ w: 10, x: 2, y: 300 }); //=> true + // @dts-jest:pass + R.where(spec)({ x: 1, y: 'moo', z: true }); //=> false + + const spec2 = { x: (val: number) => val > 10 }; + // @dts-jest:pass + R.where(spec2, { x: 2, y: 7 }); //=> false + // @dts-jest:pass + R.where(spec2, { x: 3, y: 8 }); //=> true + + const xs = [{ x: 2, y: 1 }, { x: 10, y: 2 }, { x: 8, y: 3 }, { x: 10, y: 4 }]; + // @dts-jest:pass + R.filter(R.where({ x: R.equals(10) }), xs); // ==> [{x: 10, y: 2}, {x: 10, y: 4}] + // @dts-jest:pass + R.filter(R.where({ x: R.equals(10) }))(xs); // ==> [{x: 10, y: 2}, {x: 10, y: 4}] +})(); + +// @dts-jest:group whereEq +(() => { + const pred = R.whereEq({ a: 1, b: 2 }); + // @dts-jest:pass + pred; + // @dts-jest:pass + pred({ a: 1 }); //=> false + // @dts-jest:pass + pred({ a: 1, b: 2 }); //=> true + // @dts-jest:pass + pred({ a: 1, b: 2, c: 3 }); //=> true + // @dts-jest:pass + pred({ a: 1, b: 1 }); //=> false + // @dts-jest:pass + R.whereEq({ a: 'one' }, { a: 'one' }); //=> true +})(); + +// @dts-jest:group without +(() => { + // @dts-jest:pass + R.without([1, 2], [1, 2, 1, 3, 4]); //=> [3, 4] +})(); + +// @dts-jest:group xprod +(() => { + // @dts-jest:pass + R.xprod([1, 2], ['a', 'b']); //=> [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']] + // @dts-jest:pass + R.xprod([1, 2])(['a', 'b']); //=> [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']] +})(); + +// @dts-jest:group zip +(() => { + // @dts-jest:pass + R.zip([1, 2, 3], ['a', 'b', 'c']); //=> [[1, 'a'], [2, 'b'], [3, 'c']] + // @dts-jest:pass + R.zip([1, 2, 3])(['a', 'b', 'c']); //=> [[1, 'a'], [2, 'b'], [3, 'c']] +})(); + +// @dts-jest:group zipObj +(() => { + // @dts-jest:pass + R.zipObj(['a', 'b', 'c'], [1, 2, 3]); //=> {a: 1, b: 2, c: 3} + // @dts-jest:pass + R.zipObj(['a', 'b', 'c'])([1, 2, 3]); //=> {a: 1, b: 2, c: 3} +})(); + +// @dts-jest:group zipWith +(() => { + const f = (_x: number, _y: string) => { + /* ... */ + }; + // @dts-jest:pass + R.zipWith(f, [1, 2, 3], ['a', 'b', 'c']); //=> [f(1, 'a'), f(2, 'b'), f(3, 'c')] + // @dts-jest:pass + R.zipWith(f)([1, 2, 3], ['a', 'b', 'c']); //=> [f(1, 'a'), f(2, 'b'), f(3, 'c')] + // @dts-jest:pass + R.zipWith(f, [1, 2, 3])(['a', 'b', 'c']); //=> [f(1, 'a'), f(2, 'b'), f(3, 'c')] +})(); diff --git a/tests/range.ts b/tests/range.ts new file mode 100644 index 0000000..2591a6f --- /dev/null +++ b/tests/range.ts @@ -0,0 +1,10 @@ +import * as R_range from '../ramda/dist/src/range'; + +declare const number: number; + +// @dts-jest:pass +R_range(number); +// @dts-jest:pass +R_range(number)(number); +// @dts-jest:pass +R_range(number, number); diff --git a/tests/reduce.ts b/tests/reduce.ts new file mode 100644 index 0000000..b8eeff5 --- /dev/null +++ b/tests/reduce.ts @@ -0,0 +1,12 @@ +import * as R_reduce from '../ramda/dist/src/reduce'; + +declare const number_array: number[]; +declare const object: object; +declare const object_number_to_object: (acc: object, val: number) => object; + +// @dts-jest:pass +R_reduce(object_number_to_object, object); +// @dts-jest:pass +R_reduce(object_number_to_object)(object)(number_array); +// @dts-jest:pass +R_reduce(object_number_to_object, object, number_array); diff --git a/tests/reduceBy.ts b/tests/reduceBy.ts new file mode 100644 index 0000000..c1bf4c1 --- /dev/null +++ b/tests/reduceBy.ts @@ -0,0 +1,21 @@ +import * as R_reduceBy from '../ramda/dist/src/reduceBy'; + +declare const number_array: number[]; +declare const object: object; +declare const object_number_to_object: (acc: object, val: number) => object; +declare const number_to_string: (x: number) => string; +declare const number_to_a_b_c: (x: number) => 'a' | 'b' | 'c'; + +// @dts-jest:pass +R_reduceBy(object_number_to_object, object, number_to_string); +// @dts-jest:pass +R_reduceBy(object_number_to_object)(object)(number_to_string)(number_array); +// @dts-jest:pass +R_reduceBy(object_number_to_object, object, number_to_string, number_array); + +// @dts-jest:pass +R_reduceBy(object_number_to_object, object, number_to_a_b_c); +// @dts-jest:pass +R_reduceBy(object_number_to_object)(object)(number_to_a_b_c)(number_array); +// @dts-jest:pass +R_reduceBy(object_number_to_object, object, number_to_a_b_c, number_array); diff --git a/tests/reduceRight.ts b/tests/reduceRight.ts new file mode 100644 index 0000000..9dc5a03 --- /dev/null +++ b/tests/reduceRight.ts @@ -0,0 +1,12 @@ +import * as R_reduceRight from '../ramda/dist/src/reduceRight'; + +declare const number_array: number[]; +declare const object: object; +declare const number_object_to_object: (val: number, acc: object) => object; + +// @dts-jest:pass +R_reduceRight(number_object_to_object, object); +// @dts-jest:pass +R_reduceRight(number_object_to_object)(object)(number_array); +// @dts-jest:pass +R_reduceRight(number_object_to_object, object, number_array); diff --git a/tests/reduceWhile.ts b/tests/reduceWhile.ts new file mode 100644 index 0000000..0e83157 --- /dev/null +++ b/tests/reduceWhile.ts @@ -0,0 +1,20 @@ +import * as R_reduceWhile from '../ramda/dist/src/reduceWhile'; + +declare const number_array: number[]; +declare const object: object; +declare const object_number_to_object: (acc: object, val: number) => object; +declare const object_number_to_boolean: (acc: object, val: number) => boolean; + +// @dts-jest:pass +R_reduceWhile(object_number_to_boolean, object_number_to_object, object); +// @dts-jest:pass +R_reduceWhile(object_number_to_boolean)(object_number_to_object)(object)( + number_array, +); +// @dts-jest:pass +R_reduceWhile( + object_number_to_boolean, + object_number_to_object, + object, + number_array, +); diff --git a/tests/reduced.ts b/tests/reduced.ts new file mode 100644 index 0000000..9f95c1c --- /dev/null +++ b/tests/reduced.ts @@ -0,0 +1,10 @@ +import { Reduced } from '../ramda/dist/src/$types'; +import * as R_reduced from '../ramda/dist/src/reduced'; + +declare const object: object; +declare const reduced_object: Reduced; + +// @dts-jest:pass +R_reduced(object); +// @dts-jest:pass +R_reduced(reduced_object); diff --git a/tests/reject.ts b/tests/reject.ts new file mode 100644 index 0000000..8ccdded --- /dev/null +++ b/tests/reject.ts @@ -0,0 +1,22 @@ +import { Dictionary, Filterable, Predicate } from '../ramda/dist/src/$types'; +import * as R_reject from '../ramda/dist/src/reject'; + +declare const string_predicate: Predicate; +declare const string_array: string[]; +declare const string_dictionary: Dictionary; +declare const string_filterable: Filterable; + +// @dts-jest:pass +R_reject(string_predicate, string_array); +// @dts-jest:pass +R_reject(string_predicate)(string_array); + +// @dts-jest:pass +R_reject(string_predicate, string_dictionary); +// @dts-jest:pass +R_reject(string_predicate)(string_dictionary); + +// @dts-jest:pass +R_reject(string_predicate, string_filterable); +// @dts-jest:pass +R_reject(string_predicate)(string_filterable); diff --git a/tests/remove.ts b/tests/remove.ts new file mode 100644 index 0000000..aca9247 --- /dev/null +++ b/tests/remove.ts @@ -0,0 +1,11 @@ +import * as R_remove from '../ramda/dist/src/remove'; + +declare const boolean_array: boolean[]; +declare const number: number; + +// @dts-jest:pass +R_remove(number, number); +// @dts-jest:pass +R_remove(number)(number)(boolean_array); +// @dts-jest:pass +R_remove(number, number, boolean_array); diff --git a/tests/repeat.ts b/tests/repeat.ts new file mode 100644 index 0000000..e3f3708 --- /dev/null +++ b/tests/repeat.ts @@ -0,0 +1,11 @@ +import * as R_repeat from '../ramda/dist/src/repeat'; + +declare const string: string; +declare const number: number; + +// @dts-jest:pass +R_repeat(string); +// @dts-jest:pass +R_repeat(string)(number); +// @dts-jest:pass +R_repeat(string, number); diff --git a/tests/replace.ts b/tests/replace.ts new file mode 100644 index 0000000..2f6e636 --- /dev/null +++ b/tests/replace.ts @@ -0,0 +1,11 @@ +import * as R_replace from '../ramda/dist/src/replace'; + +declare const regex: RegExp; +declare const string: string; + +// @dts-jest:pass +R_replace(regex, string); +// @dts-jest:pass +R_replace(regex)(string)(string); +// @dts-jest:pass +R_replace(regex, string, string); diff --git a/tests/reverse.ts b/tests/reverse.ts new file mode 100644 index 0000000..7bda70a --- /dev/null +++ b/tests/reverse.ts @@ -0,0 +1,10 @@ +import { List } from '../ramda/dist/src/$types'; +import * as R_reverse from '../ramda/dist/src/reverse'; + +declare const string: string; +declare const number_list: List; + +// @dts-jest:pass +R_reverse(string); +// @dts-jest:pass +R_reverse(number_list); diff --git a/tests/scan.ts b/tests/scan.ts new file mode 100644 index 0000000..903cb07 --- /dev/null +++ b/tests/scan.ts @@ -0,0 +1,12 @@ +import * as R_scan from '../ramda/dist/src/scan'; + +declare const number_array: number[]; +declare const object: object; +declare const object_number_to_object: (acc: object, val: number) => object; + +// @dts-jest:pass +R_scan(object_number_to_object, object); +// @dts-jest:pass +R_scan(object_number_to_object)(object)(number_array); +// @dts-jest:pass +R_scan(object_number_to_object, object, number_array); diff --git a/tests/sequence.ts b/tests/sequence.ts new file mode 100644 index 0000000..70ed1d6 --- /dev/null +++ b/tests/sequence.ts @@ -0,0 +1,20 @@ +import { Applicative, Traversable } from '../ramda/dist/src/$types'; +import * as R_sequence from '../ramda/dist/src/sequence'; + +declare const any_applicative: Applicative; +declare const number_applicative: Applicative; +declare const any_applicative_traverable: Traversable>; + +// @dts-jest:pass +R_sequence(number_applicative.of, [number_applicative]); +// @dts-jest:pass +R_sequence(any_applicative.of, [any_applicative]); +// @dts-jest:pass +R_sequence(any_applicative.of, [any_applicative]); + +// @dts-jest:pass +R_sequence(number_applicative.of, any_applicative_traverable); +// @dts-jest:pass +R_sequence(any_applicative.of, any_applicative_traverable); +// @dts-jest:pass +R_sequence(any_applicative.of, any_applicative_traverable); diff --git a/tests/set.ts b/tests/set.ts new file mode 100644 index 0000000..2ea49d0 --- /dev/null +++ b/tests/set.ts @@ -0,0 +1,37 @@ +import { ManualLens, PseudoLens } from '../ramda/dist/src/$types'; +import * as R_set from '../ramda/dist/src/set'; + +declare const menual_lens_number_object: ManualLens; +declare const pseudo_lens_a: PseudoLens<'a'>; +declare const pseudo_lens_1: PseudoLens<1>; + +declare const object: object; +declare const a_1_b_2_c_3: { a: 1; b: 2; c: 3 }; +declare const number_array: number[]; +declare const string_number_tuple: [string, number]; +declare const number: number; + +// @dts-jest:pass +R_set(menual_lens_number_object, number); +// @dts-jest:pass +R_set(menual_lens_number_object)(number)(object); +// @dts-jest:pass +R_set(menual_lens_number_object, number, object); + +// @dts-jest:pass +R_set(pseudo_lens_a, number); +// @dts-jest:pass +R_set(pseudo_lens_a)(number)(a_1_b_2_c_3); +// @dts-jest:pass +R_set(pseudo_lens_a, number, a_1_b_2_c_3); + +// @dts-jest:pass +R_set(pseudo_lens_1, number); +// @dts-jest:pass +R_set(pseudo_lens_1)(number)(string_number_tuple); +// @dts-jest:pass +R_set(pseudo_lens_1, number, string_number_tuple); +// @dts-jest:pass +R_set(pseudo_lens_1)(number)(number_array); +// @dts-jest:pass +R_set(pseudo_lens_1, number, number_array); diff --git a/tests/slice.ts b/tests/slice.ts new file mode 100644 index 0000000..d28513e --- /dev/null +++ b/tests/slice.ts @@ -0,0 +1,16 @@ +import { List } from '../ramda/dist/src/$types'; +import * as R_slice from '../ramda/dist/src/slice'; + +declare const number: number; +declare const string: string; +declare const object_list: List; + +// @dts-jest:pass +R_slice(number)(number)(string); +// @dts-jest:pass +R_slice(number, number, string); + +// @dts-jest:pass +R_slice(number)(number)(object_list); +// @dts-jest:pass +R_slice(number, number, object_list); diff --git a/tests/sort.ts b/tests/sort.ts new file mode 100644 index 0000000..05a2e85 --- /dev/null +++ b/tests/sort.ts @@ -0,0 +1,22 @@ +import { List } from '../ramda/dist/src/$types'; +import * as R_sort from '../ramda/dist/src/sort'; + +declare const string: string; +declare const string_string_to_number: (x: string, y: string) => number; + +declare const object_list: List; +declare const object_object_to_number: (x: object, y: object) => number; + +// @dts-jest:pass +R_sort(string_string_to_number); +// @dts-jest:pass +R_sort(string_string_to_number)(string); +// @dts-jest:pass +R_sort(string_string_to_number, string); + +// @dts-jest:pass +R_sort(object_object_to_number); +// @dts-jest:pass +R_sort(object_object_to_number)(object_list); +// @dts-jest:pass +R_sort(object_object_to_number, object_list); diff --git a/tests/sortBy.ts b/tests/sortBy.ts new file mode 100644 index 0000000..2386b13 --- /dev/null +++ b/tests/sortBy.ts @@ -0,0 +1,22 @@ +import { List } from '../ramda/dist/src/$types'; +import * as R_sortBy from '../ramda/dist/src/sortBy'; + +declare const string: string; +declare const string_to_number: (x: string) => number; + +declare const object_list: List; +declare const object_to_number: (x: object) => number; + +// @dts-jest:pass +R_sortBy(string_to_number); +// @dts-jest:pass +R_sortBy(string_to_number)(string); +// @dts-jest:pass +R_sortBy(string_to_number, string); + +// @dts-jest:pass +R_sortBy(object_to_number); +// @dts-jest:pass +R_sortBy(object_to_number)(object_list); +// @dts-jest:pass +R_sortBy(object_to_number, object_list); diff --git a/tests/sortWith.ts b/tests/sortWith.ts new file mode 100644 index 0000000..a5730b9 --- /dev/null +++ b/tests/sortWith.ts @@ -0,0 +1,22 @@ +import { List } from '../ramda/dist/src/$types'; +import * as R_sortWith from '../ramda/dist/src/sortWith'; + +declare const string: string; +declare const string_string_to_number: (x: string, y: string) => number; + +declare const object_list: List; +declare const object_object_to_number: (x: object, y: object) => number; + +// @dts-jest:pass +R_sortWith([string_string_to_number]); +// @dts-jest:pass +R_sortWith([string_string_to_number])(string); +// @dts-jest:pass +R_sortWith([string_string_to_number], string); + +// @dts-jest:pass +R_sortWith([object_object_to_number]); +// @dts-jest:pass +R_sortWith([object_object_to_number])(object_list); +// @dts-jest:pass +R_sortWith([object_object_to_number], object_list); diff --git a/tests/split.ts b/tests/split.ts new file mode 100644 index 0000000..af82ee8 --- /dev/null +++ b/tests/split.ts @@ -0,0 +1,11 @@ +import * as R_split from '../ramda/dist/src/split'; + +declare const regex: RegExp; +declare const string: string; + +// @dts-jest:pass +R_split(regex); +// @dts-jest:pass +R_split(regex)(string); +// @dts-jest:pass +R_split(regex, string); diff --git a/tests/splitAt.ts b/tests/splitAt.ts new file mode 100644 index 0000000..88e2141 --- /dev/null +++ b/tests/splitAt.ts @@ -0,0 +1,16 @@ +import { List } from '../ramda/dist/src/$types'; +import * as R_splitAt from '../ramda/dist/src/splitAt'; + +declare const number: number; +declare const string: string; +declare const object_list: List; + +// @dts-jest:pass +R_splitAt(number)(string); +// @dts-jest:pass +R_splitAt(number, string); + +// @dts-jest:pass +R_splitAt(number)(object_list); +// @dts-jest:pass +R_splitAt(number, object_list); diff --git a/tests/splitEvery.ts b/tests/splitEvery.ts new file mode 100644 index 0000000..ca428b4 --- /dev/null +++ b/tests/splitEvery.ts @@ -0,0 +1,16 @@ +import { List } from '../ramda/dist/src/$types'; +import * as R_splitEvery from '../ramda/dist/src/splitEvery'; + +declare const number: number; +declare const string: string; +declare const object_list: List; + +// @dts-jest:pass +R_splitEvery(number)(string); +// @dts-jest:pass +R_splitEvery(number, string); + +// @dts-jest:pass +R_splitEvery(number)(object_list); +// @dts-jest:pass +R_splitEvery(number, object_list); diff --git a/tests/splitWhen.ts b/tests/splitWhen.ts new file mode 100644 index 0000000..44e3dd7 --- /dev/null +++ b/tests/splitWhen.ts @@ -0,0 +1,22 @@ +import { List } from '../ramda/dist/src/$types'; +import * as R_splitWhen from '../ramda/dist/src/splitWhen'; + +declare const string: string; +declare const string_to_boolean: (x: string) => boolean; + +declare const object_list: List; +declare const object_to_boolean: (x: object) => boolean; + +// @dts-jest:pass +R_splitWhen(string_to_boolean); +// @dts-jest:pass +R_splitWhen(string_to_boolean)(string); +// @dts-jest:pass +R_splitWhen(string_to_boolean, string); + +// @dts-jest:pass +R_splitWhen(object_to_boolean); +// @dts-jest:pass +R_splitWhen(object_to_boolean)(object_list); +// @dts-jest:pass +R_splitWhen(object_to_boolean, object_list); diff --git a/tests/startsWith.ts b/tests/startsWith.ts new file mode 100644 index 0000000..65b2a50 --- /dev/null +++ b/tests/startsWith.ts @@ -0,0 +1,13 @@ +import * as R_startsWith from '../ramda/dist/src/startsWith'; + +declare const string: string; +declare const boolean_array: boolean[]; + +// @dts-jest:pass +R_startsWith(string); +// @dts-jest:pass +R_startsWith(string, string); +// @dts-jest:pass +R_startsWith(boolean_array); +// @dts-jest:pass +R_startsWith(boolean_array, boolean_array); diff --git a/tests/subtract.ts b/tests/subtract.ts new file mode 100644 index 0000000..9a396e0 --- /dev/null +++ b/tests/subtract.ts @@ -0,0 +1,8 @@ +import * as R_subtract from '../ramda/dist/src/subtract'; + +declare const number: number; + +// @dts-jest:pass +R_subtract(number, number); +// @dts-jest:pass +R_subtract(number)(number); diff --git a/tests/sum.ts b/tests/sum.ts new file mode 100644 index 0000000..499d07a --- /dev/null +++ b/tests/sum.ts @@ -0,0 +1,6 @@ +import * as R_sum from '../ramda/dist/src/sum'; + +declare const number_array: number[]; + +// @dts-jest:pass +R_sum(number_array); diff --git a/tests/symmetricDifference.ts b/tests/symmetricDifference.ts new file mode 100644 index 0000000..210db05 --- /dev/null +++ b/tests/symmetricDifference.ts @@ -0,0 +1,8 @@ +import * as R_symmetricDifference from '../ramda/dist/src/symmetricDifference'; + +declare const number_array: number[]; + +// @dts-jest:pass +R_symmetricDifference(number_array); +// @dts-jest:pass +R_symmetricDifference(number_array, number_array); diff --git a/tests/symmetricDifferenceWith.ts b/tests/symmetricDifferenceWith.ts new file mode 100644 index 0000000..979761e --- /dev/null +++ b/tests/symmetricDifferenceWith.ts @@ -0,0 +1,9 @@ +import * as R_symmetricDifferenceWith from '../ramda/dist/src/symmetricDifferenceWith'; + +declare const number_number_to_boolean: (a: number, b: number) => boolean; +declare const number_array: number[]; + +// @dts-jest:pass +R_symmetricDifferenceWith(number_number_to_boolean, number_array); +// @dts-jest:pass +R_symmetricDifferenceWith(number_number_to_boolean, number_array, number_array); diff --git a/tests/tail.ts b/tests/tail.ts new file mode 100644 index 0000000..742effe --- /dev/null +++ b/tests/tail.ts @@ -0,0 +1,9 @@ +import * as R_tail from '../ramda/dist/src/tail'; + +declare const string: string; +declare const string_array: string[]; + +// @dts-jest:pass +R_tail(string); +// @dts-jest:pass +R_tail(string_array); diff --git a/tests/take.ts b/tests/take.ts new file mode 100644 index 0000000..3a58fc1 --- /dev/null +++ b/tests/take.ts @@ -0,0 +1,10 @@ +import * as R_take from '../ramda/dist/src/take'; + +declare const number: number; +declare const string: string; +declare const boolean_array: boolean[]; + +// @dts-jest:pass +R_take(number, string); +// @dts-jest:pass +R_take(number, boolean_array); diff --git a/tests/takeLast.ts b/tests/takeLast.ts new file mode 100644 index 0000000..31626a0 --- /dev/null +++ b/tests/takeLast.ts @@ -0,0 +1,10 @@ +import * as R_takeLast from '../ramda/dist/src/takeLast'; + +declare const number: number; +declare const string: string; +declare const boolean_array: boolean[]; + +// @dts-jest:pass +R_takeLast(number, string); +// @dts-jest:pass +R_takeLast(number, boolean_array); diff --git a/tests/takeLastWhile.ts b/tests/takeLastWhile.ts new file mode 100644 index 0000000..ce6c148 --- /dev/null +++ b/tests/takeLastWhile.ts @@ -0,0 +1,9 @@ +import * as R_takeLastWhile from '../ramda/dist/src/takeLastWhile'; + +declare const string_to_boolean: (x: string) => boolean; +declare const string_array: string[]; + +// @dts-jest:pass +R_takeLastWhile(string_to_boolean); +// @dts-jest:pass +R_takeLastWhile(string_to_boolean, string_array); diff --git a/tests/takeWhile.ts b/tests/takeWhile.ts new file mode 100644 index 0000000..b8b9165 --- /dev/null +++ b/tests/takeWhile.ts @@ -0,0 +1,9 @@ +import * as R_takeWhile from '../ramda/dist/src/takeWhile'; + +declare const string_to_boolean: (x: string) => boolean; +declare const string_array: string[]; + +// @dts-jest:pass +R_takeWhile(string_to_boolean); +// @dts-jest:pass +R_takeWhile(string_to_boolean, string_array); diff --git a/tests/tap.ts b/tests/tap.ts new file mode 100644 index 0000000..4baf0a2 --- /dev/null +++ b/tests/tap.ts @@ -0,0 +1,9 @@ +import * as R_tap from '../ramda/dist/src/tap'; + +declare const string_to_void: (x: string) => void; +declare const string: string; + +// @dts-jest:pass +R_tap(string_to_void); +// @dts-jest:pass +R_tap(string_to_void, string); diff --git a/tests/test.ts b/tests/test.ts index 4b4e7da..8093936 100644 --- a/tests/test.ts +++ b/tests/test.ts @@ -1,3330 +1,9 @@ -import * as R from '../index'; +import * as R_test from '../ramda/dist/src/test'; -declare let console: any; +declare const regex: RegExp; +declare const string: string; -let double = (x: number): number => x + x; - -let shout = function(x: number): string { - return x >= 10 - ? 'big' - : 'small'; -}; - -// check type information is not lost for lists -let onlyNumberList = function(xs: number[]): number[] { - return xs; -}; - -// check type information is not lost for simple objects -let onlyNumberObj = function(xs: {[key: string]: number}): {[key: string]: number} { - return xs; -}; - - -class F { - x = 'X'; - y = 'Y'; -} -class F2 { - a = 100; - y = 1; - x() {}; - z() {}; -} - -// isArrayLike -() => { - // $ExpectType boolean - R.isArrayLike('a'); - // $ExpectType boolean - R.isArrayLike([1,2,3]); - // $ExpectType boolean - R.isArrayLike([]); -}; - -// propIs -(() => { - // $ExpectType boolean - R.propIs(Number, 'x', {x: 1, y: 2}); // => true - // $ExpectType boolean - R.propIs(Number, 'x')({x: 1, y: 2}); // => true - // $ExpectType boolean - R.propIs(Number)('x', {x: 1, y: 2}); // => true - // $ExpectType boolean - R.propIs(Number)('x')({x: 1, y: 2}); // => true - // $ExpectType boolean - R.propIs(Number, 'x', {x: 'foo'}); // => false - // $ExpectError Argument of type 'x' is not assignable to parameter of type 'never'.`, because 'x' is not in `{}`. - R.propIs(Number, 'x', {}); // => false -}); - -// type -(() => { - // $ExpectType string - R.type({}); // => 'Object' - // $ExpectType string - R.type(1); // => 'Number' - // $ExpectType string - R.type(false); // => 'Boolean' - // $ExpectType string - R.type('s'); // => 'String' - // $ExpectType string - R.type(null); // => 'Null' - // $ExpectType string - R.type([]); // => 'Array' - // $ExpectType string - R.type(/[A-z]/); // => 'RegExp' -}); - -// curry -() => { - const addTwo = R.curry((x: number, y: number) => x + y); - // $ExpectType (v2: number) => number - addTwo(3); - // $ExpectType number - addTwo(3)(1); - const addThree = R.curry((x: number, y: number, z: number) => x + y + z); - // $ExpectType number - addThree(3, 2, 1); - // $ExpectType number - addThree(3)(2)(1); - // $ExpectType (v3: number) => number - addThree(3, 2); - // $ExpectType (v2: number) => number - addThree(3)(2); - // $ExpectType CurriedFunction2 - addThree(3); - - const xy = R.curry((x: X, y: Y) => ({ x, y })); - // $ExpectType (v2: Y) => { x: number; y: Y; } - xy(3); - // $ExpectType { x: number; y: number; } - xy(3)(1); - const xyz = R.curry((x: X, y: Y, z: Z) => ({ x, y, z })); - // $ExpectType { x: number; y: number; z: number; } - xyz(3, 2, 1); - // $ExpectType { x: number; y: number; z: number; } - xyz(3)(2)(1); - // $ExpectType (v3: Z) => ({ x: number; y: number; z: Z; }) - xyz(3, 2); - // $ExpectType (v3: Z) => ({ x: number; y: number; z: Z; }) - xyz(3)(2); - // $ExpectType (v2: Y, v3: Z) => ({ x: number; y: Y; z: Z; }) - xyz(3); -}; - -// unary, binary, nAry -() => { - let takesNoArg = function() { return true; }; - let takesOneArg = function(a: number) { return [a]; }; - let takesTwoArgs = function(a: number, b: number) { return [a, b]; }; - let takesThreeArgs = function(a: number, b: number, c: number) { return [a, b, c]; }; - - let addFourNumbers = function(a: number, b: number, c: number, d: number): number { - return a + b + c + d; - }; - - const curriedFourNumbers = R.curry(addFourNumbers); - // $ExpectType CurriedFunction4 - curriedFourNumbers; - // $ExpectType CurriedFunction3 - curriedFourNumbers(1); - // $ExpectType CurriedFunction2 - curriedFourNumbers(1)(2); - // $ExpectType (v1: T1) => R - curriedFourNumbers(1)(2)(3); - // $ExpectType (v1: T1) => R - curriedFourNumbers(1,2,4); - // $ExpectType number - curriedFourNumbers(1)(2)(3)(4); - // $ExpectType number - curriedFourNumbers(1,2)(3,4); - // $ExpectType number - curriedFourNumbers(1,2,3)(4); - - // $ExpectType () => boolean - R.nAry(0, takesNoArg); - // $ExpectType () => number[] - R.nAry(0, takesOneArg); - // $ExpectType (a: number) => number[] - R.nAry(1, takesTwoArgs); - // $ExpectType (a: number) => number[] - R.nAry(1, takesThreeArgs); - - // $ExpectType (a: number) => number[] - R.unary(takesOneArg); - // $ExpectType (a: number) => number[] - R.unary(takesTwoArgs); - // $ExpectType (a: number) => number[] - R.unary(takesThreeArgs); - - // $ExpectType (a: number, b: number) => number[] - R.binary(takesTwoArgs); - // $ExpectType (a: number, b: number) => number[] - R.binary(takesThreeArgs); - - let addTwoNumbers = function(a: number, b: number) { return a + b; }; - // $ExpectType CurriedFunction2 - let addTwoNumbersCurried = R.curry(addTwoNumbers); - - let inc = addTwoNumbersCurried(1); - // $ExpectType number - inc(2); - // $ExpectType number - addTwoNumbersCurried(2,3); -}; - -// uncurry -() => { - const addFour = (a: number) => (b: number) => (c: number) => (d: number) => a + b + c + d; - const uncurriedAddFour = R.uncurryN(4, addFour); - // $ExpectType number - uncurriedAddFour(1, 2, 3, 4); // => 10 -}; - -// unless -() => { - // $ExpectType (v: a|[a]) => [a] - const coerceArray = R.unless(R.isArrayLike, R.of); - // $ExpectType number[] - coerceArray([1, 2, 3]); // => [1, 2, 3] - // $ExpectType number[] - coerceArray(1); // => [1] -}; - -// nthArg -(() => { - // $ExpectType string - R.nthArg(1)('a', 'b', 'c'); // => 'b' - // $ExpectType string - R.nthArg(-1)('a', 'b', 'c'); // => 'c' -}); - -// unapply -() => { - // $ExpectType (...args: string[])=>string - R.unapply(JSON.stringify); - // $ExpectType string - R.unapply(JSON.stringify)(1, 2, 3); // => '[1,2,3]' -}; - -// until -() => { - // $ExpectType number - R.until(R.flip(R.gt)(100), R.multiply(2))(1); // => 128 -}; - -// propSatisfies -() => { - const truncate = R.when( - R.propSatisfies(R.flip(R.gt)(10), 'length'), - R.pipe(R.take(10), R.append('…'), R.join('')) - ); - // $ExpectType string - truncate('12345'); // => '12345' - // $ExpectType string - truncate('0123456789ABC'); // => '0123456789…' -}; - -/* compose */ -() => { - let limit10 = function(x: number): boolean { - return x >= 10; - }; - // $ExpectType (x0: number) => boolean - R.compose(limit10, double); - // $ExpectType boolean - R.compose(limit10, double)(10); - - const f0 = (s: string) => +s; // string -> number - const f1 = (n: number) => n === 1; // number -> boolean - const f2 = R.compose(f1, f0); // string -> boolean - - // akward example that bounces types between number and string - const g0 = (list: number[]) => R.map(R.inc, list); - const g1 = R.dropWhile(R.gt(10)); - const g2 = R.map((i: number) => i > 5 ? 'bigger' : 'smaller'); - const g3 = R.all((i: string) => i === 'smaller'); - // $ExpectType (list: number[]) => boolean - const g = R.compose(g3, g2, g1, g0); - // $ExpectType boolean - g([1, 2, 10, 13]); -}; - -/* pipe */ -() => { - // $ExpectType (x0: number) => string - R.pipe(double, double, shout); - // $ExpectType string - R.pipe(double, double, shout)(10); - - // $ExpectType string - const capitalize = (str: string) => R.pipe( - R.split(''), - R.adjust(R.toUpper, 0), - R.join('') - )(str); - - let f = R.pipe(Math.pow, R.negate, R.inc); - // $ExpectType number - f(3, 4); // -(3^4) + 1 - - // test for type degeneration if the first function has generics - // $ExpectType (x0: number) => number - R.pipe(R.identity, double); -}; - -/* pipeP */ -() => { - // $ExpectType Promise - R.pipeP( - (m: number) => Promise.resolve(R.multiply(2, m)), - (m: number) => Promise.resolve(m / 2), - R.multiply(2) - )(10); -}; - -// TODO: pipeK - -// invoker -() => { - // $ExpectType string - R.invoker(0, 'toUpperCase', 'foo'); - // $ExpectType string - R.invoker(1, 'charAt', 'foo', 1); -}; - -// juxt -(() => { - const range = R.juxt([Math.min, Math.max]); - // $ExpectType number[] - range(3, 4, 9, -3); // => [-3, 9] - - const chopped = R.juxt([R.head, R.last]); - // $ExpectType string[] - chopped('longstring'); // => ['l', 'g'] -}); - -// useWith -(() => { - let square = function(x: number) { return x * x; }; - let add = function(a: number, b: number) { return a + b; }; - // Adds any number of arguments together - let addAll = function() { - return 0; - }; - - // Basic example - R.useWith(addAll, [ double, square ]); -}); - -// clone -(() => { - let printXPlusFive = function(x: number) { console.log(x + 5); }; - R.forEach(printXPlusFive, [1, 2, 3]); - // $ExpectType Object[] - R.clone([{},{},{}]); - // $ExpectType number[] - R.clone([1,2,3]); -})(); - -// forEach -// (() => { -// let printXPlusFive = function(x, i) { console.log(i + 5); }; -// R.forEach.idx(printXPlusFive, [{name: 1}, {name: 2}, {name: 3}]); -// })(); - -// times -(() => { - let i = function(x: number) {return x;}; - // $ExpectType number[] - R.times(i, 5); -})(); - -// pipe -(() => { - let triple = function(x: number): number { return x * 3; }; - let square = function(x: number): number { return x * x; }; - let squareThenDoubleThenTriple = R.pipe(square, double, triple); - // $ExpectType number - squareThenDoubleThenTriple(5); // => 150 -})(); - -// partial -(() => { - let multiply = function(a: number, b: number) { return a * b; }; - let double = R.partial(multiply, [2]); - // $ExpectType number - double(2); // => 4 - - let greet = function(salutation: string, title: string, firstName: string, lastName: string) { - return salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!'; - }; - let sayHello = R.partial(greet, ['Hello']); - let sayHelloToMs = R.partial(sayHello, ['Ms.']); - // $ExpectType string - sayHelloToMs('Jane', 'Jones'); // => 'Hello, Ms. Jane Jones!' - - let greetMsJaneJones = R.partialRight(greet, ['Ms.', 'Jane', 'Jones']); - // $ExpectType string - greetMsJaneJones('Hello'); // => 'Hello, Ms. Jane Jones!' -})(); - -// memoize -(() => { - let numberOfCalls = 0; - let trackedAdd = function(a: number, b: number) { - numberOfCalls += 1; - return a + b; - }; - let memoTrackedAdd = R.memoize(trackedAdd); - - // $ExpectType number - memoTrackedAdd(1, 2); // => 3 - // $ExpectType number - numberOfCalls; // => 1 - // $ExpectType number - memoTrackedAdd(1, 2); // => 3 - // $ExpectType number - numberOfCalls; // => 1 - // $ExpectType number - memoTrackedAdd(2, 3); // => 5 - // $ExpectType number - numberOfCalls; // => 2 - - // Note that argument order matters - // $ExpectType number - memoTrackedAdd(2, 1); // => 3 - // $ExpectType number - numberOfCalls; // => 3 -})(); - -// once -(() => { - let x: number; - let addOneOnce = R.once(function(x: number){ return x + 1; }); - // $ExpectType number - addOneOnce(10); // => 11 - // $ExpectType number - addOneOnce(addOneOnce(50)); // => 11 -})(); - -// match -() => { - // $ExpectType string[] - R.match(/([a-z]a)/g, 'bananas'); // => ['ba', 'na', 'na'] - // $ExpectType string[] - R.match(/a/, 'b'); // => [] - // $ExpectError Argument of type 'null' is not assignable to parameter of type 'string'. - let sr = R.match(/a/, null); // error with strict null checks -}; - -// reduce -(() => { - let numbers = [1, 2, 3]; - let add = function(a: number, b: number) { - return a + b; - }; - // $ExpectType number - R.reduce(add, 10, numbers); // => 16; -})(); - -// add -(() => { - let plus3 = R.add(3); - // $ExpectType number - plus3(5); -})(); - -// reduceRight -(() => { - let pairs = [ ['a', 1], ['b', 2], ['c', 3] ]; - let flattenPairs = function(acc: [string, number], pair: [string, number]) { - return acc.concat(pair); - }; - // $ExpectType Array - R.reduceRight(flattenPairs, [], pairs); // => [ 'c', 3, 'b', 2, 'a', 1 ] -})(); - -// reduceWhile -() => { - let isOdd = (x: number, acc: number) => x % 2 === 1; - let xs = [1, 3, 5, 60, 777, 800]; - // $ExpectType number - R.reduceWhile(isOdd, R.add, 0, xs); // => 9 - - let ys = [2, 4, 6]; - // $ExpectType number - R.reduceWhile(isOdd, R.add, 111, ys); // => 111 -}; - -// mapObjIndexed -(() => { - let values = { x: 1, y: 2, z: 3 }; - let prependKeyAndDouble = function(num: number, key: string, obj: any) { - return key + (num * 2); - }; - // $ExpectType Dictionary - R.mapObjIndexed(prependKeyAndDouble, values); // => { x: 'x2', y: 'y4', z: 'z6' } -}); - -// ap, of -(() => { - // $ExpectType number[] - R.ap([R.multiply(2), R.add(3)], [1,2,3]); // => [2, 4, 6, 4, 5, 6] - // $ExpectType number[][] - R.of([1]); // => [[1]] - // $ExpectType number[] - R.of(1); -}); - -// empty -() => { - // $ExpectType number[] - R.empty([1,2,3,4,5]); // => [] - // $ExpectType number[] - R.empty([1, 2, 3]); // => [] - // $ExpectType string - R.empty('unicorns'); // => '' - // $ExpectType {} - R.empty({x: 1, y: 2}); // => {} -}; - -// length -(() => { - // $ExpectType number - R.length([1, 2, 3]); // => 3 -}); - -// addIndex, filter, reject -(() => { - const isEven = function(n: number) { - return n % 2 === 0; - }; - const filterIndexed = R.addIndex(R.filter); - - // $ExpectType number[] - R.filter(isEven, [1, 2, 3, 4]); // => [2, 4] - - let lastTwo = function(val: number, idx: number, list: number[]) { - return list.length - idx <= 2; - }; - // $ExpectType number[] - filterIndexed(lastTwo, [8, 6, 7, 5, 3, 0, 9]); // => [0, 9] - - let isOdd = function(n: number) { - return n % 2 === 1; - }; - // $ExpectType number[] - R.reject(isOdd, [1, 2, 3, 4]); // => [2, 4] -}); - -// take, takeWhile -(() => { - let isNotFour = function(x: number) { - return !(x === 4); - }; - // $ExpectType number[] - R.takeWhile(isNotFour, [1, 2, 3, 4]); // => [1, 2, 3] - // $ExpectType number[] - R.take(2, [1, 2, 3, 4]); // => [1, 2] -}); - -// unfold -(() => { - let f = function(n: number) { return n > 50 ? false : [-n, n + 10]; }; - // $ExpectType number[] - R.unfold(f, 10); // => [-10, -20, -30, -40, -50] - let b = R.unfold(f); // => [-10, -20, -30, -40, -50] - // $ExpectType number[] - b(10); -}); - -/***************************************************************** - * Function category - */ - -// flip -() => { - let mergeThree = function(a: number, b: number, c: number): number[] { - return ([] as number[]).concat(a, b, c); // strictNullChecks: must cast array to right type - }; - // $ExpectType number[] - mergeThree(1, 2, 3); // => [1, 2, 3] - let flipped = R.flip(mergeThree); - // $ExpectType number[] - flipped(1, 2, 3); // => [2, 1, 3] - }; - -/********************* - * List category - ********************/ - -// all -() => { - let lessThan2 = R.flip(R.lt)(2); - let lessThan3 = R.flip(R.lt)(3); - // $ExpectType boolean - R.all(lessThan2)([1, 2]); // => false - // $ExpectType boolean - R.all(lessThan3)([1, 2]); // => true -}; - -// any -() => { - let lessThan0 = R.flip(R.lt)(0); - let lessThan2 = R.flip(R.lt)(2); - // $ExpectType boolean - R.any(lessThan0)([1, 2]); // => false - // $ExpectType boolean - R.any(lessThan2)([1, 2]); // => true -}; - -// ascend -() => { - let byAge = R.ascend(R.prop('age')); - let alice = { - name: 'ALICE', - age: 101 - }; - let bob = { - name: 'Bob', - age: -10 - }; - let clara = { - name: 'clara', - age: 314.159 - }; - let people = [clara, bob, alice]; - // $ExpectType typeof people - let peopleByYoungestFirst = R.sort(byAge, people); -}; - -// aperture -() => { - // $ExpectType number[][] - R.aperture(2, [1, 2, 3, 4, 5]); // => [[1, 2], [2, 3], [3, 4], [4, 5]] - // $ExpectType number[][] - R.aperture(3, [1, 2, 3, 4, 5]); // => [[1, 2, 3], [2, 3, 4], [3, 4, 5]] - // $ExpectType number[][] - R.aperture(7, [1, 2, 3, 4, 5]); // => [] - // $ExpectType number[][] - R.aperture(7)([1, 2, 3, 4, 5]); // => [] -}; - -// append -() => { - // $ExpectType string[] - R.append('tests', ['write', 'more']); // => ['write', 'more', 'tests'] - // $ExpectType string[] - R.append('tests')(['write', 'more']); // => ['write', 'more', 'tests'] - // $ExpectType string[] - R.append('tests', []); // => ['tests'] - // $ExpectType Array - R.append(['tests'], ['write', 'more']); // => ['write', 'more', ['tests']] - // $ExpectType Array - R.append(['tests'], ['write', 'more']); // => ['write', 'more', ['tests']] - // $ExpectType Array - R.append(['tests'])(['write', 'more']); // => ['write', 'more', ['tests']] - // $ExpectType Array - R.append(['tests'])(['write', 'more']); // => ['write', 'more', ['tests']] -}; - -// chain -() => { - let duplicate = function(n: number) { - return [n, n]; - }; - // $ExpectType number[] - R.chain(duplicate, [1, 2, 3]); // => [1, 1, 2, 2, 3, 3] - // $ExpectType number[] - R.chain(duplicate)([1, 2, 3]); // => [1, 1, 2, 2, 3, 3] - // $ExpectType number[] - R.chain(R.append, R.head)([1, 2, 3]); // => [1, 2, 3, 1] - // $ExpectType number[] - R.chain(R.append)(R.head)([1, 2, 3]); // => [1, 2, 3, 1] -}; - -// clamp -() => { - // $ExpectType number - R.clamp(1, 10, -1); // => 1 - // $ExpectType number - R.clamp(1, 10)(11); // => 10 - // $ExpectType number - R.clamp(1)(10, 4); // => 4 - // $ExpectType string - R.clamp('a', 'd', 'e'); // => 'd' -}; - -// concat -() => { - R.concat([], []); // => [] // let r: [] = - // $ExpectType number[] - R.concat([4, 5, 6], [1, 2, 3]); // => [4, 5, 6, 1, 2, 3] - // $ExpectType number[] - R.concat([4, 5, 6])([1, 2, 3]); // => [4, 5, 6, 1, 2, 3] - // $ExpectType string - R.concat('ABC')('DEF'); // 'ABCDEF' -}; - -// contains -() => { - // $ExpectType boolean - R.contains(3)([1, 2, 3]); // => true - // $ExpectType boolean - R.contains(3, [1, 2, 3]); // => true - // $ExpectType boolean - R.contains(4)([1, 2, 3]); // => false - // $ExpectType boolean - R.contains({})([{}, {}]); // => false - let obj = {}; - // $ExpectType boolean - R.contains(obj)([{}, obj, {}]); // => true -}; - -// descend -() => { - let byAge = R.descend(R.prop('age')); - let alice = { - name: 'ALICE', - age: 101 - }; - let bob = { - name: 'Bob', - age: -10 - }; - let clara = { - name: 'clara', - age: 314.159 - }; - let people = [clara, bob, alice]; - // $ExpectType typeof people - let peopleByOldestFirst = R.sort(byAge, people); -}; - -// drop -() => { - // $ExpectType number[] - R.drop(3, [1,2,3,4,5,6,7]); // => [4,5,6,7] - // $ExpectType number[] - R.drop(3)([1,2,3,4,5,6,7]); // => [4,5,6,7] - // $ExpectType string - R.drop(3, 'ramda'); // => 'ram' - // $ExpectType string - R.drop(3)('ramda'); // => 'ram' -}; - -// dropLast -(() => { - // $ExpectType string[] - R.dropLast(1, ['foo', 'bar', 'baz']); // => ['foo', 'bar'] - // $ExpectType string[] - R.dropLast(2)(['foo', 'bar', 'baz']); // => ['foo'] - // $ExpectType string - R.dropLast(3, 'ramda'); // => 'ra' - // $ExpectType string - R.dropLast(3)('ramda'); // => 'ra' -}); - -// dropLastWhile -(() => { - let lteThree = (x: number) => x <= 3; - // $ExpectType number[] - R.dropLastWhile(lteThree, [1, 2, 3, 4, 3, 2, 1]); // => [1, 2, 3, 4] -}); - -// dropWhile -() => { - let lteTwo = function(x: number) { - return x <= 2; - }; - // $ExpectType number[] - R.dropWhile(lteTwo, [1, 2, 3, 4]); // => [3, 4] - // $ExpectType number[] - R.dropWhile(lteTwo)([1, 2, 3, 4]); // => [3, 4] -}; - -// filter -() => { - let isEven = function(n: number) { - return n % 2 === 0; - }; - // filter works with lists... - // $ExpectType number[] - R.filter(isEven, [1, 2, 3, 4]); // => [2, 4] - let isEvenFn = R.filter(isEven); - isEvenFn([1, 2, 3, 4]); - // ... but also objects - // $ExpectType Dictionary - R.filter(isEven, {a: 1, b: 2, c: 3, d: 4}); // => {b: 2, d: 4} - let isEvenFnObj = R.filter(isEven); - // see that we did not break anything - // and we kept type information - // $ExpectType number[] - onlyNumberList(R.filter(isEven,[1,2,3,4])); - // $ExpectType Dictionary - onlyNumberObj(R.filter(isEven, {a: 1, b: 2, c: 3, d: 4})); // strictNullChecks: Partial fails, consider Pick -}; - -// addIndex -() => { - let lastTwo = function(val: number, idx: number, list: number[]) { - return list.length - idx <= 2; - }; - let filterIndexed = R.addIndex(R.filter); - - // $ExpectType number[] - filterIndexed(lastTwo, [8, 6, 7, 5, 3, 0, 9]); // => [0, 9] - let lastTwoFn = filterIndexed(lastTwo); - // $ExpectType number[] - lastTwoFn([8, 6, 7, 5, 3, 0, 9]); -}; - -// find, propEq -() => { - let xs = [{a: 1}, {a: 2}, {a: 3}]; - // $ExpectType Dictionary - R.find(R.propEq('a', 2))(xs); // => {a: 2} - // $ExpectType undefined - R.find(R.propEq('a', 4))(xs); // => undefined -}; - -// find -() => { - type Task = {id: number}; - let tasks: Task[] = []; - const a = R.find((task: Task) => task.id === 1, tasks); // this works - const f: (list: Task[]) => Task = R.find((task: Task) => task.id === 1); - // $ExpectType Task - f(tasks); // works -}; - -// findIndex -() => { - type Task = {a: number}; - let xs = [{a: 1}, {a: 2}, {a: 3}]; - const a: (list: Task[]) => number = R.findIndex(R.propEq('a', 2)); - // $ExpectType number - a(xs); // => 1 - // $ExpectType number - R.findIndex(R.propEq('a', 4))(xs); // => -1 - - // $ExpectType number - R.findIndex((x: number) => x === 1, [1, 2, 3]); -}; - -// findLast -() => { - let xs = [{a: 1, b: 0}, {a: 1, b: 1}]; - // $ExpectType Dictionary - R.findLast(R.propEq('a', 1))(xs); // => {a: 1, b: 1} - // $ExpectType undefined - R.findLast(R.propEq('a', 4))(xs); // => undefined -}; - -// findLastIndex -() => { - let xs = [{a: 1, b: 0}, {a: 1, b: 1}]; - // $ExpectType number - R.findLastIndex(R.propEq('a', 1))(xs); // => 1 - // $ExpectType number - R.findLastIndex(R.propEq('a', 4))(xs); // => -1 - // $ExpectType number[] - R.findLastIndex((x: number) => x === 1, [1, 2, 3]); -}; - -// pathEq -() => { - let user1 = { address: { zipCode: 90210 } }; - let user2 = { address: { zipCode: 55555 } }; - let user3 = { name: 'Bob' }; - let users = [ user1, user2, user3 ]; - let isFamous = R.pathEq(['address', 'zipCode'], 90210); - // $ExpectType Object[] - R.filter(isFamous, users); // => [ user1 ] -}; - -// propEq -() => { - let xs: {[key: string]: string} = {a: '1', b: '0'}; - // $ExpectType boolean - R.propEq('a', '1', xs);// => true - // $ExpectType boolean - R.propEq('a', '4', xs); // => false -}; -() => { - let xs: {[key: string]: number} = {a: 1, b: 0}; - // $ExpectType boolean - R.propEq('a', 1, xs);// => true - // $ExpectType boolean - R.propEq('a', 4, xs); // => false -}; -() => { - let xs = {a: '1', b: '0'}; - // $ExpectType boolean - R.propEq('a', '1', xs);// => true - // $ExpectType boolean - R.propEq('a', '4', xs); // => false -}; -() => { - let xs = {a: 1, b: 0}; - // $ExpectType boolean - R.propEq('a', 1, xs);// => true - // $ExpectType boolean - R.propEq('a', 4, xs); // => false -}; -interface Obj { a: number; b: number; }; -() => { - let xs: Obj = {a: 1, b: 0}; - // $ExpectType boolean - R.propEq('a', 1, xs);// => true - // $ExpectType boolean - R.propEq('a', 4, xs); // => false -}; - -// forEach -() => { - let printXPlusFive = function(x: number) { console.log(x + 5); }; - // $ExpectType number[] - R.forEach(printXPlusFive, [1, 2, 3]); // => [1, 2, 3] - // $ExpectType number[] - R.forEach(printXPlusFive)([1, 2, 3]); // => [1, 2, 3] - // => 6 - // => 7 - // => 8 -}; - -// forEach -() => { - let printKeyConcatValue = (value: any, key: string, obj: any) => console.log(key + ':' + value); - // $ExpectType {x: 1, y: 2} - R.forEachObjIndexed(printKeyConcatValue, {x: 1, y: 2}); - // $ExpectType {x: 1, y: 2} - R.forEachObjIndexed(printKeyConcatValue)({x: 1, y: 2}); - // $ExpectType [1, 2] - R.forEachObjIndexed(printKeyConcatValue, [1, 2]); - // $ExpectType [1, 2] - R.forEachObjIndexed(printKeyConcatValue)([1, 2]); -}; - -// addIndex? -() => { - let plusFive = function(num: number, idx: number, list: number[]) { list[idx] = num + 5; }; - // $ExpectType number[] - R.addIndex(R.forEach)(plusFive)([1, 2, 3]); // => [6, 7, 8] -}; - -// groupBy -() => { - let byGrade = R.groupBy(function(student: {score: number; name: string}) { - let score = student.score; - return score < 65 ? 'F' : - score < 70 ? 'D' : - score < 80 ? 'C' : - score < 90 ? 'B' : 'A'; - }); - let students = [{name: 'Abby', score: 84}, - {name: 'Eddy', score: 58}, - {name: 'Jack', score: 69}]; - // $ExpectType Dictionary - byGrade(students); -}; - -// groupWith -() => { - // $ExpectType number[][] - R.groupWith(R.equals, [0, 1, 1, 2, 3, 5, 8, 13, 21]); - // [[0], [1, 1], [2, 3, 5, 8, 13, 21]] - - // $ExpectType number[][] - R.groupWith((a: number, b: number) => a % 2 === b % 2, [0, 1, 1, 2, 3, 5, 8, 13, 21]); - // [[0], [1, 1], [2], [3, 5], [8], [13, 21]] - - const isVowel = (a: string) => R.contains(a, 'aeiou') ? a : ''; - // $ExpectType string[] - R.groupWith(R.eqBy(isVowel), 'aestiou'); - // ['ae', 'st', 'iou'] -}; - -// head -() => { - // $ExpectType string - R.head(['fi', 'fo', 'fum']); // => 'fi' - // $ExpectType number - R.head([10, 'ten']); // => 10 - // $ExpectType string - R.head(['10', 10]); // => '10' -}; - -// indexBy -(() => { - let list = [{id: 'xyz', title: 'A'}, {id: 'abc', title: 'B'}]; - // $ExpectType Dictionary - R.indexBy(R.prop('id'), list); - // $ExpectType Dictionary - R.indexBy(R.prop('id'))(list); - // $ExpectType Dictionary - R.indexBy<{id: string}>(R.prop('id'))(list); -}); - -// indexOf -() => { - // $ExpectType number - R.indexOf(3, [1,2,3,4]); // => 2 - // $ExpectType number - R.indexOf(10)([1,2,3,4]); // => -1 -}; - -// init -() => { - // $ExpectType string[] - R.init(['fi', 'fo', 'fum']); // => ['fi', 'fo'] -}; - -// insert -() => { - // $ExpectType number[] - R.insert(2, 5, [1,2,3,4]); // => [1,2,5,3,4] - // $ExpectType number[] - R.insert(2)(5, [1,2,3,4]); // => [1,2,5,3,4] - // $ExpectType number[] - R.insert(2, 5)([1,2,3,4]); // => [1,2,5,3,4] - // $ExpectType number[] - R.insert(2)(5)([1,2,3,4]); // => [1,2,5,3,4] -}; - -// insertAll -() => { - // $ExpectType number[] - R.insertAll(2, [10,11,12], [1,2,3,4]); - // $ExpectType number[] - R.insertAll(2)([10,11,12], [1,2,3,4]); - // $ExpectType number[] - R.insertAll(2, [10,11,12])([1,2,3,4]); - // $ExpectType number[] - R.insertAll(2)([10,11,12])([1,2,3,4]); -}; - -// intersection -() => { - // $ExpectType number[] - R.intersection([1,2,3,4], [7,6,5,4,3]); // => [4, 3] - // $ExpectType number[] - R.intersection([1,2,3,4])([7,6,5,4,3]); // => [4, 3] - // $ExpectType number[] - R.intersection([1,2,4], [1,2,3]); // => [1,2] - // $ExpectType number[] - R.intersection([1,2,4])([1,2,3]); // => [1,2] -}; - -// intersectionWith -() => { - let buffaloSpringfield = [ - {id: 824, name: 'Richie Furay'}, - {id: 956, name: 'Dewey Martin'}, - {id: 313, name: 'Bruce Palmer'}, - {id: 456, name: 'Stephen Stills'}, - {id: 177, name: 'Neil Young'} - ]; - let csny = [ - {id: 204, name: 'David Crosby'}, - {id: 456, name: 'Stephen Stills'}, - {id: 539, name: 'Graham Nash'}, - {id: 177, name: 'Neil Young'} - ]; - - // $ExpectType { id: number, name: string }[] - R.intersectionWith(R.eqBy(R.prop('id')), buffaloSpringfield, csny); - // => [{id: 456, name: 'Stephen Stills'}, {id: 177, name: 'Neil Young'}] - // $ExpectType { id: number, name: string }[] - R.intersectionWith(R.eqBy(R.prop('id')), buffaloSpringfield, csny); - // => [{id: 456, name: 'Stephen Stills'}, {id: 177, name: 'Neil Young'}] - // $ExpectType { id: number, name: string }[] - R.intersectionWith(R.eqBy(R.prop('id')))(buffaloSpringfield, csny); - // $ExpectType { id: number, name: string }[] - R.intersectionWith(R.eqBy(R.prop('id')))(buffaloSpringfield)(csny); -}; - -// into -() => { - let numbers = [1, 2, 3, 4]; - let a = R.map(R.add(1), R.take(2, numbers)); - let b = R.take(2); - let transducer = R.compose(R.map(R.add(1)), R.take(2)); - - - // $ExpectType number[] - R.into([], transducer, numbers); // => [2, 3] - // $ExpectType number[] - R.into([])(transducer, numbers); // => [2, 3] - // $ExpectType number[] - R.into([], transducer)(numbers); // => [2, 3] - - let intoArray = R.into([]); - // $ExpectType number[] - intoArray(transducer, numbers); // => [2, 3] - // $ExpectType number[] - intoArray(transducer)(numbers); // => [2, 3] -}; - -// join -() => { - let spacer = R.join(' '); - // $ExpectType string - spacer(['a', 2, 3.4]); // => 'a 2 3.4' - // $ExpectType string - R.join('|', [1, 2, 3]); // => '1|2|3' -}; - -// last -() => { - // $ExpectType string - R.last(['fi', 'fo', 'fum']); // => 'fum' -}; - -// lastIndexOf -() => { - R.lastIndexOf(3, [-1,3,3,0,1,2,3,4]); // => 6 - R.lastIndexOf(10, [1,2,3,4]); // => -1 - R.lastIndexOf(10)([1,2,3,4]); // => -1 -}; - -// length -() => { - // $ExpectType number - R.length([]); // => 0 - // $ExpectType number - R.length([1, 2, 3]); // => 3 -}; - -// lensIndex, set, view, over -() => { - let headLens = R.lensIndex(0); - // $ExpectType number - headLens([10, 20, 30, 40]); // => 10 - // $ExpectType Array - headLens.set('mu', [10, 20, 30, 40]); // => ['mu', 20, 30, 40] - // $ExpectType string - R.view(headLens, ['a', 'b', 'c']); // => 'a' - // $ExpectType string[] - R.set(headLens, 'x', ['a', 'b', 'c']); // => ['x', 'b', 'c'] - // $ExpectType string[] - R.over(headLens, R.toUpper, ['a', 'b', 'c']); // => ['A', 'b', 'c'] -}; - -// map -() => { - let arrayify = (v: T): T[] => [v]; - // homogeneous array - // $ExpectType number[] - R.map(double, [1, 2, 3]); // => [2, 4, 6] - // $ExpectType number[] - R.map(double)([1, 2, 3]); // => [2, 4, 6] - // homogeneous object - // $ExpectType Dictionary - R.map(double, { a: 1, b: 2, c: 3 }); // => { a: 2, b: 4, c: 6 } - // $ExpectType Dictionary - R.map(double)({ a: 1, b: 2, c: 3 }); // => { a: 2, b: 4, c: 6 } - // heterogeneous array - // $ExpectType [number[], string[]] - R.map(arrayify, [1, 'a']); // => [[1], ['a']] - // $ExpectType [number[], string[]] - R.map(arrayify)([1, 'a']); // => [[1], ['a']] - // heterogeneous object - // $ExpectType { a: number[], b: string[] } - R.map(arrayify, { a: 1, b: 'c' }); // => { a: [1], b: ['c'] } - // $ExpectType { a: number[], b: string[] } - R.map(arrayify)({ a: 1, b: 'c' }); // => { a: [1], b: ['c'] } - - // functor - // I'm sorry, I have no clue how to make this example work with proper functor typing - // const stringFunctor = { - // map: (fn: (c: number) => number) => { - // let chars = 'Ifmmp!Xpsme'.split(''); - // return chars.map((char) => String.fromCharCode(fn(char.charCodeAt(0)))).join(''); - // } - // }; - // let s = R.map((x: number) => x-1, stringFunctor); // => 'Hello World' -}; - -// mapAccum -() => { - let digits = ['1', '2', '3', '4']; - let append = function(a: string, b: string): [string, string]{ - return [a + b, a + b]; - }; - // $ExpectType Array - R.mapAccum(append, '0', digits); // => ['01234', ['01', '012', '0123', '01234']] - // $ExpectType Array - R.mapAccum(append)('0', digits); // => ['01234', ['01', '012', '0123', '01234']] - // $ExpectType Array - R.mapAccum(append, '0')(digits); // => ['01234', ['01', '012', '0123', '01234']] - // $ExpectType Array - R.mapAccum(append)('0')(digits); // => ['01234', ['01', '012', '0123', '01234']] -}; - -// mapAccumRight -() => { - let digits = ['1', '2', '3', '4']; - let append = function(a: string, b: string): [string, string] { - return [a + b, a + b]; - }; - // $ExpectType Array - R.mapAccumRight(append, '0', digits); // => ['04321', ['04321', '0432', '043', '04']] - // $ExpectType Array - R.mapAccumRight(append)('0', digits); // => ['04321', ['04321', '0432', '043', '04']] - // $ExpectType Array - R.mapAccumRight(append, '0')(digits); // => ['04321', ['04321', '0432', '043', '04']] - // $ExpectType Array - R.mapAccumRight(append)('0')(digits); // => ['04321', ['04321', '0432', '043', '04']] -}; - -// addIndex -() => { - let squareEnds = function(elt: number, idx: number, list: number[]) { - if (idx === 0 || idx === list.length - 1) { - return elt * elt; - } - return elt; - }; - // $ExpectType number[] - R.addIndex(R.map)(squareEnds, [8, 5, 3, 0, 9]); // => [64, 5, 3, 0, 81] - // $ExpectType number[] - R.addIndex(R.map)(squareEnds)([8, 5, 3, 0, 9]); // => [64, 5, 3, 0, 81] -}; - -// none -() => { - // $ExpectType boolean - R.none(R.isNaN, [1, 2, 3]); // => true - // $ExpectType boolean - R.none(R.isNaN, [1, 2, 3, NaN]); // => false - // $ExpectType boolean - R.none(R.isNaN)([1, 2, 3, NaN]); // => false -}; - -// nth -() => { - let list = ['foo', 'bar', 'baz', 'quux']; - // $ExpectType string - R.nth(1, list); // => 'bar' - // $ExpectType string - R.nth(-1, list); // => 'quux' - // $ExpectType undefined - R.nth(-99, list); // => undefined - // $ExpectType undefined - R.nth(-99)(list); // => undefined -}; - -// partition, contains -() => { - // $ExpectType [string[], string[]] - R.partition(R.contains('s'), ['sss', 'ttt', 'foo', 'bars']); - // $ExpectType [string[], string[]] - R.partition(R.contains('s'))(['sss', 'ttt', 'foo', 'bars']); - // $ExpectType [number[], number[]] - R.partition((x: number) => x > 2, [1, 2, 3, 4]); - // $ExpectType [number[], number[]] - R.partition((x: number) => x > 2)([1, 2, 3, 4]); - // $ExpectType Object[] - R.partition(R.contains('s'),{ a: 'sss', b: 'ttt', foo: 'bars' }); // => [ { a: 'sss', foo: 'bars' }, { b: 'ttt' } ] -}; - -// pluck -() => { - // $ExpectType number[] - R.pluck('a', [{a: 1}, {a: 2}]); // => [1, 2] - // $ExpectType number[] - R.pluck(0, [[1, 2], [3, 4]]); // => [1, 3] - // $ExpectType number[] - R.pluck('a')([{a: 1}, {a: 2}]); // => [1, 2] - // $ExpectType number[] - R.pluck(0)([[1, 2], [3, 4]]); // => [1, 3] -}; - -// prepend -() => { - // $ExpectType string[] - R.prepend('fee', ['fi', 'fo', 'fum']); // => ['fee', 'fi', 'fo', 'fum'] - // $ExpectType string[] - R.prepend('fee')(['fi', 'fo', 'fum']); // => ['fee', 'fi', 'fo', 'fum'] -}; - -// range -() => { - // $ExpectType number[] - R.range(1, 5); // => [1, 2, 3, 4] - // $ExpectType number[] - R.range(50)(53); // => [50, 51, 52] -}; - -// reduce -() => { - let numbers = [1, 2, 3]; - let add = function(a: number, b: number) { - return a + b; - }; - // $ExpectType number - R.reduce(add, 10, numbers); // => 16 - // $ExpectType number - R.reduce(add)(10, numbers); // => 16 - // $ExpectType number - R.reduce(add, 10)(numbers); // => 16 -}; - -// reduceBy - -interface Student { - name: string; - score: number; -} -() => { - const reduceToNamesBy = R.reduceBy((acc: string[], student: Student) => acc.concat(student.name), []); - const namesByGrade = reduceToNamesBy(function(student: Student) { - let score = student.score; - return score < 65 ? 'F' : - score < 70 ? 'D' : - score < 80 ? 'C' : - score < 90 ? 'B' : 'A'; - }); - let students = [{name: 'Lucy', score: 92}, - {name: 'Drew', score: 85}, - {name: 'Bart', score: 62}]; - // $ExpectType Dictionary - namesByGrade(students); - // { - // 'A': ['Lucy'], - // 'B': ['Drew'] - // 'F': ['Bart'] - // } -}; - -// addIndex -() => { - let reduceIndexed = R.addIndex(R.reduce); - let letters = ['a', 'b', 'c']; - let objectify = function(accObject: {[elem: string]: number}, elem: string, idx: number, list: string[]) { - accObject[elem] = idx; - return accObject; - }; - // $ExpectType Dictionary - reduceIndexed(objectify, {}, letters); // => { 'a': 0, 'b': 1, 'c': 2 } - // $ExpectType Dictionary - reduceIndexed(objectify)({}, letters); // => { 'a': 0, 'b': 1, 'c': 2 } - // $ExpectType Dictionary - reduceIndexed(objectify, {})(letters); // => { 'a': 0, 'b': 1, 'c': 2 } -}; - -// reduceRight -interface KeyValuePair extends Array { 0 : K; 1 : V; } -type Pair = KeyValuePair; -() => { - let pairs: Pair[] = [ ['a', 1], ['b', 2], ['c', 3] ]; - let flattenPairs = function(pair: Pair, acc: Pair[]): Pair[] { - return acc.concat(pair); - }; - // $ExpectType Array - R.reduceRight(flattenPairs, [], pairs); // => [ 'c', 3, 'b', 2, 'a', 1 ] - // $ExpectType Array - R.reduceRight(flattenPairs, [])(pairs); // => [ 'c', 3, 'b', 2, 'a', 1 ] - // $ExpectType Array - R.reduceRight(flattenPairs)([], pairs); // => [ 'c', 3, 'b', 2, 'a', 1 ] -}; - -// reject -() => { - let isOdd = function(n: number) { - return n % 2 === 1; - }; - // $ExpectType number[] - R.reject(isOdd, [1, 2, 3, 4]); // => [2, 4] - const a2 = R.reject(isOdd); - // $ExpectType number[] - R.reject(isOdd)([1, 2, 3, 4]); // => [2, 4] -}; - -// rejectIndexed -() => { - const lastTwo = function(val: number, idx: number, list: number[]) { - return list.length - idx <= 2; - }; - const rejectIndexed = R.addIndex(R.reject); - // $ExpectType number[] - rejectIndexed(lastTwo, [8, 6, 7, 5, 3, 0, 9]); // => [8, 6, 7, 5, 3] - // $ExpectType number[] - rejectIndexed(lastTwo)([8, 6, 7, 5, 3, 0, 9]); // => [8, 6, 7, 5, 3] -}; - -// remove -() => { - // $ExpectType number[] - R.remove(2, 3, [1,2,3,4,5,6,7,8]); // => [1,2,6,7,8] - // $ExpectType number[] - R.remove(2, 3)([1,2,3,4,5,6,7,8]); // => [1,2,6,7,8] - // $ExpectType number[] - R.remove(2)(3, [1,2,3,4,5,6,7,8]); // => [1,2,6,7,8] -}; - -// repeat -() => { - // $ExpectType string[] - R.repeat('hi', 5); // => ['hi', 'hi', 'hi', 'hi', 'hi'] - let obj = {}; - let repeatedObjs = R.repeat(obj, 5); // => [{}, {}, {}, {}, {}] - // $ExpectType boolean - repeatedObjs[0] === repeatedObjs[1]; // => true -}; - -// reverse -() => { - // $ExpectType number[] - R.reverse([1, 2, 3]); // => [3, 2, 1] - // $ExpectType number[] - R.reverse([1, 2]); // => [2, 1] - // $ExpectType number[] - R.reverse([1]); // => [1] - // $ExpectType number[] - R.reverse([]); // => [] -}; - -// scan -() => { - let numbers = [1, 2, 3, 4]; - // $ExpectType number[] - R.scan(R.multiply, 1, numbers); // => [1, 1, 2, 6, 24] - // $ExpectType number[] - R.scan(R.multiply, 1)(numbers); // => [1, 1, 2, 6, 24] - // $ExpectType number[] - R.scan(R.multiply)(1, numbers); // => [1, 1, 2, 6, 24] -}; - -// slice -() => { - let xs = R.range(0, 10); - // $ExpectType number[] - R.slice(2, 5, xs); // => [2, 3, 4] - // $ExpectType number[] - R.slice(2, 5)(xs); // => [2, 3, 4] - // $ExpectType number[] - R.slice(2)(5, xs); // => [2, 3, 4] - - let str = 'Hello World'; - // $ExpectType string - R.slice(2, 5, str); // => 'llo' - // $ExpectType string - R.slice(2, 5)(str); // => 'llo' - // $ExpectType string - R.slice(2)(5, str); // => 'llo' -}; - -// sort -() => { - let diff = function(a: number, b: number) { return a - b; }; - // $ExpectType number[] - R.sort(diff, [4,2,7,5]); // => [2, 4, 5, 7] - // $ExpectType number[] - R.sort(diff)([4,2,7,5]); // => [2, 4, 5, 7] -}; - -// cond, equals, always -() => { - const fn = R.cond([ - [R.equals(0), R.always('water freezes at 0°C')], - [R.equals(100), R.always('water boils at 100°C')], - [R.T, (temp: number) => 'nothing special happens at ' + temp + '°C'] - ]); - // $ExpectType string - fn(0); // => 'water freezes at 0°C' - // $ExpectType string - fn(50); // => 'nothing special happens at 50°C' - // $ExpectType string - fn(100); // => 'water boils at 100°C' -}; - -// tail -() => { - // $ExpectType string[] - R.tail(['fi', 'fo', 'fum']); // => ['fo', 'fum'] - // $ExpectType number[] - R.tail([1, 2, 3]); // => [2, 3] -}; - -// take -() => { - // $ExpectType number[] - R.take(3,[1,2,3,4,5]); // => [1,2,3] - - let members= [ 'Paul Desmond','Bob Bates','Joe Dodge','Ron Crotty','Lloyd Davis','Joe Morello','Norman Bates', - 'Eugene Wright','Gerry Mulligan','Jack Six','Alan Dawson','Darius Brubeck','Chris Brubeck', - 'Dan Brubeck','Bobby Militello','Michael Moore','Randy Jones']; - let takeFive = R.take(5); - // $ExpectType string[] - takeFive(members); // => ['Paul Desmond','Bob Bates','Joe Dodge','Ron Crotty','Lloyd Davis'] -}; -() => { - // $ExpectType string - R.take(3,'Example'); // => 'Exa' - - let takeThree = R.take(3); - // $ExpectType string - takeThree('Example'); // => 'Exa' -}; - -// takeLast -() => { - // $ExpectType string[] - R.takeLast(1, ['foo', 'bar', 'baz']); // => ['baz'] - // $ExpectType string[] - R.takeLast(2)(['foo', 'bar', 'baz']); // => ['bar', 'baz'] - // $ExpectType string - R.takeLast(3, 'ramda'); // => 'mda' - // $ExpectType string - R.takeLast(3)('ramda'); // => 'mda' -}; - -// takeLastWhile -() => { - const isNotOne = (x: number) => x !== 1; - // $ExpectType number[] - R.takeLastWhile(isNotOne, [1, 2, 3, 4]); // => [2, 3, 4] - // $ExpectType number[] - R.takeLastWhile(isNotOne)([1, 2, 3, 4]); // => [2, 3, 4] -}; - -// takeWhile -() => { - let isNotFour = function(x: number) { - return !(x === 4); - }; - // $ExpectType number[] - R.takeWhile(isNotFour, [1, 2, 3, 4]); // => [1, 2, 3] - // $ExpectType number[] - R.takeWhile(isNotFour)([1, 2, 3, 4]); // => [1, 2, 3] -}; - -// tap -() => { - const sayX = (x: number) => console.log('x is ' + x); - // $ExpectType number - R.tap(sayX, 100); // => 100 -}; - -// test -() => { - // $ExpectType boolean - R.test(/^x/, 'xyz'); // => true - // $ExpectType boolean - R.test(/^y/)('xyz'); // => false -}; - -// times -() => { - // $ExpectType number[] - R.times(R.identity, 5); // => [0, 1, 2, 3, 4] - // $ExpectType number[] - R.times(R.identity)(5); // => [0, 1, 2, 3, 4] -}; - -// toString -() => { - class Point { - constructor(public x: number, public y: number) { - this.x = x; - this.y = y; - } - toStringn() { - return 'new Point(' + this.x + ', ' + this.y + ')'; - } - }; - // $ExpectType string - R.toString(new Point(1, 2)); // => 'new Point(1, 2)' - // $ExpectType string - R.toString(42); // => '42' - // $ExpectType string - R.toString('abc'); // => ''abc'' - // $ExpectType string - R.toString([1, 2, 3]); // => '[1, 2, 3]' - // $ExpectType string - R.toString({foo: 1, bar: 2, baz: 3}); // => '{'bar': 2, 'baz': 3, 'foo': 1}' - // $ExpectType string - R.toString(new Date('2001-02-03T04: 05: 06Z')); // => 'new Date('2001-02-03T04: 05: 06.000Z')' -}; - -// transduce -() => { - let numbers = [1, 2, 3, 4]; - let transducer = R.compose(R.map(R.add(1)), R.take(2)); - let fn = R.flip(R.append); - // $ExpectType number[] - R.transduce(transducer, fn, [] as number[], numbers); // => [2, 3] // strictNullChecks: must annotate empty array type - // $ExpectType number[] - R.transduce(transducer, fn, [] as number[])(numbers); // => [2, 3] - // $ExpectType number[] - R.transduce(transducer, fn)([] as number[], numbers); // => [2, 3] - // $ExpectType number[] - R.transduce(transducer)(fn, [] as number[], numbers); // => [2, 3] -}; - -// // traverse -// () => { -// // Returns `Nothing` if the given divisor is `0` -// safeDiv = n => d => d === 0 ? Nothing() : Just(n / d) -// -// R.traverse(Maybe.of, safeDiv(10), [2, 4, 5]); // => Just([5, 2.5, 2]) -// R.traverse(Maybe.of, safeDiv(10), [2, 0, 5]); // => Nothing -// } - -// transpose -() => { - // $ExpectType any[][] - R.transpose([[1, 'a'], [2, 'b'], [3, 'c']]); // => [[1, 2, 3], ['a', 'b', 'c']] - // $ExpectType any[][] - R.transpose([[1, 2, 3], ['a', 'b', 'c']]); // => [[1, 'a'], [2, 'b'], [3, 'c']] - // $ExpectType number[][] - R.transpose([[10, 11], [20], [], [30, 31, 32]]); // => [[10, 20, 30], [11, 31], [32]] -}; - -// tryCatch -() => { - const x = R.prop('x'); - // $ExpectType boolean - R.tryCatch(R.prop('x'), R.F)({x: true}); // => true - // $ExpectType boolean - R.tryCatch(R.prop('x'), R.F)(null); // => false -}; - -// uniq -() => { - // $ExpectType number[] - R.uniq([1, 1, 2, 1]); // => [1, 2] - // $ExpectType Object[] - R.uniq([{}, {}]); // => [{}, {}] - // $ExpectType any[] - R.uniq([1, '1']); // => [1, '1'] -}; - -// uniqWith -() => { - let strEq = function(a: any, b: any) { return String(a) === String(b); }; - // $ExpectType number[] - R.uniqWith(strEq, [1, '1', 2, 1]); // => [1, 2] - // $ExpectType number[] - R.uniqWith(strEq)([1, '1', 2, 1]); // => [1, 2] - // $ExpectType Object[] - R.uniqWith(strEq)([{}, {}]); // => [{}] - // $ExpectType number[] - R.uniqWith(strEq)([1, '1', 1]); // => [1] - // $ExpectType string[] - R.uniqWith(strEq)(['1', 1, 1]); // => ['1'] -}; - -// unnest, equals -() => { - // $ExpectType boolean - R.equals(R.unnest([1, [2], [[3]]]), [1,2,[3]]); // => true - // $ExpectType boolean - R.equals(R.unnest([[1, 2], [3, 4], [5, 6]]),[1,2,3,4,5,6]); // => true -}; - -// xprod -() => { - // $ExpectType [number, string][] - R.xprod([1, 2], ['a', 'b']); // => [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']] - // $ExpectType [number, string][] - R.xprod([1, 2])(['a', 'b']); // => [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']] -}; - -// zip -() => { - // $ExpectType [number, string][] - R.zip([1, 2, 3], ['a', 'b', 'c']); // => [[1, 'a'], [2, 'b'], [3, 'c']] - // $ExpectType [number, string][] - R.zip([1, 2, 3])(['a', 'b', 'c']); // => [[1, 'a'], [2, 'b'], [3, 'c']] -}; - -// zipObj -() => { - // $ExpectType Dictionary - R.zipObj(['a', 'b', 'c'], [1, 2, 3]); // => {a: 1, b: 2, c: 3} - // $ExpectType Dictionary - R.zipObj(['a', 'b', 'c'])([1, 2, 3]); // => {a: 1, b: 2, c: 3} -}; - -// zipWith -() => { - let f = function(x: number, y: string) { - // ... - }; - // $ExpectType any[] - R.zipWith(f, [1, 2, 3], ['a', 'b', 'c']); // => [f(1, 'a'), f(2, 'b'), f(3, 'c')] - // $ExpectType any[] - R.zipWith(f)([1, 2, 3], ['a', 'b', 'c']); // => [f(1, 'a'), f(2, 'b'), f(3, 'c')] - // $ExpectType any[] - R.zipWith(f, [1, 2, 3])(['a', 'b', 'c']); // => [f(1, 'a'), f(2, 'b'), f(3, 'c')] -}; - -/***************************************************************** - * Object category - */ - -// assoc -() => { - // $ExpectType Dictionary - R.assoc('c', 3, {a: 1, b: 2}); // => {a: 1, b: 2, c: 3} - // $ExpectType Dictionary - R.assoc('c')(3, {a: 1, b: 2}); // => {a: 1, b: 2, c: 3} - // $ExpectType Dictionary - R.assoc('c', 3)({a: 1, b: 2}); // => {a: 1, b: 2, c: 3} -}; - -// dissoc -() => { - // $ExpectType Dictionary - R.dissoc<{a: number, c: number}>('b', {a: 1, b: 2, c: 3}); // => {a: 1, c: 3} - // $ExpectType Dictionary - R.dissoc('b', {a: 1, b: 2, c: 3}); // => {a: 1, c: 3} - // $ExpectType Dictionary - R.dissoc('b')<{a: number, c: number}>({a: 1, b: 2, c: 3}); // => {a: 1, c: 3} -}; - -// assocPath -() => { - // $ExpectType {a: {b: {c: number}}} - R.assocPath(['a', 'b', 'c'], 42, {a: {b: {c: 0}}}); // => {a: {b: {c: 42}}} - // $ExpectType {a: {b: {c: number}}} - R.assocPath(['a', 'b', 'c'])(42, {a: {b: {c: 0}}}); // => {a: {b: {c: 42}}} - // $ExpectType {a: {b: {c: number}}} - R.assocPath(['a', 'b', 'c'], 42)({a: {b: {c: 0}}}); // => {a: {b: {c: 42}}} -}; - -// dissocPath -() => { - // $ExpectType {a: {b: {}}} - R.dissocPath(['a', 'b', 'c'], {a: {b: {c: 42}}}); // => {a: {b: {}}} - // optionally specify return type - // $ExpectType {a: {b: {}}} - R.dissocPath<{a : { b: number}}>(['a', 'b', 'c'], {a: {b: {c: 42}}}); // => {a: {b: {}}} - // $ExpectType {a: {b: {}}} - R.dissocPath(['a', 'b', 'c'])({a: {b: {c: 42}}}); // => {a: {b: {}}} -}; - -// clone -() => { - let obj1 = [{}, {}, {}]; - let obj2 = [{a: 1}, {a: 2}, {a: 3}]; - // $ExpectType any[] - R.clone(obj1); - // $ExpectType {a: number}[] - R.clone(obj2); - // $ExpectType Object - R.clone({}); - // $ExpectType 10 - R.clone(10); - // $ExpectType "foo" - R.clone('foo'); - // $ExpectType number - R.clone(Date.now()); -}; - -// eqProps -() => { - let o1 = { a: 1, b: 2, c: 3, d: 4 }; - let o2 = { a: 10, b: 20, c: 3, d: 40 }; - // $ExpectType boolean - R.eqProps('a', o1, o2); // => false - // $ExpectType boolean - R.eqProps('c', o1, o2); // => true - // $ExpectType {(obj1: T, obj2: U): boolean} - R.eqProps('c'); - // $ExpectType {(obj2: U): boolean} - R.eqProps('c', o1); -}; - -// evolve -() => { - let tomato = {firstName: 'Tomato ', data: {elapsed: 100, remaining: 1400}, id: 123}; - let transformations = { - firstName: R.trim, - lastName: R.trim, // Will not get invoked. - data: {elapsed: R.add(1), remaining: R.add(-1)} - }; - // $ExpectType typeof tomato - const a: typeof tomato = R.evolve(transformations, tomato); // => {firstName: 'Tomato', data: {elapsed: 101, remaining: 1399}, id: 123} - // $ExpectType typeof tomato - const b: typeof tomato = R.evolve(transformations)(tomato); // => {firstName: 'Tomato', data: {elapsed: 101, remaining: 1399}, id: 123} -}; - -// has -() => { - const hasName = R.has('name'); - // $ExpectType boolean - hasName({name: 'alice'}); // => true - // $ExpectType boolean - hasName({name: 'bob'}); // => true - // $ExpectType boolean - hasName({}); // => false - - const point = {x: 0, y: 0}; - const pointHas = R.flip(R.has)(point); - // $ExpectType boolean - pointHas('x'); // => true - // $ExpectType boolean - pointHas('y'); // => true - // $ExpectType boolean - pointHas('z'); // => false -}; - -// hasIn -class Rectangle { - constructor(public width: number, public height: number) { - this.width = width; - this.height = height; - } - area(): number { - return this.width * this.height; - } -}; -() => { - let square = new Rectangle(2, 2); - // $ExpectType boolean - R.hasIn('width', square); // => true - // $ExpectType boolean - R.hasIn('area', square); // => true - // $ExpectType boolean - R.flip(R.hasIn)(square)('area'); // => true -}; - -// invert -() => { - let raceResultsByFirstName = { - first: 'alice', - second: 'jake', - third: 'alice' - }; - // $ExpectType Dictionary - R.invert(raceResultsByFirstName); - // => { 'alice': ['first', 'third'], 'jake': ['second'] } -}; - -// invertObj -() => { - let raceResults0 = { - first: 'alice', - second: 'jake' - }; - // $ExpectType Dictionary - R.invertObj(raceResults0); - // => { 'alice': 'first', 'jake': 'second' } - - // Alternatively: - let raceResults1 = ['alice', 'jake']; - // $ExpectType Dictionary - R.invertObj(raceResults1); - // => { 'alice': '0', 'jake': '1' } -}; - -// keys -() => { - // $ExpectType string[] - R.keys({a: 1, b: 2, c: 3}); // => ['a', 'b', 'c'] -}; - -// keysIn -() => { - let f = new F(); - // $ExpectType string[] - R.keysIn(f); // => ['x', 'y'] -}; - -// lens -() => { - interface xy { - x: number; - y: number; - } - // let xLens = R.lens(R.prop('x'), R.assoc('x')); - // let xLens = R.lens(R.prop('x'), R.assoc('x')); - let xLens = R.lens(R.prop('x'))(R.assoc('x')); - // ^ works with only 1 generic, for curried version managed to split the inferred generic from the manual generic - // $ExpectType number - R.view(xLens, {x: 1, y: 2}); // => 1 - // $ExpectType { x: number, y: number } - R.set(xLens, 4, {x: 1, y: 2}); // => {x: 4, y: 2} - // $ExpectType { x: number, y: number } - R.set(xLens)(4, {x: 1, y: 2}); // => {x: 4, y: 2} - // $ExpectType { x: number, y: number } - R.set(xLens, 4)({x: 1, y: 2}); // => {x: 4, y: 2} - // $ExpectType { x: number, y: number } - R.over(xLens, R.negate, {x: 1, y: 2}); // => {x: -1, y: 2} - // $ExpectType { x: number, y: number } - R.over(xLens, R.negate)({x: 1, y: 2}); // => {x: -1, y: 2} - // $ExpectType { x: number, y: number } - R.over(xLens)(R.negate, {x: 1, y: 2}); // => {x: -1, y: 2} -}; - -// lensIndex -() => { - let headLens = R.lensIndex(0); - // $ExpectType string - R.view(headLens, ['a', 'b', 'c']); // => 'a' - // $ExpectType string[] - R.set(headLens, 'x', ['a', 'b', 'c']); // => ['x', 'b', 'c'] - // $ExpectType string[] - R.over(headLens, R.toUpper, ['a', 'b', 'c']); // => ['A', 'b', 'c'] -}; - -// lensProp -() => { - let xLens = R.lensProp('x'); - // $ExpectType number - R.view(xLens, {x: 1, y: 2}); // => 1 - // $ExpectType Dictionary - R.set(xLens, 4, {x: 1, y: 2}); // => {x: 4, y: 2} - // $ExpectType Dictionary - R.over(xLens, R.negate, {x: 1, y: 2}); // => {x: -1, y: 2} -}; - -// lensPath -() => { - const xyLens = R.lensPath(['x', 'y']); - // $ExpectType number - R.view(xyLens, {x: {y: 2, z: 3}}); // => 2 - // $ExpectType { [s: string]: { [s: string]: number } } - R.set(xyLens, 4, {x: {y: 2, z: 3}}); // => {x: {y: 4, z: 3}} - // $ExpectType { [s: string]: { [s: string]: number } } - R.over(xyLens, R.negate, {x: {y: 2, z: 3}}); // => {x: {y: -2, z: 3}} -}; - -// keys -() => { - // $ExpectType string[] - R.keys({a: 1, b: 2, c: 3}); // => ['a', 'b', 'c'] -}; - -// keysIn -() => { - let f = new F(); - // $ExpectType string[] - R.keysIn(f); // => ['x', 'y'] -}; - -// lens -() => { - let headLens = R.lens( - function get(arr: number[]) { return arr[0]; }, - function set(val: number, arr: number[]) { return [val].concat(arr.slice(1)); } - ); - headLens([10, 20, 30, 40]); // => 10 - // // $ExpectError Argument of type 'mu' is not assignable to parameter of type 'number'. - // headLens.set('mu', [10, 20, 30, 40]); // => ['mu', 20, 30, 40] - - let phraseLens = R.lens( - function get(obj: any) { return obj.phrase; }, - function set(val: string, obj: any) { - let out = R.clone(obj); - out.phrase = val; - return out; - } - ); - let obj1 = { phrase: 'Absolute filth . . . and I LOVED it!'}; - let obj2 = { phrase: "What's all this, then?"}; - // $ExpectType string - phraseLens(obj1); // => 'Absolute filth . . . and I LOVED it!' - // $ExpectType string - phraseLens(obj2); // => "What's all this, then?" - // $ExpectType Dictionary - phraseLens.set('Ooh Betty', obj1); // => { phrase: 'Ooh Betty'} -}; - -// lensProp -() => { - let phraseLens = R.lensProp('phrase'); - let obj1 = { phrase: 'Absolute filth . . . and I LOVED it!'}; - let obj2 = { phrase: "What's all this, then?"}; - // $ExpectType string - phraseLens(obj1); // => 'Absolute filth . . . and I LOVED it!' - // $ExpectType string - phraseLens(obj2); // => 'What's all this, then?' - // $ExpectType Dictionary - phraseLens.set('Ooh Betty', obj1); // => { phrase: 'Ooh Betty'} -}; - -// merge -() => { - // $ExpectType Dictionary - R.merge({ 'name': 'fred', 'age': 10 }, { 'age': 40 }); - // => { 'name': 'fred', 'age': 40 } - let resetToDefault = R.flip(R.merge)({x: 0}); - // $ExpectType Dictionary - resetToDefault({x: 5, y: 2}); // => {x: 0, y: 2} -}; - -// megeAll -() => { - // $ExpectType Dictionary - R.mergeAll([{foo: 1},{bar: 2},{baz: 3}]); // => {foo: 1,bar: 2,baz: 3} - // $ExpectType Dictionary - R.mergeAll([{foo: 1},{foo: 2},{bar: 2}]); // => {foo: 2,bar: 2} -}; - -// mergeWith -() => { - // $ExpectType { a: boolean, b: boolean, values: number[] } - R.mergeWith(R.concat, - { a: true, values: [10, 20] }, - { b: true, values: [15, 35] }); - // => { a: true, b: true, values: [10, 20, 15, 35] } -}; - -// mergeWithKey -() => { - let concatValues = (k: string, l: string, r: string) => k === 'values' ? R.concat(l, r) : r; - R.mergeWithKey(concatValues, - { a: true, thing: 'foo', values: [10, 20] }, - { b: true, thing: 'bar', values: [15, 35] }); - const merge = R.mergeWithKey(concatValues); - // $ExpectType { a: boolean, b: boolean, values: number[], thing: string } - merge({ a: true, thing: 'foo', values: [10, 20] }, { b: true, thing: 'bar', values: [15, 35] }); -}; - -// pathOr -() => { - // $ExpectType number - R.pathOr('N/A', ['a', 'b'], {a: {b: 2}}); // => 2 - // $ExpectType number - R.pathOr('N/A', ['a', 'b'])({a: {b: 2}}); // => 2 - // $ExpectType number - R.pathOr('N/A', ['a', 'b'], {c: {b: 2}}); // => 'N/A' - // $ExpectType number - R.pathOr({c: 2})(['a', 'b'], {c: {b: 2}}); // => 'N/A' -}; - -// pathSatisfies -() => { - // $ExpectType boolean - R.pathSatisfies((a: any) => a === 'foo', ['a', 'b', 'c'], {a: {b: {c: 'foo'}}}); // => true - // $ExpectType boolean - R.pathSatisfies((a: any) => a === 'bar', ['a', 'b', 'c'], {a: {b: {c: 'foo'}}}); // => false - // $ExpectType boolean - R.pathSatisfies((a: any) => a === 1, ['a', 'b', 'c'], {a: {b: {c: 1}}}); // => true - // $ExpectType boolean - R.pathSatisfies((a: any) => a !== 1, ['a', 'b', 'c'], {a: {b: {c: 2}}}); // => true - // $ExpectType boolean - R.pathSatisfies((a: any) => a === 1)(['a', 'b', 'c'], {a: {b: {c: 1}}}); // => true - // $ExpectType boolean - R.pathSatisfies((a: any) => a === 1, ['a', 'b', 'c'])({a: {b: {c: 1}}}); // => true - // $ExpectType boolean - R.pathSatisfies((a: any) => a === 1)(['a', 'b', 'c'])({a: {b: {c: 1}}}); // => true -}; - -// pickBy -() => { - let isPositive = function(n: number) { - return n > 0; - }; - // $ExpectType Dictionary - R.pickBy(isPositive, {a: 1, b: 2, c: -1, d: 0, e: 5}); // => {a: 1, b: 2, e: 5} - let containsBackground = function(val: any) { - return val.bgcolor; - }; - let colors = {1: {color: 'read'}, 2: {color: 'black', bgcolor: 'yellow'}}; - // $ExpectType { 2: R.Dictionary } - R.pickBy(containsBackground, colors); // => {2: {color: 'black', bgcolor: 'yellow'}} - - let isUpperCase = function(val: number, key: string) { return key.toUpperCase() === key; }; - // $ExpectType Dictionary - R.pickBy(isUpperCase, {a: 1, b: 2, A: 3, B: 4}); // => {A: 3, B: 4} -}; - - -// pick -() => { - // $ExpectType Dictionary - R.pick(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); // => {a: 1, d: 4} - // the following should errror: e/f are not keys in these objects - // $ExpectError not keys - let no1 = R.pick(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); // => {a: 1} - // $ExpectError not keys - let no2 = R.pick(['a', 'e', 'f'])({a: 1, b: 2, c: 3, d: 4}); // => {a: 1} - // $ExpectError not keys - let no3 = R.pick(['a', 'e', 'f'], [1, 2, 3, 4]); // => {a: 1} -}; - -// objOf -() => { - let matchPhrases = R.compose( - R.objOf('must'), - R.map(R.objOf('match_phrase')) - ); - // $ExpectType { must: { match_phrase: string }[] } - matchPhrases(['foo', 'bar', 'baz']); -}; - -// omit -() => { - // $ExpectType Dictionary - R.omit(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); // => {b: 2, c: 3} - // $ExpectType Dictionary - R.omit(['a', 'd'])({a: 1, b: 2, c: 3, d: 4}); // => {b: 2, c: 3} -}; - -// fromPairs -() => { - // $ExpectType Dictionary - R.fromPairs([['a', 1], ['b', 2], ['c', 3]]); // => {a: 1, b: 2, c: 3} -}; - -// pair -() => { - R.pair('foo', 'bar'); // => ['foo', 'bar'] - let p = R.pair('foo', 1); // => ['foo', 'bar'] - // $ExpectType string - p[0]; - // $ExpectType number - p[1]; -}; - -// over, lensIndex -() => { - let headLens = R.lensIndex(0); - // $ExpectType string[] - R.over(headLens, R.toUpper, ['foo', 'bar', 'baz']); // => ['FOO', 'bar', 'baz'] -}; - -// pickAll -() => { - // $ExpectType Dictionary - R.pickAll(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); // => {a: 1, d: 4} - // $ExpectType Dictionary - R.pickAll(['a', 'd'])({a: 1, b: 2, c: 3, d: 4}); // => {a: 1, d: 4} - // $ExpectType Dictionary - R.pickAll(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); // => {a: 1, e: undefined, f: undefined} - // $ExpectType Dictionary - R.pickAll(['a', 'e', 'f'])({a: 1, b: 2, c: 3, d: 4}); // => {a: 1, e: undefined, f: undefined} // why does this pass while the above fails? -}; - -// pickBy -() => { - let isUpperCase = function(val: number, key: string) { return key.toUpperCase() === key; }; - // $ExpectType Dictionary - R.pickBy(isUpperCase, {a: 1, b: 2, A: 3, B: 4}); // => {A: 3, B: 4} -}; - -// project -() => { - let abby = {name: 'Abby', age: 7, hair: 'blond', grade: 2}; - let fred = {name: 'Fred', age: 12, hair: 'brown', grade: 7}; - let kids = [abby, fred]; - // $ExpectType { name: string, grade: number }[] - R.project(['name', 'grade'], kids); // => [{name: 'Abby', grade: 2}, {name: 'Fred', grade: 7}] -}; - -// prop -() => { - // $ExpectType number - R.prop('x', {x: 100}); // => 100 - // $ExpectError Argument of type 'x' is not assignable to parameter of type 'never'. - R.prop('x', {}); // => undefined -}; - -// propOr -() => { - let alice = { - name: 'ALICE', - age: 101 - }; - let favorite = R.prop('favoriteLibrary'); - let favoriteWithDefault = R.propOr('Ramda', 'favoriteLibrary'); - - // $ExpectType undefined - favorite(alice); // => undefined - // $ExpectType string - favoriteWithDefault(alice); // => 'Ramda' -}; - -// propSatisfies -() => { - // $ExpectType boolean - R.propSatisfies((x: number) => x > 0, 'x', {x: 1, y: 2}); // => true - // $ExpectType boolean - R.propSatisfies((x: number) => x > 0, 'x')({x: 1, y: 2}); // => true - // $ExpectType boolean - R.propSatisfies((x: number) => x > 0)('x')({x: 1, y: 2}); // => true -}; - -// props -() => { - // $ExpectType number[] - R.props(['x', 'y'], {x: 1, y: 2}); // => [1, 2] - // $ExpectType Array - R.props(['c', 'a', 'b'], {b: 2, a: 1}); // => [undefined, 1, 2] - - let fullName = R.compose(R.join(' '), R.props(['first', 'last'])); - // $ExpectType string - fullName({last: 'Bullet-Tooth', age: 33, first: 'Tony'}); // => 'Tony Bullet-Tooth' -}; - -// toPairs -() => { - // $ExpectType [string, number][] - R.toPairs({a: 1, b: 2, c: 3}); // => [['a', 1], ['b', 2], ['c', 3]] -}; - -// toPairsIn -() => { - let f = new F(); - // $ExpectType [string, string][] - R.toPairsIn(f); // => [['x','X'], ['y','Y']] - // $ExpectType [string, string][] - R.toPairsIn(f); // => [['x','X'], ['y','Y']] -}; - -// values -() => { - // $ExpectType number[] - R.values({a: 1, b: 2, c: 3}); // => [1, 2, 3] -}; - -// valuesIn -() => { - let f = new F(); - // $ExpectType string[] - R.valuesIn(f); // => ['X', 'Y'] -}; - -// where -() => { - let spec = {x: 2}; - // $ExpectType boolean - R.where(spec, {w: 10, x: 2, y: 300}); // => true - // $ExpectType boolean - R.where(spec, {x: 1, y: 'moo', z: true}); // => false - // $ExpectType boolean - R.where(spec)({w: 10, x: 2, y: 300}); // => true - // $ExpectType boolean - R.where(spec)({x: 1, y: 'moo', z: true}); // => false - - // There's no way to represent the below functionality in typescript - // per http: //stackoverflow.com/a/29803848/632495 - // will need a work around. - - let spec2 = {x: function(val: number, obj: any) { return val + obj.y > 10; }}; - // $ExpectType boolean - R.where(spec2, {x: 2, y: 7}); // => false - // $ExpectType boolean - R.where(spec2, {x: 3, y: 8}); // => true - - let xs = [{x: 2, y: 1}, {x: 10, y: 2}, {x: 8, y: 3}, {x: 10, y: 4}]; - // $ExpectType { x: number, y: number }[] - R.filter(R.where({x: 10}), xs); // ==> [{x: 10, y: 2}, {x: 10, y: 4}] - // $ExpectType { x: number, y: number }[] - R.filter(R.where({x: 10}))(xs); // ==> [{x: 10, y: 2}, {x: 10, y: 4}] -}; - -// whereEq -() => { - // $ExpectType (v: Object) => Boolean - let pred = R.whereEq({a: 1, b: 2}); - // $ExpectType boolean - pred({a: 1}); // => false - // $ExpectType boolean - pred({a: 1, b: 2}); // => true - // $ExpectType boolean - pred({a: 1, b: 2, c: 3}); // => true - // $ExpectType boolean - pred({a: 1, b: 1}); // => false - // $ExpectType boolean - R.whereEq({a: 'one'}, {a: 'one'}); // => true -}; - -// without -() => { - // $ExpectType number[] - R.without([1, 2], [1, 2, 1, 3, 4]); // => [3, 4] -}; - -// mapIndexed, addIndex -() => { - let mapIndexed = R.addIndex(R.map); - // $ExpectType string[] - mapIndexed(function(val: string, idx: number) {return idx + '-' + val;})(['f', 'o', 'o', 'b', 'a', 'r']); - // $ExpectType string[] - R.mapIndexed(function(val: string, idx: number) {return idx + '-' + val;})(['f', 'o', 'o', 'b', 'a', 'r']); - // => ['0-f', '1-o', '2-o', '3-b', '4-a', '5-r'] - // $ExpectType number[] - R.mapIndexed((rectangle: Rectangle, idx: number): number => rectangle.area()*idx, [new Rectangle(1,2), new Rectangle(4,7)]); - // => [2, 56] -}; - -// addIndex -() => { - let reduceIndexed = R.addIndex(R.reduce); - // $ExpectType string[] - reduceIndexed( - (acc: string, val: string, idx: number) => acc + ',' + idx + '-' + val - ,'' - ,['f', 'o', 'o', 'b', 'a', 'r'] - ); - // => ['0-f,1-o,2-o,3-b,4-a,5-r'] -}; - -// always -() => { - let t = R.always('Tee'); - // $ExpectType string - t(); // => 'Tee' -}; - -// ap -() => { - // $ExpectType number[] - R.ap([R.multiply(2), R.add(3)], [1,2,3]); // => [2, 4, 6, 4, 5, 6] - // $ExpectType number[] - R.ap([R.multiply(2), R.add(3)])([1,2,3]); // => [2, 4, 6, 4, 5, 6] -}; - -// apply -() => { - let nums = [1, 2, 3, -99, 42, 6, 7]; - // $ExpectType number - R.apply(Math.max, nums); // => 42 - // $ExpectType number - R.apply(Math.max)(nums); // => 42 -}; - -// applySpec -() => { - type T = {sum: number, nested: {mul: number}}; - const getMetrics = R.applySpec({ - sum: R.add, nested: { mul: R.multiply } - }); - // $ExpectType T - getMetrics(2, 4); // => { sum: 6, nested: { mul: 8 } } -}; - -// binary -() => { - let takesThreeArgs = function(a: number, b: number, c: number) { - return [a, b, c]; - }; - // $ExpectType number - takesThreeArgs.length; // => 3 - // $ExpectType number[] - takesThreeArgs(1, 2, 3); // => [1, 2, 3] - - let takesTwoArgs = R.binary(takesThreeArgs); - // $ExpectType number - takesTwoArgs.length; // => 2 - // Only 2 arguments are passed to the wrapped function - // $ExpectError Supplied parameters do not match any signature of call target. - takesTwoArgs(1, 2, 3); // => [1, 2, undefined] -}; - -// pipe, inc, negate -() => { - const f = R.pipe(Math.pow, R.negate, R.inc); - // $ExpectType number - f(3, 4); // -(3^4) + 1 -}; - -// comparator -() => { - type T = {age: number}; - let cmp = R.comparator(function(a: T, b: T) { - return a.age < b.age; - }); - let people = [ - {name: 'Agy', age: 33}, {name: 'Bib', age: 15}, {name: 'Cari', age: 16} - ]; - // $ExpectType { age: number, name: string }[] - R.sort(cmp, people); -}; - -// converge -() => { - let add = function(a: number, b: number) { return a + b; }; - let multiply = function(a: number, b: number) { return a * b; }; - let subtract = function(a: number, b: number) { return a - b; }; - - // ≅ multiply( add(1, 2), subtract(1, 2) ); - // $ExpectType number - R.converge(multiply, [ add, subtract ])(1, 2); // => -3 - - let add3 = function(a: number, b: number, c: number) { return a + b + c; }; - // $ExpectType number - R.converge(add3, [ multiply, add, subtract ])(1, 2); // => 4 -}; - -// compose -() => { - const f0 = R.compose(Math.pow); - const f1 = R.compose(R.negate, Math.pow); - const f2 = R.compose(R.inc, R.negate, Math.pow); - const f3 = R.compose(R.inc, R.inc, R.negate, Math.pow); - const f4 = R.compose(R.inc, R.inc, R.inc, R.negate, Math.pow); - const f5 = R.compose(R.inc, R.inc, R.inc, R.inc, R.negate, Math.pow); - // $ExpectType number - f0(3, 4); // -(3^4) + 1 - // $ExpectType number - f1(3, 4); // -(3^4) + 1 - // $ExpectType number - f2(3, 4); // -(3^4) + 1 - // $ExpectType number - f3(3, 4); // -(3^4) + 1 - // $ExpectType number - f4(3, 4); // -(3^4) + 1 - // $ExpectType number - f5(3, 4); // -(3^4) + 1 - - // test for type degeneration if the first function has generics - // $ExpectType (x0: number) => number - R.compose(double, R.identity); -}; - -// compose -() => { - const fn = function(a: string, b: number, c: string) { - return [a,b,c]; - }; - const gn = R.compose(R.length, fn); - // $ExpectType number - gn('Hello', 4, 'world'); -}; - -// TODO: composeP - -// TODO: composeK - -// construct, constructN -(() => { - type circle = { r: number, colors: string[] }; - let Circle = function(r: number) { - this.r = r; - this.colors = Array.prototype.slice.call(arguments, 1); - }; - Circle.prototype.area = function() {return Math.PI * Math.pow(this.r, 2);}; - let circleN = R.constructN(2, Circle); - // $ExpectType circle - circleN(1, 'red'); - let circle = R.construct(Circle); - // $ExpectType circle - circle(1, 'red'); -})(); - -/***************************************************************** - * Relation category - */ - -// countBy -() => { - let numbers = [1.0, 1.1, 1.2, 2.0, 3.0, 2.2]; - let letters = R.split('', 'abcABCaaaBBc'); - // $ExpectType Dictionary - R.countBy(Math.floor)(numbers); // => {'1': 3, '2': 2, '3': 1} - // $ExpectType Dictionary - R.countBy(R.toLower)(letters); // => {'a': 5, 'b': 4, 'c': 3} -}; - -// difference -() => { - // $ExpectType number[] - R.difference([1,2,3,4], [7,6,5,4,3]); // => [1,2] - // $ExpectType number[] - R.difference([7,6,5,4,3], [1,2,3,4]); // => [7,6,5] -}; - -// differenceWith -() => { - function cmp(x: any, y: any) { return x.a === y.a; } - let l1 = [{a: 1}, {a: 2}, {a: 3}]; - let l2 = [{a: 3}, {a: 4}]; - // $ExpectType {a: number}[] - R.differenceWith(cmp, l1, l2); // => [{a: 1}, {a: 2}] - // $ExpectType {a: number}[] - R.differenceWith(cmp)(l1, l2); // => [{a: 1}, {a: 2}] - // $ExpectType {a: number}[] - R.differenceWith(cmp)(l1)(l2); // => [{a: 1}, {a: 2}] -}; - -// equals -() => { - // $ExpectType boolean - R.equals(1, 1); // => true - // $ExpectType boolean - R.equals('2', '1'); // => false - // $ExpectType boolean - R.equals([1, 2, 3], [1, 2, 3]); // => true - - let a: any = {}; a.v = a; - let b: any = {}; b.v = b; - // $ExpectType boolean - R.equals(a, b); // => true -}; - -// identity -() => { - const a1 = R.identity(1); // => 1 - let obj = {}; - // $ExpectType number[] - R.identity([1,2,3]); - // $ExpectType string[] - R.identity(['a','b','c']); - // $ExpectType boolean - R.identity(obj) === obj; // => true -}; - -// identical -() => { - let o = {}; - // $ExpectType boolean - R.identical(o, o); // => true - // $ExpectType boolean - R.identical(1, 1); // => true - // $ExpectType boolean - R.identical('2', '1'); // => false - // $ExpectType boolean - R.identical([], []); // => false - // $ExpectType boolean - R.identical(0, -0); // => false - // $ExpectType boolean - R.identical(NaN, NaN); // => true -}; - -// path -() => { - // $ExpectType number - R.path(['a', 'b'], {a: {b: 2}}); // => 2 - // $ExpectType number - R.path(['a', 'b'])({a: {b: 2}}); // => 2 -}; - -// sortBy -() => { - let sortByNameCaseInsensitive = R.sortBy(R.compose(R.toLower, R.prop('name'))); - let sortByAgeDescending = R.sortBy(R.compose(R.negate, R.prop('age'))); - let sortByAgeAscending = R.sortBy(R.prop('age')); - let alice = { - name: 'ALICE', - age: 101 - }; - let bob = { - name: 'Bob', - age: -10 - }; - let clara = { - name: 'clara', - age: 314.159 - }; - let people = [clara, bob, alice]; - // $ExpectType { name: string, age: number }[] - sortByAgeDescending(people); //=> [alice, bob, clara] - // $ExpectType { name: string, age: number }[] - sortByNameCaseInsensitive(people); // => [alice, bob, clara] - // $ExpectType { name: string, age: number }[] - sortByAgeAscending(people); // => [bob, alice, clara] -}; - -// sortWith -() => { - let alice = { - name: 'alice', - age: 40 - }; - let bob = { - name: 'bob', - age: 30 - }; - let clara = { - name: 'clara', - age: 40 - }; - let people = [clara, bob, alice]; - // $ExpectType typeof people - R.sortWith([ - R.descend(R.prop('age')), - R.ascend(R.prop('name')) - ], people); - let ageNameSort = R.sortWith([ - R.descend(R.prop('age')), - R.ascend(R.prop('name')) - ]); - // $ExpectType typeof people - ageNameSort(people); - // => [alice, clara, bob] -}; - -// splitAt -() => { - // $ExpectType number[][] - R.splitAt(1, [1, 2, 3]); // => [[1], [2, 3]] - // $ExpectType number[][] - R.splitAt(1)([1, 2, 3]); // => [[1], [2, 3]] - // $ExpectType string[] - R.splitAt(5, 'hello world'); // => ['hello', ' world'] - // $ExpectType string[] - R.splitAt(-1, 'foobar'); // => ['fooba', 'r'] -}; - -// splitWhen -() => { - // $ExpectType number[][] - R.splitWhen(R.equals(2), [1, 2, 3, 1, 2, 3]); // => [[1], [2, 3, 1, 2, 3]] - // $ExpectType number[][] - R.splitWhen(R.equals(2))([1, 2, 3, 1, 2, 3]); // => [[1], [2, 3, 1, 2, 3]] -}; - -// add -() => { - // $ExpectType number - R.add(2, 3); // => 5 - // $ExpectType number - R.add(7)(10); // => 17 -}; - -// dec -() => { - // $ExpectType number - R.dec(42); // => 41 -}; - -// divide -() => { - // $ExpectType number - R.divide(71, 100); // => 0.71 - - let half = R.flip(R.divide)(2); - // $ExpectType number - half(42); // => 21 - - let reciprocal = R.divide(1); - // $ExpectType number - reciprocal(4); // => 0.25 -}; - -// gt -() => { - // $ExpectType boolean - R.gt(2, 6); // => false - // $ExpectType boolean - R.gt(2, 0); // => true - // $ExpectType boolean - R.gt(2, 2); // => false - // $ExpectType boolean - R.flip(R.gt)(2)(10); // => true - // $ExpectType boolean - R.gt(2)(10); // => false -}; - -// gte -() => { - // $ExpectType boolean - R.gte(2, 6); // => false - // $ExpectType boolean - R.gte(2, 0); // => true - // $ExpectType boolean - R.gte(2, 2); // => false - // $ExpectType boolean - R.flip(R.gte)(2)(10); // => true - // $ExpectType boolean - R.gte(2)(10); // => false -}; - -// isNaN -() => { - // $ExpectType boolean - R.isNaN(NaN); // => true - // $ExpectType boolean - R.isNaN(undefined); // => false - // $ExpectType boolean - R.isNaN({}); // => false -}; - -// lt -() => { - // $ExpectType boolean - R.lt(2, 6); // => true - // $ExpectType boolean - R.lt(2, 0); // => false - // $ExpectType boolean - R.lt(2, 2); // => false - // $ExpectType boolean - R.lt(5)(10); // => true - // $ExpectType boolean - R.flip(R.lt)(5)(10); // => false // right-sectioned currying -}; - -// lte -() => { - // $ExpectType boolean - R.lte(2, 6); // => true - // $ExpectType boolean - R.lte(2, 0); // => false - // $ExpectType boolean - R.lte(2, 2); // => true - // $ExpectType boolean - R.flip(R.lte)(2)(1); // => true - // $ExpectType boolean - R.lte(2)(10); // => true -}; - -// mathMod -() => { - // $ExpectType number - R.mathMod(-17, 5); // => 3 - // $ExpectType number - R.mathMod(17, 5); // => 2 - // $ExpectType number - R.mathMod(17, -5); // => NaN - // $ExpectType number - R.mathMod(17, 0); // => NaN - // $ExpectType number - R.mathMod(17.2, 5); // => NaN - // $ExpectType number - R.mathMod(17, 5.3); // => NaN - - let clock = R.flip(R.mathMod)(12); - // $ExpectType number - clock(15); // => 3 - // $ExpectType number - clock(24); // => 0 - - let seventeenMod = R.mathMod(17); - // $ExpectType number - seventeenMod(3); // => 2 -}; - -// max -() => { - // $ExpectType number - R.max(7, 3); // => 7 - // $ExpectType string - R.max('a', 'z'); // => 'z' -}; - -// maxBy -() => { - function cmp(obj: { x: number }) { return obj.x; } - let a = {x: 1}; - let b = {x: 2}; - let c = {x: 3}; - let d = {x: 'a'}; - let e = {x: 'z'}; - // $ExpectType { x: number; } - R.maxBy(cmp, a, c); // => {x: 3} - // $ExpectType { x: number; } - R.maxBy(cmp)(a, c); // => {x: 3} - // $ExpectType { x: number; } - R.maxBy(cmp)(a)(b); - // $ExpectError Argument of type '{ x: string; }' is not assignable to parameter of type '{ x: number; }' - R.maxBy(cmp)(d)(e); -}; - -// mean -() => { - // $ExpectType number - R.mean([2, 7, 9]); // => 6 - // $ExpectType number - R.mean([]); // => NaN -}; - -// median -() => { - // $ExpectType number - R.median([7, 2, 10, 9]); // => 8 - // $ExpectType number - R.median([]); // => NaN -}; - -// min -() => { - // $ExpectType number - R.min(9, 3); // => 3 - // $ExpectType string - R.min('a', 'z'); // => 'a' -}; - -// minBy -() => { - function cmp(obj: { x: number }) { return obj.x; } - let a = {x: 1}; - let b = {x: 2}; - let c = {x: 3}; - let d = {x: 'a'}; - let e = {x: 'z'}; - // $ExpectType { x: number } - R.minBy(cmp, a, b); // => {x: 1} - // $ExpectType { x: number } - R.minBy(cmp)(a, b); // => {x: 1} - // $ExpectType { x: number } - R.minBy(cmp)(a)(c); - // $ExpectError Argument of type '{ x: string; }' is not assignable to parameter of type '{ x: number; }' - R.minBy(cmp, d, e); -}; - -// modulo -() => { - // $ExpectType number - R.modulo(17, 3); // => 2 - // JS behavior: - // $ExpectType number - R.modulo(-17, 3); // => -2 - // $ExpectType number - R.modulo(17, -3); // => 2 - - let isOdd = R.flip(R.modulo)(2); - // $ExpectType number - isOdd(42); // => 0 - // $ExpectType number - isOdd(21); // => 1 -}; - -// multiply -() => { - let double = R.multiply(2); - let triple = R.multiply(3); - // $ExpectType number - double(3); // => 6 - // $ExpectType number - triple(4); // => 12 - // $ExpectType number - R.multiply(2, 5); // => 10 -}; - -// negate -() => { - // $ExpectType number - R.negate(42); // => -42 -}; - -// product -() => { - // $ExpectType number - R.product([2,4,6,8,100,1]); // => 38400 -}; - -// subtract -() => { - // $ExpectType number - R.subtract(10, 8); // => 2 - - let minus5 = R.flip(R.subtract)(5); - // $ExpectType number - minus5(17); // => 12 - - let complementaryAngle = R.subtract(90); - // $ExpectType number - complementaryAngle(30); // => 60 - // $ExpectType number - complementaryAngle(72); // => 18 -}; - -// sum -() => { - // $ExpectType number - R.sum([2,4,6,8,100,1]); // => 121 -}; - -// symmetricDifference -() => { - // $ExpectType number[] - R.symmetricDifference([1,2,3,4], [7,6,5,4,3]); // => [1,2,7,6,5] - // $ExpectType number[] - R.symmetricDifference([7,6,5,4,3])([1,2,3,4]); // => [7,6,5,1,2] -}; - -// symmetricDifferenceWith -() => { - const eqA = R.eqBy(R.prop('a')); - const l1 = [{a: 1}, {a: 2}, {a: 3}, {a: 4}]; - const l2 = [{a: 3}, {a: 4}, {a: 5}, {a: 6}]; - // $ExpectType { a: number }[] - R.symmetricDifferenceWith(eqA, l1, l2); // => [{a: 1}, {a: 2}, {a: 5}, {a: 6}] - // $ExpectType { a: number }[] - R.symmetricDifferenceWith(eqA)(l1, l2); // => [{a: 1}, {a: 2}, {a: 5}, {a: 6}] - // $ExpectType (a: any[]) => any[] - R.symmetricDifferenceWith(eqA)(l1); // => [{a: 1}, {a: 2}, {a: 5}, {a: 6}] -}; - -/***************************************************************** - * String category - */ - -// replace -() => { - // $ExpectType string - R.replace('foo', 'bar', 'foo foo foo'); // => 'bar foo foo' - // $ExpectType string - R.replace('foo', 'bar')('foo foo foo'); // => 'bar foo foo' - // $ExpectType string - R.replace('foo')('bar')('foo foo foo'); // => 'bar foo foo' - // $ExpectType string - R.replace(/foo/, 'bar', 'foo foo foo'); // => 'bar foo foo' - - // Use the 'g' (global) flag to replace all occurrences: - // $ExpectType string - R.replace(/foo/g, 'bar', 'foo foo foo'); // => 'bar bar bar' - // $ExpectType string - R.replace(/foo/g, 'bar')('foo foo foo'); // => 'bar bar bar' - // $ExpectType string - R.replace(/foo/g)('bar')('foo foo foo'); // => 'bar bar bar' -}; - -/***************************************************************** - * Is category - */ - -() => { - // $ExpectType boolean - R.is(Object, {}); // => true - // $ExpectType boolean - R.is(Object)({}); // => true - // $ExpectType boolean - R.is(Number, 1); // => true - // $ExpectType boolean - R.is(Number)(1); // => true - // $ExpectType boolean - R.is(Object, 1); // => false - // $ExpectType boolean - R.is(Object)(1); // => false - // $ExpectType boolean - R.is(String, 's'); // => true - // $ExpectType boolean - R.is(String)('s'); // => true - // $ExpectType boolean - R.is(String, ''); // => true - // $ExpectType boolean - R.is(String)(''); // => true - // $ExpectType boolean - R.is(Object, new Object()); // => true - // $ExpectType boolean - R.is(Object)(new Object()); // => true - // $ExpectType boolean - R.is(Object, 's'); // => false - // $ExpectType boolean - R.is(Object)('s'); // => false - // $ExpectType boolean - R.is(Number, {}); // => false - // $ExpectType boolean - R.is(Number)({}); // => false -}; - -/***************************************************************** - * Logic category - */ - -// allPass -() => { - let gt10 = function(x: number) { return x > 10; }; - let even = function(x: number) { return x % 2 === 0;}; - let f = R.allPass([gt10, even]); - // $ExpectType boolean - f(11); // => false - // $ExpectType boolean - f(12); // => true -}; - -// and -() => { - // $ExpectType boolean - R.and(false, true); // => false - // $ExpectType number - R.and(0, []); // => 0 - // $ExpectType number - R.and(0)([]); // => 0 - // $ExpectType null - R.and(null, ''); // => null - let Why: any = (function(val: boolean) { - let why: any; - why.val = val; - why.and = function(x: boolean) { - return this.val && x; - }; - return Why; - })(true); - let why = new Why(true); - // $ExpectType boolean - R.and(why, false); // false -}; - -// anyPass -() => { - let gt10 = function(x: number) { return x > 10; }; - let even = function(x: number) { return x % 2 === 0;}; - let f = R.anyPass([gt10, even]); - // $ExpectType boolean - f(11); // => true - // $ExpectType boolean - f(8); // => true - // $ExpectType boolean - f(9); // => false -}; - -// both -() => { - let gt10 = function(x: number) { return x > 10; }; - let even = function(x: number) { return x % 2 === 0; }; - let f = R.both(gt10, even); - let g = R.both(gt10)(even); - // $ExpectType boolean - f(100); // => true - // $ExpectType boolean - f(101); // => false -}; - -// complement -() => { - let isEven = function(n: number) { return n % 2 === 0; }; - let isOdd = R.complement(isEven); - // $ExpectType boolean - isOdd(21); // => true - // $ExpectType boolean - isOdd(42); // => false -}; - -// eqBy -(() => { - // $ExpectType boolean - R.eqBy(Math.abs, 5, -5); // => true - // $ExpectType boolean - R.eqBy(Math.abs)(5, -5); // => true - // $ExpectType boolean - R.eqBy(Math.abs, 5)(-5); // => true -}); - -// defaultTo -() => { - let defaultTo42 = R.defaultTo(42); - // $ExpectType number - defaultTo42(null); // => 42 - // $ExpectType number - defaultTo42(undefined); // => 42 - // $ExpectType string - defaultTo42('Ramda'); // => 'Ramda' -}; - -// either -() => { - let gt10 = function(x: number) { return x > 10; }; - let even = function(x: number) { return x % 2 === 0; }; - let f = R.either(gt10, even); - let g = R.either(gt10)(even); - // $ExpectType boolean - f(101); // => true - // $ExpectType boolean - f(8); // => true -}; - -// ifElse -() => { - // Flatten all arrays in the list but leave other values alone. - let flattenArrays = R.map(R.ifElse(Array.isArray, R.flatten, R.identity)); - - // $ExpectType any[] - flattenArrays([[0], [[10], [8]], 1234, {}]); // => [[0], [10, 8], 1234, {}] - // $ExpectType any[] - flattenArrays([[[10], 123], [8, [10]], 'hello']); // => [[10, 123], [8, 10], 'hello'] -}; - -// isEmpty -() => { - // $ExpectType boolean - R.isEmpty([1, 2, 3]); // => false - // $ExpectType boolean - R.isEmpty([]); // => true - // $ExpectType boolean - R.isEmpty(''); // => true - // $ExpectType boolean - R.isEmpty(null); // => false - // $ExpectType boolean - R.isEmpty({}); // =>true - // $ExpectType boolean - R.isEmpty({a: 1}); // => false -}; - -// not -() => { - // $ExpectType boolean - R.not(true); // => false - // $ExpectType boolean - R.not(false); // => true - // $ExpectType boolean - R.not(0); // => true - // $ExpectType boolean - R.not(1); // => false -}; - -class Why { - val: boolean; - constructor(val: boolean) { - this.val = val; - } - or(x: boolean) { - return this.val && x; - } -} - -// or -() => { - // $ExpectType boolean - R.or(false, true); // => false - // $ExpectType number|any[] - R.or(0, []); // => [] - // $ExpectType number|any[] - R.or(0)([]); // => [] - // $ExpectType string - R.or(null, ''); // => '' - - let why = new Why(true); - why.or(true); - // $ExpectType Why|boolean - R.or(why, false); // false -}; - -// intersperse -() => { - // $ExpectType string[] - R.intersperse(',', ['foo', 'bar']); // => ['foo', ',', 'bar'] - // $ExpectType number[] - R.intersperse(0, [1, 2]); // => [1, 0, 2] - // $ExpectType number[] - R.intersperse(0, [1]); // => [1] -}; - -// ISSUES: - -// RESOLVED ISSUES: - -() => { - // #65, evolve issue - const a1 = R.evolve({ elapsed: R.add(1), remaining: R.add(-1) }, { name: 'Tomato', elapsed: 100, remaining: 1400 }); - const a2 = R.evolve({ elapsed: R.add(1), remaining: R.add(-1) })({ name: 'Tomato', elapsed: 100, remaining: 1400 }); - let test = { a: 1, b: 2}; - // $ExpectType { a: number, b: number } - R.evolve({ a: R.add(1)}, test ); -}; - -() => { - // #73 - let filterMatrix = function (v: number, m: Array>): Array { - return R.chain(R.filter((c: number) => c === v), m); - // return R.chain(R.filter(R.equals(v)), m) - }; - let b = [ - [0, 1], - [1, 0] - ]; - // $ExpectType number[] - filterMatrix(1, b); // --> [1, 1] - - // compiles - let filterMatrix2 = function (v: number, m: Array>): Array { - return R.chain((r: number[]) => R.filter((c: number) => c === v, r), m); - }; - - // also compiles - let mapMatrix3 = function(fn: (v: number) => number, m: Array>): Array { - return R.chain(R.map((c: number) => fn(c)), m); - }; -}; - -() => { - // #109 - function grepSomethingRecursively(grepPatterns: string | string[]) { - if (R.is(Array, grepPatterns)) { - R.forEach(() => {}, grepPatterns); - } - } -}; - -// UNRESOLVED ISSUES: - -// /* - -() => { - // #29 - // $ExpectType string[] - R.pipe(R.append('a'), R.uniq)(['a', 'b', 'c']); - // $ExpectType string[][] - R.pipe( - R.split(''), - R.map((letter: string) => ([ letter ])) - )('dave'); - - // $ExpectType number - R.pipe( - R.prop('name'), - R.length - )({ name: 'dave' }); - - let build: string; - let mapPackages = R.partial(R.map, [(test: any) => test.package]); - let filterBuild = R.partial(R.filter, [(test: any) => test.build === build]); - let getPackages = R.compose(R.uniq, mapPackages, filterBuild); - this.packages = getPackages(this._tests); - // ^ expected: ?? - - interface Foo { - build: string; - package: string; - } - const build2 = 'dev'; - let mapPackages2 = R.map((test: Foo) => test.package); - let filterBuild2 = R.filter((test: Foo) => test.build === build2); - let getPackages2 = R.compose(R.uniq, mapPackages2, filterBuild2); - let foos = [{ - build: 'dev', - package: 'devPackage' - }, { - build: 'prod', - package: 'prodPackage' - }, { - build: 'dev', - package: 'devPackage' - }]; - let foosFiltered = getPackages2(foos); - // ^ expected: ?? -}; - -() => { - // #69: lens composition - const sectioneditems = { sections: [ - {items: []}, - {items: []} - ]}; - const elem = 'Hello'; - R.over(R.compose(R.lensProp('sections'), R.lensIndex(sectioneditems.sections.length - 1), R.lensProp('items')), R.append(elem), sectioneditems); -}; - -() => { - // #78: curry loses generics - // : R.CurriedFunction3, T, T[], T[]> - // : R.CurriedFunction3, any, any[], any[]> - let updateBy = R.curry((pred: (v: T) => boolean, val: T, array: T[]): T[] => { - let i = R.findIndex(pred, array); - if (i >= 0) { - return R.update(i, val, array); - } else { - return array; - } - }); - // $ExpectType number[] - updateBy((n: number) => n > 1, 0, [1,2,3]); -}; - -() => { - // #86: lose generics in compose - let pairs = [['1','A'], ['2','B'], ['3','C']]; - // $ExpectType { [index: string]: string } - R.fromPairs ([['1','A'], ['2','B'], ['3','C']]); - // $ExpectType { [index: string]: string } - R.fromPairs (pairs); // fails -- variable reduced to string[][], killing tuples - // $ExpectType { [index: string]: string } - R.pipe (R.fromPairs)([['1','A'], ['2','B'], ['3','C']]); - // $ExpectType { [index: string]: string } - R.compose(R.fromPairs)([['1','A'], ['2','B'], ['3','C']]); - - // generics in pipe loses generics - R.pipe(R.identity); -}; - -() => { - // #90: curried function loses generics - const map = (func: (some: string) => (x: number) => 1) => { - return func('xx')(1); - }; - const map2 = (func: (some: string, other: string) => '1') => { - return func('xx', 'x'); - }; - // will work only with proposed changes - map(R.assoc('xxx')); - map2(R.assoc('xxx')); -}; - -() => { - // #92: lose generics in compose - - // can't infer cond paths, must annotate: - // $ExpectType (v: T) => T - const x = R.cond([ - [R.F, R.F], - [R.T, R.identity] - ]); - // argument order matters for some reason... - // $ExpectType (v: number) => number - R.pipe (R.inc, x); // ok - // $ExpectType (v: number) => number - R.compose(x, R.inc); // boom - - // don't use generics in pipe/compose/curry if it can't resolve them right away: - let pipeF0 = R.pipe (R.identity); // : (v: {}) => {} - let compF0 = R.compose(R.identity); // : (v: {}) => {} - - // argument order matters too: - let pipeF1 = R.pipe (R.inc, R.identity); // : (v: number) => number - let compF1 = R.compose(R.identity, R.inc); // : (v: number) => {} - // $ExpectType number - compF1(1); // uh-oh, fails - - // also can't reason backward: - let compF2 = R.compose(R.inc, R.identity); // : (v: {}) => number - // $ExpectType number - compF2('foo'); // uh-oh, passes - let pipeF2 = R.pipe (R.identity, R.inc); // : (v: {}) => number - // $ExpectType number - pipeF2('foo'); // uh-oh, passes -}; - -() => { - // #101: compose can't guess types for generic functions - interface SomeStruct { - a: number[]; - b: string[]; - c: { [index: string]: string }; - } - const x: SomeStruct = { - 'a': [], - 'b': [], - 'c': {} - }; - // const fun = <(y: SomeStruct) => SomeStruct>R.compose( // annotated: works - const fun = R.compose( - R.assoc('a', [1, 2, 3]), - R.assoc('b', ['a', 'b', 'c']), - R.assoc('c', { 'k': 'v'}) - ); - let struct: SomeStruct = fun(x); - - let a = R.assoc('a', 2, {z:3}); - let b = R.assoc('b', 2); -}; - -() => { - // #118: flatten - // $ExpectType number[] - R.flatten([1, 2, [3, 4], 5, [6, [7, 8, [9, [10, 11], 12]]]]); - // => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] -}; - -() => { - // #119: path - // $ExpectType number - R.path(['a', 'b', 'c'], {a: {b: {c: 2}}}); - // $ExpectType null - R.path(['a', 'b', 'c'], {a: {b: 2}}); // still fails - // let n = R.path(['a', '0', 'c'], {a: [{c: 2}] }) - // $ExpectType number - R.path(['a', 0, 'c'], {a: [{c: 2}] }); -}; - -() => { - // #129: nested evolve - type FormState = { index: number }; - function ramdaIssue(state: FormState): FormState { - return R.evolve({ - index: R.inc - }, state); - } -}; - -// */ +// @dts-jest:pass +R_test(regex); +// @dts-jest:pass +R_test(regex, string); diff --git a/tests/test.ts.out b/tests/test.ts.out deleted file mode 100644 index ee67974..0000000 --- a/tests/test.ts.out +++ /dev/null @@ -1,1907 +0,0 @@ -tests/test.ts:R.propIs(Number, 'x', {}); - -Expected error Argument of type 'x' is not assignable to parameter of type 'never'.`, because 'x' is not in `{}`. - -tests/test.ts:xy(3); - -Expected type - (v2: Y) => { x: number; y: Y; } -but got: - (v2: {}) => { x: {}; y: {}; } - -tests/test.ts:xy(3)(1); - -Expected type - { x: number; y: number; } -but got: - { x: {}; y: {}; } - -tests/test.ts:xyz(3, 2, 1); - -Expected type - { x: number; y: number; z: number; } -but got: - { x: {}; y: {}; z: {}; } - -tests/test.ts:xyz(3)(2)(1); - -Expected type - { x: number; y: number; z: number; } -but got: - { x: {}; y: {}; z: {}; } - -tests/test.ts:xyz(3, 2); - -Expected type - (v3: Z) => ({ x: number; y: number; z: Z; }) -but got: - (v3: {}) => { x: {}; y: {}; z: {}; } - -tests/test.ts:xyz(3)(2); - -Expected type - (v3: Z) => ({ x: number; y: number; z: Z; }) -but got: - (v2: {}) => { x: {}; y: {}; z: {}; } - -tests/test.ts:xyz(3); - -Expected type - (v2: Y, v3: Z) => ({ x: number; y: Y; z: Z; }) -but got: - CurriedFunction2<{}, {}, { x: {}; y: {}; z: {}; }> - -tests/test.ts:curriedFourNumbers(1)(2)(3); - -Expected type - (v1: T1) => R -but got: - (v2: number) => number - -tests/test.ts:curriedFourNumbers(1,2,4); - -Expected type - (v1: T1) => R -but got: - (v4: number) => number - -tests/test.ts:R.nAry(0, takesNoArg); - -Expected type - () => boolean -but got: - Variadic - -tests/test.ts:R.nAry(0, takesOneArg); - -Expected type - () => number[] -but got: - Variadic - -tests/test.ts:R.nAry(1, takesTwoArgs); - -Expected type - (a: number) => number[] -but got: - Variadic - -tests/test.ts:R.nAry(1, takesThreeArgs); - -Expected type - (a: number) => number[] -but got: - Variadic - -tests/test.ts:R.binary(takesTwoArgs); - -Expected type - (a: number, b: number) => number[] -but got: - (a: any, b: any) => number[] - -tests/test.ts:R.binary(takesThreeArgs); - -Expected type - (a: number, b: number) => number[] -but got: - (a: any, b: any) => number[] - -tests/test.ts:let addTwoNumbersCurried = R.curry(addTwoNumbers); - -Expected type - CurriedFunction2 -but got: - any - -tests/test.ts:const coerceArray = R.unless(R.isArrayLike, R.of); - -Expected type - (v: a|[a]) => [a] -but got: - any - -tests/test.ts:coerceArray([1, 2, 3]); - -Expected type - number[] -but got: - any[] - -tests/test.ts:coerceArray(1); - -Expected type - number[] -but got: - any[] - -tests/test.ts:R.nthArg(1)('a', 'b', 'c'); - -Expected type - string -but got: - "a" | "b" | "c" - -tests/test.ts:R.nthArg(-1)('a', 'b', 'c'); - -Expected type - string -but got: - "a" | "b" | "c" - -tests/test.ts:R.unapply(JSON.stringify); - -Expected type - (...args: string[])=>string -but got: - Variadic - -tests/test.ts:const g = R.compose(g3, g2, g1, g0); - -Expected type - (list: number[]) => boolean -but got: - any - -tests/test.ts:const capitalize = (str: string) => R.pipe( - R.split(''), - R.adjust(R.toUpper, 0), - R.join('') - )(str); - -Expected type - string -but got: - any - -tests/test.ts:R.pipe(R.identity, double); - -Expected type - (x0: number) => number -but got: - (x0: {}) => number - -tests/test.ts: Unexpected error - 'Promise' only refers to a type, but is being used as a value here. - -tests/test.ts: Unexpected error - 'Promise' only refers to a type, but is being used as a value here. - -tests/test.ts:R.invoker(0, 'toUpperCase', 'foo'); - -Expected type - string -but got: - {} - -tests/test.ts:R.invoker(1, 'charAt', 'foo', 1); - -Expected type - string -but got: - {} - -tests/test.ts:chopped('longstring'); - -Expected type - string[] -but got: - ({} | undefined)[] - -tests/test.ts:R.clone([{},{},{}]); - -Expected type - Object[] -but got: - {}[] - -tests/test.ts:R.reduceRight(flattenPairs, [], pairs); - -Expected type - Array -but got: - [string, number] - -tests/test.ts:R.empty('unicorns'); - -Expected type - string -but got: - "unicorns" - -tests/test.ts:R.empty({x: 1, y: 2}); - -Expected type - {} -but got: - { x: number; y: number; } - -tests/test.ts:filterIndexed(lastTwo, [8, 6, 7, 5, 3, 0, 9]); - -Expected type - number[] -but got: - any[] - -tests/test.ts:R.unfold(f, 10); - -Expected type - number[] -but got: - TResult[] - -tests/test.ts: Unexpected error - Argument of type '(n: number) => false | number[]' is not assignable to parameter of type '(seed: number) => false | [{}, number]'. - Type 'false | number[]' is not assignable to type 'false | [{}, number]'. - Type 'number[]' is not assignable to type 'false | [{}, number]'. - Type 'number[]' is not assignable to type '[{}, number]'. - -tests/test.ts:b(10); - -Expected type - number[] -but got: - TResult[] - -tests/test.ts:let peopleByYoungestFirst = R.sort(byAge, people); - -Expected type - typeof people -but got: - any - -tests/test.ts:R.append(['tests'], ['write', 'more']); - -Expected type - Array -but got: - (string & string[])[] - -tests/test.ts:R.append(['tests'], ['write', 'more']); - -Expected type - Array -but got: - (string & string[])[] - -tests/test.ts:R.append(['tests'])(['write', 'more']); - -Expected type - Array -but got: - (string & string[])[] - -tests/test.ts:R.append(['tests'])(['write', 'more']); - -Expected type - Array -but got: - (string & string[])[] - -tests/test.ts:R.chain(R.append, R.head)([1, 2, 3]); - -Expected type - number[] -but got: - any - -tests/test.ts:R.chain(R.append)(R.head)([1, 2, 3]); - -Expected type - number[] -but got: - any - -tests/test.ts:R.clamp(1, 10, -1); - -Expected type - number -but got: - 1 | -1 | 10 - -tests/test.ts:R.clamp('a', 'd', 'e'); - -Expected type - string -but got: - "a" | "d" | "e" - -tests/test.ts:let peopleByOldestFirst = R.sort(byAge, people); - -Expected type - typeof people -but got: - any - -tests/test.ts:R.drop(3)([1,2,3,4,5,6,7]); - -Expected type - number[] -but got: - List - -tests/test.ts:R.drop(3, 'ramda'); - -Expected type - string -but got: - "ramda" - -tests/test.ts:R.drop(3)('ramda'); - -Expected type - string -but got: - List - -tests/test.ts:R.dropLast(2)(['foo', 'bar', 'baz']); - -Expected type - string[] -but got: - List - -tests/test.ts:R.dropLast(3, 'ramda'); - -Expected type - string -but got: - "ramda" - -tests/test.ts:R.dropLast(3)('ramda'); - -Expected type - string -but got: - List - -tests/test.ts:R.filter(isEven, {a: 1, b: 2, c: 3, d: 4}); - -Expected type - Dictionary -but got: - Partial<{ a: number; b: number; c: number; d: number; }> - -tests/test.ts:onlyNumberObj(R.filter(isEven, {a: 1, b: 2, c: 3, d: 4})); - -Expected type - Dictionary -but got: - { [key: string]: number; } - -tests/test.ts:filterIndexed(lastTwo, [8, 6, 7, 5, 3, 0, 9]); - -Expected type - number[] -but got: - any[] - -tests/test.ts:lastTwoFn([8, 6, 7, 5, 3, 0, 9]); - -Expected type - number[] -but got: - any[] - -tests/test.ts:R.find(R.propEq('a', 2))(xs); - -Expected type - Dictionary -but got: - {} - -tests/test.ts:R.find(R.propEq('a', 4))(xs); - -Expected type - undefined -but got: - {} - -tests/test.ts:R.findLast(R.propEq('a', 1))(xs); - -Expected type - Dictionary -but got: - {} - -tests/test.ts:R.findLast(R.propEq('a', 4))(xs); - -Expected type - undefined -but got: - {} - -tests/test.ts:R.findLastIndex((x: number) => x === 1, [1, 2, 3]); - -Expected type - number[] -but got: - number - -tests/test.ts:R.filter(isFamous, users); - -Expected type - Object[] -but got: - any[] - -tests/test.ts:R.forEachObjIndexed(printKeyConcatValue, {x: 1, y: 2}); - -Expected type - {x: 1, y: 2} -but got: - { x: number; y: number; } - -tests/test.ts:R.forEachObjIndexed(printKeyConcatValue)({x: 1, y: 2}); - -Expected type - {x: 1, y: 2} -but got: - any - -tests/test.ts:R.forEachObjIndexed(printKeyConcatValue, [1, 2]); - -Expected type - [1, 2] -but got: - number[] - -tests/test.ts:R.forEachObjIndexed(printKeyConcatValue)([1, 2]); - -Expected type - [1, 2] -but got: - any - -tests/test.ts:R.addIndex(R.forEach)(plusFive)([1, 2, 3]); - -Expected type - number[] -but got: - any[] - -tests/test.ts:byGrade(students); - -Expected type - Dictionary -but got: - Dictionary<{ score: number; name: string; }[]> - -tests/test.ts:R.head(['fi', 'fo', 'fum']); - -Expected type - string -but got: - string | undefined - -tests/test.ts:R.head([10, 'ten']); - -Expected type - number -but got: - string | number | undefined - -tests/test.ts:R.head(['10', 10]); - -Expected type - string -but got: - string | number | undefined - -tests/test.ts:R.indexBy(R.prop('id'), list); - -Expected type - Dictionary -but got: - Dictionary> - -tests/test.ts:R.indexBy(R.prop('id'))(list); - -Expected type - Dictionary -but got: - Dictionary> - -tests/test.ts:R.indexBy<{id: string}>(R.prop('id'))(list); - -Expected type - Dictionary -but got: - Dictionary<{ id: string; }> - -tests/test.ts:R.intersectionWith(R.eqBy(R.prop('id')), buffaloSpringfield, csny); - -Expected type - { id: number, name: string }[] -but got: - any[] - -tests/test.ts:R.intersectionWith(R.eqBy(R.prop('id')), buffaloSpringfield, csny); - -Expected type - { id: number, name: string }[] -but got: - any[] - -tests/test.ts:R.intersectionWith(R.eqBy(R.prop('id')))(buffaloSpringfield, csny); - -Expected type - { id: number, name: string }[] -but got: - any[] - -tests/test.ts:R.intersectionWith(R.eqBy(R.prop('id')))(buffaloSpringfield)(csny); - -Expected type - { id: number, name: string }[] -but got: - any[] - -tests/test.ts:R.last(['fi', 'fo', 'fum']); - -Expected type - string -but got: - {} | undefined - -tests/test.ts:headLens([10, 20, 30, 40]); - -Expected type - number -but got: - {} - -tests/test.ts:headLens.set('mu', [10, 20, 30, 40]); - -Expected type - Array -but got: - number[] - -tests/test.ts:R.view(headLens, ['a', 'b', 'c']); - -Expected type - string -but got: - {} - -tests/test.ts:R.set(headLens, 'x', ['a', 'b', 'c']); - -Expected type - string[] -but got: - any - -tests/test.ts:R.map(double)([1, 2, 3]); - -Expected type - number[] -but got: - Functor - -tests/test.ts:R.map(arrayify, [1, 'a']); - -Expected type - [number[], string[]] -but got: - {}[][] - -tests/test.ts:R.map(arrayify)([1, 'a']); - -Expected type - [number[], string[]] -but got: - Functor<{}[]> - -tests/test.ts:R.map(arrayify, { a: 1, b: 'c' }); - -Expected type - { a: number[], b: string[] } -but got: - Dictionary<{}[]> - -tests/test.ts:R.map(arrayify)({ a: 1, b: 'c' }); - -Expected type - { a: number[], b: string[] } -but got: - Dictionary<{}[]> - -tests/test.ts:R.mapAccum(append, '0', digits); - -Expected type - Array -but got: - [string, string[]] - -tests/test.ts:R.mapAccum(append)('0', digits); - -Expected type - Array -but got: - [string, string[]] - -tests/test.ts:R.mapAccum(append, '0')(digits); - -Expected type - Array -but got: - [string, string[]] - -tests/test.ts:R.mapAccum(append)('0')(digits); - -Expected type - Array -but got: - [string, string[]] - -tests/test.ts:R.mapAccumRight(append, '0', digits); - -Expected type - Array -but got: - [string[], string] - -tests/test.ts:R.mapAccumRight(append)('0', digits); - -Expected type - Array -but got: - [string[], string] - -tests/test.ts:R.mapAccumRight(append, '0')(digits); - -Expected type - Array -but got: - [string[], string] - -tests/test.ts:R.mapAccumRight(append)('0')(digits); - -Expected type - Array -but got: - [string[], string] - -tests/test.ts:R.addIndex(R.map)(squareEnds, [8, 5, 3, 0, 9]); - -Expected type - number[] -but got: - any[] - -tests/test.ts:R.addIndex(R.map)(squareEnds)([8, 5, 3, 0, 9]); - -Expected type - number[] -but got: - any[] - -tests/test.ts:R.nth(1, list); - -Expected type - string -but got: - string | undefined - -tests/test.ts:R.nth(-1, list); - -Expected type - string -but got: - string | undefined - -tests/test.ts:R.nth(-99, list); - -Expected type - undefined -but got: - string | undefined - -tests/test.ts:R.nth(-99)(list); - -Expected type - undefined -but got: - string | undefined - -tests/test.ts:R.partition(R.contains('s'),{ a: 'sss', b: 'ttt', foo: 'bars' }); - -Expected type - Object[] -but got: - [Dictionary, Dictionary] - -tests/test.ts:R.pluck(0, [[1, 2], [3, 4]]); - -Expected type - number[] -but got: - {}[] - -tests/test.ts:R.pluck('a')([{a: 1}, {a: 2}]); - -Expected type - number[] -but got: - {}[] - -tests/test.ts:R.pluck(0)([[1, 2], [3, 4]]); - -Expected type - number[] -but got: - {}[] - -tests/test.ts:namesByGrade(students); - -Expected type - Dictionary -but got: - string[] - -tests/test.ts:reduceIndexed(objectify, {}, letters); - -Expected type - Dictionary -but got: - any - -tests/test.ts:reduceIndexed(objectify)({}, letters); - -Expected type - Dictionary -but got: - any - -tests/test.ts:reduceIndexed(objectify, {})(letters); - -Expected type - Dictionary -but got: - any - -tests/test.ts:R.reduceRight(flattenPairs, [], pairs); - -Expected type - Array -but got: - KeyValuePair[] - -tests/test.ts:R.reduceRight(flattenPairs, [])(pairs); - -Expected type - Array -but got: - KeyValuePair[] - -tests/test.ts:R.reduceRight(flattenPairs)([], pairs); - -Expected type - Array -but got: - KeyValuePair[] - -tests/test.ts:rejectIndexed(lastTwo, [8, 6, 7, 5, 3, 0, 9]); - -Expected type - number[] -but got: - any[] - -tests/test.ts:rejectIndexed(lastTwo)([8, 6, 7, 5, 3, 0, 9]); - -Expected type - number[] -but got: - any[] - -tests/test.ts:R.reverse([]); - -Expected type - number[] -but got: - never[] - -tests/test.ts:R.take(3,'Example'); - -Expected type - string -but got: - "Example" - -tests/test.ts:takeThree('Example'); - -Expected type - string -but got: - "Example" - -tests/test.ts:R.takeLast(3, 'ramda'); - -Expected type - string -but got: - "ramda" - -tests/test.ts:R.takeLast(3)('ramda'); - -Expected type - string -but got: - "ramda" - -tests/test.ts:R.transduce(transducer, fn, [] as number[], numbers); - -Expected type - number[] -but got: - number | undefined - -tests/test.ts:R.transduce(transducer, fn, [] as number[])(numbers); - -Expected type - number[] -but got: - number | undefined - -tests/test.ts:R.transduce(transducer, fn)([] as number[], numbers); - -Expected type - number[] -but got: - number | undefined - -tests/test.ts:R.transduce(transducer)(fn, [] as number[], numbers); - -Expected type - number[] -but got: - number | undefined - -tests/test.ts:R.transpose([[1, 'a'], [2, 'b'], [3, 'c']]); - -Expected type - any[][] -but got: - Index[][] - -tests/test.ts:R.uniq([{}, {}]); - -Expected type - Object[] -but got: - {}[] - -tests/test.ts:R.uniq([1, '1']); - -Expected type - any[] -but got: - Index[] - -tests/test.ts:R.uniqWith(strEq, [1, '1', 2, 1]); - -Expected type - number[] -but got: - any[] - -tests/test.ts:R.uniqWith(strEq)([1, '1', 2, 1]); - -Expected type - number[] -but got: - any[] - -tests/test.ts:R.uniqWith(strEq)([{}, {}]); - -Expected type - Object[] -but got: - any[] - -tests/test.ts:R.uniqWith(strEq)([1, '1', 1]); - -Expected type - number[] -but got: - any[] - -tests/test.ts:R.uniqWith(strEq)(['1', 1, 1]); - -Expected type - string[] -but got: - any[] - -tests/test.ts:R.xprod([1, 2], ['a', 'b']); - -Expected type - [number, string][] -but got: - KeyValuePair[] - -tests/test.ts:R.xprod([1, 2])(['a', 'b']); - -Expected type - [number, string][] -but got: - KeyValuePair[] - -tests/test.ts:R.zip([1, 2, 3], ['a', 'b', 'c']); - -Expected type - [number, string][] -but got: - KeyValuePair[] - -tests/test.ts:R.zip([1, 2, 3])(['a', 'b', 'c']); - -Expected type - [number, string][] -but got: - KeyValuePair[] - -tests/test.ts:R.zipWith(f, [1, 2, 3], ['a', 'b', 'c']); - -Expected type - any[] -but got: - void[] - -tests/test.ts:R.zipWith(f)([1, 2, 3], ['a', 'b', 'c']); - -Expected type - any[] -but got: - void[] - -tests/test.ts:R.zipWith(f, [1, 2, 3])(['a', 'b', 'c']); - -Expected type - any[] -but got: - void[] - -tests/test.ts:R.assoc('c', 3, {a: 1, b: 2}); - -Expected type - Dictionary -but got: - { a: number; b: number; } - -tests/test.ts:R.assoc('c')(3, {a: 1, b: 2}); - -Expected type - Dictionary -but got: - Struct<{}> - -tests/test.ts:R.assoc('c', 3)({a: 1, b: 2}); - -Expected type - Dictionary -but got: - { a: number; b: number; } - -tests/test.ts:R.dissoc<{a: number, c: number}>('b', {a: 1, b: 2, c: 3}); - -Expected type - Dictionary -but got: - { a: number; c: number; } - -tests/test.ts:R.dissoc('b', {a: 1, b: 2, c: 3}); - -Expected type - Dictionary -but got: - {} - -tests/test.ts:R.dissoc('b')<{a: number, c: number}>({a: 1, b: 2, c: 3}); - -Expected type - Dictionary -but got: - { a: number; c: number; } - -tests/test.ts:R.assocPath(['a', 'b', 'c'], 42, {a: {b: {c: 0}}}); - -Expected type - {a: {b: {c: number}}} -but got: - { a: { b: { c: number; }; }; } - -tests/test.ts:R.assocPath(['a', 'b', 'c'])(42, {a: {b: {c: 0}}}); - -Expected type - {a: {b: {c: number}}} -but got: - { a: { b: { c: number; }; }; } - -tests/test.ts:R.assocPath(['a', 'b', 'c'], 42)({a: {b: {c: 0}}}); - -Expected type - {a: {b: {c: number}}} -but got: - { a: { b: { c: number; }; }; } - -tests/test.ts:R.dissocPath(['a', 'b', 'c'], {a: {b: {c: 42}}}); - -Expected type - {a: {b: {}}} -but got: - {} - -tests/test.ts:R.dissocPath<{a : { b: number}}>(['a', 'b', 'c'], {a: {b: {c: 42}}}); - -Expected type - {a: {b: {}}} -but got: - { a: { b: number; }; } - -tests/test.ts:R.dissocPath(['a', 'b', 'c'])({a: {b: {c: 42}}}); - -Expected type - {a: {b: {}}} -but got: - {} - -tests/test.ts:R.clone(obj1); - -Expected type - any[] -but got: - {}[] - -tests/test.ts:R.clone(obj2); - -Expected type - {a: number}[] -but got: - { a: number; }[] - -tests/test.ts:R.clone({}); - -Expected type - Object -but got: - {} - -tests/test.ts:R.eqProps('c'); - -Expected type - {(obj1: T, obj2: U): boolean} -but got: - { (obj1: T, obj2: U): boolean; (obj1: T): (obj2: U) => boolean; } - -tests/test.ts:R.eqProps('c', o1); - -Expected type - {(obj2: U): boolean} -but got: - (obj2: U) => boolean - -tests/test.ts:const a: typeof tomato = R.evolve(transformations, tomato); - -Expected type - typeof tomato -but got: - any - -tests/test.ts:const b: typeof tomato = R.evolve(transformations)(tomato); - -Expected type - typeof tomato -but got: - any - -tests/test.ts:R.invert(raceResultsByFirstName); - -Expected type - Dictionary -but got: - Dictionary> - -tests/test.ts:R.set(xLens, 4, {x: 1, y: 2}); - -Expected type - { x: number, y: number } -but got: - any - -tests/test.ts:R.set(xLens)(4, {x: 1, y: 2}); - -Expected type - { x: number, y: number } -but got: - any - -tests/test.ts:R.set(xLens, 4)({x: 1, y: 2}); - -Expected type - { x: number, y: number } -but got: - any - -tests/test.ts:R.over(xLens, R.negate, {x: 1, y: 2}); - -Expected type - { x: number, y: number } -but got: - { x: number; y: number; } - -tests/test.ts:R.over(xLens, R.negate)({x: 1, y: 2}); - -Expected type - { x: number, y: number } -but got: - {} - -tests/test.ts:R.over(xLens)(R.negate, {x: 1, y: 2}); - -Expected type - { x: number, y: number } -but got: - {} - -tests/test.ts:R.view(headLens, ['a', 'b', 'c']); - -Expected type - string -but got: - {} - -tests/test.ts:R.set(headLens, 'x', ['a', 'b', 'c']); - -Expected type - string[] -but got: - any - -tests/test.ts:R.view(xLens, {x: 1, y: 2}); - -Expected type - number -but got: - {} - -tests/test.ts:R.set(xLens, 4, {x: 1, y: 2}); - -Expected type - Dictionary -but got: - any - -tests/test.ts:R.over(xLens, R.negate, {x: 1, y: 2}); - -Expected type - Dictionary -but got: - { x: number; y: number; } - -tests/test.ts:R.view(xyLens, {x: {y: 2, z: 3}}); - -Expected type - number -but got: - {} - -tests/test.ts:R.set(xyLens, 4, {x: {y: 2, z: 3}}); - -Expected type - { [s: string]: { [s: string]: number } } -but got: - any - -tests/test.ts:R.over(xyLens, R.negate, {x: {y: 2, z: 3}}); - -Expected type - { [s: string]: { [s: string]: number } } -but got: - { x: { y: number; z: number; }; } - -tests/test.ts:phraseLens(obj1); - -Expected type - string -but got: - any - -tests/test.ts:phraseLens(obj2); - -Expected type - string -but got: - any - -tests/test.ts:phraseLens.set('Ooh Betty', obj1); - -Expected type - Dictionary -but got: - { phrase: string; } - -tests/test.ts:phraseLens(obj1); - -Expected type - string -but got: - {} - -tests/test.ts:phraseLens(obj2); - -Expected type - string -but got: - {} - -tests/test.ts:phraseLens.set('Ooh Betty', obj1); - -Expected type - Dictionary -but got: - { phrase: string; } - -tests/test.ts:R.merge({ 'name': 'fred', 'age': 10 }, { 'age': 40 }); - -Expected type - Dictionary -but got: - { 'name': string; 'age': number; } & { 'age': number; } - -tests/test.ts:resetToDefault({x: 5, y: 2}); - -Expected type - Dictionary -but got: - any - -tests/test.ts:R.mergeAll([{foo: 1},{bar: 2},{baz: 3}]); - -Expected type - Dictionary -but got: - {} - -tests/test.ts:R.mergeAll([{foo: 1},{foo: 2},{bar: 2}]); - -Expected type - Dictionary -but got: - {} - -tests/test.ts:R.mergeWith(R.concat, - { a: true, values: [10, 20] }, - { b: true, values: [15, 35] }); - -Expected type - { a: boolean, b: boolean, values: number[] } -but got: - { a: boolean; values: number[]; } & { b: boolean; values: number[]; } - -tests/test.ts:merge({ a: true, thing: 'foo', values: [10, 20] }, { b: true, thing: 'bar', values: [15, 35] }); - -Expected type - { a: boolean, b: boolean, values: number[], thing: string } -but got: - { a: boolean; thing: string; values: number[]; } & { b: boolean; thing: string; values: number[]; } - -tests/test.ts:R.pathOr('N/A', ['a', 'b'], {a: {b: 2}}); - -Expected type - number -but got: - any - -tests/test.ts:R.pathOr('N/A', ['a', 'b'])({a: {b: 2}}); - -Expected type - number -but got: - any - -tests/test.ts:R.pathOr('N/A', ['a', 'b'], {c: {b: 2}}); - -Expected type - number -but got: - any - -tests/test.ts:R.pathOr({c: 2})(['a', 'b'], {c: {b: 2}}); - -Expected type - number -but got: - any - -tests/test.ts:R.pickBy(isPositive, {a: 1, b: 2, c: -1, d: 0, e: 5}); - -Expected type - Dictionary -but got: - Partial<{ a: number; b: number; c: number; d: number; e: number; }> - -tests/test.ts:R.pickBy(containsBackground, colors); - -Expected type - { 2: R.Dictionary } -but got: - Partial<{ 1: { color: string; }; 2: { color: string; bgcolor: string; }; }> - -tests/test.ts:R.pickBy(isUpperCase, {a: 1, b: 2, A: 3, B: 4}); - -Expected type - Dictionary -but got: - Partial<{ a: number; b: number; A: number; B: number; }> - -tests/test.ts:R.pick(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); - -Expected type - Dictionary -but got: - { a: number; b: number; c: number; d: number; } - -tests/test.ts:let no1 = R.pick(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); - -Expected error not keys - -tests/test.ts:let no2 = R.pick(['a', 'e', 'f'])({a: 1, b: 2, c: 3, d: 4}); - -Expected error not keys - -tests/test.ts:let no3 = R.pick(['a', 'e', 'f'], [1, 2, 3, 4]); - -Expected error not keys - -tests/test.ts:matchPhrases(['foo', 'bar', 'baz']); - -Expected type - { must: { match_phrase: string }[] } -but got: - Dictionary<{}> - -tests/test.ts:R.omit(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); - -Expected type - Dictionary -but got: - { a: number; b: number; c: number; d: number; } - -tests/test.ts:R.omit(['a', 'd'])({a: 1, b: 2, c: 3, d: 4}); - -Expected type - Dictionary -but got: - { a: number; b: number; c: number; d: number; } - -tests/test.ts:R.pickAll(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); - -Expected type - Dictionary -but got: - Partial<{ a: number; b: number; c: number; d: number; }> - -tests/test.ts:R.pickAll(['a', 'd'])({a: 1, b: 2, c: 3, d: 4}); - -Expected type - Dictionary -but got: - Partial<{}> - -tests/test.ts:R.pickAll(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); - -Expected type - Dictionary -but got: - Partial<{ a: number; b: number; c: number; d: number; }> - -tests/test.ts:R.pickAll(['a', 'e', 'f'])({a: 1, b: 2, c: 3, d: 4}); - -Expected type - Dictionary -but got: - Partial<{}> - -tests/test.ts:R.pickBy(isUpperCase, {a: 1, b: 2, A: 3, B: 4}); - -Expected type - Dictionary -but got: - Partial<{ a: number; b: number; A: number; B: number; }> - -tests/test.ts:R.project(['name', 'grade'], kids); - -Expected type - { name: string, grade: number }[] -but got: - Pick<{ name: string; age: number; hair: string; grade: number; }, "name" | "grade">[] - -tests/test.ts:R.prop('x', {}); - -Expected error Argument of type 'x' is not assignable to parameter of type 'never'. - -tests/test.ts:favorite(alice); - -Expected type - undefined -but got: - {} - -tests/test.ts:favoriteWithDefault(alice); - -Expected type - string -but got: - any - -tests/test.ts:R.props(['c', 'a', 'b'], {b: 2, a: 1}); - -Expected type - Array -but got: - number[] - -tests/test.ts:R.toPairsIn(f); - -Expected type - [string, string][] -but got: - [string, any][] - -tests/test.ts:R.toPairsIn(f); - -Expected type - [string, string][] -but got: - [string, any][] - -tests/test.ts:R.valuesIn(f); - -Expected type - string[] -but got: - any[] - -tests/test.ts:R.filter(R.where({x: 10}), xs); - -Expected type - { x: number, y: number }[] -but got: - {}[] - -tests/test.ts:R.filter(R.where({x: 10}))(xs); - -Expected type - { x: number, y: number }[] -but got: - {}[] - -tests/test.ts:let pred = R.whereEq({a: 1, b: 2}); - -Expected type - (v: Object) => Boolean -but got: - any - -tests/test.ts: Unexpected error - Argument of type '{ (fn: (x: T) => U, list: List): U[]; >(fn: (value: T) => ...' is not assignable to parameter of type '(f: (acc: string, item: string) => string, aci: string, list: List) => string'. - Type 'any[]' is not assignable to type 'string'. - -tests/test.ts:mapIndexed(function(val: string, idx: number) {return idx + '-' + val;})(['f', 'o', 'o', 'b', 'a', 'r']); - -Expected type - string[] -but got: - (v2: List) => string - -tests/test.ts:reduceIndexed( - (acc: string, val: string, idx: number) => acc + ',' + idx + '-' + val - ,'' - ,['f', 'o', 'o', 'b', 'a', 'r'] - ); - -Expected type - string[] -but got: - any - -tests/test.ts:R.sort(cmp, people); - -Expected type - { age: number, name: string }[] -but got: - T[] - -tests/test.ts:R.compose(double, R.identity); - -Expected type - (x0: number) => number -but got: - (x0: {}) => number - -tests/test.ts:circleN(1, 'red'); - -Expected type - circle -but got: - any - -tests/test.ts:circle(1, 'red'); - -Expected type - circle -but got: - any - -tests/test.ts:R.differenceWith(cmp, l1, l2); - -Expected type - {a: number}[] -but got: - any[] - -tests/test.ts:R.differenceWith(cmp)(l1, l2); - -Expected type - {a: number}[] -but got: - any[] - -tests/test.ts:R.differenceWith(cmp)(l1)(l2); - -Expected type - {a: number}[] -but got: - any[] - -tests/test.ts:R.path(['a', 'b'])({a: {b: 2}}); - -Expected type - number -but got: - {} | undefined - -tests/test.ts:sortByNameCaseInsensitive(people); - -Expected type - { name: string, age: number }[] -but got: - Struct[] - -tests/test.ts:R.sortWith([ - R.descend(R.prop('age')), - R.ascend(R.prop('name')) - ], people); - -Expected type - typeof people -but got: - Struct[] - -tests/test.ts:ageNameSort(people); - -Expected type - typeof people -but got: - Struct[] - -tests/test.ts:R.splitAt(5, 'hello world'); - -Expected type - string[] -but got: - [string, string] - -tests/test.ts:R.splitAt(-1, 'foobar'); - -Expected type - string[] -but got: - [string, string] - -tests/test.ts:R.max(7, 3); - -Expected type - number -but got: - 3 | 7 - -tests/test.ts:R.max('a', 'z'); - -Expected type - string -but got: - "a" | "z" - -tests/test.ts:R.min(9, 3); - -Expected type - number -but got: - 3 | 9 - -tests/test.ts:R.min('a', 'z'); - -Expected type - string -but got: - "a" | "z" - -tests/test.ts:R.minBy(cmp, a, b); - -Expected type - { x: number } -but got: - { x: number; } - -tests/test.ts:R.minBy(cmp)(a, b); - -Expected type - { x: number } -but got: - { x: number; } - -tests/test.ts:R.minBy(cmp)(a)(c); - -Expected type - { x: number } -but got: - { x: number; } - -tests/test.ts:R.minBy(cmp, d, e); - -Expected error - Argument of type '{ x: string; }' is not assignable to parameter of type '{ x: number; }' -but got: - The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. - Type argument candidate '{ x: string; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; }'. - Types of property 'x' are incompatible. - Type 'number' is not assignable to type 'string'. - -tests/test.ts:R.symmetricDifferenceWith(eqA, l1, l2); - -Expected type - { a: number }[] -but got: - any[] - -tests/test.ts:R.symmetricDifferenceWith(eqA)(l1, l2); - -Expected type - { a: number }[] -but got: - any[] - -tests/test.ts:R.symmetricDifferenceWith(eqA)(l1); - -Expected type - (a: any[]) => any[] -but got: - (list2: List) => any[] - -tests/test.ts:R.and(0, []); - -Expected type - number -but got: - boolean - -tests/test.ts:R.and(0)([]); - -Expected type - number -but got: - boolean - -tests/test.ts:R.and(null, ''); - -Expected type - null -but got: - boolean - -tests/test.ts:defaultTo42(null); - -Expected type - number -but got: - number | null - -tests/test.ts:defaultTo42(undefined); - -Expected type - number -but got: - number | undefined - -tests/test.ts:defaultTo42('Ramda'); - -Expected type - string -but got: - number | "Ramda" - -tests/test.ts:flattenArrays([[0], [[10], [8]], 1234, {}]); - -Expected type - any[] -but got: - Dictionary - -tests/test.ts:flattenArrays([[[10], 123], [8, [10]], 'hello']); - -Expected type - any[] -but got: - Dictionary - -tests/test.ts:R.or(0, []); - -Expected type - number|any[] -but got: - 0 | never[] - -tests/test.ts:R.or(0)([]); - -Expected type - number|any[] -but got: - number | never[] - -tests/test.ts:R.or(null, ''); - -Expected type - string -but got: - "" | null - -tests/test.ts:R.or(why, false); - -Expected type - Why|boolean -but got: - false | Why - -tests/test.ts:R.evolve({ a: R.add(1)}, test ); - -Expected type - { a: number, b: number } -but got: - { a: number; b: number; } - -tests/test.ts: Unexpected error - Type '{}[]' is not assignable to type 'number[]'. - Type '{}' is not assignable to type 'number'. - -tests/test.ts:R.pipe(R.append('a'), R.uniq)(['a', 'b', 'c']); - -Expected type - string[] -but got: - ({} & string)[] - -tests/test.ts: Unexpected error - Argument of type '(x0: any) => {}' is not assignable to parameter of type 'UnknownLens | ManualLens<{}> | Lens'. - Type '(x0: any) => {}' is not assignable to type 'Lens'. - Property 'set' is missing in type '(x0: any) => {}'. - -tests/test.ts:updateBy((n: number) => n > 1, 0, [1,2,3]); - -Expected type - number[] -but got: - {}[] - -tests/test.ts:R.fromPairs ([['1','A'], ['2','B'], ['3','C']]); - -Expected type - { [index: string]: string } -but got: - Dictionary - -tests/test.ts:R.fromPairs (pairs); - -Expected type - { [index: string]: string } -but got: - Dictionary - -tests/test.ts:R.pipe (R.fromPairs)([['1','A'], ['2','B'], ['3','C']]); - -Expected type - { [index: string]: string } -but got: - Dictionary<{}> - -tests/test.ts:R.compose(R.fromPairs)([['1','A'], ['2','B'], ['3','C']]); - -Expected type - { [index: string]: string } -but got: - Dictionary<{}> - -tests/test.ts: Unexpected error - Argument of type 'CurriedFunction2<{}, Struct<{}>, Struct<{}>>' is not assignable to parameter of type '(some: string) => (x: number) => 1'. - Type '(v2: Struct<{}>) => Struct<{}>' is not assignable to type '(x: number) => 1'. - Types of parameters 'v2' and 'x' are incompatible. - Type 'number' is not assignable to type 'Struct<{}>'. - -tests/test.ts: Unexpected error - Argument of type 'CurriedFunction2<{}, Struct<{}>, Struct<{}>>' is not assignable to parameter of type '(some: string, other: string) => "1"'. - Type '(v2: Struct<{}>) => Struct<{}>' is not assignable to type '"1"'. - -tests/test.ts:const x = R.cond([ - [R.F, R.F], - [R.T, R.identity] - ]); - -Expected type - (v: T) => T -but got: - any - -tests/test.ts:R.pipe (R.inc, x); - -Expected type - (v: number) => number -but got: - (x0: number) => {} - -tests/test.ts:R.compose(x, R.inc); - -Expected type - (v: number) => number -but got: - (x0: number) => {} - -tests/test.ts:compF1(1); - -Expected type - number -but got: - {} - -tests/test.ts: Unexpected error - Type 'Struct' is not assignable to type 'SomeStruct'. - Type 'number[][]' is not assignable to type 'SomeStruct'. - Property 'a' is missing in type 'number[][]'. - -tests/test.ts:R.flatten([1, 2, [3, 4], 5, [6, [7, 8, [9, [10, 11], 12]]]]); - -Expected type - number[] -but got: - (number | (number | (number | (number | number[])[])[])[])[] - -tests/test.ts:R.path(['a', 'b', 'c'], {a: {b: 2}}); - -Expected type - null -but got: - { b: number; } - -tests/test.ts: 450 / 725 checks passed. diff --git a/tests/times.ts b/tests/times.ts new file mode 100644 index 0000000..80d26e8 --- /dev/null +++ b/tests/times.ts @@ -0,0 +1,9 @@ +import * as R_times from '../ramda/dist/src/times'; + +declare const number_to_object: (x: number) => object; +declare const number: number; + +// @dts-jest:pass +R_times(number_to_object); +// @dts-jest:pass +R_times(number_to_object, number); diff --git a/tests/toLower.ts b/tests/toLower.ts new file mode 100644 index 0000000..018afa2 --- /dev/null +++ b/tests/toLower.ts @@ -0,0 +1,6 @@ +import * as R_toLower from '../ramda/dist/src/toLower'; + +declare const string: string; + +// @dts-jest:pass +R_toLower(string); diff --git a/tests/toPairs.ts b/tests/toPairs.ts new file mode 100644 index 0000000..7cc25dc --- /dev/null +++ b/tests/toPairs.ts @@ -0,0 +1,13 @@ +import * as R_toPairs from '../ramda/dist/src/toPairs'; + +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; +declare const string_number_record: Record; + +// @dts-jest:pass +R_toPairs(a_1_b_2_c_3); +// @dts-jest:pass +R_toPairs(string_number_record); diff --git a/tests/toPairsIn.ts b/tests/toPairsIn.ts new file mode 100644 index 0000000..980fd53 --- /dev/null +++ b/tests/toPairsIn.ts @@ -0,0 +1,13 @@ +import * as R_toPairsIn from '../ramda/dist/src/toPairsIn'; + +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; +declare const string_number_record: Record; + +// @dts-jest:pass +R_toPairsIn(a_1_b_2_c_3); +// @dts-jest:pass +R_toPairsIn(string_number_record); diff --git a/tests/toString.ts b/tests/toString.ts new file mode 100644 index 0000000..c00497e --- /dev/null +++ b/tests/toString.ts @@ -0,0 +1,9 @@ +import * as R_toString from '../ramda/dist/src/toString'; + +declare const number: number; +declare const object: object; + +// @dts-jest:pass +R_toString(number); +// @dts-jest:pass +R_toString(object); diff --git a/tests/toUpper.ts b/tests/toUpper.ts new file mode 100644 index 0000000..0648b3d --- /dev/null +++ b/tests/toUpper.ts @@ -0,0 +1,6 @@ +import * as R_toUpper from '../ramda/dist/src/toUpper'; + +declare const string: string; + +// @dts-jest:pass +R_toUpper(string); diff --git a/tests/transduce.ts b/tests/transduce.ts new file mode 100644 index 0000000..e277c0d --- /dev/null +++ b/tests/transduce.ts @@ -0,0 +1,27 @@ +import { Transformer } from '../ramda/dist/src/$types'; +import * as R_transduce from '../ramda/dist/src/transduce'; + +declare const number_object_transformer_identity: ( + x: Transformer, +) => Transformer; +declare const number_array: number[]; +declare const object: object; +declare const object_number_to_object: (acc: object, val: number) => object; + +// @dts-jest:pass +R_transduce( + number_object_transformer_identity, + object_number_to_object, + object, +); +// @dts-jest:pass +R_transduce(number_object_transformer_identity)(object_number_to_object)( + object, +)(number_array); +// @dts-jest:pass +R_transduce( + number_object_transformer_identity, + object_number_to_object, + object, + number_array, +); diff --git a/tests/transpose.ts b/tests/transpose.ts new file mode 100644 index 0000000..8a0efd4 --- /dev/null +++ b/tests/transpose.ts @@ -0,0 +1,13 @@ +import { List } from '../ramda/dist/src/$types'; +import * as R_transpose from '../ramda/dist/src/transpose'; + +declare const number_array_array: number[][]; +declare const number_list_list: List>; +declare const boolean_array_array: boolean[][]; + +// @dts-jest:pass +R_transpose(number_list_list); +// @dts-jest:pass +R_transpose(number_array_array); +// @dts-jest:pass +R_transpose(boolean_array_array); diff --git a/tests/traverse.ts b/tests/traverse.ts new file mode 100644 index 0000000..c8ac4dd --- /dev/null +++ b/tests/traverse.ts @@ -0,0 +1,22 @@ +import { Applicative, Traversable } from '../ramda/dist/src/$types'; +import * as R_traverse from '../ramda/dist/src/traverse'; + +declare const number_array: number[]; +declare const number_applicative: Applicative; +declare const number_traverable: Traversable; +declare const number_to_string_applicative: (x: number) => Applicative; + +// @dts-jest:pass +R_traverse(number_applicative.of, number_to_string_applicative, number_array); +// @dts-jest:pass +R_traverse(number_applicative.of)(number_to_string_applicative)(number_array); +// @dts-jest:pass +R_traverse( + number_applicative.of, + number_to_string_applicative, + number_traverable, +); +// @dts-jest:pass +R_traverse(number_applicative.of)(number_to_string_applicative)( + number_traverable, +); diff --git a/tests/trim.ts b/tests/trim.ts new file mode 100644 index 0000000..0bda817 --- /dev/null +++ b/tests/trim.ts @@ -0,0 +1,6 @@ +import * as R_trim from '../ramda/dist/src/trim'; + +declare const string: string; + +// @dts-jest:pass +R_trim(string); diff --git a/tests/tryCatch.ts b/tests/tryCatch.ts new file mode 100644 index 0000000..343dded --- /dev/null +++ b/tests/tryCatch.ts @@ -0,0 +1,10 @@ +import * as R_tryCatch from '../ramda/dist/src/tryCatch'; + +declare const T_to_T: (x: T) => T; + +// @dts-jest:pass +R_tryCatch(T_to_T); +// @dts-jest:pass +R_tryCatch(T_to_T)(T_to_T); +// @dts-jest:pass +R_tryCatch(T_to_T, T_to_T); diff --git a/tests/tslint.json b/tests/tslint.json new file mode 100644 index 0000000..781301a --- /dev/null +++ b/tests/tslint.json @@ -0,0 +1,18 @@ +{ + "extends": "../tslint.json", + "rules": { + "deprecation": false, + "max-classes-per-file": false, + "no-inferred-empty-object-type": false, + "no-unbound-method": false, + "no-unused-expression": false, + "promise-function-async": false, + "filename-convention": [ + true, + { + "namingStyle": "camelCase", + "allowPatterns": ["^(__|T|F|ramda-tests)$"] + } + ] + } +} diff --git a/tests/type.ts b/tests/type.ts new file mode 100644 index 0000000..83c9f00 --- /dev/null +++ b/tests/type.ts @@ -0,0 +1,15 @@ +import * as R_type from '../ramda/dist/src/type'; + +declare const boolean: boolean; +declare const number: number; +declare const object: object; +declare const any: any; + +// @dts-jest:pass +R_type(boolean); +// @dts-jest:pass +R_type(number); +// @dts-jest:pass +R_type(object); +// @dts-jest:pass +R_type(any); diff --git a/tests/unapply.ts b/tests/unapply.ts new file mode 100644 index 0000000..baf111b --- /dev/null +++ b/tests/unapply.ts @@ -0,0 +1,9 @@ +import * as R_unapply from '../ramda/dist/src/unapply'; + +declare const number_array_to_string: (nums: number[]) => string; +declare const number_array: number[]; + +// @dts-jest:pass +R_unapply(number_array_to_string); +// @dts-jest:pass +R_unapply(number_array_to_string)(...number_array); diff --git a/tests/unary.ts b/tests/unary.ts new file mode 100644 index 0000000..d70060c --- /dev/null +++ b/tests/unary.ts @@ -0,0 +1,14 @@ +import { Variadic } from '../ramda/dist/src/$types'; +import * as R_unary from '../ramda/dist/src/unary'; + +declare const string_number_symbol_to_boolean: ( + a: string, + b: number, + c: symbol, +) => boolean; +declare const object_variadic: Variadic; + +// @dts-jest:pass +R_unary(string_number_symbol_to_boolean); +// @dts-jest:pass +R_unary(object_variadic); diff --git a/tests/uncurryN.ts b/tests/uncurryN.ts new file mode 100644 index 0000000..32bc54b --- /dev/null +++ b/tests/uncurryN.ts @@ -0,0 +1,32 @@ +import * as R_uncurryN from '../ramda/dist/src/uncurryN'; + +declare const string_to_object: (x: string) => object; +declare const number_boolean_to_string: (x: number, y: boolean) => string; +declare const number_args_to_boolean: (...args: number[]) => boolean; +declare const seven_string_to_number: ( + v1: string, + v2: string, + v3: string, + v4: string, + v5: string, + v6: string, + v7: string, +) => number; + +// @dts-jest:pass +R_uncurryN(0, string_to_object); +// @dts-jest:pass +R_uncurryN(1, number_boolean_to_string); +// @dts-jest:pass +R_uncurryN(4, number_args_to_boolean); +// @dts-jest:pass +R_uncurryN(7, seven_string_to_number); + +// @dts-jest:pass +R_uncurryN(0, string_to_object); +// @dts-jest:pass +R_uncurryN(1, number_boolean_to_string); +// @dts-jest:pass +R_uncurryN(4, number_args_to_boolean); +// @dts-jest:pass +R_uncurryN(7, seven_string_to_number); diff --git a/tests/unfold.ts b/tests/unfold.ts new file mode 100644 index 0000000..26a2d20 --- /dev/null +++ b/tests/unfold.ts @@ -0,0 +1,13 @@ +import * as R_unfold from '../ramda/dist/src/unfold'; + +declare const string_to_object_string_tuple_or_false: ( + x: string, +) => [object, string] | false; +declare const string: string; + +// @dts-jest:pass +R_unfold(string_to_object_string_tuple_or_false); +// @dts-jest:pass +R_unfold(string_to_object_string_tuple_or_false)(string); +// @dts-jest:pass +R_unfold(string_to_object_string_tuple_or_false, string); diff --git a/tests/union.ts b/tests/union.ts new file mode 100644 index 0000000..91122da --- /dev/null +++ b/tests/union.ts @@ -0,0 +1,8 @@ +import * as R_union from '../ramda/dist/src/union'; + +declare const number_array: number[]; + +// @dts-jest:pass +R_union(number_array); +// @dts-jest:pass +R_union(number_array, number_array); diff --git a/tests/unionWith.ts b/tests/unionWith.ts new file mode 100644 index 0000000..9974584 --- /dev/null +++ b/tests/unionWith.ts @@ -0,0 +1,9 @@ +import * as R_unionWith from '../ramda/dist/src/unionWith'; + +declare const number_number_to_boolean: (a: number, b: number) => boolean; +declare const number_array: number[]; + +// @dts-jest:pass +R_unionWith(number_number_to_boolean, number_array); +// @dts-jest:pass +R_unionWith(number_number_to_boolean, number_array, number_array); diff --git a/tests/uniq.ts b/tests/uniq.ts new file mode 100644 index 0000000..cf1155a --- /dev/null +++ b/tests/uniq.ts @@ -0,0 +1,9 @@ +import * as R_uniq from '../ramda/dist/src/uniq'; + +declare const number_array: number[]; +declare const string_array: string[]; + +// @dts-jest:pass +R_uniq(number_array); +// @dts-jest:pass +R_uniq(string_array); diff --git a/tests/uniqBy.ts b/tests/uniqBy.ts new file mode 100644 index 0000000..9f08c8a --- /dev/null +++ b/tests/uniqBy.ts @@ -0,0 +1,20 @@ +import * as R_uniqBy from '../ramda/dist/src/uniqBy'; + +declare const number_to_object: (x: number) => object; +declare const number_array: number[]; +declare const string_to_any: (x: string) => any; +declare const string_array: string[]; + +// @dts-jest:pass +R_uniqBy(number_to_object); +// @dts-jest:pass +R_uniqBy(number_to_object)(number_array); +// @dts-jest:pass +R_uniqBy(number_to_object, number_array); + +// @dts-jest:pass +R_uniqBy(string_to_any); +// @dts-jest:pass +R_uniqBy(string_to_any)(string_array); +// @dts-jest:pass +R_uniqBy(string_to_any, string_array); diff --git a/tests/uniqWith.ts b/tests/uniqWith.ts new file mode 100644 index 0000000..e49ae0c --- /dev/null +++ b/tests/uniqWith.ts @@ -0,0 +1,20 @@ +import * as R_uniqWith from '../ramda/dist/src/uniqWith'; + +declare const number_number_to_boolean: (x: number, y: number) => boolean; +declare const number_array: number[]; +declare const string_string_to_boolean: (x: string, y: string) => boolean; +declare const string_array: string[]; + +// @dts-jest:pass +R_uniqWith(number_number_to_boolean); +// @dts-jest:pass +R_uniqWith(number_number_to_boolean)(number_array); +// @dts-jest:pass +R_uniqWith(number_number_to_boolean, number_array); + +// @dts-jest:pass +R_uniqWith(string_string_to_boolean); +// @dts-jest:pass +R_uniqWith(string_string_to_boolean)(string_array); +// @dts-jest:pass +R_uniqWith(string_string_to_boolean, string_array); diff --git a/tests/unless.ts b/tests/unless.ts new file mode 100644 index 0000000..020f5c7 --- /dev/null +++ b/tests/unless.ts @@ -0,0 +1,20 @@ +import * as R_unless from '../ramda/dist/src/unless'; + +declare const number_is_1: (x: number) => x is 1; +declare const number_to_boolean: (x: number) => boolean; +declare const number_to_string: (x: number) => string; +declare const number: number; + +// @dts-jest:pass +R_unless(number_to_boolean, number_to_string); +// @dts-jest:pass +R_unless(number_to_boolean)(number_to_string)(number); +// @dts-jest:pass +R_unless(number_to_boolean, number_to_string, number); + +// @dts-jest:pass +R_unless(number_is_1, number_to_string); +// @dts-jest:pass +R_unless(number_is_1)(number_to_string)(number); +// @dts-jest:pass +R_unless(number_is_1, number_to_string, number); diff --git a/tests/unnest.ts b/tests/unnest.ts new file mode 100644 index 0000000..1012a42 --- /dev/null +++ b/tests/unnest.ts @@ -0,0 +1,9 @@ +import * as R_unnest from '../ramda/dist/src/unnest'; + +declare const number_array: number[]; +declare const number_array_array: number[][]; + +// @dts-jest:pass +R_unnest(number_array); +// @dts-jest:pass +R_unnest(number_array_array); diff --git a/tests/until.ts b/tests/until.ts new file mode 100644 index 0000000..9dfca96 --- /dev/null +++ b/tests/until.ts @@ -0,0 +1,12 @@ +import * as R_until from '../ramda/dist/src/until'; + +declare const number_to_boolean: (x: number) => boolean; +declare const number_to_number: (x: number) => number; +declare const number: number; + +// @dts-jest:pass +R_until(number_to_boolean, number_to_number); +// @dts-jest:pass +R_until(number_to_boolean)(number_to_number)(number); +// @dts-jest:pass +R_until(number_to_boolean, number_to_number, number); diff --git a/tests/update.ts b/tests/update.ts new file mode 100644 index 0000000..f973805 --- /dev/null +++ b/tests/update.ts @@ -0,0 +1,17 @@ +import * as R_update from '../ramda/dist/src/update'; + +declare const string_array: string[]; +declare const boolean: boolean; +declare const string: string; +declare const number: number; + +// @dts-jest:pass +R_update(number, boolean); +// @dts-jest:pass +R_update(number)(boolean)(string_array); +// @dts-jest:pass +R_update(number, boolean, string_array); +// @dts-jest:pass +R_update(number)(string)(string_array); +// @dts-jest:pass +R_update(number, string, string_array); diff --git a/tests/useWith.ts b/tests/useWith.ts new file mode 100644 index 0000000..72794c8 --- /dev/null +++ b/tests/useWith.ts @@ -0,0 +1,33 @@ +import * as R_useWith from '../ramda/dist/src/useWith'; + +declare const any_args_to_object: (...args: any[]) => object; +declare const string_number_boolean_to_object: ( + x: string, + y: number, + z: boolean, +) => object; +declare const number_to_boolean: (x: number) => boolean; +declare const symbol_to_number: (x: symbol) => number; +declare const number_to_string: (x: number) => string; + +// @dts-jest:pass +R_useWith(string_number_boolean_to_object); +// @dts-jest:pass +R_useWith(string_number_boolean_to_object)([ + number_to_string, + symbol_to_number, + number_to_boolean, +]); +// @dts-jest:pass +R_useWith(string_number_boolean_to_object, [ + number_to_string, + symbol_to_number, + number_to_boolean, +]); + +// @dts-jest:pass +R_useWith(any_args_to_object); +// @dts-jest:pass +R_useWith<'1', '2arity'>()(any_args_to_object); +// @dts-jest:pass +R_useWith<'1', 'variadic'>()(any_args_to_object); diff --git a/tests/values.ts b/tests/values.ts new file mode 100644 index 0000000..49de1d6 --- /dev/null +++ b/tests/values.ts @@ -0,0 +1,13 @@ +import * as R_values from '../ramda/dist/src/values'; + +declare const object: object; +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; + +// @dts-jest:pass +R_values(object); +// @dts-jest:pass +R_values(a_1_b_2_c_3); diff --git a/tests/valuesIn.ts b/tests/valuesIn.ts new file mode 100644 index 0000000..1c371e6 --- /dev/null +++ b/tests/valuesIn.ts @@ -0,0 +1,13 @@ +import * as R_valuesIn from '../ramda/dist/src/valuesIn'; + +declare const object: object; +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; + +// @dts-jest:pass +R_valuesIn(object); +// @dts-jest:pass +R_valuesIn(a_1_b_2_c_3); diff --git a/tests/view.ts b/tests/view.ts new file mode 100644 index 0000000..a33f41b --- /dev/null +++ b/tests/view.ts @@ -0,0 +1,36 @@ +import { ManualLens, PseudoLens } from '../ramda/dist/src/$types'; +import * as R_view from '../ramda/dist/src/view'; + +declare const menual_lens_number_object: ManualLens; +declare const pseudo_lens_a: PseudoLens<'a'>; +declare const pseudo_lens_1: PseudoLens<1>; + +declare const object: object; +declare const a_1_b_2_c_3: { a: 1; b: 2; c: 3 }; +declare const number_array: number[]; +declare const string_number_tuple: [string, number]; + +// @dts-jest:pass +R_view(menual_lens_number_object); +// @dts-jest:pass +R_view(menual_lens_number_object)(object); +// @dts-jest:pass +R_view(menual_lens_number_object, object); + +// @dts-jest:pass +R_view(pseudo_lens_a); +// @dts-jest:pass +R_view(pseudo_lens_a)(a_1_b_2_c_3); +// @dts-jest:pass +R_view(pseudo_lens_a, a_1_b_2_c_3); + +// @dts-jest:pass +R_view(pseudo_lens_1); +// @dts-jest:pass +R_view(pseudo_lens_1)(string_number_tuple); +// @dts-jest:pass +R_view(pseudo_lens_1, string_number_tuple); +// @dts-jest:pass +R_view(pseudo_lens_1)(number_array); +// @dts-jest:pass +R_view(pseudo_lens_1, number_array); diff --git a/tests/when.ts b/tests/when.ts new file mode 100644 index 0000000..6c48f92 --- /dev/null +++ b/tests/when.ts @@ -0,0 +1,12 @@ +import * as R_when from '../ramda/dist/src/when'; + +declare const number_to_boolean: (x: number) => boolean; +declare const number_to_string: (x: number) => string; +declare const number: number; + +// @dts-jest:pass +R_when(number_to_boolean, number_to_string); +// @dts-jest:pass +R_when(number_to_boolean)(number_to_string)(number); +// @dts-jest:pass +R_when(number_to_boolean, number_to_string, number); diff --git a/tests/where.ts b/tests/where.ts new file mode 100644 index 0000000..c4170cc --- /dev/null +++ b/tests/where.ts @@ -0,0 +1,43 @@ +import { Dictionary } from '../ramda/dist/src/$types'; +import * as R_where from '../ramda/dist/src/where'; + +declare const dictionary_of_number_to_boolean: Dictionary< + (x: number) => boolean +>; +declare const a_b_c_number_to_boolean: { + a: (x: number) => boolean; + b: (x: number) => boolean; + c: (x: number) => boolean; +}; +declare const number_dictionary: Dictionary; +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; + +// @dts-jest:pass +R_where(a_b_c_number_to_boolean); + +// @dts-jest:pass +R_where(a_b_c_number_to_boolean)(a_1_b_2_c_3); +// @dts-jest:pass +R_where(a_b_c_number_to_boolean, a_1_b_2_c_3); + +// @dts-jest:pass +R_where(a_b_c_number_to_boolean)(number_dictionary); +// @dts-jest:pass +R_where(a_b_c_number_to_boolean, number_dictionary); + +// @dts-jest:pass +R_where(dictionary_of_number_to_boolean); + +// @dts-jest:pass +R_where(dictionary_of_number_to_boolean)(a_1_b_2_c_3); +// @dts-jest:pass +R_where(dictionary_of_number_to_boolean, a_1_b_2_c_3); + +// @dts-jest:pass +R_where(dictionary_of_number_to_boolean)(number_dictionary); +// @dts-jest:pass +R_where(dictionary_of_number_to_boolean, number_dictionary); diff --git a/tests/whereEq.ts b/tests/whereEq.ts new file mode 100644 index 0000000..1eee866 --- /dev/null +++ b/tests/whereEq.ts @@ -0,0 +1,16 @@ +import { Dictionary } from '../ramda/dist/src/$types'; +import * as R_whereEq from '../ramda/dist/src/whereEq'; + +declare const number_dictionary: Dictionary; +declare const a_1_b_2_c_3: { + a: 1; + b: 2; + c: 3; +}; + +// @dts-jest:pass +R_whereEq(number_dictionary); +// @dts-jest:pass +R_whereEq(number_dictionary)(a_1_b_2_c_3); +// @dts-jest:pass +R_whereEq(number_dictionary, a_1_b_2_c_3); diff --git a/tests/without.ts b/tests/without.ts new file mode 100644 index 0000000..4528d81 --- /dev/null +++ b/tests/without.ts @@ -0,0 +1,8 @@ +import * as R_without from '../ramda/dist/src/without'; + +declare const number_array: number[]; + +// @dts-jest:pass +R_without(number_array); +// @dts-jest:pass +R_without(number_array, number_array); diff --git a/tests/xprod.ts b/tests/xprod.ts new file mode 100644 index 0000000..c92c063 --- /dev/null +++ b/tests/xprod.ts @@ -0,0 +1,11 @@ +import * as R_xprod from '../ramda/dist/src/xprod'; + +declare const number_array: number[]; +declare const string_array: string[]; + +// @dts-jest:pass +R_xprod(number_array); +// @dts-jest:pass +R_xprod(number_array)(string_array); +// @dts-jest:pass +R_xprod(number_array, string_array); diff --git a/tests/zip.ts b/tests/zip.ts new file mode 100644 index 0000000..ec80431 --- /dev/null +++ b/tests/zip.ts @@ -0,0 +1,11 @@ +import * as R_zip from '../ramda/dist/src/zip'; + +declare const number_array: number[]; +declare const string_array: string[]; + +// @dts-jest:pass +R_zip(number_array); +// @dts-jest:pass +R_zip(number_array)(string_array); +// @dts-jest:pass +R_zip(number_array, string_array); diff --git a/tests/zipObj.ts b/tests/zipObj.ts new file mode 100644 index 0000000..34d1228 --- /dev/null +++ b/tests/zipObj.ts @@ -0,0 +1,18 @@ +import * as R_zipObj from '../ramda/dist/src/zipObj'; + +declare const number_array: number[]; +declare const string_array: string[]; + +// @dts-jest:pass +R_zipObj(number_array); +// @dts-jest:pass +R_zipObj(number_array)(string_array); +// @dts-jest:pass +R_zipObj(number_array, string_array); + +// @dts-jest:pass +R_zipObj(['a', 'b']); +// @dts-jest:pass +R_zipObj(['a', 'b'])(number_array); +// @dts-jest:pass +R_zipObj(['a', 'b'], number_array); diff --git a/tests/zipWith.ts b/tests/zipWith.ts new file mode 100644 index 0000000..9ae0213 --- /dev/null +++ b/tests/zipWith.ts @@ -0,0 +1,12 @@ +import * as R_zipWith from '../ramda/dist/src/zipWith'; + +declare const number_string_to_object: (x: number, y: string) => object; +declare const number_array: number[]; +declare const string_array: string[]; + +// @dts-jest:pass +R_zipWith(number_string_to_object, number_array); +// @dts-jest:pass +R_zipWith(number_string_to_object)(number_array)(string_array); +// @dts-jest:pass +R_zipWith(number_string_to_object, number_array, string_array); diff --git a/tsconfig.json b/tsconfig.json index a77e3f6..9c4afaf 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,13 +1,14 @@ { "compilerOptions": { "target": "es6", - "module": "commonjs", - "noEmit": true, - "noImplicitAny": true, - "strictNullChecks": true + "strict": true, + "module": "commonjs" }, - "files": [ - "index.d.ts", - "ramda-tests.ts" + "include": [ + "gulpfile.ts", + "scripts/**/*.ts", + "templates/**/*.ts", + "tests/**/*.ts", + "tasks/**/*.ts" ] } diff --git a/tslint.json b/tslint.json index 9e1edaa..dd96458 100644 --- a/tslint.json +++ b/tslint.json @@ -1,3 +1,11 @@ { - "extends": "tslint-config-typings" + "extends": [ + "tslint-config-ikatyang", + "tslint-config-prettier-ext", + "tslint-plugin-prettier", + "prettier-config-ikatyang/tslint" + ], + "rules": { + "no-unnecessary-type-assertion": false + } } diff --git a/typings.json b/typings.json deleted file mode 100644 index 9865df7..0000000 --- a/typings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "ramda", - "main": "index.d.ts", - "version": "0.22.1", - "homepage": "https://github.com/types/npm-ramda", - "author": "Erwin Poeze ", - "description": "Type definitions for Ramda" -} diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..686b9bb --- /dev/null +++ b/yarn.lock @@ -0,0 +1,3499 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@types/chalk@*": + version "0.4.31" + resolved "https://registry.yarnpkg.com/@types/chalk/-/chalk-0.4.31.tgz#a31d74241a6b1edbb973cf36d97a2896834a51f9" + +"@types/chokidar@*": + version "1.7.1" + resolved "https://registry.yarnpkg.com/@types/chokidar/-/chokidar-1.7.1.tgz#f958c073fab94c2a9c67cca11ccdb80fd5c1b488" + dependencies: + "@types/node" "*" + +"@types/del@3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/del/-/del-3.0.0.tgz#1c8cd8b6e38da3b572352ca8eaf5527931426288" + dependencies: + "@types/glob" "*" + +"@types/glob-stream@*": + version "3.1.30" + resolved "https://registry.yarnpkg.com/@types/glob-stream/-/glob-stream-3.1.30.tgz#b853990b40a4cfe6a80ec0d2fadf68d8060f78b1" + dependencies: + "@types/glob" "*" + "@types/node" "*" + +"@types/glob@*", "@types/glob@5.0.30": + version "5.0.30" + resolved "https://registry.yarnpkg.com/@types/glob/-/glob-5.0.30.tgz#1026409c5625a8689074602808d082b2867b8a51" + dependencies: + "@types/minimatch" "*" + "@types/node" "*" + +"@types/gulp-diff@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@types/gulp-diff/-/gulp-diff-1.0.0.tgz#6ed98a61d11693e4acbce88d4f011701d3fc8010" + dependencies: + "@types/node" "*" + +"@types/gulp-rename@0.0.32": + version "0.0.32" + resolved "https://registry.yarnpkg.com/@types/gulp-rename/-/gulp-rename-0.0.32.tgz#602828783f97f190e438937dfa6a579eb0198e63" + dependencies: + "@types/node" "*" + +"@types/gulp-util@3.0.31": + version "3.0.31" + resolved "https://registry.yarnpkg.com/@types/gulp-util/-/gulp-util-3.0.31.tgz#272e298220365717e1f7f979b50ebadb44297cbf" + dependencies: + "@types/chalk" "*" + "@types/node" "*" + "@types/through2" "*" + "@types/vinyl" "*" + +"@types/gulp@*": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@types/gulp/-/gulp-4.0.4.tgz#753ffe5b0ddaf0c9a60101b346141bb80e602f25" + dependencies: + "@types/chokidar" "*" + "@types/undertaker" "*" + "@types/vinyl-fs" "*" + +"@types/gulp@3.8.33": + version "3.8.33" + resolved "https://registry.yarnpkg.com/@types/gulp/-/gulp-3.8.33.tgz#b1b076820738c9c4eb7808cd926bff1683e1c2ab" + dependencies: + "@types/node" "*" + "@types/orchestrator" "*" + "@types/vinyl" "*" + +"@types/jest@20.0.6": + version "20.0.6" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-20.0.6.tgz#7e0ba76ddfacb42ee9bb0d8833e5208cf0680431" + +"@types/minimatch@*": + version "2.0.29" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-2.0.29.tgz#5002e14f75e2d71e564281df0431c8c1b4a2a36a" + +"@types/node@*", "@types/node@8.0.20": + version "8.0.20" + resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.20.tgz#65c7375255c24b184c215a5d0b63247c32f01c91" + +"@types/orchestrator@*": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@types/orchestrator/-/orchestrator-0.3.0.tgz#bf84a1699c9330d4fe89cd81263e8fc09fb32978" + dependencies: + "@types/node" "*" + "@types/q" "^0" + +"@types/q@^0": + version "0.0.36" + resolved "https://registry.yarnpkg.com/@types/q/-/q-0.0.36.tgz#97d786389641bcbd0e22bfc729a534175976371d" + +"@types/ramda@ikatyang/types-ramda#v0.24.1-dist": + version "0.24.1" + resolved "https://codeload.github.com/ikatyang/types-ramda/tar.gz/4e6f7df81ca0b0ec29a92a759304c00dccc0fd3a" + +"@types/run-sequence@0.0.29": + version "0.0.29" + resolved "https://registry.yarnpkg.com/@types/run-sequence/-/run-sequence-0.0.29.tgz#6ad0f7383136e13925322e69fc41db77b30b2075" + dependencies: + "@types/gulp" "*" + "@types/node" "*" + +"@types/through2@*", "@types/through2@2.0.33": + version "2.0.33" + resolved "https://registry.yarnpkg.com/@types/through2/-/through2-2.0.33.tgz#1ff2e88a100dfb5b140e7bb98791f1194400d131" + dependencies: + "@types/node" "*" + +"@types/undertaker-registry@*": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@types/undertaker-registry/-/undertaker-registry-1.0.0.tgz#6f61a0be75a22e9ef62df68b480c68bce344fe5f" + +"@types/undertaker@*": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@types/undertaker/-/undertaker-1.1.2.tgz#cf0f62cdcbdf62ad9f70a4d78f81869a5c349a09" + dependencies: + "@types/undertaker-registry" "*" + +"@types/vinyl-fs@*": + version "2.4.6" + resolved "https://registry.yarnpkg.com/@types/vinyl-fs/-/vinyl-fs-2.4.6.tgz#b33597fe4b915fca6878199e9e54bc0eb0ef2f91" + dependencies: + "@types/glob-stream" "*" + "@types/node" "*" + "@types/vinyl" "*" + +"@types/vinyl@*": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@types/vinyl/-/vinyl-2.0.0.tgz#fd213bf7f4136dde21fe1895500b12c186f8c268" + dependencies: + "@types/node" "*" + +"@types/yargs@8.0.2": + version "8.0.2" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-8.0.2.tgz#0f9c7b236e2d78cd8f4b6502de15d0728aa29385" + +abab@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.3.tgz#b81de5f7274ec4e756d797cd834f303642724e5d" + +acorn-globals@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-3.1.0.tgz#fd8270f71fbb4996b004fa880ee5d46573a731bf" + dependencies: + acorn "^4.0.4" + +acorn@^4.0.4: + version "4.0.13" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" + +ajv@^4.9.1: + version "4.11.8" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" + dependencies: + co "^4.6.0" + json-stable-stringify "^1.0.1" + +align-text@^0.1.1, align-text@^0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" + dependencies: + kind-of "^3.0.2" + longest "^1.0.1" + repeat-string "^1.5.2" + +amdefine@>=0.0.4: + version "1.0.1" + resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" + +ansi-escapes@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" + +ansi-regex@^2.0.0, ansi-regex@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + +ansi-styles@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + +ansi-styles@^3.0.0, ansi-styles@^3.1.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" + dependencies: + color-convert "^1.9.0" + +anymatch@^1.3.0: + version "1.3.2" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.2.tgz#553dcb8f91e3c889845dfdba34c77721b90b9d7a" + dependencies: + micromatch "^2.1.5" + normalize-path "^2.0.0" + +append-transform@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-0.4.0.tgz#d76ebf8ca94d276e247a36bad44a4b74ab611991" + dependencies: + default-require-extensions "^1.0.0" + +archy@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/archy/-/archy-1.0.0.tgz#f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40" + +argparse@^1.0.7: + version "1.0.9" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86" + dependencies: + sprintf-js "~1.0.2" + +arr-diff@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" + dependencies: + arr-flatten "^1.0.1" + +arr-flatten@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + +array-differ@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-1.0.0.tgz#eff52e3758249d33be402b8bb8e564bb2b5d4031" + +array-each@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/array-each/-/array-each-1.0.1.tgz#a794af0c05ab1752846ee753a1f211a05ba0c44f" + +array-equal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" + +array-slice@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array-slice/-/array-slice-1.0.0.tgz#e73034f00dcc1f40876008fd20feae77bd4b7c2f" + +array-union@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" + dependencies: + array-uniq "^1.0.1" + +array-uniq@^1.0.1, array-uniq@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" + +array-unique@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" + +arrify@^1.0.0, arrify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + +asn1@~0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.3.tgz#dac8787713c9966849fc8180777ebe9c1ddf3b86" + +assert-plus@1.0.0, assert-plus@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + +assert-plus@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234" + +async@^1.4.0: + version "1.5.2" + resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" + +async@^2.1.4: + version "2.5.0" + resolved "https://registry.yarnpkg.com/async/-/async-2.5.0.tgz#843190fd6b7357a0b9e1c956edddd5ec8462b54d" + dependencies: + lodash "^4.14.0" + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + +aws-sign2@~0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" + +aws4@^1.2.1: + version "1.6.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" + +babel-code-frame@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" + dependencies: + chalk "^1.1.0" + esutils "^2.0.2" + js-tokens "^3.0.0" + +babel-core@^6.0.0, babel-core@^6.24.1: + version "6.25.0" + resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.25.0.tgz#7dd42b0463c742e9d5296deb3ec67a9322dad729" + dependencies: + babel-code-frame "^6.22.0" + babel-generator "^6.25.0" + babel-helpers "^6.24.1" + babel-messages "^6.23.0" + babel-register "^6.24.1" + babel-runtime "^6.22.0" + babel-template "^6.25.0" + babel-traverse "^6.25.0" + babel-types "^6.25.0" + babylon "^6.17.2" + convert-source-map "^1.1.0" + debug "^2.1.1" + json5 "^0.5.0" + lodash "^4.2.0" + minimatch "^3.0.2" + path-is-absolute "^1.0.0" + private "^0.1.6" + slash "^1.0.0" + source-map "^0.5.0" + +babel-generator@^6.18.0, babel-generator@^6.25.0: + version "6.25.0" + resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.25.0.tgz#33a1af70d5f2890aeb465a4a7793c1df6a9ea9fc" + dependencies: + babel-messages "^6.23.0" + babel-runtime "^6.22.0" + babel-types "^6.25.0" + detect-indent "^4.0.0" + jsesc "^1.3.0" + lodash "^4.2.0" + source-map "^0.5.0" + trim-right "^1.0.1" + +babel-helpers@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.24.1.tgz#3471de9caec388e5c850e597e58a26ddf37602b2" + dependencies: + babel-runtime "^6.22.0" + babel-template "^6.24.1" + +babel-jest@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-20.0.3.tgz#e4a03b13dc10389e140fc645d09ffc4ced301671" + dependencies: + babel-core "^6.0.0" + babel-plugin-istanbul "^4.0.0" + babel-preset-jest "^20.0.3" + +babel-messages@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-istanbul@^4.0.0, babel-plugin-istanbul@^4.1.4: + version "4.1.4" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.4.tgz#18dde84bf3ce329fddf3f4103fae921456d8e587" + dependencies: + find-up "^2.1.0" + istanbul-lib-instrument "^1.7.2" + test-exclude "^4.1.1" + +babel-plugin-jest-hoist@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-20.0.3.tgz#afedc853bd3f8dc3548ea671fbe69d03cc2c1767" + +babel-plugin-transform-es2015-modules-commonjs@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.24.1.tgz#d3e310b40ef664a36622200097c6d440298f2bfe" + dependencies: + babel-plugin-transform-strict-mode "^6.24.1" + babel-runtime "^6.22.0" + babel-template "^6.24.1" + babel-types "^6.24.1" + +babel-plugin-transform-strict-mode@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz#d5faf7aa578a65bbe591cf5edae04a0c67020758" + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.24.1" + +babel-preset-jest@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-20.0.3.tgz#cbacaadecb5d689ca1e1de1360ebfc66862c178a" + dependencies: + babel-plugin-jest-hoist "^20.0.3" + +babel-register@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.24.1.tgz#7e10e13a2f71065bdfad5a1787ba45bca6ded75f" + dependencies: + babel-core "^6.24.1" + babel-runtime "^6.22.0" + core-js "^2.4.0" + home-or-tmp "^2.0.0" + lodash "^4.2.0" + mkdirp "^0.5.1" + source-map-support "^0.4.2" + +babel-runtime@^6.22.0: + version "6.25.0" + resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.25.0.tgz#33b98eaa5d482bb01a8d1aa6b437ad2b01aec41c" + dependencies: + core-js "^2.4.0" + regenerator-runtime "^0.10.0" + +babel-template@^6.16.0, babel-template@^6.24.1, babel-template@^6.25.0: + version "6.25.0" + resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.25.0.tgz#665241166b7c2aa4c619d71e192969552b10c071" + dependencies: + babel-runtime "^6.22.0" + babel-traverse "^6.25.0" + babel-types "^6.25.0" + babylon "^6.17.2" + lodash "^4.2.0" + +babel-traverse@^6.18.0, babel-traverse@^6.25.0: + version "6.25.0" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.25.0.tgz#2257497e2fcd19b89edc13c4c91381f9512496f1" + dependencies: + babel-code-frame "^6.22.0" + babel-messages "^6.23.0" + babel-runtime "^6.22.0" + babel-types "^6.25.0" + babylon "^6.17.2" + debug "^2.2.0" + globals "^9.0.0" + invariant "^2.2.0" + lodash "^4.2.0" + +babel-types@^6.18.0, babel-types@^6.24.1, babel-types@^6.25.0: + version "6.25.0" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.25.0.tgz#70afb248d5660e5d18f811d91c8303b54134a18e" + dependencies: + babel-runtime "^6.22.0" + esutils "^2.0.2" + lodash "^4.2.0" + to-fast-properties "^1.0.1" + +babylon@^6.17.2, babylon@^6.17.4: + version "6.17.4" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.4.tgz#3e8b7402b88d22c3423e137a1577883b15ff869a" + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + +bcrypt-pbkdf@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz#63bc5dcb61331b92bc05fd528953c33462a06f8d" + dependencies: + tweetnacl "^0.14.3" + +beeper@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/beeper/-/beeper-1.1.1.tgz#e6d5ea8c5dad001304a70b22638447f69cb2f809" + +boom@2.x.x: + version "2.10.1" + resolved "https://registry.yarnpkg.com/boom/-/boom-2.10.1.tgz#39c8918ceff5799f83f9492a848f625add0c766f" + dependencies: + hoek "2.x.x" + +brace-expansion@^1.0.0, brace-expansion@^1.1.7: + version "1.1.8" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +braces@^1.8.2: + version "1.8.5" + resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" + dependencies: + expand-range "^1.8.1" + preserve "^0.2.0" + repeat-element "^1.1.2" + +browser-resolve@^1.11.2: + version "1.11.2" + resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.2.tgz#8ff09b0a2c421718a1051c260b32e48f442938ce" + dependencies: + resolve "1.1.7" + +bser@1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/bser/-/bser-1.0.2.tgz#381116970b2a6deea5646dd15dd7278444b56169" + dependencies: + node-int64 "^0.4.0" + +bser@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/bser/-/bser-2.0.0.tgz#9ac78d3ed5d915804fd87acb158bc797147a1719" + dependencies: + node-int64 "^0.4.0" + +builtin-modules@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" + +callsites@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-2.0.0.tgz#06eb84f00eea413da86affefacbffb36093b3c50" + +camelcase@^1.0.2: + version "1.2.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" + +camelcase@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" + +camelcase@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" + +caseless@~0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" + +center-align@^0.1.1: + version "0.1.3" + resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad" + dependencies: + align-text "^0.1.3" + lazy-cache "^1.0.3" + +chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + dependencies: + ansi-styles "^2.2.1" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + +chalk@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.1.0.tgz#ac5becf14fa21b99c6c92ca7a7d7cfd5b17e743e" + dependencies: + ansi-styles "^3.1.0" + escape-string-regexp "^1.0.5" + supports-color "^4.0.0" + +ci-info@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.0.0.tgz#dc5285f2b4e251821683681c381c3388f46ec534" + +cli-color@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/cli-color/-/cli-color-1.2.0.tgz#3a5ae74fd76b6267af666e69e2afbbd01def34d1" + dependencies: + ansi-regex "^2.1.1" + d "1" + es5-ext "^0.10.12" + es6-iterator "2" + memoizee "^0.4.3" + timers-ext "0.1" + +cliui@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" + dependencies: + center-align "^0.1.1" + right-align "^0.1.1" + wordwrap "0.0.2" + +cliui@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d" + dependencies: + string-width "^1.0.1" + strip-ansi "^3.0.1" + wrap-ansi "^2.0.0" + +clone-stats@^0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/clone-stats/-/clone-stats-0.0.1.tgz#b88f94a82cf38b8791d58046ea4029ad88ca99d1" + +clone@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/clone/-/clone-0.2.0.tgz#c6126a90ad4f72dbf5acdb243cc37724fe93fc1f" + +clone@^1.0.0, clone@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.2.tgz#260b7a99ebb1edfe247538175f783243cb19d149" + +co@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + +color-convert@^1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.0.tgz#1accf97dd739b983bf994d56fec8f95853641b7a" + dependencies: + color-name "^1.1.1" + +color-name@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + +colors@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/colors/-/colors-1.1.2.tgz#168a4701756b6a7f51a12ce0c97bfa28c084ed63" + +combined-stream@^1.0.5, combined-stream@~1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009" + dependencies: + delayed-stream "~1.0.0" + +commander@^2.9.0: + version "2.11.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + +content-type-parser@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/content-type-parser/-/content-type-parser-1.0.1.tgz#c3e56988c53c65127fb46d4032a3a900246fdc94" + +convert-source-map@^1.1.0, convert-source-map@^1.4.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.0.tgz#9acd70851c6d5dfdd93d9282e5edf94a03ff46b5" + +core-js@^2.4.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.0.tgz#569c050918be6486b3837552028ae0466b717086" + +core-util-is@1.0.2, core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + +cross-spawn@^5.0.1: + version "5.1.0" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" + dependencies: + lru-cache "^4.0.1" + shebang-command "^1.2.0" + which "^1.2.9" + +cryptiles@2.x.x: + version "2.0.5" + resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" + dependencies: + boom "2.x.x" + +cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": + version "0.3.2" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.2.tgz#b8036170c79f07a90ff2f16e22284027a243848b" + +"cssstyle@>= 0.2.37 < 0.3.0": + version "0.2.37" + resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-0.2.37.tgz#541097234cb2513c83ceed3acddc27ff27987d54" + dependencies: + cssom "0.3.x" + +d@1: + version "1.0.0" + resolved "https://registry.yarnpkg.com/d/-/d-1.0.0.tgz#754bb5bfe55451da69a58b94d45f4c5b0462d58f" + dependencies: + es5-ext "^0.10.9" + +dashdash@^1.12.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + dependencies: + assert-plus "^1.0.0" + +dateformat@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-2.0.0.tgz#2743e3abb5c3fc2462e527dca445e04e9f4dee17" + +debug@^2.1.1, debug@^2.2.0, debug@^2.6.3: + version "2.6.8" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" + dependencies: + ms "2.0.0" + +decamelize@^1.0.0, decamelize@^1.1.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + +deep-is@~0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + +default-require-extensions@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-1.0.0.tgz#f37ea15d3e13ffd9b437d33e1a75b5fb97874cb8" + dependencies: + strip-bom "^2.0.0" + +defaults@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d" + dependencies: + clone "^1.0.2" + +del@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/del/-/del-3.0.0.tgz#53ecf699ffcbcb39637691ab13baf160819766e5" + dependencies: + globby "^6.1.0" + is-path-cwd "^1.0.0" + is-path-in-cwd "^1.0.0" + p-map "^1.1.1" + pify "^3.0.0" + rimraf "^2.2.8" + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + +deprecated@^0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/deprecated/-/deprecated-0.0.1.tgz#f9c9af5464afa1e7a971458a8bdef2aa94d5bb19" + +detect-file@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/detect-file/-/detect-file-0.1.0.tgz#4935dedfd9488648e006b0129566e9386711ea63" + dependencies: + fs-exists-sync "^0.1.0" + +detect-indent@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-4.0.0.tgz#f76d064352cdf43a1cb6ce619c4ee3a9475de208" + dependencies: + repeating "^2.0.0" + +diff@^2.0.2: + version "2.2.3" + resolved "https://registry.yarnpkg.com/diff/-/diff-2.2.3.tgz#60eafd0d28ee906e4e8ff0a52c1229521033bf99" + +diff@^3.1.0, diff@^3.2.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.3.0.tgz#056695150d7aa93237ca7e378ac3b1682b7963b9" + +doctrine@^0.7.2: + version "0.7.2" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-0.7.2.tgz#7cb860359ba3be90e040b26b729ce4bfa654c523" + dependencies: + esutils "^1.1.6" + isarray "0.0.1" + +dts-element-fp@1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/dts-element-fp/-/dts-element-fp-1.0.2.tgz#0ec25671032557ecfe90bd56e5dd3e063c876436" + dependencies: + ramda "^0.24.1" + +dts-element@2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/dts-element/-/dts-element-2.2.1.tgz#3c3986813464082a16dc94c026114b6d26fb4f9f" + dependencies: + typescript "~2.4.1" + +dts-jest@20.5.1: + version "20.5.1" + resolved "https://registry.yarnpkg.com/dts-jest/-/dts-jest-20.5.1.tgz#deeb39da318f40d5ed20031baa91718438047e3d" + dependencies: + require-from-string "^1.2.1" + ts-comment "^1.0.1" + tsconfig-extends "^1.0.1" + typescript "^2.4.0" + +duplexer2@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.0.2.tgz#c614dcf67e2fb14995a91711e5a617e8a60a31db" + dependencies: + readable-stream "~1.1.9" + +duplexer@~0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1" + +ecc-jsbn@~0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" + dependencies: + jsbn "~0.1.0" + +end-of-stream@~0.1.5: + version "0.1.5" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-0.1.5.tgz#8e177206c3c80837d85632e8b9359dfe8b2f6eaf" + dependencies: + once "~1.3.0" + +errno@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.4.tgz#b896e23a9e5e8ba33871fc996abd3635fc9a1c7d" + dependencies: + prr "~0.0.0" + +error-ex@^1.2.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" + dependencies: + is-arrayish "^0.2.1" + +es5-ext@^0.10.12, es5-ext@^0.10.13, es5-ext@^0.10.14, es5-ext@^0.10.9, es5-ext@~0.10.14, es5-ext@~0.10.2: + version "0.10.27" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.27.tgz#bf926b058c62b1cb5de1a887930673b6aa6d9a66" + dependencies: + es6-iterator "2" + es6-symbol "~3.1" + +es6-iterator@2, es6-iterator@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.1.tgz#8e319c9f0453bf575d374940a655920e59ca5512" + dependencies: + d "1" + es5-ext "^0.10.14" + es6-symbol "^3.1" + +es6-symbol@^3.1, es6-symbol@^3.1.1, es6-symbol@~3.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77" + dependencies: + d "1" + es5-ext "~0.10.14" + +es6-weak-map@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.2.tgz#5e3ab32251ffd1538a1f8e5ffa1357772f92d96f" + dependencies: + d "1" + es5-ext "^0.10.14" + es6-iterator "^2.0.1" + es6-symbol "^3.1.1" + +escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + +escodegen@^1.6.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.8.1.tgz#5a5b53af4693110bebb0867aa3430dd3b70a1018" + dependencies: + esprima "^2.7.1" + estraverse "^1.9.1" + esutils "^2.0.2" + optionator "^0.8.1" + optionalDependencies: + source-map "~0.2.0" + +esprima@^2.7.1: + version "2.7.3" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" + +esprima@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" + +estraverse@^1.9.1: + version "1.9.3" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.9.3.tgz#af67f2dc922582415950926091a4005d29c9bb44" + +esutils@^1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-1.1.6.tgz#c01ccaa9ae4b897c6d0c3e210ae52f3c7a844375" + +esutils@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" + +event-emitter@^0.3.4: + version "0.3.5" + resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" + dependencies: + d "1" + es5-ext "~0.10.14" + +event-stream@^3.1.5: + version "3.3.4" + resolved "https://registry.yarnpkg.com/event-stream/-/event-stream-3.3.4.tgz#4ab4c9a0f5a54db9338b4c34d86bfce8f4b35571" + dependencies: + duplexer "~0.1.1" + from "~0" + map-stream "~0.1.0" + pause-stream "0.0.11" + split "0.3" + stream-combiner "~0.0.4" + through "~2.3.1" + +exec-sh@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.2.0.tgz#14f75de3f20d286ef933099b2ce50a90359cef10" + dependencies: + merge "^1.1.3" + +execa@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" + dependencies: + cross-spawn "^5.0.1" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + +expand-brackets@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" + dependencies: + is-posix-bracket "^0.1.0" + +expand-range@^1.8.1: + version "1.8.2" + resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" + dependencies: + fill-range "^2.1.0" + +expand-tilde@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/expand-tilde/-/expand-tilde-1.2.2.tgz#0b81eba897e5a3d31d1c3d102f8f01441e559449" + dependencies: + os-homedir "^1.0.1" + +expand-tilde@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/expand-tilde/-/expand-tilde-2.0.2.tgz#97e801aa052df02454de46b02bf621642cdc8502" + dependencies: + homedir-polyfill "^1.0.1" + +extend@^3.0.0, extend@~3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" + +extglob@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" + dependencies: + is-extglob "^1.0.0" + +extsprintf@1.3.0, extsprintf@^1.2.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" + +fancy-log@^1.1.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/fancy-log/-/fancy-log-1.3.0.tgz#45be17d02bb9917d60ccffd4995c999e6c8c9948" + dependencies: + chalk "^1.1.1" + time-stamp "^1.0.0" + +fast-diff@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.1.tgz#0aea0e4e605b6a2189f0e936d4b7fbaf1b7cfd9b" + +fast-levenshtein@~2.0.4: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + +fb-watchman@^1.8.0: + version "1.9.2" + resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-1.9.2.tgz#a24cf47827f82d38fb59a69ad70b76e3b6ae7383" + dependencies: + bser "1.0.2" + +fb-watchman@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.0.tgz#54e9abf7dfa2f26cd9b1636c588c1afc05de5d58" + dependencies: + bser "^2.0.0" + +filename-regex@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" + +fileset@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/fileset/-/fileset-2.0.3.tgz#8e7548a96d3cc2327ee5e674168723a333bba2a0" + dependencies: + glob "^7.0.3" + minimatch "^3.0.3" + +fill-range@^2.1.0: + version "2.2.3" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.3.tgz#50b77dfd7e469bc7492470963699fe7a8485a723" + dependencies: + is-number "^2.1.0" + isobject "^2.0.0" + randomatic "^1.1.3" + repeat-element "^1.1.2" + repeat-string "^1.5.2" + +find-index@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/find-index/-/find-index-0.1.1.tgz#675d358b2ca3892d795a1ab47232f8b6e2e0dde4" + +find-up@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" + dependencies: + path-exists "^2.0.0" + pinkie-promise "^2.0.0" + +find-up@^2.0.0, find-up@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + dependencies: + locate-path "^2.0.0" + +findup-sync@^0.4.2: + version "0.4.3" + resolved "https://registry.yarnpkg.com/findup-sync/-/findup-sync-0.4.3.tgz#40043929e7bc60adf0b7f4827c4c6e75a0deca12" + dependencies: + detect-file "^0.1.0" + is-glob "^2.0.1" + micromatch "^2.3.7" + resolve-dir "^0.1.0" + +fined@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/fined/-/fined-1.1.0.tgz#b37dc844b76a2f5e7081e884f7c0ae344f153476" + dependencies: + expand-tilde "^2.0.2" + is-plain-object "^2.0.3" + object.defaults "^1.1.0" + object.pick "^1.2.0" + parse-filepath "^1.0.1" + +first-chunk-stream@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz#59bfb50cd905f60d7c394cd3d9acaab4e6ad934e" + +flagged-respawn@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/flagged-respawn/-/flagged-respawn-0.3.2.tgz#ff191eddcd7088a675b2610fffc976be9b8074b5" + +for-in@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + +for-own@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" + dependencies: + for-in "^1.0.1" + +for-own@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/for-own/-/for-own-1.0.0.tgz#c63332f415cedc4b04dbfe70cf836494c53cb44b" + dependencies: + for-in "^1.0.1" + +forever-agent@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" + +form-data@~2.1.1: + version "2.1.4" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.1.4.tgz#33c183acf193276ecaa98143a69e94bfee1750d1" + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.5" + mime-types "^2.1.12" + +from@~0: + version "0.1.7" + resolved "https://registry.yarnpkg.com/from/-/from-0.1.7.tgz#83c60afc58b9c56997007ed1a768b3ab303a44fe" + +fs-exists-sync@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/fs-exists-sync/-/fs-exists-sync-0.1.0.tgz#982d6893af918e72d08dec9e8673ff2b5a8d6add" + +fs-extra@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.1.tgz#7fc0c6c8957f983f57f306a24e5b9ddd8d0dd880" + dependencies: + graceful-fs "^4.1.2" + jsonfile "^3.0.0" + universalify "^0.1.0" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + +gaze@^0.5.1: + version "0.5.2" + resolved "https://registry.yarnpkg.com/gaze/-/gaze-0.5.2.tgz#40b709537d24d1d45767db5a908689dfe69ac44f" + dependencies: + globule "~0.1.0" + +get-caller-file@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5" + +get-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + +getpass@^0.1.1: + version "0.1.7" + resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + dependencies: + assert-plus "^1.0.0" + +glob-base@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" + dependencies: + glob-parent "^2.0.0" + is-glob "^2.0.0" + +glob-parent@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" + dependencies: + is-glob "^2.0.0" + +glob-stream@^3.1.5: + version "3.1.18" + resolved "https://registry.yarnpkg.com/glob-stream/-/glob-stream-3.1.18.tgz#9170a5f12b790306fdfe598f313f8f7954fd143b" + dependencies: + glob "^4.3.1" + glob2base "^0.0.12" + minimatch "^2.0.1" + ordered-read-streams "^0.1.0" + through2 "^0.6.1" + unique-stream "^1.0.0" + +glob-watcher@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/glob-watcher/-/glob-watcher-0.0.6.tgz#b95b4a8df74b39c83298b0c05c978b4d9a3b710b" + dependencies: + gaze "^0.5.1" + +glob2base@^0.0.12: + version "0.0.12" + resolved "https://registry.yarnpkg.com/glob2base/-/glob2base-0.0.12.tgz#9d419b3e28f12e83a362164a277055922c9c0d56" + dependencies: + find-index "^0.1.1" + +glob@7.1.2, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1: + version "7.1.2" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +glob@^4.3.1: + version "4.5.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-4.5.3.tgz#c6cb73d3226c1efef04de3c56d012f03377ee15f" + dependencies: + inflight "^1.0.4" + inherits "2" + minimatch "^2.0.1" + once "^1.3.0" + +glob@~3.1.21: + version "3.1.21" + resolved "https://registry.yarnpkg.com/glob/-/glob-3.1.21.tgz#d29e0a055dea5138f4d07ed40e8982e83c2066cd" + dependencies: + graceful-fs "~1.2.0" + inherits "1" + minimatch "~0.2.11" + +global-modules@^0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-0.2.3.tgz#ea5a3bed42c6d6ce995a4f8a1269b5dae223828d" + dependencies: + global-prefix "^0.1.4" + is-windows "^0.2.0" + +global-prefix@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/global-prefix/-/global-prefix-0.1.5.tgz#8d3bc6b8da3ca8112a160d8d496ff0462bfef78f" + dependencies: + homedir-polyfill "^1.0.0" + ini "^1.3.4" + is-windows "^0.2.0" + which "^1.2.12" + +globals@^9.0.0: + version "9.18.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" + +globby@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" + dependencies: + array-union "^1.0.1" + glob "^7.0.3" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + +globule@~0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/globule/-/globule-0.1.0.tgz#d9c8edde1da79d125a151b79533b978676346ae5" + dependencies: + glob "~3.1.21" + lodash "~1.0.1" + minimatch "~0.2.11" + +glogg@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/glogg/-/glogg-1.0.0.tgz#7fe0f199f57ac906cf512feead8f90ee4a284fc5" + dependencies: + sparkles "^1.0.0" + +graceful-fs@^3.0.0: + version "3.0.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-3.0.11.tgz#7613c778a1afea62f25c630a086d7f3acbbdd818" + dependencies: + natives "^1.1.0" + +graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6: + version "4.1.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" + +graceful-fs@~1.2.0: + version "1.2.3" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-1.2.3.tgz#15a4806a57547cb2d2dbf27f42e89a8c3451b364" + +growly@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" + +gulp-diff@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/gulp-diff/-/gulp-diff-1.0.0.tgz#101b23712dd6b107bd07d05ab88ea3ac485fed77" + dependencies: + cli-color "^1.0.0" + diff "^2.0.2" + event-stream "^3.1.5" + gulp-util "^3.0.6" + through2 "^2.0.0" + +gulp-rename@1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/gulp-rename/-/gulp-rename-1.2.2.tgz#3ad4428763f05e2764dec1c67d868db275687817" + +gulp-util@3.0.8, gulp-util@^3.0.0, gulp-util@^3.0.6, gulp-util@^3.0.8: + version "3.0.8" + resolved "https://registry.yarnpkg.com/gulp-util/-/gulp-util-3.0.8.tgz#0054e1e744502e27c04c187c3ecc505dd54bbb4f" + dependencies: + array-differ "^1.0.0" + array-uniq "^1.0.2" + beeper "^1.0.0" + chalk "^1.0.0" + dateformat "^2.0.0" + fancy-log "^1.1.0" + gulplog "^1.0.0" + has-gulplog "^0.1.0" + lodash._reescape "^3.0.0" + lodash._reevaluate "^3.0.0" + lodash._reinterpolate "^3.0.0" + lodash.template "^3.0.0" + minimist "^1.1.0" + multipipe "^0.1.2" + object-assign "^3.0.0" + replace-ext "0.0.1" + through2 "^2.0.0" + vinyl "^0.5.0" + +gulp@3.9.1: + version "3.9.1" + resolved "https://registry.yarnpkg.com/gulp/-/gulp-3.9.1.tgz#571ce45928dd40af6514fc4011866016c13845b4" + dependencies: + archy "^1.0.0" + chalk "^1.0.0" + deprecated "^0.0.1" + gulp-util "^3.0.0" + interpret "^1.0.0" + liftoff "^2.1.0" + minimist "^1.1.0" + orchestrator "^0.3.0" + pretty-hrtime "^1.0.0" + semver "^4.1.0" + tildify "^1.0.0" + v8flags "^2.0.2" + vinyl-fs "^0.3.0" + +gulplog@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/gulplog/-/gulplog-1.0.0.tgz#e28c4d45d05ecbbed818363ce8f9c5926229ffe5" + dependencies: + glogg "^1.0.0" + +handlebars@^4.0.3: + version "4.0.10" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.10.tgz#3d30c718b09a3d96f23ea4cc1f403c4d3ba9ff4f" + dependencies: + async "^1.4.0" + optimist "^0.6.1" + source-map "^0.4.4" + optionalDependencies: + uglify-js "^2.6" + +har-schema@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-1.0.5.tgz#d263135f43307c02c602afc8fe95970c0151369e" + +har-validator@~4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-4.2.1.tgz#33481d0f1bbff600dd203d75812a6a5fba002e2a" + dependencies: + ajv "^4.9.1" + har-schema "^1.0.5" + +has-ansi@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + dependencies: + ansi-regex "^2.0.0" + +has-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" + +has-flag@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" + +has-gulplog@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/has-gulplog/-/has-gulplog-0.1.0.tgz#6414c82913697da51590397dafb12f22967811ce" + dependencies: + sparkles "^1.0.0" + +hawk@~3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4" + dependencies: + boom "2.x.x" + cryptiles "2.x.x" + hoek "2.x.x" + sntp "1.x.x" + +hoek@2.x.x: + version "2.16.3" + resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" + +home-or-tmp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8" + dependencies: + os-homedir "^1.0.0" + os-tmpdir "^1.0.1" + +homedir-polyfill@^1.0.0, homedir-polyfill@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz#4c2bbc8a758998feebf5ed68580f76d46768b4bc" + dependencies: + parse-passwd "^1.0.0" + +hosted-git-info@^2.1.4: + version "2.5.0" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.5.0.tgz#6d60e34b3abbc8313062c3b798ef8d901a07af3c" + +html-encoding-sniffer@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-1.0.1.tgz#79bf7a785ea495fe66165e734153f363ff5437da" + dependencies: + whatwg-encoding "^1.0.1" + +http-signature@~1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.1.1.tgz#df72e267066cd0ac67fb76adf8e134a8fbcf91bf" + dependencies: + assert-plus "^0.2.0" + jsprim "^1.2.2" + sshpk "^1.7.0" + +iconv-lite@0.4.13: + version "0.4.13" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.13.tgz#1f88aba4ab0b1508e8312acc39345f36e992e2f2" + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-1.0.2.tgz#ca4309dadee6b54cc0b8d247e8d7c7a0975bdc9b" + +inherits@2, inherits@~2.0.1, inherits@~2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + +ini@^1.3.4: + version "1.3.4" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e" + +interpret@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.3.tgz#cbc35c62eeee73f19ab7b10a801511401afc0f90" + +invariant@^2.2.0: + version "2.2.2" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" + dependencies: + loose-envify "^1.0.0" + +invert-kv@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" + +is-absolute@^0.2.3: + version "0.2.6" + resolved "https://registry.yarnpkg.com/is-absolute/-/is-absolute-0.2.6.tgz#20de69f3db942ef2d87b9c2da36f172235b1b5eb" + dependencies: + is-relative "^0.2.1" + is-windows "^0.2.0" + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + +is-buffer@^1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.5.tgz#1f3b26ef613b214b88cbca23cc6c01d87961eecc" + +is-builtin-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" + dependencies: + builtin-modules "^1.0.0" + +is-ci@^1.0.10: + version "1.0.10" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.0.10.tgz#f739336b2632365061a9d48270cd56ae3369318e" + dependencies: + ci-info "^1.0.0" + +is-dotfile@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" + +is-equal-shallow@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" + dependencies: + is-primitive "^2.0.0" + +is-extendable@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + +is-extglob@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" + +is-finite@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + +is-glob@^2.0.0, is-glob@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" + dependencies: + is-extglob "^1.0.0" + +is-number@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" + dependencies: + kind-of "^3.0.2" + +is-number@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + dependencies: + kind-of "^3.0.2" + +is-path-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" + +is-path-in-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz#6477582b8214d602346094567003be8a9eac04dc" + dependencies: + is-path-inside "^1.0.0" + +is-path-inside@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.0.tgz#fc06e5a1683fbda13de667aff717bbc10a48f37f" + dependencies: + path-is-inside "^1.0.1" + +is-plain-object@^2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + dependencies: + isobject "^3.0.1" + +is-posix-bracket@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" + +is-primitive@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" + +is-promise@^2.1: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" + +is-relative@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-relative/-/is-relative-0.2.1.tgz#d27f4c7d516d175fb610db84bbeef23c3bc97aa5" + dependencies: + is-unc-path "^0.1.1" + +is-stream@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + +is-typedarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + +is-unc-path@^0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/is-unc-path/-/is-unc-path-0.1.2.tgz#6ab053a72573c10250ff416a3814c35178af39b9" + dependencies: + unc-path-regex "^0.1.0" + +is-utf8@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" + +is-windows@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-0.2.0.tgz#de1aa6d63ea29dd248737b69f1ff8b8002d2108c" + +isarray@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" + +isarray@1.0.0, isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + +isobject@^2.0.0, isobject@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + dependencies: + isarray "1.0.0" + +isobject@^3.0.0, isobject@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + +isstream@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + +istanbul-api@^1.1.1: + version "1.1.11" + resolved "https://registry.yarnpkg.com/istanbul-api/-/istanbul-api-1.1.11.tgz#fcc0b461e2b3bda71e305155138238768257d9de" + dependencies: + async "^2.1.4" + fileset "^2.0.2" + istanbul-lib-coverage "^1.1.1" + istanbul-lib-hook "^1.0.7" + istanbul-lib-instrument "^1.7.4" + istanbul-lib-report "^1.1.1" + istanbul-lib-source-maps "^1.2.1" + istanbul-reports "^1.1.1" + js-yaml "^3.7.0" + mkdirp "^0.5.1" + once "^1.4.0" + +istanbul-lib-coverage@^1.0.1, istanbul-lib-coverage@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz#73bfb998885299415c93d38a3e9adf784a77a9da" + +istanbul-lib-hook@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-1.0.7.tgz#dd6607f03076578fe7d6f2a630cf143b49bacddc" + dependencies: + append-transform "^0.4.0" + +istanbul-lib-instrument@^1.4.2, istanbul-lib-instrument@^1.7.2, istanbul-lib-instrument@^1.7.4: + version "1.7.4" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.7.4.tgz#e9fd920e4767f3d19edc765e2d6b3f5ccbd0eea8" + dependencies: + babel-generator "^6.18.0" + babel-template "^6.16.0" + babel-traverse "^6.18.0" + babel-types "^6.18.0" + babylon "^6.17.4" + istanbul-lib-coverage "^1.1.1" + semver "^5.3.0" + +istanbul-lib-report@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz#f0e55f56655ffa34222080b7a0cd4760e1405fc9" + dependencies: + istanbul-lib-coverage "^1.1.1" + mkdirp "^0.5.1" + path-parse "^1.0.5" + supports-color "^3.1.2" + +istanbul-lib-source-maps@^1.1.0, istanbul-lib-source-maps@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.1.tgz#a6fe1acba8ce08eebc638e572e294d267008aa0c" + dependencies: + debug "^2.6.3" + istanbul-lib-coverage "^1.1.1" + mkdirp "^0.5.1" + rimraf "^2.6.1" + source-map "^0.5.3" + +istanbul-reports@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.1.1.tgz#042be5c89e175bc3f86523caab29c014e77fee4e" + dependencies: + handlebars "^4.0.3" + +jest-changed-files@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-20.0.3.tgz#9394d5cc65c438406149bef1bf4d52b68e03e3f8" + +jest-cli@^20.0.4: + version "20.0.4" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-20.0.4.tgz#e532b19d88ae5bc6c417e8b0593a6fe954b1dc93" + dependencies: + ansi-escapes "^1.4.0" + callsites "^2.0.0" + chalk "^1.1.3" + graceful-fs "^4.1.11" + is-ci "^1.0.10" + istanbul-api "^1.1.1" + istanbul-lib-coverage "^1.0.1" + istanbul-lib-instrument "^1.4.2" + istanbul-lib-source-maps "^1.1.0" + jest-changed-files "^20.0.3" + jest-config "^20.0.4" + jest-docblock "^20.0.3" + jest-environment-jsdom "^20.0.3" + jest-haste-map "^20.0.4" + jest-jasmine2 "^20.0.4" + jest-message-util "^20.0.3" + jest-regex-util "^20.0.3" + jest-resolve-dependencies "^20.0.3" + jest-runtime "^20.0.4" + jest-snapshot "^20.0.3" + jest-util "^20.0.3" + micromatch "^2.3.11" + node-notifier "^5.0.2" + pify "^2.3.0" + slash "^1.0.0" + string-length "^1.0.1" + throat "^3.0.0" + which "^1.2.12" + worker-farm "^1.3.1" + yargs "^7.0.2" + +jest-config@^20.0.0, jest-config@^20.0.4: + version "20.0.4" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-20.0.4.tgz#e37930ab2217c913605eff13e7bd763ec48faeea" + dependencies: + chalk "^1.1.3" + glob "^7.1.1" + jest-environment-jsdom "^20.0.3" + jest-environment-node "^20.0.3" + jest-jasmine2 "^20.0.4" + jest-matcher-utils "^20.0.3" + jest-regex-util "^20.0.3" + jest-resolve "^20.0.4" + jest-validate "^20.0.3" + pretty-format "^20.0.3" + +jest-diff@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-20.0.3.tgz#81f288fd9e675f0fb23c75f1c2b19445fe586617" + dependencies: + chalk "^1.1.3" + diff "^3.2.0" + jest-matcher-utils "^20.0.3" + pretty-format "^20.0.3" + +jest-docblock@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-20.0.3.tgz#17bea984342cc33d83c50fbe1545ea0efaa44712" + +jest-environment-jsdom@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-20.0.3.tgz#048a8ac12ee225f7190417713834bb999787de99" + dependencies: + jest-mock "^20.0.3" + jest-util "^20.0.3" + jsdom "^9.12.0" + +jest-environment-node@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-20.0.3.tgz#d488bc4612af2c246e986e8ae7671a099163d403" + dependencies: + jest-mock "^20.0.3" + jest-util "^20.0.3" + +jest-haste-map@^20.0.4: + version "20.0.5" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-20.0.5.tgz#abad74efb1a005974a7b6517e11010709cab9112" + dependencies: + fb-watchman "^2.0.0" + graceful-fs "^4.1.11" + jest-docblock "^20.0.3" + micromatch "^2.3.11" + sane "~1.6.0" + worker-farm "^1.3.1" + +jest-jasmine2@^20.0.4: + version "20.0.4" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-20.0.4.tgz#fcc5b1411780d911d042902ef1859e852e60d5e1" + dependencies: + chalk "^1.1.3" + graceful-fs "^4.1.11" + jest-diff "^20.0.3" + jest-matcher-utils "^20.0.3" + jest-matchers "^20.0.3" + jest-message-util "^20.0.3" + jest-snapshot "^20.0.3" + once "^1.4.0" + p-map "^1.1.1" + +jest-matcher-utils@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-20.0.3.tgz#b3a6b8e37ca577803b0832a98b164f44b7815612" + dependencies: + chalk "^1.1.3" + pretty-format "^20.0.3" + +jest-matchers@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-matchers/-/jest-matchers-20.0.3.tgz#ca69db1c32db5a6f707fa5e0401abb55700dfd60" + dependencies: + jest-diff "^20.0.3" + jest-matcher-utils "^20.0.3" + jest-message-util "^20.0.3" + jest-regex-util "^20.0.3" + +jest-message-util@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-20.0.3.tgz#6aec2844306fcb0e6e74d5796c1006d96fdd831c" + dependencies: + chalk "^1.1.3" + micromatch "^2.3.11" + slash "^1.0.0" + +jest-mock@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-20.0.3.tgz#8bc070e90414aa155c11a8d64c869a0d5c71da59" + +jest-regex-util@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-20.0.3.tgz#85bbab5d133e44625b19faf8c6aa5122d085d762" + +jest-resolve-dependencies@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-20.0.3.tgz#6e14a7b717af0f2cb3667c549de40af017b1723a" + dependencies: + jest-regex-util "^20.0.3" + +jest-resolve@^20.0.4: + version "20.0.4" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-20.0.4.tgz#9448b3e8b6bafc15479444c6499045b7ffe597a5" + dependencies: + browser-resolve "^1.11.2" + is-builtin-module "^1.0.0" + resolve "^1.3.2" + +jest-runtime@^20.0.4: + version "20.0.4" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-20.0.4.tgz#a2c802219c4203f754df1404e490186169d124d8" + dependencies: + babel-core "^6.0.0" + babel-jest "^20.0.3" + babel-plugin-istanbul "^4.0.0" + chalk "^1.1.3" + convert-source-map "^1.4.0" + graceful-fs "^4.1.11" + jest-config "^20.0.4" + jest-haste-map "^20.0.4" + jest-regex-util "^20.0.3" + jest-resolve "^20.0.4" + jest-util "^20.0.3" + json-stable-stringify "^1.0.1" + micromatch "^2.3.11" + strip-bom "3.0.0" + yargs "^7.0.2" + +jest-snapshot@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-20.0.3.tgz#5b847e1adb1a4d90852a7f9f125086e187c76566" + dependencies: + chalk "^1.1.3" + jest-diff "^20.0.3" + jest-matcher-utils "^20.0.3" + jest-util "^20.0.3" + natural-compare "^1.4.0" + pretty-format "^20.0.3" + +jest-util@^20.0.0, jest-util@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-20.0.3.tgz#0c07f7d80d82f4e5a67c6f8b9c3fe7f65cfd32ad" + dependencies: + chalk "^1.1.3" + graceful-fs "^4.1.11" + jest-message-util "^20.0.3" + jest-mock "^20.0.3" + jest-validate "^20.0.3" + leven "^2.1.0" + mkdirp "^0.5.1" + +jest-validate@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-20.0.3.tgz#d0cfd1de4f579f298484925c280f8f1d94ec3cab" + dependencies: + chalk "^1.1.3" + jest-matcher-utils "^20.0.3" + leven "^2.1.0" + pretty-format "^20.0.3" + +jest@20.0.4: + version "20.0.4" + resolved "https://registry.yarnpkg.com/jest/-/jest-20.0.4.tgz#3dd260c2989d6dad678b1e9cc4d91944f6d602ac" + dependencies: + jest-cli "^20.0.4" + +js-tokens@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" + +js-yaml@^3.7.0: + version "3.9.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.9.1.tgz#08775cebdfdd359209f0d2acd383c8f86a6904a0" + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +jsbn@~0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" + +jsdom@^9.12.0: + version "9.12.0" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-9.12.0.tgz#e8c546fffcb06c00d4833ca84410fed7f8a097d4" + dependencies: + abab "^1.0.3" + acorn "^4.0.4" + acorn-globals "^3.1.0" + array-equal "^1.0.0" + content-type-parser "^1.0.1" + cssom ">= 0.3.2 < 0.4.0" + cssstyle ">= 0.2.37 < 0.3.0" + escodegen "^1.6.1" + html-encoding-sniffer "^1.0.1" + nwmatcher ">= 1.3.9 < 2.0.0" + parse5 "^1.5.1" + request "^2.79.0" + sax "^1.2.1" + symbol-tree "^3.2.1" + tough-cookie "^2.3.2" + webidl-conversions "^4.0.0" + whatwg-encoding "^1.0.1" + whatwg-url "^4.3.0" + xml-name-validator "^2.0.1" + +jsesc@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" + +json-schema@0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" + +json-stable-stringify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" + dependencies: + jsonify "~0.0.0" + +json-stringify-safe@~5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + +json5@^0.5.0: + version "0.5.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" + +jsonfile@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-3.0.1.tgz#a5ecc6f65f53f662c4415c7675a0331d0992ec66" + optionalDependencies: + graceful-fs "^4.1.6" + +jsonify@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" + +jsprim@^1.2.2: + version "1.4.1" + resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" + dependencies: + assert-plus "1.0.0" + extsprintf "1.3.0" + json-schema "0.2.3" + verror "1.10.0" + +kind-of@^3.0.2: + version "3.2.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + dependencies: + is-buffer "^1.1.5" + +kind-of@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + dependencies: + is-buffer "^1.1.5" + +lazy-cache@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" + +lcid@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" + dependencies: + invert-kv "^1.0.0" + +leven@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" + +levn@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + dependencies: + prelude-ls "~1.1.2" + type-check "~0.3.2" + +liftoff@^2.1.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/liftoff/-/liftoff-2.3.0.tgz#a98f2ff67183d8ba7cfaca10548bd7ff0550b385" + dependencies: + extend "^3.0.0" + findup-sync "^0.4.2" + fined "^1.0.1" + flagged-respawn "^0.3.2" + lodash.isplainobject "^4.0.4" + lodash.isstring "^4.0.1" + lodash.mapvalues "^4.4.0" + rechoir "^0.6.2" + resolve "^1.1.7" + +load-json-file@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" + dependencies: + graceful-fs "^4.1.2" + parse-json "^2.2.0" + pify "^2.0.0" + pinkie-promise "^2.0.0" + strip-bom "^2.0.0" + +load-json-file@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" + dependencies: + graceful-fs "^4.1.2" + parse-json "^2.2.0" + pify "^2.0.0" + strip-bom "^3.0.0" + +locate-path@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + dependencies: + p-locate "^2.0.0" + path-exists "^3.0.0" + +lodash._basecopy@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" + +lodash._basetostring@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/lodash._basetostring/-/lodash._basetostring-3.0.1.tgz#d1861d877f824a52f669832dcaf3ee15566a07d5" + +lodash._basevalues@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz#5b775762802bde3d3297503e26300820fdf661b7" + +lodash._getnative@^3.0.0: + version "3.9.1" + resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" + +lodash._isiterateecall@^3.0.0: + version "3.0.9" + resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c" + +lodash._reescape@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lodash._reescape/-/lodash._reescape-3.0.0.tgz#2b1d6f5dfe07c8a355753e5f27fac7f1cde1616a" + +lodash._reevaluate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lodash._reevaluate/-/lodash._reevaluate-3.0.0.tgz#58bc74c40664953ae0b124d806996daca431e2ed" + +lodash._reinterpolate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" + +lodash._root@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/lodash._root/-/lodash._root-3.0.1.tgz#fba1c4524c19ee9a5f8136b4609f017cf4ded692" + +lodash.camelcase@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" + +lodash.escape@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/lodash.escape/-/lodash.escape-3.2.0.tgz#995ee0dc18c1b48cc92effae71a10aab5b487698" + dependencies: + lodash._root "^3.0.0" + +lodash.isarguments@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" + +lodash.isarray@^3.0.0: + version "3.0.4" + resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" + +lodash.isplainobject@^4.0.4: + version "4.0.6" + resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb" + +lodash.isstring@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451" + +lodash.kebabcase@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz#8489b1cb0d29ff88195cceca448ff6d6cc295c36" + +lodash.keys@^3.0.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a" + dependencies: + lodash._getnative "^3.0.0" + lodash.isarguments "^3.0.0" + lodash.isarray "^3.0.0" + +lodash.mapvalues@^4.4.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/lodash.mapvalues/-/lodash.mapvalues-4.6.0.tgz#1bafa5005de9dd6f4f26668c30ca37230cc9689c" + +lodash.restparam@^3.0.0: + version "3.6.1" + resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805" + +lodash.snakecase@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz#39d714a35357147837aefd64b5dcbb16becd8f8d" + +lodash.template@^3.0.0: + version "3.6.2" + resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-3.6.2.tgz#f8cdecc6169a255be9098ae8b0c53d378931d14f" + dependencies: + lodash._basecopy "^3.0.0" + lodash._basetostring "^3.0.0" + lodash._basevalues "^3.0.0" + lodash._isiterateecall "^3.0.0" + lodash._reinterpolate "^3.0.0" + lodash.escape "^3.0.0" + lodash.keys "^3.0.0" + lodash.restparam "^3.0.0" + lodash.templatesettings "^3.0.0" + +lodash.templatesettings@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/lodash.templatesettings/-/lodash.templatesettings-3.1.1.tgz#fb307844753b66b9f1afa54e262c745307dba8e5" + dependencies: + lodash._reinterpolate "^3.0.0" + lodash.escape "^3.0.0" + +lodash.upperfirst@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz#1365edf431480481ef0d1c68957a5ed99d49f7ce" + +lodash@^4.14.0, lodash@^4.2.0: + version "4.17.4" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" + +lodash@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-1.0.2.tgz#8f57560c83b59fc270bd3d561b690043430e2551" + +longest@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" + +loose-envify@^1.0.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" + dependencies: + js-tokens "^3.0.0" + +lru-cache@2: + version "2.7.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-2.7.3.tgz#6d4524e8b955f95d4f5b58851ce21dd72fb4e952" + +lru-cache@^4.0.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.1.tgz#622e32e82488b49279114a4f9ecf45e7cd6bba55" + dependencies: + pseudomap "^1.0.2" + yallist "^2.1.2" + +lru-queue@0.1: + version "0.1.0" + resolved "https://registry.yarnpkg.com/lru-queue/-/lru-queue-0.1.0.tgz#2738bd9f0d3cf4f84490c5736c48699ac632cda3" + dependencies: + es5-ext "~0.10.2" + +make-error@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.0.tgz#52ad3a339ccf10ce62b4040b708fe707244b8b96" + +makeerror@1.0.x: + version "1.0.11" + resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c" + dependencies: + tmpl "1.0.x" + +map-cache@^0.2.0: + version "0.2.2" + resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + +map-stream@~0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/map-stream/-/map-stream-0.1.0.tgz#e56aa94c4c8055a16404a0674b78f215f7c8e194" + +mem@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76" + dependencies: + mimic-fn "^1.0.0" + +memoizee@^0.4.3: + version "0.4.5" + resolved "https://registry.yarnpkg.com/memoizee/-/memoizee-0.4.5.tgz#1bc3ea1e4be056dd475d521979d7be3d5e5b21c8" + dependencies: + d "1" + es5-ext "^0.10.13" + es6-weak-map "^2.0.1" + event-emitter "^0.3.4" + is-promise "^2.1" + lru-queue "0.1" + next-tick "1" + timers-ext "0.1" + +merge@^1.1.3: + version "1.2.0" + resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.0.tgz#7531e39d4949c281a66b8c5a6e0265e8b05894da" + +micromatch@^2.1.5, micromatch@^2.3.11, micromatch@^2.3.7: + version "2.3.11" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" + dependencies: + arr-diff "^2.0.0" + array-unique "^0.2.1" + braces "^1.8.2" + expand-brackets "^0.1.4" + extglob "^0.3.1" + filename-regex "^2.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.1" + kind-of "^3.0.2" + normalize-path "^2.0.1" + object.omit "^2.0.0" + parse-glob "^3.0.4" + regex-cache "^0.4.2" + +mime-db@~1.29.0: + version "1.29.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.29.0.tgz#48d26d235589651704ac5916ca06001914266878" + +mime-types@^2.1.12, mime-types@~2.1.7: + version "2.1.16" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.16.tgz#2b858a52e5ecd516db897ac2be87487830698e23" + dependencies: + mime-db "~1.29.0" + +mimic-fn@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18" + +minimatch@^2.0.1: + version "2.0.10" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-2.0.10.tgz#8d087c39c6b38c001b97fca7ce6d0e1e80afbac7" + dependencies: + brace-expansion "^1.0.0" + +minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + dependencies: + brace-expansion "^1.1.7" + +minimatch@~0.2.11: + version "0.2.14" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-0.2.14.tgz#c74e780574f63c6f9a090e90efbe6ef53a6a756a" + dependencies: + lru-cache "2" + sigmund "~1.0.0" + +minimist@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + +minimist@^1.1.0, minimist@^1.1.1, minimist@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + +minimist@~0.0.1: + version "0.0.10" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" + +mkdirp@^0.5.0, mkdirp@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + dependencies: + minimist "0.0.8" + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + +multipipe@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/multipipe/-/multipipe-0.1.2.tgz#2a8f2ddf70eed564dff2d57f1e1a137d9f05078b" + dependencies: + duplexer2 "0.0.2" + +natives@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/natives/-/natives-1.1.0.tgz#e9ff841418a6b2ec7a495e939984f78f163e6e31" + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + +next-tick@1: + version "1.0.0" + resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" + +node-int64@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" + +node-notifier@^5.0.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.1.2.tgz#2fa9e12605fa10009d44549d6fcd8a63dde0e4ff" + dependencies: + growly "^1.3.0" + semver "^5.3.0" + shellwords "^0.1.0" + which "^1.2.12" + +normalize-package-data@^2.3.2: + version "2.4.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" + dependencies: + hosted-git-info "^2.1.4" + is-builtin-module "^1.0.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + +normalize-path@^2.0.0, normalize-path@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" + dependencies: + remove-trailing-separator "^1.0.1" + +npm-run-path@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + dependencies: + path-key "^2.0.0" + +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + +"nwmatcher@>= 1.3.9 < 2.0.0": + version "1.4.1" + resolved "https://registry.yarnpkg.com/nwmatcher/-/nwmatcher-1.4.1.tgz#7ae9b07b0ea804db7e25f05cb5fe4097d4e4949f" + +oauth-sign@~0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" + +object-assign@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-3.0.0.tgz#9bedd5ca0897949bca47e7ff408062d549f587f2" + +object-assign@^4.0.1, object-assign@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + +object.defaults@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/object.defaults/-/object.defaults-1.1.0.tgz#3a7f868334b407dea06da16d88d5cd29e435fecf" + dependencies: + array-each "^1.0.1" + array-slice "^1.0.0" + for-own "^1.0.0" + isobject "^3.0.0" + +object.omit@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" + dependencies: + for-own "^0.1.4" + is-extendable "^0.1.1" + +object.pick@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.2.0.tgz#b5392bee9782da6d9fb7d6afaf539779f1234c2b" + dependencies: + isobject "^2.1.0" + +once@^1.3.0, once@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + dependencies: + wrappy "1" + +once@~1.3.0: + version "1.3.3" + resolved "https://registry.yarnpkg.com/once/-/once-1.3.3.tgz#b2e261557ce4c314ec8304f3fa82663e4297ca20" + dependencies: + wrappy "1" + +optimist@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" + dependencies: + minimist "~0.0.1" + wordwrap "~0.0.2" + +optionator@^0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" + dependencies: + deep-is "~0.1.3" + fast-levenshtein "~2.0.4" + levn "~0.3.0" + prelude-ls "~1.1.2" + type-check "~0.3.2" + wordwrap "~1.0.0" + +orchestrator@^0.3.0: + version "0.3.8" + resolved "https://registry.yarnpkg.com/orchestrator/-/orchestrator-0.3.8.tgz#14e7e9e2764f7315fbac184e506c7aa6df94ad7e" + dependencies: + end-of-stream "~0.1.5" + sequencify "~0.0.7" + stream-consume "~0.1.0" + +ordered-read-streams@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/ordered-read-streams/-/ordered-read-streams-0.1.0.tgz#fd565a9af8eb4473ba69b6ed8a34352cb552f126" + +os-homedir@^1.0.0, os-homedir@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + +os-locale@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-1.4.0.tgz#20f9f17ae29ed345e8bde583b13d2009803c14d9" + dependencies: + lcid "^1.0.0" + +os-locale@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.1.0.tgz#42bc2900a6b5b8bd17376c8e882b65afccf24bf2" + dependencies: + execa "^0.7.0" + lcid "^1.0.0" + mem "^1.1.0" + +os-tmpdir@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + +p-finally@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + +p-limit@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.1.0.tgz#b07ff2d9a5d88bec806035895a2bab66a27988bc" + +p-locate@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + dependencies: + p-limit "^1.1.0" + +p-map@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.1.1.tgz#05f5e4ae97a068371bc2a5cc86bfbdbc19c4ae7a" + +parse-filepath@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parse-filepath/-/parse-filepath-1.0.1.tgz#159d6155d43904d16c10ef698911da1e91969b73" + dependencies: + is-absolute "^0.2.3" + map-cache "^0.2.0" + path-root "^0.1.1" + +parse-glob@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" + dependencies: + glob-base "^0.3.0" + is-dotfile "^1.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.0" + +parse-json@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + dependencies: + error-ex "^1.2.0" + +parse-passwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" + +parse5@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-1.5.1.tgz#9b7f3b0de32be78dc2401b17573ccaf0f6f59d94" + +path-exists@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" + dependencies: + pinkie-promise "^2.0.0" + +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + +path-is-inside@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + +path-key@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + +path-parse@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" + +path-root-regex@^0.1.0: + version "0.1.2" + resolved "https://registry.yarnpkg.com/path-root-regex/-/path-root-regex-0.1.2.tgz#bfccdc8df5b12dc52c8b43ec38d18d72c04ba96d" + +path-root@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/path-root/-/path-root-0.1.1.tgz#9a4a6814cac1c0cd73360a95f32083c8ea4745b7" + dependencies: + path-root-regex "^0.1.0" + +path-type@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" + dependencies: + graceful-fs "^4.1.2" + pify "^2.0.0" + pinkie-promise "^2.0.0" + +path-type@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" + dependencies: + pify "^2.0.0" + +pause-stream@0.0.11: + version "0.0.11" + resolved "https://registry.yarnpkg.com/pause-stream/-/pause-stream-0.0.11.tgz#fe5a34b0cbce12b5aa6a2b403ee2e73b602f1445" + dependencies: + through "~2.3" + +performance-now@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-0.2.0.tgz#33ef30c5c77d4ea21c5a53869d91b56d8f2555e5" + +pify@^2.0.0, pify@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + +pify@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + +pinkie-promise@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + dependencies: + pinkie "^2.0.0" + +pinkie@^2.0.0: + version "2.0.4" + resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" + +pkg-dir@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b" + dependencies: + find-up "^2.1.0" + +prelude-ls@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + +preserve@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" + +prettier-config-ikatyang@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/prettier-config-ikatyang/-/prettier-config-ikatyang-1.1.1.tgz#9ccab4bc2d441e4c68b58dbe8f1a4e18213c3f2d" + +prettier@1.5.3: + version "1.5.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.5.3.tgz#59dadc683345ec6b88f88b94ed4ae7e1da394bfe" + +pretty-format@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-20.0.3.tgz#020e350a560a1fe1a98dc3beb6ccffb386de8b14" + dependencies: + ansi-regex "^2.1.1" + ansi-styles "^3.0.0" + +pretty-hrtime@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz#b7e3ea42435a4c9b2759d99e0f201eb195802ee1" + +private@^0.1.6: + version "0.1.7" + resolved "https://registry.yarnpkg.com/private/-/private-0.1.7.tgz#68ce5e8a1ef0a23bb570cc28537b5332aba63ef1" + +process-nextick-args@~1.0.6: + version "1.0.7" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" + +prr@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/prr/-/prr-0.0.0.tgz#1a84b85908325501411853d0081ee3fa86e2926a" + +pseudomap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + +punycode@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + +qs@~6.4.0: + version "6.4.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233" + +ramda@0.24.1, ramda@^0.24.1: + version "0.24.1" + resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.24.1.tgz#c3b7755197f35b8dc3502228262c4c91ddb6b857" + +randomatic@^1.1.3: + version "1.1.7" + resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.7.tgz#c7abe9cc8b87c0baa876b19fde83fd464797e38c" + dependencies: + is-number "^3.0.0" + kind-of "^4.0.0" + +read-pkg-up@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" + dependencies: + find-up "^1.0.0" + read-pkg "^1.0.0" + +read-pkg-up@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" + dependencies: + find-up "^2.0.0" + read-pkg "^2.0.0" + +read-pkg@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" + dependencies: + load-json-file "^1.0.0" + normalize-package-data "^2.3.2" + path-type "^1.0.0" + +read-pkg@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8" + dependencies: + load-json-file "^2.0.0" + normalize-package-data "^2.3.2" + path-type "^2.0.0" + +"readable-stream@>=1.0.33-1 <1.1.0-0": + version "1.0.34" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c" + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "0.0.1" + string_decoder "~0.10.x" + +readable-stream@^2.1.5: + version "2.3.3" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.3.tgz#368f2512d79f9d46fdfc71349ae7878bbc1eb95c" + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~1.0.6" + safe-buffer "~5.1.1" + string_decoder "~1.0.3" + util-deprecate "~1.0.1" + +readable-stream@~1.1.9: + version "1.1.14" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9" + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "0.0.1" + string_decoder "~0.10.x" + +rechoir@^0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" + dependencies: + resolve "^1.1.6" + +regenerator-runtime@^0.10.0: + version "0.10.5" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658" + +regex-cache@^0.4.2: + version "0.4.3" + resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.3.tgz#9b1a6c35d4d0dfcef5711ae651e8e9d3d7114145" + dependencies: + is-equal-shallow "^0.1.3" + is-primitive "^2.0.0" + +remove-trailing-separator@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.0.2.tgz#69b062d978727ad14dc6b56ba4ab772fd8d70511" + +repeat-element@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.2.tgz#ef089a178d1483baae4d93eb98b4f9e4e11d990a" + +repeat-string@^1.5.2: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + +repeating@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" + dependencies: + is-finite "^1.0.0" + +replace-ext@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-0.0.1.tgz#29bbd92078a739f0bcce2b4ee41e837953522924" + +request@^2.79.0: + version "2.81.0" + resolved "https://registry.yarnpkg.com/request/-/request-2.81.0.tgz#c6928946a0e06c5f8d6f8a9333469ffda46298a0" + dependencies: + aws-sign2 "~0.6.0" + aws4 "^1.2.1" + caseless "~0.12.0" + combined-stream "~1.0.5" + extend "~3.0.0" + forever-agent "~0.6.1" + form-data "~2.1.1" + har-validator "~4.2.1" + hawk "~3.1.3" + http-signature "~1.1.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.7" + oauth-sign "~0.8.1" + performance-now "^0.2.0" + qs "~6.4.0" + safe-buffer "^5.0.1" + stringstream "~0.0.4" + tough-cookie "~2.3.0" + tunnel-agent "^0.6.0" + uuid "^3.0.0" + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + +require-from-string@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-1.2.1.tgz#529c9ccef27380adfec9a2f965b649bbee636418" + +require-main-filename@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" + +resolve-dir@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/resolve-dir/-/resolve-dir-0.1.1.tgz#b219259a5602fac5c5c496ad894a6e8cc430261e" + dependencies: + expand-tilde "^1.2.2" + global-modules "^0.2.3" + +resolve@1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" + +resolve@^1.1.6, resolve@^1.1.7, resolve@^1.3.2: + version "1.4.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.4.0.tgz#a75be01c53da25d934a98ebd0e4c4a7312f92a86" + dependencies: + path-parse "^1.0.5" + +right-align@^0.1.1: + version "0.1.3" + resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" + dependencies: + align-text "^0.1.1" + +rimraf@^2.2.8, rimraf@^2.6.1: + version "2.6.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" + dependencies: + glob "^7.0.5" + +run-sequence@2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/run-sequence/-/run-sequence-2.1.0.tgz#149da012516f21dcf79db6dc99a2a95603631b21" + dependencies: + chalk "^1.1.3" + gulp-util "^3.0.8" + +safe-buffer@^5.0.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" + +sane@~1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/sane/-/sane-1.6.0.tgz#9610c452307a135d29c1fdfe2547034180c46775" + dependencies: + anymatch "^1.3.0" + exec-sh "^0.2.0" + fb-watchman "^1.8.0" + minimatch "^3.0.2" + minimist "^1.1.1" + walker "~1.0.5" + watch "~0.10.0" + +sax@^1.2.1: + version "1.2.4" + resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" + +"semver@2 || 3 || 4 || 5", semver@^5.3.0: + version "5.4.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" + +semver@^4.1.0: + version "4.3.6" + resolved "https://registry.yarnpkg.com/semver/-/semver-4.3.6.tgz#300bc6e0e86374f7ba61068b5b1ecd57fc6532da" + +sequencify@~0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/sequencify/-/sequencify-0.0.7.tgz#90cff19d02e07027fd767f5ead3e7b95d1e7380c" + +set-blocking@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + dependencies: + shebang-regex "^1.0.0" + +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + +shellwords@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.0.tgz#66afd47b6a12932d9071cbfd98a52e785cd0ba14" + +sigmund@~1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590" + +signal-exit@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + +slash@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" + +sntp@1.x.x: + version "1.0.9" + resolved "https://registry.yarnpkg.com/sntp/-/sntp-1.0.9.tgz#6541184cc90aeea6c6e7b35e2659082443c66198" + dependencies: + hoek "2.x.x" + +source-map-support@^0.4.0, source-map-support@^0.4.2, source-map-support@^0.4.4: + version "0.4.15" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.15.tgz#03202df65c06d2bd8c7ec2362a193056fef8d3b1" + dependencies: + source-map "^0.5.6" + +source-map@^0.4.4: + version "0.4.4" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" + dependencies: + amdefine ">=0.0.4" + +source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1: + version "0.5.6" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" + +source-map@~0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.2.0.tgz#dab73fbcfc2ba819b4de03bd6f6eaa48164b3f9d" + dependencies: + amdefine ">=0.0.4" + +sparkles@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/sparkles/-/sparkles-1.0.0.tgz#1acbbfb592436d10bbe8f785b7cc6f82815012c3" + +spdx-correct@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40" + dependencies: + spdx-license-ids "^1.0.2" + +spdx-expression-parse@~1.0.0: + version "1.0.4" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz#9bdf2f20e1f40ed447fbe273266191fced51626c" + +spdx-license-ids@^1.0.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz#c9df7a3424594ade6bd11900d596696dc06bac57" + +split@0.3: + version "0.3.3" + resolved "https://registry.yarnpkg.com/split/-/split-0.3.3.tgz#cd0eea5e63a211dfff7eb0f091c4133e2d0dd28f" + dependencies: + through "2" + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + +sshpk@^1.7.0: + version "1.13.1" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.13.1.tgz#512df6da6287144316dc4c18fe1cf1d940739be3" + dependencies: + asn1 "~0.2.3" + assert-plus "^1.0.0" + dashdash "^1.12.0" + getpass "^0.1.1" + optionalDependencies: + bcrypt-pbkdf "^1.0.0" + ecc-jsbn "~0.1.1" + jsbn "~0.1.0" + tweetnacl "~0.14.0" + +stream-combiner@~0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/stream-combiner/-/stream-combiner-0.0.4.tgz#4d5e433c185261dde623ca3f44c586bcf5c4ad14" + dependencies: + duplexer "~0.1.1" + +stream-consume@~0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/stream-consume/-/stream-consume-0.1.0.tgz#a41ead1a6d6081ceb79f65b061901b6d8f3d1d0f" + +string-length@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/string-length/-/string-length-1.0.1.tgz#56970fb1c38558e9e70b728bf3de269ac45adfac" + dependencies: + strip-ansi "^3.0.0" + +string-width@^1.0.1, string-width@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + +string-width@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + +string_decoder@~0.10.x: + version "0.10.31" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" + +string_decoder@~1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab" + dependencies: + safe-buffer "~5.1.0" + +stringstream@~0.0.4: + version "0.0.5" + resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" + +strip-ansi@^3.0.0, strip-ansi@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + dependencies: + ansi-regex "^2.0.0" + +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + dependencies: + ansi-regex "^3.0.0" + +strip-bom@3.0.0, strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + +strip-bom@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-1.0.0.tgz#85b8862f3844b5a6d5ec8467a93598173a36f794" + dependencies: + first-chunk-stream "^1.0.0" + is-utf8 "^0.2.0" + +strip-bom@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" + dependencies: + is-utf8 "^0.2.0" + +strip-eof@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + +strip-json-comments@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + +supports-color@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + +supports-color@^3.1.2: + version "3.2.3" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" + dependencies: + has-flag "^1.0.0" + +supports-color@^4.0.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.2.1.tgz#65a4bb2631e90e02420dba5554c375a4754bb836" + dependencies: + has-flag "^2.0.0" + +symbol-tree@^3.2.1: + version "3.2.2" + resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" + +test-exclude@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.1.1.tgz#4d84964b0966b0087ecc334a2ce002d3d9341e26" + dependencies: + arrify "^1.0.1" + micromatch "^2.3.11" + object-assign "^4.1.0" + read-pkg-up "^1.0.1" + require-main-filename "^1.0.1" + +throat@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/throat/-/throat-3.2.0.tgz#50cb0670edbc40237b9e347d7e1f88e4620af836" + +through2@2.0.3, through2@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be" + dependencies: + readable-stream "^2.1.5" + xtend "~4.0.1" + +through2@^0.6.1: + version "0.6.5" + resolved "https://registry.yarnpkg.com/through2/-/through2-0.6.5.tgz#41ab9c67b29d57209071410e1d7a7a968cd3ad48" + dependencies: + readable-stream ">=1.0.33-1 <1.1.0-0" + xtend ">=4.0.0 <4.1.0-0" + +through@2, through@~2.3, through@~2.3.1: + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + +tildify@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/tildify/-/tildify-1.2.0.tgz#dcec03f55dca9b7aa3e5b04f21817eb56e63588a" + dependencies: + os-homedir "^1.0.0" + +time-stamp@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/time-stamp/-/time-stamp-1.1.0.tgz#764a5a11af50561921b133f3b44e618687e0f5c3" + +timers-ext@0.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/timers-ext/-/timers-ext-0.1.2.tgz#61cc47a76c1abd3195f14527f978d58ae94c5204" + dependencies: + es5-ext "~0.10.14" + next-tick "1" + +tmpl@1.0.x: + version "1.0.4" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" + +to-fast-properties@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" + +tough-cookie@^2.3.2, tough-cookie@~2.3.0: + version "2.3.2" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.2.tgz#f081f76e4c85720e6c37a5faced737150d84072a" + dependencies: + punycode "^1.4.1" + +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + +trim-right@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" + +ts-comment@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/ts-comment/-/ts-comment-1.0.1.tgz#f12b27eb5086491cc291788bbf179be8865ac144" + dependencies: + typescript "^2.4.0" + +ts-jest@20.0.10: + version "20.0.10" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-20.0.10.tgz#19e9386e6c890d31c2a64e938edc0c84fc937ebc" + dependencies: + babel-core "^6.24.1" + babel-plugin-istanbul "^4.1.4" + babel-plugin-transform-es2015-modules-commonjs "^6.24.1" + babel-preset-jest "^20.0.3" + fs-extra "^4.0.0" + jest-config "^20.0.0" + jest-util "^20.0.0" + pkg-dir "^2.0.0" + source-map-support "^0.4.4" + yargs "^8.0.1" + +ts-node@3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-3.3.0.tgz#c13c6a3024e30be1180dd53038fc209289d4bf69" + dependencies: + arrify "^1.0.0" + chalk "^2.0.0" + diff "^3.1.0" + make-error "^1.1.1" + minimist "^1.2.0" + mkdirp "^0.5.1" + source-map-support "^0.4.0" + tsconfig "^6.0.0" + v8flags "^3.0.0" + yn "^2.0.0" + +tsconfig-extends@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/tsconfig-extends/-/tsconfig-extends-1.0.1.tgz#f5e5a4c3520a284c5642a7fb57713cbb7ae42f0f" + +tsconfig@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/tsconfig/-/tsconfig-6.0.0.tgz#6b0e8376003d7af1864f8df8f89dd0059ffcd032" + dependencies: + strip-bom "^3.0.0" + strip-json-comments "^2.0.0" + +tslib@^1.0.0, tslib@^1.7.1: + version "1.7.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.7.1.tgz#bc8004164691923a79fe8378bbeb3da2017538ec" + +tslint-config-ikatyang@2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/tslint-config-ikatyang/-/tslint-config-ikatyang-2.2.0.tgz#10de198873836a0a521fc1071ad8ec9fbca5d727" + dependencies: + tslint-consistent-codestyle "~1.6.0" + tslint-eslint-rules "~4.1.0" + tslint-plugin-ikatyang "~1.0.0" + +tslint-config-prettier-ext@1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/tslint-config-prettier-ext/-/tslint-config-prettier-ext-1.5.0.tgz#1bf25bc5820dd18cc7d0ef23a0c4fd6c943840a9" + +tslint-consistent-codestyle@~1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/tslint-consistent-codestyle/-/tslint-consistent-codestyle-1.6.0.tgz#e42f5fd1d5bd4ffa697386ec8a41ed2cb6812aaf" + dependencies: + tslib "^1.7.1" + tsutils "^2.6.1" + +tslint-eslint-rules@~4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/tslint-eslint-rules/-/tslint-eslint-rules-4.1.1.tgz#7c30e7882f26bc276bff91d2384975c69daf88ba" + dependencies: + doctrine "^0.7.2" + tslib "^1.0.0" + tsutils "^1.4.0" + +tslint-plugin-ikatyang@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/tslint-plugin-ikatyang/-/tslint-plugin-ikatyang-1.0.0.tgz#fb70140938879435f084696fe98193e7e8561093" + dependencies: + lodash.camelcase "^4.3.0" + lodash.kebabcase "^4.1.1" + lodash.snakecase "^4.1.1" + lodash.upperfirst "^4.3.1" + tslib "^1.7.1" + tsutils "^2.8.0" + +tslint-plugin-prettier@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/tslint-plugin-prettier/-/tslint-plugin-prettier-1.0.0.tgz#2138ec2a65de883d19b95247430771cdfcbff8de" + dependencies: + fast-diff "^1.1.1" + tslib "^1.7.1" + +tslint@5.6.0: + version "5.6.0" + resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.6.0.tgz#088aa6c6026623338650b2900828ab3edf59f6cf" + dependencies: + babel-code-frame "^6.22.0" + colors "^1.1.2" + commander "^2.9.0" + diff "^3.2.0" + glob "^7.1.1" + minimatch "^3.0.4" + resolve "^1.3.2" + semver "^5.3.0" + tslib "^1.7.1" + tsutils "^2.7.1" + +tsutils@^1.4.0: + version "1.9.1" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-1.9.1.tgz#b9f9ab44e55af9681831d5f28d0aeeaf5c750cb0" + +tsutils@^2.6.1, tsutils@^2.7.1, tsutils@^2.8.0: + version "2.8.0" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.8.0.tgz#0160173729b3bf138628dd14a1537e00851d814a" + dependencies: + tslib "^1.7.1" + +tunnel-agent@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + dependencies: + safe-buffer "^5.0.1" + +tweetnacl@^0.14.3, tweetnacl@~0.14.0: + version "0.14.5" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + +type-check@~0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + dependencies: + prelude-ls "~1.1.2" + +typescript@2.4.2, typescript@^2.4.0, typescript@~2.4.1: + version "2.4.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.4.2.tgz#f8395f85d459276067c988aa41837a8f82870844" + +uglify-js@^2.6: + version "2.8.29" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" + dependencies: + source-map "~0.5.1" + yargs "~3.10.0" + optionalDependencies: + uglify-to-browserify "~1.0.0" + +uglify-to-browserify@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" + +unc-path-regex@^0.1.0: + version "0.1.2" + resolved "https://registry.yarnpkg.com/unc-path-regex/-/unc-path-regex-0.1.2.tgz#e73dd3d7b0d7c5ed86fbac6b0ae7d8c6a69d50fa" + +unique-stream@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unique-stream/-/unique-stream-1.0.0.tgz#d59a4a75427447d9aa6c91e70263f8d26a4b104b" + +universalify@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.1.tgz#fa71badd4437af4c148841e3b3b165f9e9e590b7" + +user-home@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/user-home/-/user-home-1.1.1.tgz#2b5be23a32b63a7c9deb8d0f28d485724a3df190" + +util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + +uuid@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" + +v8flags@^2.0.2: + version "2.1.1" + resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-2.1.1.tgz#aab1a1fa30d45f88dd321148875ac02c0b55e5b4" + dependencies: + user-home "^1.1.1" + +v8flags@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-3.0.0.tgz#4be9604488e0c4123645def705b1848d16b8e01f" + dependencies: + user-home "^1.1.1" + +validate-npm-package-license@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz#2804babe712ad3379459acfbe24746ab2c303fbc" + dependencies: + spdx-correct "~1.0.0" + spdx-expression-parse "~1.0.0" + +verror@1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" + dependencies: + assert-plus "^1.0.0" + core-util-is "1.0.2" + extsprintf "^1.2.0" + +vinyl-fs@^0.3.0: + version "0.3.14" + resolved "https://registry.yarnpkg.com/vinyl-fs/-/vinyl-fs-0.3.14.tgz#9a6851ce1cac1c1cea5fe86c0931d620c2cfa9e6" + dependencies: + defaults "^1.0.0" + glob-stream "^3.1.5" + glob-watcher "^0.0.6" + graceful-fs "^3.0.0" + mkdirp "^0.5.0" + strip-bom "^1.0.0" + through2 "^0.6.1" + vinyl "^0.4.0" + +vinyl@^0.4.0: + version "0.4.6" + resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-0.4.6.tgz#2f356c87a550a255461f36bbeb2a5ba8bf784847" + dependencies: + clone "^0.2.0" + clone-stats "^0.0.1" + +vinyl@^0.5.0: + version "0.5.3" + resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-0.5.3.tgz#b0455b38fc5e0cf30d4325132e461970c2091cde" + dependencies: + clone "^1.0.0" + clone-stats "^0.0.1" + replace-ext "0.0.1" + +walker@~1.0.5: + version "1.0.7" + resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" + dependencies: + makeerror "1.0.x" + +watch@~0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/watch/-/watch-0.10.0.tgz#77798b2da0f9910d595f1ace5b0c2258521f21dc" + +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + +webidl-conversions@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.1.tgz#8015a17ab83e7e1b311638486ace81da6ce206a0" + +whatwg-encoding@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.1.tgz#3c6c451a198ee7aec55b1ec61d0920c67801a5f4" + dependencies: + iconv-lite "0.4.13" + +whatwg-url@^4.3.0: + version "4.8.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.8.0.tgz#d2981aa9148c1e00a41c5a6131166ab4683bbcc0" + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + +which-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f" + +which-module@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + +which@^1.2.12, which@^1.2.9: + version "1.3.0" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" + dependencies: + isexe "^2.0.0" + +window-size@0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" + +wordwrap@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" + +wordwrap@~0.0.2: + version "0.0.3" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" + +wordwrap@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + +worker-farm@^1.3.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.4.1.tgz#a438bc993a7a7d133bcb6547c95eca7cff4897d8" + dependencies: + errno "^0.1.4" + xtend "^4.0.1" + +wrap-ansi@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" + dependencies: + string-width "^1.0.1" + strip-ansi "^3.0.1" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + +xml-name-validator@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-2.0.1.tgz#4d8b8f1eccd3419aa362061becef515e1e559635" + +"xtend@>=4.0.0 <4.1.0-0", xtend@^4.0.1, xtend@~4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" + +y18n@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" + +yallist@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + +yargs-parser@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-5.0.0.tgz#275ecf0d7ffe05c77e64e7c86e4cd94bf0e1228a" + dependencies: + camelcase "^3.0.0" + +yargs-parser@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-7.0.0.tgz#8d0ac42f16ea55debd332caf4c4038b3e3f5dfd9" + dependencies: + camelcase "^4.1.0" + +yargs@8.0.2, yargs@^8.0.1: + version "8.0.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-8.0.2.tgz#6299a9055b1cefc969ff7e79c1d918dceb22c360" + dependencies: + camelcase "^4.1.0" + cliui "^3.2.0" + decamelize "^1.1.1" + get-caller-file "^1.0.1" + os-locale "^2.0.0" + read-pkg-up "^2.0.0" + require-directory "^2.1.1" + require-main-filename "^1.0.1" + set-blocking "^2.0.0" + string-width "^2.0.0" + which-module "^2.0.0" + y18n "^3.2.1" + yargs-parser "^7.0.0" + +yargs@^7.0.2: + version "7.1.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-7.1.0.tgz#6ba318eb16961727f5d284f8ea003e8d6154d0c8" + dependencies: + camelcase "^3.0.0" + cliui "^3.2.0" + decamelize "^1.1.1" + get-caller-file "^1.0.1" + os-locale "^1.4.0" + read-pkg-up "^1.0.1" + require-directory "^2.1.1" + require-main-filename "^1.0.1" + set-blocking "^2.0.0" + string-width "^1.0.2" + which-module "^1.0.0" + y18n "^3.2.1" + yargs-parser "^5.0.0" + +yargs@~3.10.0: + version "3.10.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1" + dependencies: + camelcase "^1.0.2" + cliui "^2.1.0" + decamelize "^1.0.0" + window-size "0.1.0" + +yn@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/yn/-/yn-2.0.0.tgz#e5adabc8acf408f6385fc76495684c88e6af689a"