Merge pull request #6025 from chrootsu/lodash-matches

lodash: added _.matches() method
This commit is contained in:
Masahiro Wakame
2015-10-05 22:29:37 +09:00
2 changed files with 49 additions and 0 deletions
+17
View File
@@ -2439,6 +2439,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
@@ -8423,6 +8423,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 {
/**