Bug Tracker

Modify

Ticket #1830 (closed enhancement: wontfix)

Opened 6 years ago

Last modified 6 years ago

$.copy

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

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

comment:1 Changed 6 years ago by brandon

  • Status changed from new to closed
  • Resolution set to wontfix

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

$.copy = function(obj) {
    return $.extend({}, obj);
};

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.