mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-25 11:11:46 +08:00
Merge pull request #6026 from chrootsu/lodash-matchesProperty
lodash: added _.matchesProperty() method
This commit is contained in:
@@ -2696,6 +2696,24 @@ module TestMatches {
|
||||
}
|
||||
}
|
||||
|
||||
// _.matchesProperty
|
||||
module TestMatches {
|
||||
let path: {toString(): string;}|{toString(): string;}[];
|
||||
let source: TResult;
|
||||
|
||||
{
|
||||
let result: (value: any) => boolean;
|
||||
result = _.matchesProperty<TResult>(path, source);
|
||||
result = _(path).matchesProperty<TResult>(source).value();
|
||||
}
|
||||
|
||||
{
|
||||
let result: (value: TResult) => boolean;
|
||||
result = _.matchesProperty<TResult, TResult>(path, source);
|
||||
result = _(path).matchesProperty<TResult, TResult>(source).value();
|
||||
}
|
||||
}
|
||||
|
||||
// _.method
|
||||
class TestMethod {
|
||||
a = {
|
||||
|
||||
Vendored
+42
@@ -8654,6 +8654,48 @@ declare module _ {
|
||||
matches<V>(): LoDashObjectWrapper<(value: V) => boolean>;
|
||||
}
|
||||
|
||||
//_.matchesProperty
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a function that compares the property value of path on a given object to value.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @param path The path of the property to get.
|
||||
* @param srcValue The value to match.
|
||||
* @return Returns the new function.
|
||||
*/
|
||||
matchesProperty<T>(
|
||||
path: StringRepresentable|StringRepresentable[],
|
||||
srcValue: T
|
||||
): (value: any) => boolean;
|
||||
|
||||
/**
|
||||
* @see _.matchesProperty
|
||||
*/
|
||||
matchesProperty<T, V>(
|
||||
path: StringRepresentable|StringRepresentable[],
|
||||
srcValue: T
|
||||
): (value: V) => boolean;
|
||||
}
|
||||
|
||||
interface LoDashWrapperBase<T, TWrapper> {
|
||||
/**
|
||||
* @see _.matchesProperty
|
||||
*/
|
||||
matchesProperty<SrcValue>(
|
||||
srcValue: SrcValue
|
||||
): LoDashObjectWrapper<(value: any) => boolean>;
|
||||
|
||||
/**
|
||||
* @see _.matchesProperty
|
||||
*/
|
||||
matchesProperty<SrcValue, Value>(
|
||||
srcValue: SrcValue
|
||||
): LoDashObjectWrapper<(value: Value) => boolean>;
|
||||
}
|
||||
|
||||
//_.method
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user