mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-26 11:12:19 +08:00
lodash: added set() method
This commit is contained in:
@@ -1080,6 +1080,9 @@ result = <HasName>_.pick({ 'name': 'moe', '_userid': 'moe1' }, function (value,
|
||||
return key.charAt(0) != '_';
|
||||
});
|
||||
|
||||
|
||||
result = <{ a: { b: { c: number; }}[]}>_.set({ 'a': [{ 'b': { 'c': 3 } }] }, 'a[0].b.c', 4);
|
||||
|
||||
result = <number[]>_.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function (r: number[], num: number) {
|
||||
num *= num;
|
||||
if (num % 2) {
|
||||
|
||||
Vendored
+14
@@ -6235,6 +6235,20 @@ declare module _ {
|
||||
thisArg?: any): Picked;
|
||||
}
|
||||
|
||||
//_.set
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Sets the property value of path on object. If a portion of path does not exist it is created.
|
||||
* @param object The object to augment.
|
||||
* @param path The path of the property to set.
|
||||
* @param value The value to set.
|
||||
* @return Returns object.
|
||||
**/
|
||||
set<T>(object: T,
|
||||
path: string|string[],
|
||||
value: any): T;
|
||||
}
|
||||
|
||||
//_.transform
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user