1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
|
import _ = require("../index");
declare module "../index" {
// clamp
interface LoDashStatic {
/**
* Clamps `number` within the inclusive `lower` and `upper` bounds.
*
* @category Number
* @param number The number to clamp.
* @param [lower] The lower bound.
* @param upper The upper bound.
* @returns Returns the clamped number.
* @example
*
* _.clamp(-10, -5, 5);
* // => -5
*
* _.clamp(10, -5, 5);
* // => 5
*/
clamp(
number: number,
lower: number,
upper: number
): number;
clamp(
number: number,
upper: number
): number;
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.clamp
*/
clamp(
lower: number,
upper: number
): number;
clamp(
upper: number
): number;
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.clamp
*/
clamp(
lower: number,
upper: number
): LoDashExplicitWrapper<number>;
clamp(
upper: number
): LoDashExplicitWrapper<number>;
}
// inRange
interface LoDashStatic {
/**
* Checks if n is between start and up to but not including, end. If end is not specified it’s set to start
* with start then set to 0.
*
* @param n The number to check.
* @param start The start of the range.
* @param end The end of the range.
* @return Returns true if n is in the range, else false.
*/
inRange(
n: number,
start: number,
end?: number
): boolean;
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.inRange
*/
inRange(
start: number,
end?: number
): boolean;
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.inRange
*/
inRange(
start: number,
end?: number
): LoDashExplicitWrapper<boolean>;
}
// random
interface LoDashStatic {
/**
* Produces a random number between min and max (inclusive). If only one argument is provided a number between
* 0 and the given number is returned. If floating is true, or either min or max are floats, a floating-point
* number is returned instead of an integer.
*
* @param min The minimum possible value.
* @param max The maximum possible value.
* @param floating Specify returning a floating-point number.
* @return Returns the random number.
*/
random(
floating?: boolean
): number;
/**
* @see _.random
*/
random(
max: number,
floating?: boolean
): number;
/**
* @see _.random
*/
random(
min: number,
max: number,
floating?: boolean
): number;
/**
* Produces a random number between min and max (inclusive). If only one argument is provided a number between
* 0 and the given number is returned. If floating is true, or either min or max are floats, a floating-point
* number is returned instead of an integer.
*
* @param min The minimum possible value.
* @param index Not used in this overload.
* @param guard Enables use as an iteratee for methods like _.map. You should not pass this parameter directly in your code.
* @return Returns the random number.
*/
random(
min: number,
index: string | number,
guard: object
): number;
}
interface LoDashImplicitWrapper<TValue> {
/**
* @see _.random
*/
random(floating?: boolean): number;
/**
* @see _.random
*/
random(
max: number,
floating?: boolean
): number;
}
interface LoDashExplicitWrapper<TValue> {
/**
* @see _.random
*/
random(floating?: boolean): LoDashExplicitWrapper<number>;
/**
* @see _.random
*/
random(
max: number,
floating?: boolean
): LoDashExplicitWrapper<number>;
}
}
|