mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-11 11:50:54 +08:00
added _.random definition
This commit is contained in:
@@ -726,6 +726,12 @@ var lodash = <typeof _>_.noConflict();
|
||||
|
||||
result = <number>_.parseInt('08');
|
||||
|
||||
result = <number>_.random(0, 5);
|
||||
result = <number>_.random(5);
|
||||
result = <number>_.random(5, true);
|
||||
result = <number>_.random(1.2, 5.2);
|
||||
result = <number>_.random(0, 5, true);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var iceCream = { flavor: "chocolate" };
|
||||
|
||||
Vendored
+15
-17
@@ -2745,7 +2745,22 @@ declare module _ {
|
||||
**/
|
||||
export function parseInt(value: string): number;
|
||||
|
||||
/**
|
||||
* Produces a random number between min and max (inclusive). If only one argument is provided a
|
||||
* number between 0 and the given number will be returned. If floating is truey or either min or
|
||||
* max are floats a floating-point number will be returned instead of an integer.
|
||||
* @param max The maximum possible value.
|
||||
* @param floating Specify returning a floating-point number.
|
||||
* @return A random number.
|
||||
**/
|
||||
export function random(max: number, floating?: boolean): number;
|
||||
|
||||
/**
|
||||
* @see _.random
|
||||
* @param min The minimum possible value.
|
||||
* @return A random number between `min` and `max`.
|
||||
**/
|
||||
export function random(min: number, max: number, floating?: boolean): number;
|
||||
|
||||
|
||||
|
||||
@@ -2765,23 +2780,6 @@ declare module _ {
|
||||
**/
|
||||
export function times<TResult>(n: number, iterator: (n: number) => TResult, context?: any): TResult[];
|
||||
|
||||
/**
|
||||
* Returns a random integer between min and max, inclusive. If you only pass one argument,
|
||||
* it will return a number between 0 and that number.
|
||||
* @param max The maximum random number.
|
||||
* @return A random number between 0 and `max`.
|
||||
**/
|
||||
export function random(max: number): number;
|
||||
|
||||
/**
|
||||
* @see _.random
|
||||
* @param min The minimum random number.
|
||||
* @return A random number between `min` and `max`.
|
||||
**/
|
||||
export function random(min: number, max: number): number;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Generate a globally-unique id for client-side models or DOM elements that need one.
|
||||
* If prefix is passed, the id will be appended to it. Without prefix, returns an integer.
|
||||
|
||||
Reference in New Issue
Block a user