can.extend

  • function
 

Merge objects together.

can.extend([deep], target, ...obj)

Parameters

  1. deep {Boolean}Optional

    If true, the merge becomes recursive (aka. deep copy).

  2. target {Object}

    The object to merge properties into.

  3. obj {Object}

    Objects containing properties to merge.

Returns

{Object}

target, post-merge.

can.extend(target, objectN) merges the contents of two or more objects together into the first object similarly to jQuery.extend.

var first = {},
second = {a: "b"},
third = {c: "d"};

can.extend(first, second, third); //-> first

first  //-> {a: "b", c: "d"}
second //-> {a: "b"}
third  //-> {c: "d"}