mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
lodash: added _.propertyOf() method
This commit is contained in:
@@ -1439,6 +1439,17 @@ result = <string>_.result(object, 'stuff');
|
||||
var tempObject = {};
|
||||
result = <typeof _>_.runInContext(tempObject);
|
||||
|
||||
// _.propertyOf
|
||||
interface TestPropertyOfObject {
|
||||
a: {
|
||||
b: number[];
|
||||
}
|
||||
}
|
||||
var testPropertyOfObject: TestPropertyOfObject;
|
||||
result = <(path: string|string[]) => any>_.propertyOf({});
|
||||
result = <(path: string|string[]) => any>_.propertyOf<TestPropertyOfObject>(testPropertyOfObject);
|
||||
result = <(path: string|string[]) => any>_({}).propertyOf().value();
|
||||
|
||||
result = <_.TemplateExecutor>_.template('hello <%= name %>');
|
||||
result = <string>_.template('<b><%- value %></b>', { 'value': '<script>' });
|
||||
|
||||
|
||||
Vendored
+18
@@ -7242,6 +7242,24 @@ declare module _ {
|
||||
property<T,RT>(key: string): (obj: T) => RT;
|
||||
}
|
||||
|
||||
//_.propertyOf
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* The opposite of _.property; this method creates a function that returns the property value at a given path
|
||||
* on object.
|
||||
* @param object The object to query.
|
||||
* @return Returns the new function.
|
||||
*/
|
||||
propertyOf<T extends {}>(object: T): (path: string|string[]) => any;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.propertyOf
|
||||
*/
|
||||
propertyOf(): LoDashObjectWrapper<(path: string|string[]) => any>;
|
||||
}
|
||||
|
||||
//_.random
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user