lodash: added _.matches() method

This commit is contained in:
Ilya Mochalov
2015-09-27 12:20:29 +05:00
parent b937e64fc9
commit 811d795bce
2 changed files with 49 additions and 0 deletions
+17
View File
@@ -2412,6 +2412,23 @@ result = <() => {}>_({}).constant<{}>();
result = _({}).iteratee(any).value();
}
// _.matches
module TestMatches {
let source: TResult;
{
let result: (value: any) => boolean;
result = _.matches<TResult>(source);
result = _(source).matches().value();
}
{
let result: (value: TResult) => boolean;
result = _.matches<TResult, TResult>(source);
result = _(source).matches<TResult>().value();
}
}
// _.method
class TestMethod {
a = {
+32
View File
@@ -8449,6 +8449,38 @@ declare module _ {
iteratee<TResult>(thisArg?: any): LoDashObjectWrapper<(...args: any[]) => TResult>;
}
//_.matches
interface LoDashStatic {
/**
* Creates a function that performs a deep comparison between a given object and source, returning true if the
* given object has equivalent property values, else false.
*
* Note: This method supports comparing arrays, booleans, Date objects, numbers, Object objects, regexes, and
* strings. Objects are compared by their own, not inherited, enumerable properties. For comparing a single own
* or inherited property value see _.matchesProperty.
*
* @param source The object of property values to match.
* @return Returns the new function.
*/
matches<T>(
source: T
): (value: any) => boolean;
/**
* @see _.matches
*/
matches<T, V>(
source: T
): (value: V) => boolean;
}
interface LoDashWrapperBase<T, TWrapper> {
/**
* @see _.matches
*/
matches<V>(): LoDashObjectWrapper<(value: V) => boolean>;
}
//_.method
interface LoDashStatic {
/**