That only does a shallow copy, though, it's not going to work for nested 
objects. At this point I'd rather go with a module.

On Wednesday, May 1, 2013 1:37:42 PM UTC-4, Raynos wrote:
>
> ```js
> function clone(x) {
>   return util._extend(x, {})
> }
> ```
>
> Obvouisly `util._extend` is not documented so if you use it and it changes 
> then thats your problem.
>
>
> On Wed, May 1, 2013 at 10:10 AM, Ilya Shaisultanov 
> <[email protected]<javascript:>
> > wrote:
>
>> Right, so util module is for internal stuff. Then it makes sense to not 
>> add stuff into it willy-nilly. Good to know.
>>
>>
>> On Wednesday, May 1, 2013 1:06:51 PM UTC-4, Mikeal Rogers wrote:
>>
>>> The util module is for common utilities required by *other core modules* 
>>> not utilities that are useful for node modules outside of core.
>>>
>>> Node core is crazy small, its not reasonable to think you can build an 
>>> application without installing additional modules with npm. Many great 
>>> utility modules exist in npm. 
>>>
>>> Underscore is the most depended on module in npm and it includes 
>>> _.clone() which is a copy function. lodash is another module which includes 
>>> all the functionality of underscore and then some and has deep copying 
>>> support (underscore copy is shallow).
>>>
>>> -Mikeal
>>>
>>> On May 1, 2013, at 9:42AM, Luke Arduini <[email protected]> wrote:
>>>
>>> that's unnecessary bloat that can be handled fine as a module on npm.
>>>
>>>
>>> On Wed, May 1, 2013 at 12:37 PM, Ilya Shaisultanov <
>>> [email protected]> wrote:
>>>
>>>> Why not add a way to copy objects, for example like 
>>>> SugarJS<https://github.com/andrewplummer/Sugar/blob/master/lib/object.js#L313>
>>>>  does?
>>>>
>>>> Util already has `inherits` helper and creating object copies is 
>>>> something that's not available natively and for newcomers there's a lot of 
>>>> gotchas, IMO, e.g. when someone tries to clone an object with nested 
>>>> properties and does a shallow clone, ending up with refs instead of copies.
>>>>
>>>> Having this in util would save people time and it'd be code that's 
>>>> reviewed by node maintainers (=> trustworthy).
>>>>
>>>> Just my 2 cents.
>>>>
>>>> -- 
>>>> -- 
>>>> Job Board: http://jobs.nodejs.org/
>>>> Posting guidelines: https://github.com/joyent/**node/wiki/Mailing-List-
>>>> **Posting-Guidelines<https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines>
>>>> You received this message because you are subscribed to the Google
>>>> Groups "nodejs" group.
>>>> To post to this group, send email to [email protected]
>>>>
>>>> To unsubscribe from this group, send email to
>>>> nodejs+un...@**googlegroups.com
>>>>
>>>> For more options, visit this group at
>>>> http://groups.google.com/**group/nodejs?hl=en?hl=en<http://groups.google.com/group/nodejs?hl=en?hl=en>
>>>>  
>>>> --- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "nodejs" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to nodejs+un...@**googlegroups.com.
>>>>
>>>> For more options, visit 
>>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>>> .
>>>>  
>>>>  
>>>>
>>>
>>>
>>> -- 
>>> -- 
>>> Job Board: http://jobs.nodejs.org/
>>> Posting guidelines: https://github.com/joyent/**node/wiki/Mailing-List-*
>>> *Posting-Guidelines<https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines>
>>> You received this message because you are subscribed to the Google
>>> Groups "nodejs" group.
>>> To post to this group, send email to [email protected]
>>>
>>> To unsubscribe from this group, send email to
>>> nodejs+un...@**googlegroups.com
>>>
>>> For more options, visit this group at
>>> http://groups.google.com/**group/nodejs?hl=en?hl=en<http://groups.google.com/group/nodejs?hl=en?hl=en>
>>>  
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "nodejs" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to nodejs+un...@**googlegroups.com.
>>>
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>> .
>>>  
>>>  
>>>
>>>
>>>  -- 
>> -- 
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines: 
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to [email protected]<javascript:>
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "nodejs" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to