Bug Tracker

Opened 12 years ago

Closed 12 years ago

#1830 closed enhancement (wontfix)

$.copy

Reported by: Byron Owned by:
Priority: minor Milestone: 1.2.2
Component: core Version: 1.2.1
Keywords: Cc:
Blocked by: Blocking:

Description

It would be nice to add a function which allows you to copy an object and all its properties, for those cases where you dont want $.extend to overwrite your original object.

$.extend($.copy(myObj), {foo : 'bar'});

Change History (1)

comment:1 Changed 12 years ago by brandon

Resolution: wontfix
Status: newclosed

This is better implemented in your own code base. It can be achieved with the following code.

$.copy = function(obj) {
    return $.extend({}, obj);
};
Note: See TracTickets for help on using tickets.