diff --git a/underscore/underscore-tests.ts b/underscore/underscore-tests.ts index f469d3bea0..13410c23b8 100644 --- a/underscore/underscore-tests.ts +++ b/underscore/underscore-tests.ts @@ -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'); diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index 4aed7a855f..1f8faf2e24 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -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).