mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 04:49:15 +08:00
* Add ERROR_STATE flag * added prop options and func timeFormatter added property `options`, which can be found in [the code](15fc4b62f5/smoothie.js (L270)). Even though it's not mentioned in the docs, it useful to be able to access these options after chart is initialized when you want to change appearance in real tme. added function `timeFormatter`, which is mentioned in [right here, in the definitions](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/smoothie/smoothie.d.ts#L127) and can be found in [the code](15fc4b62f5/smoothie.js (L795)) * Fix type errors * Added typings for css-modules-require-hook * Remove spaces * Added semver, added explicit ignore callback, unified array definition and removed one time interface * Overwriting method signature * Correct parameter type * Add MobilePhoneLocale * Add isMobilePhone tests * Type definitions for bit-array * Add emit for cluster * To use the definition inline * [logat.d.ts] Type definition for node module 'logat' (#11485) * Create logat.d.ts * Create logat-tests.ts * Update logat-tests.ts * Update logat-tests.ts * Update logat.d.ts * updated logat test * updated type definiton * [dateformat.d.ts] Add definitions for dateformat * Remove the ES6 module hack * Yayson definitions (#11484) * Add yayson Store typings * Add yayson Store tests * Improve yayson coverage * Specify version in yayson definition * Remove yayson generics and tidy * Changed namespace from angularTouchspin to angular.touchspin (#11414) * [perfect-scrollbar.d.ts] Add definitions for perfect-scrollbar (#11486) * Added types for klaw (#11492) * Added types for klaw * addressed pr comments and `tsfmt -r klaw/*.ts` * add typings for onselected and onunselected methods, refs #11493 (#11496) * Improve through2 declarations (#11499) * [through2] Fix typos * [through2] Change return types to stream.Transform `through2` creates `stream.Transform`-flavored streams, so switching the return types to `stream.Transform` gives us richer typing information than using `NodeJS.ReadWriteStream`, which is missing methods (e.g. `stream.Transform#push`) and the ability to use object mode. * [through2] Add through2.ctor method * [through2] Update header and docs * Add module declaration to crossfilter so that it can be explicitly imported (#11521) * Add typings for murmurhash3js * fix module import to be ES6 compliant * newline at EOF * [rethinkdb] Adds missing promise methods to Cursor and Connection * [rethinkdb] Applied TypeScript formatting to the file * [rethinkdb] Adds types to Cursor methods * webpack - HotModuleReplacementPlugin has opts arg * [openlayers] forEachFeatureAtPixel can return a value See doc http://openlayers.org/en/latest/apidoc/ol.Map.html#forEachFeatureAtPixel * Update react.d.ts Added myself as an author so I get notifications of PRs / updates from GitHub. * vue: fixed definition for activate() in ComponentOption * Fix error that came using typescript 2 This error come when try compile with typescript 2 kue.d.ts(13,3): error TS2440: Import declaration conflicts with local declaration of 'redis' * path can be string or a hash of options As per http://restify.com/#client-api it states: > Note that all further documentation refers to the "short-hand" > form of methods like get/put/del which take a string path. You > can also pass in an object to any of those methods with extra > params (notably headers): So the path can be either a string or a hash of options. * Add CognitoIdentity into aws-sdk * Font advanced config options added (for v2.0.6+) * Add missing slider parameters * Add backspaceToRemoveMessage prop * fixup! path can be string or a hash of options * add request.body (#11395) * add request.body * Update koa-bodyparser.d.ts According to the documentation of `koa-bodyparser`: ```javascript // the parsed body will store in this.request.body // if nothing was parsed, body will be an empty object {} ctx.body = ctx.request.body; ``` Therefore the `body` property will exit in the `request` object. Changing the `body` property from optional to required can also fix the conflict problem in Koa's declaration file: ```ts class Koa extend Request, Response {} ``` * Implement tilebelt definition (#11495) * Add import test (#11476) * [validator] Add new stuff which document not mentioned (#11498) * Add new stuff which document not mentioned * Add related test * http.ServerRequest => http.IncomingMessage (#11500) * [node] Add events for dgram (#11501) * Add events for dgram * Add tests for dgram * Correct dgram.RemoteInfo interface * Correct emit * Correct emit * [node] Add events for tls.Server and tls.TLSSocket (#11502) * Add events for tls.Server * Add tests for tls.Server * Add tests for TLSSocket * Add events for TLSSocket * [react-router] Update getComponents signatures (#11319) Update `getComponent(s)` all over the place. See #9530 for more info. * Updated jquery.dataTables for 1.10.7. (#11408) * Updated jquery.dataTables for 1.10.7. Version release notes: https://cdn.datatables.net/1.10.7/ * Added any() * Added i18n() Note: selector-modifier support currently exists with interface ObjectSelectorModifier. * Added strong variable typing in jquery.dataTables-tests.ts * For parameter 'def', replaced 'Object' data type with 'any' per TypeScript declaration file guidance. * [HAPI] Add `IStrictSessionHandler` (#11523) * Fix #11519 * Added FileResizeOptions for the changed resize function call * getEvent should not be set to void it should return a value (#11135) * getEvent should not be set to void it should return a value * Add type to getActionData for testing * pnotify Add type fpr notice styling and state * fix pnotify test * Remove Generics and replaces by return any * convert space tp tabs * Add barTintColor to NavigatorIOS (#11522) * GreenSock TweenMax TweenLite config Object typed refs #11265 (#11310) * refs #9944 * refs #11265 * refs #11265 * Call strategy with only mode or options (#11466) * Call strategy with only mode or options * Refactor `server.auth.strategy` * - add client.exists([params, [callback]]) (#11515) * Update to Electron 1.4.1 (#11481) * Correct fs.createWriteStream (#11560) * add declaration file for weapp (#11554) * add declaration file of weapp * rename "weapp" to "weapp-api" rename "weapp" to "weapp-api" to avoid naming conflicts * Added more methods to Turf (#11558) * Added more methods to Turf - circle - geojsonType - propReduce - coordAll - tesselate * Replace Object with GeoJSON * Implemented cheap-ruler definition * Remove GeoJSON dependency * Cheap-ruler fixes - Removed GeoJSON from tests - Added return-type to fromTile * Update JSDocs cheap-ruler Update based on comments https://github.com/mapbox/cheap-ruler/pull/20 - Removed `{@name}` - Changed {Object} to {CheapRuler} * [bluebird] document .suppressUnhandledRejections http://bluebirdjs.com/docs/api/suppressunhandledrejections.html * Add typings for shallowequal. * URIjs fix .joinPaths() the .joinPaths function is on URIStatic, not an instance of URI https://medialize.github.io/URI.js/docs.html#static-joinPaths * set document id property to be optional * Fixed type of onchallenge * feat(CKEditor): Add missing typings for `focusManager` * sequelize: fix return value type of Model.findOrXXX methods http://docs.sequelizejs.com/en/latest/api/model/#findorinitialize-promiseinstance-initialized * Added type Point for simplicity Comments from @vladima * add interface for mongoose document optional properties * optional constructor for RecurrenceRule * fix the framework type * add parameter support in initialize() * add callback parameter * Added promise() to the JQueryPromise<T> interface jQuery allows calling a promise() function on a Promise object. Updated the interface to reflect this. * optional authorize * add contains fn * Update ip-tests.ts * Added tests for the promise() method on jqXHR Ensures that the jqXHR object exposes a standard promise because it implements the JQueryPromise<T> interface. * angular-dynamic-local Add "storageKey" definition (#11566) Add "storageKey" definition cf : https://github.com/lgalfaso/angular-dynamic-locale/blob/master/src/tmhDynamicLocale.js#L197 * Added declare module for easier including. (#11562) * Adding recompose@0.20.2 typings (#11577) * Added typings for change-emitter@0.1.2 * Adding recompose@0.20.2 typings * Update typescript definition for selectize to 0.12.13 (#11570) * [react-router-redux] Update action payload type (#11559) The payload for React Redux Router action is a location object. For more information look at the source code [here](https://github.com/reactjs/react-router-redux/blob/master/src/sync.js#L95) * [openlayers] Rewrite for openlayers 3.18.2 (#11339) * Added missing config options for release v2.0.8 (#11595) * [graphql] Create graphql (#11598) * Complete graphql/language * Update graphql/error * Update graphql.d.ts * Create graphql-tests.ts * Update graphql/type * Update graphql/error and graphql/execution * Remove null type * Remove comma * ej typings v14.3.0.49 added (#11597) * ej typings v14.3.0.49 added * jquery dependent added * react-bootstrap-table: add ignoreSinglePage option (#11581) As shown in the [docs](http://allenfang.github.io/react-bootstrap-table/docs.html) ``` ignoreSinglePage : Bool Enable to ignore the pagination if only one page, default is false. ``` * There is no INST_EDGE_FALLING exported const but INT_EDGE_FALLING (#11603) Exporting correct `const` `INST_EDGE_FALLING` -> `INT_EDGE_FALLING` * Complete HighchartsBarStates interface. Add Color interface (#11505) - HighchartsBarStates interfaces didn't include `borderColor` and `color` properties, as documented in http://api.highcharts.com/highcharts/plotOptions.bar.states.hover - A Color interface was added, since the documentation refers many times to `Color` as a type. This colors can be either a string or a gradient, as stated in http://www.highcharts.com/docs/chart-design-and-style/colors. The introduction of this type should help alleviating the errors currently present where certain "color" properties are only allowed to be strings. * Add definition for swagger-jsdoc (#11298) * Add definition for swagger-jsdoc * Update files * Remove interface and use any instead for options, fix tests * Fix Usage example * Add definitions for: "bunyan-config", "express-mung", "node-vitalsigns" and "memwatch-next" (#11285) * Add definition for "bunnymq". * Add definition for "strftime". * Add definitions for: "bunyan-config", "express-mung" and "node-vitalsigns". * Add definitions for: "bunyan-config", "express-mung" and "node-vitalsigns". * Add definition for "memwatch-next". * Fix project URL address. * Rename "node-vitalsigns" to "vitalsigns". * Update definitions. * Use {} instead of "Object" type. Remove unnecessary namespace for "memwatch-next" definition. Rewrite "bunyan-config" definition. * Replace "Object" by "{}". * (helmet): change to namespace and export interfaces (#11585) * Replace reference to deprecated http.ClientResponse with newer http.IncomingMessage (#11596) * [cheerio] Adds missing load(CheerioElement) (#11520) * add id (#11619) * add id * remove readonly * add touch after * fix typo * change Topic property latch to boolean type (#11607) * Add AngularJS linky filter definition (#11507) * Support universal modules for SAT (#11632) * changed versionKey in Schema spec to string * better structure * Add argumentless Q() * add definitions for tz-format (#11565) * add definitions for tz-format * fix return type * Create typings for ngeohash (#11634) * [nprogress] Update configuration properties (#11627) Update a couple of nprogress configuration properties: * `ease` is renamed to `easing`. * `trickleRate` is removed. * `parent` is added. More info [here](https://github.com/rstacruz/nprogress/blob/master/nprogress.js#L19-L31) * Fix leaflet L.GeoJSON.addData et al (#11590) (#11591) * NotificationAlertOptions can have a subtitle (#11638) * Parse5 comment data (#11649) * Add test for data * Update parse5.d.ts * feat: add localforage-cordovasqlitedriver definition (#11650) * Fix export for "bunyan-config" and improve definitions (#11653) * Fix export for "bunyan-config". * Update definitions. Replace "Object" to "{}" type. Add "express" property in "VitalSigns" class. * Update ejs.d.ts (#11467) This typings give an error when templating HTML Error: Cannot invoke an expression whose type lacks a call signature. my code ```javascript var templateFunction = EJS.compile(SOMESTRTEMPLATE); myDomElement.innerHTML = templateFunction(someDataObject) // <= ERROR ``` * Added hyperscript module (#11661) * update parsimmon typings for parsimmon 0.9.2 (#11648) * update parsimmon typings for parsimmon 0.9.2 * add overloads for parsimmon#seq * code review * Fix babel-traverse buildCodeFrameError signature (#11654) The Error argument is not an error instance, instead it is a constructor function that returns an error instance. Additionally, the constructor function is optional, by default SyntaxError is used * Added type definition for riot library (#11664) * Added type definition for riot * Added type information for compile function, version, settings and template error handler * Updated namespace name Riot -> riot * Renamed riot-test.ts -> riot-tests.ts * Add definitions for pem (#11666) https://github.com/andris9/pem * Added hapi-decorators.d.ts (#11668) * Add missing each, and correct type of Date.now() (#11670) * Add definitions for spdy (#11672) https://github.com/indutny/node-spdy * Allow interface to be named (#11673) > error TS4023: Exported variable 'DevTools' has or is using name 'IDevTools' from external module "/Users/remojansen/CODE/forks/redux-bootstrap/node_modules/@types/redux-devtools/index" but cannot be named. * Add array methods to LoDashExplicitArrayWrapper to match LoDashImplicitArrayWrapper. (#11518) * add transducers-js types w/ tests (#11676) * Fix redeclare block-scoped Base64 (#11677) Issue found by https://github.com/dankogai/js-base64/issues/38#issuecomment-250999729 * added seed, randomTests and randomizeTests property (#11678) * Add toJSON method to signature (#11682) * Fix instance of cropperjs for library version > 0.8 (#11490) * Updated fbsdk definitions for authentication responses and api calls. (#11686) Fixes #11327 May help with #11007 * Create typings for jquery-alertable (#11642) * ADD: definition file for the moment-duration-format library (#11557) * Update d.ts file for Dialog API updates (#11526) * Add support for Highcharts modules: offline exporting and boost (#11030) * Create highcharts-modules-offline-exporting * Rename highcharts-modules-offline-exporting to highcharts-modules-offline-exporting.d.ts * Create highcharts-modules-boost.d.ts * Added cash-js.d.ts File (#10765) * Added cash-js.d.ts File * Fixed Link break issue * Renamed from cash-js to cash * Fixed the module name as suggested * Update headroom.d.ts (#11313) notBottom missing from definition * Added the definition for the npm package simple-url-cache (#11296) * Added the definition for the npm package simple-url-cache https://www.npmjs.com/package/simple-url-cache * - Some problems with shells.js missing the touch fucntion deifnition * More details on the touch parameters - nice screenshot btw * Updated the RowMethods interface (#11665) * Updated the RowMethods interface This Interface was missing the Definition of the id() method. Link to official documentation: https://datatables.net/reference/api/row().id() * Changed indentation from tabs to spaces * Added definition file for Defaults Js Library (#11451) * Added missing className property to CardProps (#10823) The className property for CardPros is missing, so using it like <Card className={this.myClass}>...</Card> is not possible. * Add missing perMessageDeflate server option (#11380) * Add missing class AgendaView (#11371) * Add missing class AgendaView * Move class to kendo.ui namespace * Change path to interface * Add static fn * Add static extend * Add static extend * Resolve conflicts * adds system faker methods (#11432) * added definitions for SharePoint file Search.ClientControls.js (#11652) * added definitions for SharePoint file Search.ClientControls.js (Srch namespace, heavily used in Search Display Templates) * --noImplicitAny compatibility fixes also small improvements * more fixes for --noImplicitAny * Adding union type for offset (#11689) * add type definitions for msgpack-lite package. (#11690) * Updating jasmine to version 2.5 (#11688) * Updating jasmine to version 2.5 * Fixing 2 small errors in the update of jasmine * withMock now takes a "() => void" * fixed the withMock syntax error * number added as type to seed function * add missing isEmpty function (#11698) * Added type definitions for terminal-menu (#11697) * Update THREE.js definitions to r81 (#11679) * Update THREE.js definitions to r81 * Update test_unit_maths.ts to r81 * Update version in header to r81 * UPDATE localForage type definitions (#11702) * Update Google Maps API type definition to 3.25 (#11626) * Update Google Maps Places Library definition - According to the Places Library documentation (https://goo.gl/EJFiuQ), certain fields are being removed - I have aligned the Places Library definitions with the API reference (https://goo.gl/kYoi9V) and added deprecation comments for the old properties as they are still accepted until February - I could not find an official deprecation attribute or similar for Typescript definitions so I just left a comment * Update the API version in the header * Apply API changes between version 3.20 and 3.25 - Used the Google Maps API release notes (https://goo.gl/nRUZGJ) as a reference * Fix inconsistant type definition * Override ol.layer.Vector#getSource() (#11703) Reference: http://openlayers.org/en/latest/apidoc/ol.layer.Vector.html * Replace number[] by [number, number] (#11704) * [lodash]: memoize.Cache expects construcor (#11707) https://lodash.com/docs/4.15.0#memoize * Added jquery.flagstrap.js definition suport (#11710) * apply declaration merging (#10900) * Update material-ui.d.ts (#11353) Expose ThemePalette interface. * Change ChartAxisXOptions (#11449) Change the type for minimum and maximum options in ChartAxisXOptions to support both number and Date. * Improve support for arrays of promises (#11685) * Alias IWhenable<T> = IPromise<T> | T * Allow all Q functions to work with either promises or raw values * Allow functions expecting arrays to take promises for arrays Q.race is deliberately excluded, as this does not support this type of argument. * scheduler options (#11543) * Added missing move function (#11563) * Added missing move function Added missing move function in typings so that the move function is recognised by the IDE and the compiler. * Minor derp here * Add missing Valdr typings for validation results and constraints (#11636) * Add missing Valdr types Add ValdrValidationConstraints and ValdrValidationResult typings * Refine Valdr-message typings Set a more refined type to messages instead of any * Expand Valdr typings tests Expand tests to include added typings for ValdrValidationResult and ValdrConstraints * Fix spacing Replace tabs by spaces * Rename vars in test Rename vars to make test clearer * Fix TS issues Added missing types * Remove undefined In TS by default null and undefined are subtypes of all other types * Fix wrong type Add missing namespace * Fix wrong version number Set version to only numbers * Fix wrong version number Keep version to only numbers * Use douple quotes * Remove invalid triple-slash references * Add tsconfig.json files and move main file to index.d.ts * Rename file to index.d.ts * Remove tscparams files * Remove unused file * Remove invalid references * Move hapi-decorator to use index.d.ts * Switch to use external modules * Correctely extend angular * Fix tsconfig.json * Remove unused references * HACK: Put back /// reference tag.
1808 lines
78 KiB
TypeScript
1808 lines
78 KiB
TypeScript
// Type definitions for ramda
|
|
// Project: https://github.com/donnut/typescript-ramda
|
|
// Definitions by: Erwin Poeze <https://github.com/donnut>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
declare var R: R.Static;
|
|
|
|
declare namespace R {
|
|
type Ord = number | string | boolean;
|
|
|
|
interface ListIterator<T, TResult> {
|
|
(value: T, index: number, list: T[]): TResult;
|
|
}
|
|
|
|
interface Functor<T> {
|
|
map<T>(a: any): T;
|
|
}
|
|
|
|
interface ObjectIterator<T, TResult> {
|
|
(element: T, key: string, obj: Dictionary<T>): Dictionary<TResult>;
|
|
}
|
|
|
|
interface KeyValuePair<K, V> extends Array<K | V> { 0 : K; 1 : V; }
|
|
|
|
interface ArrayLike {
|
|
nodeType: number;
|
|
}
|
|
|
|
interface Arity0Fn {
|
|
(): any
|
|
}
|
|
|
|
interface Arity1Fn {
|
|
(a: any): any
|
|
}
|
|
|
|
interface Arity2Fn {
|
|
(a: any, b: any): any
|
|
}
|
|
|
|
interface ObjFunc {
|
|
[index:string]: Function;
|
|
}
|
|
|
|
interface ObjFunc2 {
|
|
[index:string]: (x: any, y: any) => boolean;
|
|
}
|
|
|
|
interface Pred {
|
|
(...a: any[]): boolean;
|
|
}
|
|
|
|
interface ObjPred {
|
|
(value: any, key: string): boolean;
|
|
}
|
|
|
|
interface Dictionary<T> {
|
|
[index: string]: T;
|
|
}
|
|
|
|
interface CharList extends String {
|
|
push(x: string): void;
|
|
}
|
|
|
|
interface Nested<U> {
|
|
[index: string]: Nested<U>|{<U>(value: any): U};
|
|
}
|
|
|
|
interface Lens {
|
|
<T,U>(obj: T): U;
|
|
set<T,U>(str: string, obj: T): U;
|
|
}
|
|
|
|
// @see https://gist.github.com/donnut/fd56232da58d25ceecf1, comment by @albrow
|
|
interface CurriedFunction2<T1, T2, R> {
|
|
(t1: T1): (t2: T2) => R;
|
|
(t1: T1, t2: T2): R;
|
|
}
|
|
|
|
interface CurriedFunction3<T1, T2, T3, R> {
|
|
(t1: T1): CurriedFunction2<T2, T3, R>;
|
|
(t1: T1, t2: T2): (t3: T3) => R;
|
|
(t1: T1, t2: T2, t3: T3): R;
|
|
}
|
|
|
|
interface CurriedFunction4<T1, T2, T3, T4, R> {
|
|
(t1: T1): CurriedFunction3<T2, T3, T4, R>;
|
|
(t1: T1, t2: T2): CurriedFunction2<T3, T4, R>;
|
|
(t1: T1, t2: T2, t3: T3): (t4: T4) => R;
|
|
(t1: T1, t2: T2, t3: T3, t4: T4): R;
|
|
}
|
|
|
|
interface CurriedFunction5<T1, T2, T3, T4, T5, R> {
|
|
(t1: T1): CurriedFunction4<T2, T3, T4, T5, R>;
|
|
(t1: T1, t2: T2): CurriedFunction3<T3, T4, T5, R>;
|
|
(t1: T1, t2: T2, t3: T3): CurriedFunction2<T4, T5, R>;
|
|
(t1: T1, t2: T2, t3: T3, t4: T4): (t5: T5) => R;
|
|
(t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R;
|
|
}
|
|
|
|
interface CurriedFunction6<T1, T2, T3, T4, T5, T6, R> {
|
|
(t1: T1): CurriedFunction5<T2, T3, T4, T5, T6, R>;
|
|
(t1: T1, t2: T2): CurriedFunction4<T3, T4, T5, T6, R>;
|
|
(t1: T1, t2: T2, t3: T3): CurriedFunction3<T4, T5, T6, R>;
|
|
(t1: T1, t2: T2, t3: T3, t4: T4): CurriedFunction2<T5, T6, R>;
|
|
(t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): (t6: T6) => R;
|
|
(t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6): R;
|
|
}
|
|
|
|
interface Reduced {}
|
|
|
|
interface Static {
|
|
|
|
/**
|
|
* Adds two numbers (or strings). Equivalent to a + b but curried.
|
|
*/
|
|
add(a: number, b: number): number;
|
|
add(a: string, b: string): string;
|
|
add(a: number): (b: number) => number;
|
|
add(a: string): (b: string) => string;
|
|
|
|
/**
|
|
* 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<T,U>(fn: (f: (item: T) => U, list: T[]) => U[] )
|
|
: CurriedFunction2<(item: T, idx: number, list?: T[]) => U, T[], U[]>;
|
|
/* Special case for forEach */
|
|
addIndex<T>(fn: (f: (item: T) => void, list: T[]) => T[])
|
|
: CurriedFunction2<(item: T, idx: number, list?: T[]) => void, T[], T[]>;
|
|
/* Special case for reduce */
|
|
addIndex<T,U>(fn: (f: (acc:U, item: T) => U, aci:U, list: T[]) => U)
|
|
: CurriedFunction3<(acc:U, item: T, idx: number, list?: T[]) => U, U, T[], 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<T>(fn: (a: T) => T, index: number, list: T[]): T[];
|
|
adjust<T>(fn: (a: T) => T, index: number): (list: T[]) => T[];
|
|
|
|
/**
|
|
* Returns true if all elements of the list match the predicate, false if there are any that don't.
|
|
*/
|
|
all<T>(fn: (a: T) => boolean, list: T[]): boolean;
|
|
all<T>(fn: (a: T) => boolean): (list: T[]) => 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<T>(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<T extends {and?: Function;}>(fn1: T, val2: boolean|any): boolean;
|
|
and<T extends {and?: Function;}>(fn1: T): (val2: boolean|any) => boolean;
|
|
|
|
/**
|
|
* Returns true if at least one of elements of the list match the predicate, false otherwise.
|
|
*/
|
|
any<T>(fn: (a: T) => boolean, list: T[]): boolean;
|
|
any<T>(fn: (a: T) => boolean): (list: T[]) => 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<T,U>(fns: ((a: T) => U)[], vs: T[]): U[];
|
|
ap<T,U>(fns: ((a: T) => U)[]): (vs: T[]) => 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<T>(n: number, list: T): T[][];
|
|
aperture(n: number): <T>(list: T) => T[][];
|
|
|
|
/**
|
|
* Returns a new list containing the contents of the given list, followed by the given element.
|
|
*/
|
|
append<T, U>(el: U, list: T[]): (T & U)[];
|
|
append<U>(el: U): <T>(list: T[]) => (T & U)[];
|
|
append<U>(el: U): <T>(list: T[]) => (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<T, U, TResult>(fn: (arg0: T, ...args: T[]) => TResult, args: U[]): TResult;
|
|
apply<T, TResult>(fn: (arg0: T, ...args: T[]) => TResult): <U>(args: U[]) => 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<T>(obj: any): (...args: any[]) => T;
|
|
|
|
/**
|
|
* Makes a shallow clone of an object, setting or overriding the specified property with the given value.
|
|
*/
|
|
assoc<T,U>(prop: string, val: T, obj: U): {prop: T} & U;
|
|
assoc(prop: string): <T,U>(val: T, obj: U) => {prop: T} & U;
|
|
assoc<T>(prop: string, val: T): <U>(obj: U) => {prop: T} & U;
|
|
|
|
|
|
/**
|
|
* 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<T,U>(path: string[], val: T, obj: U): U;
|
|
assocPath(path: string[]): <T,U>(val: T, obj: U) => U;
|
|
assocPath<T>(path: string[], val: T): <U>(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: (...args: any[]) => any): Function;
|
|
|
|
/**
|
|
* 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<T>(thisObj: T, fn: (...args: any[]) => any): (...args: any[]) => any;
|
|
|
|
|
|
/**
|
|
* 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(pred1: Pred, pred2: Pred): Pred;
|
|
both(pred1: Pred): (pred2: Pred) => Pred;
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
call(fn: (...args: any[])=> (...args: any[]) => any, ...args: any[]): any;
|
|
|
|
/**
|
|
* `chain` maps a function over a list and concatenates the results.
|
|
* This implementation is compatible with the Fantasy-land Chain spec
|
|
*/
|
|
chain<T, U>(fn: (n: T) => U[], list: T[]): U[];
|
|
chain<T, U>(fn: (n: T) => U[]): (list: T[]) => U[];
|
|
|
|
/**
|
|
* Restricts a number to be within a range.
|
|
* Also works for other ordered types such as Strings and Date
|
|
*/
|
|
clamp<T>(min: T, max: T, value: T): T;
|
|
clamp<T>(min: T, max: T): (value: T) => T;
|
|
clamp<T>(min: T): (max: T, value: T) => T;
|
|
clamp<T>(min: 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<T>(value: T): T;
|
|
clone<T>(value: T[]): T[];
|
|
|
|
/**
|
|
* Makes a comparator function out of a function that reports whether the first element is less than the second.
|
|
*/
|
|
// comparator(pred: (a: any, b: any) => boolean): (x: number, y: number) => number;
|
|
comparator<T>(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: (...args: any[]) => boolean): (...args: any[]) => boolean
|
|
|
|
/**
|
|
* Performs right-to-left function composition. The rightmost function may have any arity; the remaining
|
|
* functions must be unary.
|
|
*/
|
|
compose<V0, T1>(fn0: (x0: V0) => T1): (x0: V0) => T1;
|
|
compose<V0, V1, T1>(fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T1;
|
|
compose<V0, V1, V2, T1>(fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T1;
|
|
|
|
compose<V0, T1, T2>(fn1: (x: T1) => T2, fn0: (x0: V0) => T1): (x0: V0) => T2;
|
|
compose<V0, V1, T1, T2>(fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T2;
|
|
compose<V0, V1, V2, T1, T2>(fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T2;
|
|
|
|
compose<V0, T1, T2, T3>(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x: V0) => T1): (x: V0) => T3;
|
|
compose<V0, V1, T1, T2, T3>(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T3;
|
|
compose<V0, V1, V2, T1, T2, T3>(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T3;
|
|
|
|
compose<V0, T1, T2, T3, T4>(fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x: V0) => T1): (x: V0) => T4;
|
|
compose<V0, V1, T1, T2, T3, T4>(fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T4;
|
|
compose<V0, V1, V2, T1, T2, T3, T4>(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<V0, T1, T2, T3, T4, T5>(fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x: V0) => T1): (x: V0) => T5;
|
|
compose<V0, V1, T1, T2, T3, T4, T5>(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<V0, V1, V2, T1, T2, T3, T4, T5>(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<V0, T1, T2, T3, T4, T5, T6>(fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x: V0) => T1): (x: V0) => T6;
|
|
compose<V0, V1, T1, T2, T3, T4, T5, T6>(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<V0, V1, V2, T1, T2, T3, T4, T5, T6>(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;
|
|
|
|
/**
|
|
* TODO composeK
|
|
*/
|
|
|
|
/**
|
|
* TODO composeP
|
|
*/
|
|
|
|
|
|
/**
|
|
* Returns a new list consisting of the elements of the first list followed by the elements
|
|
* of the second.
|
|
*/
|
|
concat<T>(list1: T[], list2: T[]): T[];
|
|
concat<T>(list1: T[]): (list2: T[]) => T[];
|
|
concat(list1: string, list2: string): string;
|
|
concat(list1: string): (list2: string) => string;
|
|
|
|
/**
|
|
* 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, Function][]): Function;
|
|
|
|
|
|
/**
|
|
* 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;
|
|
|
|
|
|
/**
|
|
* 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<T>(a: T, list: T[]): boolean;
|
|
contains(a: string): (list: string) => boolean;
|
|
contains<T>(a: T): (list: T[]) => boolean;
|
|
|
|
/**
|
|
* 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: Function, fns: Function[]): Function;
|
|
|
|
/**
|
|
* 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: any) => string|number, list: any[]): any;
|
|
countBy(fn: (a: any) => string|number): (list: any[]) => any;
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
curry<T1, T2, TResult>(fn: (a: T1, b: T2) => TResult): CurriedFunction2<T1,T2, TResult>
|
|
curry<T1, T2, T3, TResult>(fn: (a: T1, b: T2, c: T3) => TResult): CurriedFunction3<T1,T2, T3, TResult>
|
|
curry<T1, T2, T3, T4, TResult>(fn: (a: T1, b: T2, c: T3, d: T4) => TResult): CurriedFunction4<T1,T2, T3, T4, TResult>
|
|
curry<T1, T2, T3, T4, T5, TResult>(fn: (a: T1, b: T2, c: T3, d: T4, e: T5) => TResult): CurriedFunction5<T1,T2, T3, T4, T5, TResult>
|
|
curry<T1, T2, T3, T4, T5, T6, TResult>(fn: (a: T1, b: T2, c: T3, d: T4, e: T5, f: T6) => TResult): CurriedFunction6<T1,T2, T3, T4, T5, T6, TResult>
|
|
curry(fn: Function): Function
|
|
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
curryN(length: number, fn: (...args: any[]) => any): Function;
|
|
|
|
|
|
/**
|
|
* 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<T,U>(a: T, b: U): T|U
|
|
defaultTo<T>(a: T): <U>(b: U) => T|U
|
|
|
|
/**
|
|
* Finds the set (i.e. no duplicates) of all elements in the first list not contained in the second list.
|
|
*/
|
|
difference<T>(list1: T[], list2: T[]): T[];
|
|
difference<T>(list1: T[]): (list2: T[]) => 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<T>(pred: (a: T, b: T) => boolean, list1: T[], list2: T[]): T[];
|
|
|
|
/*
|
|
* Returns a new object that does not contain a prop property.
|
|
*/
|
|
// It seems impossible to infer the return type, so this may to be specified explicitely
|
|
dissoc<T>(prop: string, obj: any): T;
|
|
dissoc(prop: string): <U>(obj: any) => U;
|
|
|
|
/**
|
|
* Makes a shallow clone of an object, omitting the property at the given path.
|
|
*/
|
|
dissocPath<T>(path: string[], obj: any): T;
|
|
dissocPath(path: string[]): <T>(obj: any) => T;
|
|
|
|
/**
|
|
* Divides two numbers. Equivalent to a / b.
|
|
*/
|
|
divide(a: number, b: number): number;
|
|
divide(a: number): (b: number) => number;
|
|
|
|
/**
|
|
* Returns a new list containing all but the first n elements of the given list.
|
|
*/
|
|
drop<T>(n: number, xs: T[]): T[];
|
|
drop(n: number, xs: string): string;
|
|
drop<T>(n: number): {
|
|
(xs: string): string;
|
|
(xs: T[]): T[];
|
|
}
|
|
|
|
/**
|
|
* Returns a list containing all but the last n elements of the given list.
|
|
*/
|
|
dropLast<T>(n: number, xs: T[]): T[];
|
|
dropLast(n: number, xs: string): string;
|
|
dropLast<T>(n: number): {
|
|
(xs: T[]): T[];
|
|
(xs: string): string;
|
|
}
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
dropLastWhile<T>(fn: (a: T) => boolean, list: T[]): T[];
|
|
dropLastWhile<T>(fn: (a: T) => boolean): (list: T[]) => 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<T>(fn: (a: T) => boolean, list: T[]): T[];
|
|
dropWhile<T>(fn: (a: T) => boolean): (list: T[]) => 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;
|
|
|
|
/**
|
|
* 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 <Type>.empty and/or <Type>.prototype.empty.
|
|
* Dispatches to the empty method of the first argument, if present.
|
|
*/
|
|
empty<T>(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<T>(fn: (a: T) => T, a: T, b: T): boolean;
|
|
eqBy<T>(fn: (a: T) => T, a: T): (b: T) => boolean;
|
|
eqBy<T>(fn: (a: T) => T): (a: T, b: T) => boolean;
|
|
eqBy<T>(fn: (a: T) => T): (a: T) => (b: T) => boolean;
|
|
|
|
/**
|
|
* Reports whether two functions have the same value for the specified property.
|
|
*/
|
|
eqProps<T,U>(prop: string, obj1: T, obj2: U): boolean;
|
|
eqProps(prop: string): <T,U>(obj1: T, obj2: U) => boolean;
|
|
eqProps<T>(prop: string, obj1: T): <U>(obj2: U) => boolean;
|
|
|
|
/**
|
|
* Returns true if its arguments are equivalent, false otherwise. Dispatches to an equals method if present.
|
|
* Handles cyclical data structures.
|
|
*/
|
|
equals<T>(a: T, b: T): boolean;
|
|
equals<T>(a: T): (b: T) => boolean;
|
|
|
|
/**
|
|
* Creates a new object by evolving a shallow copy of object, according to the transformation functions.
|
|
*/
|
|
evolve<V>(transformations: Nested<V>, obj: V): Nested<V>;
|
|
evolve<V>(transformations: Nested<V>): <V>(obj: V) => Nested<V>;
|
|
/*
|
|
* A function that always returns false. Any passed in parameters are ignored.
|
|
*/
|
|
F(): boolean;
|
|
|
|
/**
|
|
* Returns a new list containing only those items that match a given predicate function. The predicate function is passed one argument: (value).
|
|
*/
|
|
filter<T>(fn: (value: T) => boolean): (list: T[]) => T[];
|
|
filter<T>(fn: (value: T) => boolean, list: T[]): T[];
|
|
|
|
/**
|
|
* Returns the first element of the list which matches the predicate, or `undefined` if no
|
|
* element matches.
|
|
*/
|
|
find<T>(fn: (a: T) => boolean, list: T[]): T;
|
|
find<T>(fn: (a: T) => boolean): (list: T[]) => T;
|
|
|
|
|
|
/**
|
|
* Returns the index of the first element of the list which matches the predicate, or `-1`
|
|
* if no element matches.
|
|
*/
|
|
findIndex<T>(fn: (a: T) => boolean, list: T[]): number;
|
|
findIndex<T>(fn: (a: T) => boolean): (list: T[]) => number;
|
|
|
|
/**
|
|
* Returns the last element of the list which matches the predicate, or `undefined` if no
|
|
* element matches.
|
|
*/
|
|
findLast<T>(fn: (a: T) => boolean, list: T[]): T;
|
|
findLast<T>(fn: (a: T) => boolean): (list: T[]) => T;
|
|
|
|
/**
|
|
* Returns the index of the last element of the list which matches the predicate, or
|
|
* `-1` if no element matches.
|
|
*/
|
|
findLastIndex<T>(fn: (a: T) => boolean, list: T[]): number;
|
|
findLastIndex<T>(fn: (a: T) => boolean): (list: T[]) => 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<T>(x: T[][]): T[];
|
|
flatten<T>(x: T[]): T[];
|
|
|
|
/**
|
|
* Returns a new function much like the supplied one, except that the first two arguments'
|
|
* order is reversed.
|
|
*/
|
|
flip<T,U,TResult>(fn: (arg0: T, arg1: U) => TResult): (arg1: U, arg0?: T) => TResult;
|
|
flip<T,U,TResult>(fn: (arg0: T, arg1: U, ...args: any[]) => TResult): (arg1: U, arg0?: T, ...args: any[]) => TResult;
|
|
|
|
|
|
/**
|
|
* Iterate over an input list, calling a provided function fn for each element in the list.
|
|
*/
|
|
forEach<T>(fn: (x: T) => void, list: T[]): T[];
|
|
forEach<T>(fn: (x: T) => void): (list: T[]) => T[];
|
|
|
|
/**
|
|
* Creates a new object out of a list key-value pairs.
|
|
*/
|
|
fromPairs<V>(pairs: KeyValuePair<string, V>[]): {[index: string]: V};
|
|
fromPairs<V>(pairs: KeyValuePair<number, V>[]): {[index: number]: V};
|
|
|
|
/**
|
|
* 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<T>(fn: (a: T) => string, list: T[]): {[index: string]: T[]}
|
|
groupBy<T>(fn: (a: T) => string): <T>(list: T[]) => {[index: string]: T[]}
|
|
|
|
/**
|
|
* Takes a list and returns a list of lists where each sublist's elements are all "equal" according to the provided equality function
|
|
*/
|
|
groupWith<T>(fn: (x: T, y: T) => boolean, list: T[]): T[][]
|
|
groupWith<T>(fn: (x: T, y: T) => boolean, list: string): string[]
|
|
|
|
/**
|
|
* Returns true if the first parameter is greater than the second.
|
|
*/
|
|
gt(a: number, b: number): boolean;
|
|
gt(a: number): (b: number) => boolean;
|
|
|
|
/**
|
|
* 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;
|
|
|
|
/**
|
|
* Returns whether or not an object has an own property with the specified name.
|
|
*/
|
|
has<T>(s: string, obj: T): boolean;
|
|
has(s: string): <T>(obj: T) => boolean;
|
|
|
|
/**
|
|
* Returns whether or not an object or its prototype chain has a property with the specified name
|
|
*/
|
|
hasIn<T>(s: string, obj: T): boolean;
|
|
hasIn(s: string): <T>(obj: T) => boolean;
|
|
|
|
/**
|
|
* Returns the first element in a list.
|
|
* In some libraries this function is named `first`.
|
|
*/
|
|
head<T>(list: T[]): T;
|
|
head(list: string): string;
|
|
|
|
/**
|
|
* 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<T>(a: T, b: T): boolean;
|
|
identical<T>(a: T): (b: T) => boolean;
|
|
|
|
|
|
/**
|
|
* A function that does nothing but return the parameter supplied to it. Good as a default
|
|
* or placeholder function.
|
|
*/
|
|
identity<T>(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: Arity1Fn, onFalse: Arity1Fn): Arity1Fn;
|
|
|
|
|
|
/**
|
|
* 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<T,U>(fn: (a: T) => string, list: T[]): U;
|
|
indexBy<T>(fn: (a: T) => string): <U>(list: T[]) => U;
|
|
|
|
/**
|
|
* 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<T>(target: T, list: T[]): number;
|
|
indexOf<T>(target: T): (list: T[]) => number;
|
|
|
|
/**
|
|
* Returns all but the last element of a list.
|
|
*/
|
|
init<T>(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.
|
|
*/
|
|
insert<T>(index: number, elt: T, list: T[]): T[];
|
|
insert<T>(index: number, elt: T): (list: T[]) => T[];
|
|
insert(index: number): <T>(elt: T, list: T[]) => T[];
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
insertAll<T>(index: number, elts: T[], list: T[]): T[];
|
|
insertAll<T>(index: number, elts: T[]): (list: T[]) => T[];
|
|
insertAll(index: number): <T>(elts: T[], list: T[]) => T[];
|
|
|
|
|
|
/**
|
|
* Combines two lists into a set (i.e. no duplicates) composed of those elements common to both lists.
|
|
*/
|
|
intersection<T>(list1: T[], list2: T[]): T[];
|
|
|
|
|
|
/**
|
|
* 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<T>(pred: (a: T, b: T) => boolean, list1: T[], list2: T[]): T[];
|
|
|
|
/**
|
|
* Creates a new list with the separator interposed between elements.
|
|
*/
|
|
intersperse<T>(separator: T, list: T[]): T[];
|
|
intersperse<T>(separator: T): (list: T[]) => 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<T>(acc: any, xf: Function, list: T[]): T[];
|
|
into(acc: any, xf: Function): <T>(list: T[]) => T[];
|
|
into(acc: any): <T>(xf: Function, list: T[]) => T[];
|
|
|
|
/**
|
|
* Same as R.invertObj, however this accounts for objects with duplicate values by putting the values into an array.
|
|
*/
|
|
invert<T>(obj: T): {[index:string]: string[]};
|
|
|
|
/**
|
|
* Returns a new object with the keys of the given object as values, and the values of the given object as keys.
|
|
*/
|
|
invertObj(obj: any): {[index:string]: string};
|
|
invertObj(obj: {[index: number]: string}): {[index:string]: string};
|
|
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
invoker(name: string, obj: any, len?: number): Function;
|
|
invoker(name: string): (obj: any, len?: number) => Function;
|
|
|
|
/**
|
|
* See if an object (`val`) is an instance of the supplied constructor.
|
|
* This function will check up the inheritance chain, if any.
|
|
*/
|
|
is(ctor: any, val: any): boolean;
|
|
is(ctor: any): (val: any) => boolean;
|
|
|
|
/**
|
|
* Tests whether or not an object is similar to an array.
|
|
*/
|
|
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: string, xs: any[]): string;
|
|
join(x: string): (xs: any[]) => string;
|
|
|
|
/**
|
|
* Applies a list of functions to a list of values.
|
|
*/
|
|
juxt<T,U>(fns: {(...args: T[]): U}[]): (...args: T[]) => U[];
|
|
|
|
|
|
/**
|
|
* Returns a list containing the names of all the enumerable own
|
|
* properties of the supplied object.
|
|
*/
|
|
keys<T>(x: T): string[];
|
|
|
|
/**
|
|
* Returns a list containing the names of all the
|
|
* properties of the supplied object, including prototype properties.
|
|
*/
|
|
keysIn<T>(obj: T): string[];
|
|
|
|
/**
|
|
* Returns the last element from a list.
|
|
*/
|
|
last<T>(list: T[]): T;
|
|
last(list: string): string;
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
lastIndexOf<T>(target: T, list: T[]): number;
|
|
|
|
/**
|
|
* Returns the number of elements in the array by returning list.length.
|
|
*/
|
|
length(list: any[]): 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.
|
|
*/
|
|
lens<T,U,V>(getter: (s: T) => U, setter: (a: U, s: T) => V): Lens;
|
|
|
|
/**
|
|
* Creates a lens that will focus on index n of the source array.
|
|
*/
|
|
lensIndex(n: number): Lens;
|
|
|
|
/**
|
|
* Returns a lens whose focus is the specified path.
|
|
* See also view, set, over.
|
|
*/
|
|
lensPath(path: string[]): Lens;
|
|
|
|
/**
|
|
* lensProp creates a lens that will focus on property k of the source object.
|
|
*/
|
|
lensProp(str: string): {
|
|
<T, U>(obj: T): U;
|
|
set<T,U,V>(val: T, obj: U): V;
|
|
/*map<T>(fn: Function, obj: T): T*/
|
|
}
|
|
|
|
/**
|
|
* "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: Function, ...args: any[]): any;
|
|
|
|
/**
|
|
* "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: Function, ...args: any[]): any;
|
|
|
|
|
|
/**
|
|
* Returns true if the first parameter is less than the second.
|
|
*/
|
|
lt(a: number, b: number): boolean;
|
|
lt(a: number): (b: number) => boolean;
|
|
|
|
/**
|
|
* 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;
|
|
|
|
/**
|
|
* Returns a new list, constructed by applying the supplied function to every element of the supplied list.
|
|
*/
|
|
map<T, U>(fn: (x: T) => U, list: T[]): U[];
|
|
map<T, U>(fn: (x: T) => U, obj: Functor<T>): Functor<U>; // used in functors
|
|
map<T, U>(fn: (x: T) => U): (list: T[]) => U[];
|
|
|
|
/**
|
|
* The mapAccum function behaves like a combination of map and reduce.
|
|
*/
|
|
mapAccum<T, U, TResult>(fn: (acc: U, value: T) => [U, TResult], acc: U, list: T[]): [U, TResult[]];
|
|
mapAccum<T, U, TResult>(fn: (acc: U, value: T) => [U, TResult]): (acc: U, list: T[]) => [U, TResult[]];
|
|
mapAccum<T, U, TResult>(fn: (acc: U, value: T) => [U, TResult], acc: U): (list: T[]) => [U, TResult[]];
|
|
|
|
/**
|
|
* The mapAccumRight function behaves like a combination of map and reduce.
|
|
*/
|
|
mapAccumRight<T, U, TResult>(fn: (acc: U, value: T) => [U, TResult], acc: U, list: T[]): [U, TResult[]];
|
|
mapAccumRight<T, U, TResult>(fn: (acc: U, value: T) => [U, TResult]): (acc: U, list: T[]) => [U, TResult[]];
|
|
mapAccumRight<T, U, TResult>(fn: (acc: U, value: T) => [U, TResult], acc: U): (list: T[]) => [U, TResult[]];
|
|
|
|
|
|
/**
|
|
* Like mapObj, but but passes additional arguments to the predicate function.
|
|
*/
|
|
mapObjIndexed<T, TResult>(fn: (value: T, key: string, obj?: any) => TResult, obj: any): {[index:string]: TResult};
|
|
mapObjIndexed<T, TResult>(fn: (value: T, key: string, obj?: any) => TResult): (obj: any) => {[index:string]: TResult};
|
|
|
|
/**
|
|
* Tests a regular expression agains a String
|
|
*/
|
|
match(regexp: RegExp, str: string): any[];
|
|
match(regexp: RegExp): (str: string) => any[];
|
|
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
mathMod(a: number, b: number): number;
|
|
mathMod(a: number): (b: number) => number;
|
|
|
|
|
|
/**
|
|
* Returns the larger of its two arguments.
|
|
*/
|
|
max(a: Ord, b: Ord): Ord;
|
|
max(a: Ord): (b: Ord) => Ord;
|
|
|
|
/**
|
|
* Takes a function and two values, and returns whichever value produces
|
|
* the larger result when passed to the provided function.
|
|
*/
|
|
maxBy<T>(keyFn: (a: T) => Ord, a: T, b: T): T;
|
|
maxBy<T>(keyFn: (a: T) => Ord, a: T): (b: T) => T;
|
|
maxBy<T>(keyFn: (a: T) => Ord): CurriedFunction2<T, T, T>
|
|
|
|
/**
|
|
* Returns the mean of the given list of numbers.
|
|
*/
|
|
mean(list: number[]): number;
|
|
|
|
/**
|
|
* Returns the median of the given list of numbers.
|
|
*/
|
|
median(list: number[]): 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: Function): Function;
|
|
|
|
/**
|
|
* 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<T1, T2>(a: T1, b: T2): T1 & T2;
|
|
merge<T1>(a: T1): <T2>(b: T2) => T1 & T2;
|
|
|
|
|
|
/**
|
|
* Merges a list of objects together into one object.
|
|
*/
|
|
mergeAll<T>(list: any[]): 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<U,V>(fn: (x: any, z: any) => any, a: U, b: V): U & V;
|
|
mergeWith<U>(fn: (x: any, z: any) => any, a: U): <V>(b: V) => U & V;
|
|
mergeWith(fn: (x: any, z: any) => any): <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<U,V>(fn: (str: string, x: any, z: any) => any, a: U, b: V): U & V;
|
|
mergeWithKey<U>(fn: (str: string, x: any, z: any) => any, a: U): <V>(b: V) => U & V;
|
|
mergeWithKey(fn: (str: string, x: any, z: any) => any): <U,V>(a: U, b: V) => U & V;
|
|
|
|
/**
|
|
* Returns the smaller of its two arguments.
|
|
*/
|
|
min(a: Ord, b: Ord): Ord;
|
|
min(a: Ord): (b: Ord) => Ord;
|
|
|
|
/**
|
|
* Takes a function and two values, and returns whichever value produces
|
|
* the smaller result when passed to the provided function.
|
|
*/
|
|
minBy<T>(keyFn: (a: T) => Ord, a: T, b: T): T;
|
|
minBy<T>(keyFn: (a: T) => Ord, a: T): (b: T) => T;
|
|
minBy<T>(keyFn: (a: T) => Ord): CurriedFunction2<T, 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;
|
|
|
|
/**
|
|
* Multiplies two numbers. Equivalent to a * b but curried.
|
|
*/
|
|
multiply(a: number, b: number): number;
|
|
multiply(a: number): (b: number) => number;
|
|
|
|
|
|
/**
|
|
* 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: (...arg: any[]) => any): Function;
|
|
|
|
/**
|
|
* Negates its argument.
|
|
*/
|
|
negate(n: number): number;
|
|
|
|
|
|
/**
|
|
* Returns true if no elements of the list match the predicate, false otherwise.
|
|
*/
|
|
none<T>(fn: (a: T) => boolean, list: T[]): boolean;
|
|
none<T>(fn: (a: T) => boolean): (list: T[]) => 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<T>(n: number, list: T[]): T;
|
|
nth(n: number): <T>(list: T[]) => T;
|
|
|
|
/**
|
|
* Returns a function which returns its nth argument.
|
|
*/
|
|
nthArg(n: number): (...a: any[]) => any;
|
|
|
|
/**
|
|
* Creates an object containing a single key:value pair.
|
|
*/
|
|
objOf<T>(key: string, value: T): {string: T};
|
|
objOf(key: string): <T>(value: T) => {string: T};
|
|
|
|
/**
|
|
* Returns a singleton array containing the value provided.
|
|
*/
|
|
of<T>(x: T): T[];
|
|
//of<T>(x: T[]): T[][]; unnecessary typing and introduced error in unless example
|
|
|
|
/**
|
|
* Returns a partial copy of an object omitting the keys specified.
|
|
*/
|
|
omit<T>(names: string[], obj: T): T;
|
|
omit(names: string[]): <T>(obj: 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: Function): Function;
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
or<T, U>(a: T, b: U): T|U;
|
|
or<T>(a: T): <U>(b: U) => T|U;
|
|
or<T extends {or?: Function;}, U>(fn1: T, val2: U): T|U;
|
|
or<T extends {or?: Function;}>(fn1: T): <U>(val2: U) => T|U;
|
|
|
|
|
|
/**
|
|
* Returns the result of "setting" the portion of the given data structure
|
|
* focused by the given lens to the given value.
|
|
*/
|
|
over<T>(lens: Lens, fn: Arity1Fn, value: T): T;
|
|
over<T>(lens: Lens, fn: Arity1Fn, value: T[]): T[];
|
|
over(lens: Lens, fn: Arity1Fn): <T>(value: T) => T;
|
|
over(lens: Lens, fn: Arity1Fn): <T>(value: T[]) => T[];
|
|
over(lens: Lens): <T>(fn: Arity1Fn, value: T) => T;
|
|
over(lens: Lens): <T>(fn: Arity1Fn, value: T[]) => T[];
|
|
|
|
|
|
/**
|
|
* Takes two arguments, fst and snd, and returns [fst, snd].
|
|
*/
|
|
pair<F,S>(fst: F, snd: S): [F, S];
|
|
|
|
/**
|
|
* 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: Function, ...args: any[]): Function;
|
|
|
|
/**
|
|
* 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: Function, ...args: any[]): Function;
|
|
|
|
/**
|
|
* Takes a predicate and a list and returns the pair of lists of elements
|
|
* which do and do not satisfy the predicate, respectively.
|
|
*/
|
|
partition(fn: (a: string) => boolean, list: string[]): string[][];
|
|
partition<T>(fn: (a: T) => boolean, list: T[]): T[][];
|
|
partition<T>(fn: (a: T) => boolean): (list: T[]) => T[][];
|
|
partition(fn: (a: string) => boolean): (list: string[]) => string[][];
|
|
|
|
/**
|
|
* Retrieve the value at a given path.
|
|
*/
|
|
path<T>(path: string[], obj: any): T;
|
|
path(path: string[]): <T>(obj: any) => T;
|
|
|
|
/**
|
|
* 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: string[], val: any, obj: any): boolean;
|
|
pathEq(path: string[], val: any): (obj: any) => boolean;
|
|
pathEq(path: string[]): (val: any, obj: any) => boolean;
|
|
pathEq(path: string[]): (val: any) => (obj: 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<T>(d: T, p: string[], obj: any): T|any;
|
|
pathOr<T>(d: T, p: string[]): (obj: any) => T|any;
|
|
pathOr<T>(d: T): (p: string[], obj: any) => T|any;
|
|
|
|
|
|
/**
|
|
* Returns a partial copy of an object containing only the keys specified. If the key does not exist, the
|
|
* property is ignored.
|
|
*/
|
|
pick<T,U>(names: string[], obj: T): U;
|
|
pick(names: string[]): <T, U>(obj: T) => U;
|
|
|
|
|
|
/**
|
|
* Similar to `pick` except that this one includes a `key: undefined` pair for properties that don't exist.
|
|
*/
|
|
pickAll<T,U>(names: string[], obj: T): U;
|
|
pickAll(names: string[]): <T,U>(obj: T) => U;
|
|
|
|
|
|
/**
|
|
* Returns a partial copy of an object containing only the keys that satisfy the supplied predicate.
|
|
*/
|
|
pickBy<T,U>(pred: ObjPred, obj: T): U;
|
|
pickBy(pred: ObjPred): <T,U>(obj: T) => U;
|
|
|
|
|
|
/**
|
|
* Creates a new function that runs each of the functions supplied as parameters in turn,
|
|
* passing the return value of each function invocation to the next function invocation,
|
|
* beginning with whatever arguments were passed to the initial invocation.
|
|
*/
|
|
pipe<V0, T1>(fn0: (x0: V0) => T1): (x0: V0) => T1;
|
|
pipe<V0, V1, T1>(fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T1;
|
|
pipe<V0, V1, V2, T1>(fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T1;
|
|
|
|
pipe<V0, T1, T2>(fn0: (x0: V0) => T1, fn1: (x: T1) => T2): (x0: V0) => T2;
|
|
pipe<V0, V1, T1, T2>(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2): (x0: V0, x1: V1) => T2;
|
|
pipe<V0, V1, V2, T1, T2>(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2): (x0: V0, x1: V1, x2: V2) => T2;
|
|
|
|
pipe<V0, T1, T2, T3>(fn0: (x: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3): (x: V0) => T3;
|
|
pipe<V0, V1, T1, T2, T3>(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3): (x0: V0, x1: V1) => T3;
|
|
pipe<V0, V1, V2, T1, T2, T3>(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3): (x0: V0, x1: V1, x2: V2) => T3;
|
|
|
|
pipe<V0, T1, T2, T3, T4>(fn0: (x: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4): (x: V0) => T4;
|
|
pipe<V0, V1, T1, T2, T3, T4>(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4): (x0: V0, x1: V1) => T4;
|
|
pipe<V0, V1, V2, T1, T2, T3, T4>(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<V0, T1, T2, T3, T4, T5>(fn0: (x: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5): (x: V0) => T5;
|
|
pipe<V0, V1, T1, T2, T3, T4, T5>(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<V0, V1, V2, T1, T2, T3, T4, T5>(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<V0, T1, T2, T3, T4, T5, T6>(fn0: (x: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6): (x: V0) => T6;
|
|
pipe<V0, V1, T1, T2, T3, T4, T5, T6>(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<V0, V1, V2, T1, T2, T3, T4, T5, T6>(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<V0, T1, T2, T3, T4, T5, T6, T7>(fn0: (x: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn: (x: T6) => T7): (x: V0) => T7;
|
|
pipe<V0, V1, T1, T2, T3, T4, T5, T6, T7>(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<V0, V1, V2, T1, T2, T3, T4, T5, T6, T7>(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<V0, T1, T2, T3, T4, T5, T6, T7, T8>(fn0: (x: 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, fn: (x: T7) => T8): (x: V0) => T8;
|
|
pipe<V0, V1, T1, T2, T3, T4, T5, T6, T7, T8>(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: T5) => T6, fn7: (x: T7) => T8): (x0: V0, x1: V1) => T8;
|
|
pipe<V0, V1, V2, T1, T2, T3, T4, T5, T6, T7, T8>(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: T5) => T6, fn7: (x: T7) => T8): (x0: V0, x1: V1, x2: V2) => T8;
|
|
|
|
|
|
/**
|
|
* Returns a new list by plucking the same named property off all objects in the list supplied.
|
|
*/
|
|
pluck<T>(p: string|number, list: any[]): T[];
|
|
pluck(p: string|number): <T>(list: any[]) => T[];
|
|
|
|
/**
|
|
* Returns a new list with the given element at the front, followed by the contents of the
|
|
* list.
|
|
*/
|
|
prepend<T>(el: T, list: T[]): T[];
|
|
prepend<T>(el: T): (list: T[]) => T[];
|
|
|
|
/**
|
|
* Multiplies together all the elements of a list.
|
|
*/
|
|
product(list: number[]): number;
|
|
|
|
|
|
/**
|
|
* Reasonable analog to SQL `select` statement.
|
|
*/
|
|
project<T,U>(props: string[], objs: T[]): U[];
|
|
|
|
/**
|
|
* Returns a function that when supplied an object returns the indicated property of that object, if it exists.
|
|
* Note: TS1.9 # replace any by dictionary
|
|
*/
|
|
prop<T>(p: string, obj: any): T;
|
|
prop<T>(p: string): <T>(obj: any) => 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<T>(name: string, val: T, obj: {[index:string]: T}): boolean;
|
|
// propEq<T>(name: string, val: T, obj: {[index:number]: T}): boolean;
|
|
propEq<T>(name: string, val: T, obj: any): boolean;
|
|
// propEq<T>(name: number, val: T, obj: any): boolean;
|
|
propEq<T>(name: string, val: T): (obj: any) => boolean;
|
|
// propEq<T>(name: number, val: T): (obj: any) => boolean;
|
|
propEq(name: string): <T>(val: T, obj: any) => boolean;
|
|
// propEq(name: number): <T>(val: T, obj: any) => boolean;
|
|
|
|
/**
|
|
* Returns true if the specified object property is of the given type; false otherwise.
|
|
*/
|
|
propIs(type: any, name: string, obj: any): boolean;
|
|
propIs(type: any, name: string): (obj: any) => boolean;
|
|
propIs(type: any): {
|
|
(name: string, obj: any): boolean;
|
|
(name: string): (obj: any) => boolean;
|
|
}
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
propOr<T,U,V>(val: T, p: string, obj: U): V;
|
|
propOr<T>(val: T, p: string): <U,V>(obj: U) => V;
|
|
propOr<T>(val: T): <U,V>(p: string, obj: U) => V;
|
|
|
|
/**
|
|
* Returns the value at the specified property.
|
|
* The only difference from `prop` is the parameter order.
|
|
* Note: TS1.9 # replace any by dictionary
|
|
*/
|
|
props<T>(ps: string[], obj: any): T[];
|
|
props(ps: string[]): <T>(obj: any) => T[];
|
|
|
|
/**
|
|
* Returns true if the specified object property satisfies the given predicate; false otherwise.
|
|
*/
|
|
propSatisfies<T,U>(pred: (val: T) => boolean, name: string, obj: U): boolean;
|
|
propSatisfies<T,U>(pred: (val: T) => boolean, name: string): (obj: U) => boolean;
|
|
propSatisfies<T,U>(pred: (val: T) => boolean): CurriedFunction2<string, 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[];
|
|
|
|
/**
|
|
* 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<T, TResult>(fn: (acc: TResult, elem: T) => TResult|Reduced, acc: TResult, list: T[]): TResult;
|
|
reduce<T, TResult>(fn: (acc: TResult, elem: T) => TResult|Reduced): (acc: TResult, list: T[]) => TResult;
|
|
reduce<T, TResult>(fn: (acc: TResult, elem: T) => TResult|Reduced, acc: TResult): (list: T[]) => 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.
|
|
*/
|
|
reduceBy<T, TResult>(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult, keyFn: (elem: T) => string, list: T[]): {[index: string]: TResult};
|
|
reduceBy<T, TResult>(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult, keyFn: (elem: T) => string): (list: T[]) => {[index: string]: TResult};
|
|
reduceBy<T, TResult>(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult): CurriedFunction2<(elem: T) => string, T[], {[index: string]: TResult}>;
|
|
reduceBy<T, TResult>(valueFn: (acc: TResult, elem: T) => TResult): CurriedFunction3<TResult, (elem: T) => string, T[], {[index: string]: 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<T>(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.
|
|
*/
|
|
reduceRight<T, TResult>(fn: (acc: TResult, elem: T) => TResult, acc: TResult, list: T[]): TResult;
|
|
reduceRight<T, TResult>(fn: (acc: TResult, elem: T) => TResult): (acc: TResult, list: T[]) => TResult;
|
|
reduceRight<T, TResult>(fn: (acc: TResult, elem: T) => TResult, acc: TResult): (list: T[]) => TResult;
|
|
|
|
/**
|
|
* Similar to `filter`, except that it keeps only values for which the given predicate
|
|
* function returns falsy.
|
|
*/
|
|
reject<T>(fn: (value: T) => boolean, list: T[]): T[];
|
|
reject<T>(fn: (value: T) => boolean): (list: T[]) => T[];
|
|
|
|
/**
|
|
* Removes the sub-list of `list` starting at index `start` and containing `count` elements.
|
|
*/
|
|
remove<T>(start: number, count: number, list: T[]): T[];
|
|
remove<T>(start: number): (count: number, list: T[]) => T[];
|
|
remove<T>(start: number, count: number): (list: T[]) => T[];
|
|
|
|
/**
|
|
* Returns a fixed list of size n containing a specified identical value.
|
|
*/
|
|
repeat<T>(a: T, n: number): T[];
|
|
repeat<T>(a: T): (n: number) => T[];
|
|
|
|
|
|
/**
|
|
* Replace a substring or regex match in a string with a replacement.
|
|
*/
|
|
replace(pattern: RegExp, replacement: string, str: string): string;
|
|
replace(pattern: RegExp, replacement: string): (str: string) => string;
|
|
replace(pattern: RegExp): (replacement: string) => (str: string) => string;
|
|
replace(pattern: String, replacement: string, str: string): string;
|
|
replace(pattern: String, replacement: string): (str: string) => string;
|
|
replace(pattern: String): (replacement: string) => (str: string) => string;
|
|
|
|
|
|
/**
|
|
* Returns a new list with the same elements as the original list, just in the reverse order.
|
|
*/
|
|
reverse<T>(list: T[]): T[];
|
|
|
|
/**
|
|
* Scan is similar to reduce, but returns a list of successively reduced values from the left.
|
|
*/
|
|
scan<T, TResult>(fn: (acc: TResult, elem: T) => any, acc: TResult, list: T[]): TResult[];
|
|
scan<T, TResult>(fn: (acc: TResult, elem: T) => any, acc: TResult): (list: T[]) => TResult[];
|
|
scan<T, TResult>(fn: (acc: TResult, elem: T) => any): (acc: TResult, list: T[]) => TResult[];
|
|
|
|
/**
|
|
* Returns the result of "setting" the portion of the given data structure focused by the given lens to the
|
|
* given value.
|
|
*/
|
|
set<T,U>(lens: Lens, a: U, obj: T): T;
|
|
set<U>(lens: Lens, a: U): <T>(obj: T) => T;
|
|
set(lens: Lens): <T,U>(a: U, obj: T) => T;
|
|
|
|
/**
|
|
* Returns the elements from `xs` starting at `a` and ending at `b - 1`.
|
|
*/
|
|
slice(a: number, b: number, list: string): string;
|
|
slice<T>(a: number, b: number, list: T[]): T[];
|
|
slice(a: number, b: number): <T>(list: string|T[]) => string|T[];
|
|
slice(a: number): <T>(b: number, list: string|T[]) => string|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<T>(fn: (a: T, b: T) => number, list: T[]): T[];
|
|
sort<T>(fn: (a: T, b: T) => number): (list: T[]) => T[];
|
|
|
|
|
|
/**
|
|
* Sorts the list according to a key generated by the supplied function.
|
|
*/
|
|
sortBy<T>(fn: (a: any) => string, list: T[]): T[];
|
|
sortBy(fn: (a: any) => string): <T>(list: T[]) => T[];
|
|
|
|
/**
|
|
* Splits a string into an array of strings based on the given
|
|
* separator.
|
|
*/
|
|
split(sep: string): (str: string) => string[];
|
|
split(sep: RegExp): (str: string) => string[];
|
|
split(sep: string, str: string): string[];
|
|
split(sep: RegExp, str: string): string[];
|
|
|
|
/**
|
|
* Splits a given list or string at a given index.
|
|
*/
|
|
splitAt<T>(index: number, list: T): T[];
|
|
splitAt(index: number): <T>(list: T) => T[];
|
|
splitAt<T>(index: number, list: T[]): T[][];
|
|
splitAt(index: number): <T>(list: T[]) => T[][];
|
|
|
|
/**
|
|
* Splits a collection into slices of the specified length.
|
|
*/
|
|
splitEvery<T>(a: number, list: T[]): T[][];
|
|
splitEvery(a: number): <T>(list: T[]) => T[][];
|
|
|
|
|
|
/**
|
|
* 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<T,U>(pred: (val: T) => boolean, list: U[]): U[][];
|
|
splitWhen<T>(pred: (val: T) => boolean): <U>(list: U[]) => U[][];
|
|
|
|
/**
|
|
* Subtracts two numbers. Equivalent to `a - b` but curried.
|
|
*/
|
|
subtract(a: number, b: number): number;
|
|
subtract(a: number): (b: number) => number;
|
|
|
|
/**
|
|
* Adds together all the elements of a list.
|
|
*/
|
|
sum(list: number[]): number;
|
|
|
|
/**
|
|
* Finds the set (i.e. no duplicates) of all elements contained in the first or second list, but not both.
|
|
*/
|
|
symmetricDifference<T>(list1: T[], list2: T[]): T[];
|
|
symmetricDifference<T>(list: T[]): <T>(list: T[]) => 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<T>(pred: (a: T, b: T) => boolean, list1: T[], list2: T[]): T[];
|
|
symmetricDifferenceWith<T>(pred: (a: T, b: T) => boolean): CurriedFunction2<T[], T[], T[]>;
|
|
|
|
/**
|
|
* A function that always returns true. Any passed in parameters are ignored.
|
|
*/
|
|
T(): boolean;
|
|
|
|
/**
|
|
* Returns all but the first element of a list.
|
|
*/
|
|
tail<T>(list: T[]): T[];
|
|
|
|
/**
|
|
* 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<T>(n: number, xs: T[]): T[];
|
|
take(n: number, xs: string): string;
|
|
take<T>(n: number): {
|
|
(xs: string): string;
|
|
(xs: T[]): T[];
|
|
}
|
|
|
|
|
|
/**
|
|
* Returns a new list containing the last n elements of the given list. If n > list.length,
|
|
* returns a list of list.length elements.
|
|
*/
|
|
takeLast<T>(n: number, xs: T[]): T[];
|
|
takeLast(n: number, xs: string): string;
|
|
takeLast(n: number): {
|
|
<T>(xs: T[]): T[];
|
|
(xs: string): string;
|
|
}
|
|
|
|
/**
|
|
* 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).
|
|
*/
|
|
takeLastWhile<T>(pred: (a: T) => Boolean, list: T[]): T[];
|
|
takeLastWhile<T>(pred: (a: T) => Boolean): <T>(list: T[]) => T[];
|
|
|
|
/**
|
|
* 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<T>(fn: (x: T) => boolean, list: T[]): T[];
|
|
takeWhile<T>(fn: (x: T) => boolean): (list: T[]) => T[];
|
|
|
|
/**
|
|
* The function to call with x. The return value of fn will be thrown away.
|
|
*/
|
|
tap<T>(fn: (a: T) => any, value: T): T;
|
|
tap<T>(fn: (a: T) => any): (value: T) => T;
|
|
|
|
/**
|
|
* Determines whether a given string matches a given regular expression.
|
|
*/
|
|
test(regexp: RegExp, str: string): boolean;
|
|
test(regexp: RegExp): (str: string) => boolean;
|
|
|
|
/**
|
|
* Calls an input function `n` times, returning an array containing the results of those
|
|
* function calls.
|
|
*/
|
|
times<T>(fn: (i: number) => T, n: number): T[];
|
|
times<T>(fn: (i: number) => T): (n: 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<F,S>(obj: {[k: string]: S} | {[k: number]: S} | any): [F,S][];
|
|
|
|
/**
|
|
* 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<F,S>(obj: {[k: string]: S} | {[k: number]: S} | any): [F,S][];
|
|
|
|
/**
|
|
* 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<T>(val: T): 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<T,U>(xf: (arg: T[]) => T[], fn: (acc: U[], val: U) => U[], acc: T[], list: T[]): U;
|
|
transduce<T,U>(xf: (arg: T[]) => T[]): (fn: (acc: U[], val: U) => U[], acc: T[], list: T[]) => U;
|
|
transduce<T,U>(xf: (arg: T[]) => T[], fn: (acc: U[], val: U) => U[]): (acc: T[], list: T[]) => U;
|
|
transduce<T,U>(xf: (arg: T[]) => T[], fn: (acc: U[], val: U) => U[], acc: T[]): (list: T[]) => 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<T>(list: any[][]): any[][];
|
|
|
|
/**
|
|
* 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<T>(tryer: (...args: any[]) => T, catcher: (...args: any[]) => T, x: any): T;
|
|
|
|
/**
|
|
* 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<T>(fn: (args: any[]) => T): (...args: any[]) => T;
|
|
|
|
/**
|
|
* 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<T>(fn: (a: T, ...args: any[]) => any): (a: T) => any
|
|
|
|
/**
|
|
* Returns a function of arity n from a (manually) curried function.
|
|
*/
|
|
uncurryN<T>(len: number, fn: (a: any) => any): (...a: any[]) => T;
|
|
|
|
/**
|
|
* 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<T, TResult>(fn: (seed: T) => TResult[]|boolean, seed: T): TResult[];
|
|
unfold<T, TResult>(fn: (seed: T) => TResult[]|boolean): (seed: T) => TResult[];
|
|
|
|
/**
|
|
* Combines two lists into a set (i.e. no duplicates) composed of the
|
|
* elements of each list.
|
|
*/
|
|
union<T>(as: T[], bs: T[]): T[];
|
|
union<T>(as: T[]): (bs: T[]) => 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<T>(pred: (a: T, b: T) => boolean, list1: T[], list2: T[]): T[];
|
|
unionWith<T>(pred: (a: T, b: T) => boolean): CurriedFunction2<T[], T[], T[]>
|
|
|
|
/**
|
|
* Returns a new list containing only one copy of each element in the original list.
|
|
*/
|
|
uniq<T>(list: T[]): 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<T,U>(fn: (a: T) => U, list: T[]): T[];
|
|
uniqBy<T,U>(fn: (a: T) => U): (list: T[]) => 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<T,U>(pred: (x: T, y: T) => boolean, list: T[]): T[];
|
|
uniqWith<T,U>(pred: (x: T, y: T) => boolean): (list: T[]) => 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<T,U>(pred: (a: T) => boolean, whenFalseFn: (a: T) => U, obj: T): U;
|
|
unless<T,U>(pred: (a: T) => boolean, whenFalseFn: (a: T) => U): (obj: 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<T>(x: T[][]): T[];
|
|
unnest<T>(x: T[]): 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<T,U>(pred: (val: T) => boolean, fn: (val: T) => U, init: U): U;
|
|
until<T,U>(pred: (val: T) => boolean, 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<T>(index: number, value: T, list: T[]): T[];
|
|
update<T>(index: number, value: T): (list: T[]) => 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: Function, transformers: Function[]): Function;
|
|
|
|
/**
|
|
* 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<T>(obj: {[index: string]: T}): T[];
|
|
values<T>(obj: any): T[];
|
|
|
|
/**
|
|
* 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<T>(obj: any): T[];
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
view<T,U>(lens: Lens, obj: T): U;
|
|
|
|
/**
|
|
* 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<T,U>(pred: (a: T) => boolean, whenTrueFn: (a: T) => U, obj: T): U;
|
|
when<T,U>(pred: (a: T) => boolean, 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`, `pickWith`, etc.
|
|
*/
|
|
where<T,U>(spec: T, testObj: U): boolean;
|
|
where<T>(spec: T): <U>(testObj: U) => boolean;
|
|
where<ObjFunc2,U>(spec: ObjFunc2, testObj: U): boolean;
|
|
where<ObjFunc2>(spec: ObjFunc2): <U>(testObj: U) => boolean;
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
whereEq<T,U>(spec: T, obj: U): boolean;
|
|
whereEq<T>(spec: T): <U>(obj: U) => boolean;
|
|
|
|
/**
|
|
* 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<T>(list1: T[], list2: T[]): T[];
|
|
without<T>(list1: T[]): (list2: T[]) => T[];
|
|
|
|
/**
|
|
* Wrap a function inside another to allow you to make adjustments to the parameters, or do other processing
|
|
* either before the internal function is called or with its results.
|
|
*/
|
|
wrap(fn: Function, wrapper: Function): Function;
|
|
|
|
/**
|
|
* Creates a new list out of the two supplied by creating each possible pair from the lists.
|
|
*/
|
|
xprod<K,V>(as: K[], bs: V[]): KeyValuePair<K,V>[];
|
|
xprod<K>(as: K[]): <V>(bs: V[]) => KeyValuePair<K,V>[];
|
|
|
|
/**
|
|
* 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<K,V>(list1: K[], list2: V[]): KeyValuePair<K,V>[];
|
|
zip<K>(list1: K[]): <V>(list2: V[]) => KeyValuePair<K,V>[];
|
|
|
|
/**
|
|
* Creates a new object out of a list of keys and a list of values.
|
|
*/
|
|
// TODO: Dictionary<T> as a return value is to specific, any seems to loose
|
|
zipObj<T>(keys: string[], values: T[]): {[index:string]: T};
|
|
zipObj(keys: string[]): <T>(values: T[]) => {[index:string]: T};
|
|
|
|
|
|
/**
|
|
* Creates a new list out of the two supplied by applying the function to each
|
|
* equally-positioned pair in the lists.
|
|
*/
|
|
zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult, list1: T[], list2: U[]): TResult[];
|
|
zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult, list1: T[]): (list2: U[]) => TResult[];
|
|
zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult): (list1: T[], list2: U[]) => TResult[];
|
|
|
|
}
|
|
}
|
|
|
|
export = R;
|