mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #32695 from Krantisinh/master
[Ramda] - Added type definition for R.move
This commit is contained in:
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
import { move } from '../index';
|
||||
export default move;
|
||||
Vendored
+13
@@ -26,6 +26,7 @@
|
||||
// Drew Wyatt <https://github.com/drewwyatt>
|
||||
// John Ottenlips <https://github.com/jottenlips>
|
||||
// Nitesh Phadatare <https://github.com/minitesh>
|
||||
// Krantisinh Deshmukh <https://github.com/krantisinh>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@@ -163,6 +164,7 @@
|
||||
/// <reference path="./es/minBy.d.ts" />
|
||||
/// <reference path="./es/min.d.ts" />
|
||||
/// <reference path="./es/modulo.d.ts" />
|
||||
/// <reference path="./es/move.d.ts" />
|
||||
/// <reference path="./es/multiply.d.ts" />
|
||||
/// <reference path="./es/nAry.d.ts" />
|
||||
/// <reference path="./es/negate.d.ts" />
|
||||
@@ -1575,6 +1577,17 @@ declare namespace R {
|
||||
multiply(a: number, b: number): number;
|
||||
multiply(a: number): (b: number) => number;
|
||||
|
||||
/**
|
||||
* Moves an item, at index `from`, to index `to`, in a `list` of elements.
|
||||
* A new list will be created containing the new elements order.
|
||||
*/
|
||||
move<T>(from: number, to: number, list: ReadonlyArray<T>): T[];
|
||||
move(from: number, to: number): <T>(list: ReadonlyArray<T>) => T[];
|
||||
move(from: number): {
|
||||
<T>(to: number, list: ReadonlyArray<T>): T[];
|
||||
(to: number): <T>(list: ReadonlyArray<T>) => T[];
|
||||
};
|
||||
|
||||
/**
|
||||
* 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.
|
||||
|
||||
@@ -1115,6 +1115,23 @@ interface Obj {
|
||||
R.addIndex(R.map)(squareEnds)([8, 5, 3, 0, 9]); // => [64, 5, 3, 0, 81]
|
||||
};
|
||||
|
||||
() => {
|
||||
const sampleList = ['a', 'b', 'c', 'd', 'e', 'f'];
|
||||
|
||||
R.move<string>(0, 2, sampleList); // => ['b', 'c', 'a', 'd', 'e', 'f']
|
||||
R.move<string>(-1, 0, sampleList); // => ['f', 'a', 'b', 'c', 'd', 'e'] list rotation
|
||||
|
||||
const moveCurried1 = R.move(0, 2);
|
||||
moveCurried1<string>(sampleList); // => ['b', 'c', 'a', 'd', 'e', 'f']
|
||||
|
||||
const moveCurried2 = R.move(0);
|
||||
moveCurried2<string>(2, sampleList); // => ['b', 'c', 'a', 'd', 'e', 'f']
|
||||
|
||||
const moveCurried3 = R.move(0);
|
||||
const moveCurried4 = moveCurried3(2);
|
||||
moveCurried4<string>(sampleList); // => ['b', 'c', 'a', 'd', 'e', 'f']
|
||||
};
|
||||
|
||||
() => {
|
||||
R.none(R.isNaN, [1, 2, 3]); // => true
|
||||
R.none(R.isNaN, [1, 2, 3, NaN]); // => false
|
||||
|
||||
Reference in New Issue
Block a user