lodash: changed _.identity() method

This commit is contained in:
Ilya Mochalov
2015-09-01 08:25:06 +05:00
parent a278148f0e
commit 0854455f2a
2 changed files with 41 additions and 6 deletions
+16 -2
View File
@@ -1644,8 +1644,6 @@ var testAttempFn: TestAttemptFn;
result = <TResult|Error>_.attempt<TResult>(testAttempFn);
result = <TResult|Error>_(testAttempFn).attempt<TResult>();
result = <{ name: string }>_.identity({ 'name': 'moe' });
_.mixin({
'capitalize': function (string) {
return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
@@ -1895,6 +1893,22 @@ result = <() => boolean>_(true).constant<boolean>();
result = <() => any[]>_(['a']).constant<any[]>();
result = <() => {}>_({}).constant<{}>();
// _.identity
{
let testIdentityValue: TResult;
let result: TResult;
result = _.identity<TResult>(testIdentityValue);
result = _(testIdentityValue).identity();
}
{
let result: number;
result = _(42).identity();
}
{
let result: boolean[];
result = _<boolean>([]).identity();
}
// _.method
class TestMethod {
a = {
+25 -4
View File
@@ -7993,13 +7993,34 @@ declare module _ {
//_.identity
interface LoDashStatic {
/**
* This method returns the first argument provided to it.
* @param value Any value.
* @return value.
**/
* This method returns the first argument provided to it.
* @param value Any value.
* @return Returns value.
*/
identity<T>(value?: T): T;
}
interface LoDashWrapper<T> {
/**
* @see _.identity
*/
identity(): T;
}
interface LoDashArrayWrapper<T> {
/**
* @see _.identity
*/
identity(): T[];
}
interface LoDashObjectWrapper<T> {
/**
* @see _.identity
*/
identity(): T;
}
//_.method
interface LoDashStatic {
/**