Merge pull request #5571 from maglar0/master

Underscore: Add types for functions extendOwn() and assign()
This commit is contained in:
Masahiro Wakame
2015-09-03 01:32:27 +09:00
2 changed files with 16 additions and 0 deletions

View File

@@ -177,6 +177,8 @@ _.pairs({ one: 1, two: 2, three: 3 });
_.invert({ Moe: "Moses", Larry: "Louis", Curly: "Jerome" });
_.functions(_);
_.extend({ name: 'moe' }, { age: 50 });
_.extendOwn({ name: 'moe'}, { age: 50 });
_.assign({ name: 'moe'}, { age: 50 });
_.pick({ name: 'moe', age: 50, userid: 'moe1' }, 'name', 'age');
_.omit({ name: 'moe', age: 50, userid: 'moe1' }, 'name');
_.omit({ name: 'moe', age: 50, userid: 'moe1' }, 'name', 'age');

View File

@@ -1236,6 +1236,20 @@ interface UnderscoreStatic {
destination: any,
...sources: any[]): any;
/**
* Like extend, but only copies own properties over to the destination object. (alias: assign)
*/
extendOwn(
destination: any,
...source: any[]): any;
/**
* Like extend, but only copies own properties over to the destination object. (alias: extendOwn)
*/
assign(
destination: any,
...source: any[]): any;
/**
* Return a copy of the object, filtered to only have values for the whitelisted keys
* (or array of valid keys).