Quantcast

deep lang.mixin

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

deep lang.mixin

Michael Schall
I opened an enhancement request (https://bugs.dojotoolkit.org/ticket/18958) today but probably should have started here first...

Basically I would like a deep mixin similar to jQuey's extend(true, obj1, obj2) overload...

var object1 = {
  apple: 0,
  banana: { weight: 52, price: 100 },
  cherry: 97
};
var object2 = {
  banana: { price: 200 },
  durian: 100
};
 
// Merge object2 into object1, recursively
$.extend( true, object1, object2 );

//object1 = {"apple":0,"banana":{"weight":52,"price":200},"cherry":97,"durian":100}

I have made a sample Plunker with jQuery.extend brute force converted to lang.jmixin using dojo's isObject, IsArray and isFunction in app/lang.js which is a copy of current dojo/_base/lang.  It works for the above input, but as dojo doesn't have a function similar to isPlainObject that I can see, it may not work exactly as theirs does.

Plunker link: http://plnkr.co/edit/ebYbu9nQ5m3rAbyQbMP1?p=preview


--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deep lang.mixin

dylanks
Hi Michael,

It's in an odd location, but I believe what you are looking for is the
same as dojo/request/util.deepCopy

See https://jsfiddle.net/dylan/oja45dv8/

Regards,
-Dylan

on 1/17/17, 21:06 (GMT-07:00) Michael Schall said the following:

> I opened an enhancement request
> (https://bugs.dojotoolkit.org/ticket/18958) today but probably should
> have started here first...
>
> Basically I would like a deep mixin similar to jQuey's extend(true,
> obj1, obj2) overload...
>
> var object1 = {
>   apple: 0,
>   banana: { weight: 52, price: 100 },
>   cherry: 97
> };
> var object2 = {
>   banana: { price: 200 },
>   durian: 100
> };
>  
> // Merge object2 into object1, recursively
> $.extend( true, object1, object2 );
>
> //object1 =
> {"apple":0,"banana":{"weight":52,"price":200},"cherry":97,"durian":100}
>
> I have made a sample Plunker with jQuery.extend brute force converted to
> lang.jmixin using dojo's isObject, IsArray and isFunction in app/lang.js
> which is a copy of current dojo/_base/lang.  It works for the above
> input, but as dojo doesn't have a function similar to isPlainObject that
> I can see, it may not work exactly as theirs does.
>
> Plunker link: http://plnkr.co/edit/ebYbu9nQ5m3rAbyQbMP1?p=preview
>
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Co-Founder, Dojo Toolkit
CEO, SitePen, Inc.  http://www.sitepen.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deep lang.mixin

Michael Schall
Dylan - Thanks for the quick response!  

I tested this today a bit and I think this may work for our cases.

Looks like dojo 2's core/lang exports a deepMixin function ( https://github.com/dojo/core/blob/master/src/lang.ts#L165 ) that will support this in the future and has special handling for arrays similar to the jQuery implementation?

Could core/lang's deepMixin be back ported to 1.x's lang module?

Mike

On Wed, Jan 18, 2017 at 6:32 AM, Dylan Schiemann <[hidden email]> wrote:
Hi Michael,

It's in an odd location, but I believe what you are looking for is the
same as dojo/request/util.deepCopy

See https://jsfiddle.net/dylan/oja45dv8/

Regards,
-Dylan

on 1/17/17, 21:06 (GMT-07:00) Michael Schall said the following:
> I opened an enhancement request
> (https://bugs.dojotoolkit.org/ticket/18958) today but probably should
> have started here first...
>
> Basically I would like a deep mixin similar to jQuey's extend(true,
> obj1, obj2) overload...
>
> var object1 = {
>   apple: 0,
>   banana: { weight: 52, price: 100 },
>   cherry: 97
> };
> var object2 = {
>   banana: { price: 200 },
>   durian: 100
> };
>
> // Merge object2 into object1, recursively
> $.extend( true, object1, object2 );
>
> //object1 =
> {"apple":0,"banana":{"weight":52,"price":200},"cherry":97,"durian":100}
>
> I have made a sample Plunker with jQuery.extend brute force converted to
> lang.jmixin using dojo's isObject, IsArray and isFunction in app/lang.js
> which is a copy of current dojo/_base/lang.  It works for the above
> input, but as dojo doesn't have a function similar to isPlainObject that
> I can see, it may not work exactly as theirs does.
>
> Plunker link: http://plnkr.co/edit/ebYbu9nQ5m3rAbyQbMP1?p=preview
>
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest


--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deep lang.mixin

dylanks
Hi Mike,

We could. I'd be happy to review a PR if someone wants to backport it.

Another option of course could be to use @dojo/core within your Dojo 1
app. It would be larger than just adding a function to
dojo/_base/lang.js, but @dojo/core is pretty small. I'd be curious to
hear how that experience goes if you're interested in that experiment.
You could basically transpile @dojo/core and then use @dojo/core/lang as
an AMD module.

Regards,
-Dylan

on 1/18/17, 17:31 (GMT-07:00) Michael Schall said the following:

> Dylan - Thanks for the quick response!  
>
> I tested this today a bit and I think this may work for our cases.
>
> Looks like dojo 2's core/lang exports a deepMixin function (
> https://github.com/dojo/core/blob/master/src/lang.ts#L165 ) that will
> support this in the future and has special handling for arrays similar
> to the jQuery implementation?
>
> Could core/lang's deepMixin be back ported to 1.x's lang module?
>
> Mike
>
> On Wed, Jan 18, 2017 at 6:32 AM, Dylan Schiemann <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hi Michael,
>
>     It's in an odd location, but I believe what you are looking for is the
>     same as dojo/request/util.deepCopy
>
>     See https://jsfiddle.net/dylan/oja45dv8/
>     <https://jsfiddle.net/dylan/oja45dv8/>
>
>     Regards,
>     -Dylan
>
>     on 1/17/17, 21:06 (GMT-07:00) Michael Schall said the following:
>     > I opened an enhancement request
>     > (https://bugs.dojotoolkit.org/ticket/18958
>     <https://bugs.dojotoolkit.org/ticket/18958>) today but probably should
>     > have started here first...
>     >
>     > Basically I would like a deep mixin similar to jQuey's extend(true,
>     > obj1, obj2) overload...
>     >
>     > var object1 = {
>     >   apple: 0,
>     >   banana: { weight: 52, price: 100 },
>     >   cherry: 97
>     > };
>     > var object2 = {
>     >   banana: { price: 200 },
>     >   durian: 100
>     > };
>     >
>     > // Merge object2 into object1, recursively
>     > $.extend( true, object1, object2 );
>     >
>     > //object1 =
>     >
>     {"apple":0,"banana":{"weight":52,"price":200},"cherry":97,"durian":100}
>     >
>     > I have made a sample Plunker with jQuery.extend brute force
>     converted to
>     > lang.jmixin using dojo's isObject, IsArray and isFunction in
>     app/lang.js
>     > which is a copy of current dojo/_base/lang.  It works for the above
>     > input, but as dojo doesn't have a function similar to
>     isPlainObject that
>     > I can see, it may not work exactly as theirs does.
>     >
>     > Plunker link: http://plnkr.co/edit/ebYbu9nQ5m3rAbyQbMP1?p=preview
>     <http://plnkr.co/edit/ebYbu9nQ5m3rAbyQbMP1?p=preview>
>     >
>     --
>     Dojo Toolkit: http://dojotoolkit.org/
>     Tutorials: http://dojotoolkit.org/documentation/
>     <http://dojotoolkit.org/documentation/>
>
>     [hidden email]
>     <mailto:[hidden email]>
>     To unsubscribe, visit:
>     http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>     <http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest>
>
>
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Co-Founder, Dojo Toolkit
CEO, SitePen, Inc.  http://www.sitepen.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deep lang.mixin

Michael Schall
I agree pulling in parts of Dojo 2 would be interesting, but probably don't want to pull that much in for a single function...  

When I get time to look into pulling this back, would the correct end goal be:

Backward compatibility: only add a deepMixin (and renamed private called functions as they collide) and leave current mixin (and called functions) unchanged?
Smaller file: pull back both deepMixin and mixin? 

The smaller file approach would probably be best, but I'm not sure the mixin functions between 1.x and 2.x are functionally equivalent.  The tests I can find for dojo 1.x lang.mixin (https://github.com/dojo/dojo/blob/master/tests/unit/_base/lang.js#L67) seem pretty sparse as compared to the ones for 2.x (https://github.com/dojo/core/blob/master/tests/unit/lang.ts#L142).


On Thu, Jan 19, 2017 at 6:44 AM Dylan Schiemann <[hidden email]> wrote:
Hi Mike,

We could. I'd be happy to review a PR if someone wants to backport it.

Another option of course could be to use @dojo/core within your Dojo 1
app. It would be larger than just adding a function to
dojo/_base/lang.js, but @dojo/core is pretty small. I'd be curious to
hear how that experience goes if you're interested in that experiment.
You could basically transpile @dojo/core and then use @dojo/core/lang as
an AMD module.

Regards,
-Dylan

on 1/18/17, 17:31 (GMT-07:00) Michael Schall said the following:
> Dylan - Thanks for the quick response!
>
> I tested this today a bit and I think this may work for our cases.
>
> Looks like dojo 2's core/lang exports a deepMixin function (
> https://github.com/dojo/core/blob/master/src/lang.ts#L165 ) that will
> support this in the future and has special handling for arrays similar
> to the jQuery implementation?
>
> Could core/lang's deepMixin be back ported to 1.x's lang module?
>
> Mike
>
> On Wed, Jan 18, 2017 at 6:32 AM, Dylan Schiemann <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hi Michael,
>
>     It's in an odd location, but I believe what you are looking for is the
>     same as dojo/request/util.deepCopy
>
>     See https://jsfiddle.net/dylan/oja45dv8/
>     <https://jsfiddle.net/dylan/oja45dv8/>
>
>     Regards,
>     -Dylan
>
>     on 1/17/17, 21:06 (GMT-07:00) Michael Schall said the following:
>     > I opened an enhancement request
>     > (https://bugs.dojotoolkit.org/ticket/18958
>     <https://bugs.dojotoolkit.org/ticket/18958>) today but probably should
>     > have started here first...
>     >
>     > Basically I would like a deep mixin similar to jQuey's extend(true,
>     > obj1, obj2) overload...
>     >
>     > var object1 = {
>     >   apple: 0,
>     >   banana: { weight: 52, price: 100 },
>     >   cherry: 97
>     > };
>     > var object2 = {
>     >   banana: { price: 200 },
>     >   durian: 100
>     > };
>     >
>     > // Merge object2 into object1, recursively
>     > $.extend( true, object1, object2 );
>     >
>     > //object1 =
>     >
>     {"apple":0,"banana":{"weight":52,"price":200},"cherry":97,"durian":100}
>     >
>     > I have made a sample Plunker with jQuery.extend brute force
>     converted to
>     > lang.jmixin using dojo's isObject, IsArray and isFunction in
>     app/lang.js
>     > which is a copy of current dojo/_base/lang.  It works for the above
>     > input, but as dojo doesn't have a function similar to
>     isPlainObject that
>     > I can see, it may not work exactly as theirs does.
>     >
>     > Plunker link: http://plnkr.co/edit/ebYbu9nQ5m3rAbyQbMP1?p=preview
>     <http://plnkr.co/edit/ebYbu9nQ5m3rAbyQbMP1?p=preview>
>     >
>     --
>     Dojo Toolkit: http://dojotoolkit.org/
>     Tutorials: http://dojotoolkit.org/documentation/
>     <http://dojotoolkit.org/documentation/>
>
>     [hidden email]
>     <mailto:[hidden email]>
>     To unsubscribe, visit:
>     http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>     <http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest>
>
>
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deep lang.mixin

dylanks
I see a few approaches:

1. Add to dojo/_base/lang. Probably the simplest, but limits what you
can do.
2. Add a new dojo/mixin module. Ok, but would probably add confusion.
3. Add a new dojox/lang/mixin module. Probably the best place to add it,
even though it might not get a lot of attention there. At least then you
could add better versions of mixin and deepMixin and not risk confusion
with what is in dojo/_base/lang

So I'd probably lean towards #3 as the right approach given the constraints.

Regards,
-Dylan

on 1/19/17, 11:18 (GMT-07:00) Michael Schall said the following:

> I agree pulling in parts of Dojo 2 would be interesting, but probably
> don't want to pull that much in for a single function...  
>
> When I get time to look into pulling this back, would the correct end
> goal be:
>
> Backward compatibility: only add a deepMixin (and renamed private called
> functions as they collide) and leave current mixin (and called
> functions) unchanged?
> Smaller file: pull back both deepMixin and mixin?
>
> The smaller file approach would probably be best, but I'm not sure the
> mixin functions between 1.x and 2.x are functionally equivalent.  The
> tests I can find for dojo 1.x lang.mixin
> (https://github.com/dojo/dojo/blob/master/tests/unit/_base/lang.js#L67
> <https://github.com/dojo/dojo/blob/master/tests/unit/_base/lang.js>)
> seem pretty sparse as compared to the ones for 2.x
> (https://github.com/dojo/core/blob/master/tests/unit/lang.ts#L142).
>
>
> On Thu, Jan 19, 2017 at 6:44 AM Dylan Schiemann <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hi Mike,
>
>     We could. I'd be happy to review a PR if someone wants to backport it.
>
>     Another option of course could be to use @dojo/core within your Dojo 1
>     app. It would be larger than just adding a function to
>     dojo/_base/lang.js, but @dojo/core is pretty small. I'd be curious to
>     hear how that experience goes if you're interested in that experiment.
>     You could basically transpile @dojo/core and then use @dojo/core/lang as
>     an AMD module.
>
>     Regards,
>     -Dylan
>
>     on 1/18/17, 17:31 (GMT-07:00) Michael Schall said the following:
>     > Dylan - Thanks for the quick response!
>     >
>     > I tested this today a bit and I think this may work for our cases.
>     >
>     > Looks like dojo 2's core/lang exports a deepMixin function (
>     > https://github.com/dojo/core/blob/master/src/lang.ts#L165 ) that will
>     > support this in the future and has special handling for arrays similar
>     > to the jQuery implementation?
>     >
>     > Could core/lang's deepMixin be back ported to 1.x's lang module?
>     >
>     > Mike
>     >
>     > On Wed, Jan 18, 2017 at 6:32 AM, Dylan Schiemann
>     <[hidden email] <mailto:[hidden email]>
>     > <mailto:[hidden email] <mailto:[hidden email]>>> wrote:
>     >
>     >     Hi Michael,
>     >
>     >     It's in an odd location, but I believe what you are looking
>     for is the
>     >     same as dojo/request/util.deepCopy
>     >
>     >     See https://jsfiddle.net/dylan/oja45dv8/
>     >     <https://jsfiddle.net/dylan/oja45dv8/>
>     >
>     >     Regards,
>     >     -Dylan
>     >
>     >     on 1/17/17, 21:06 (GMT-07:00) Michael Schall said the following:
>     >     > I opened an enhancement request
>     >     > (https://bugs.dojotoolkit.org/ticket/18958
>     >     <https://bugs.dojotoolkit.org/ticket/18958>) today but
>     probably should
>     >     > have started here first...
>     >     >
>     >     > Basically I would like a deep mixin similar to jQuey's
>     extend(true,
>     >     > obj1, obj2) overload...
>     >     >
>     >     > var object1 = {
>     >     >   apple: 0,
>     >     >   banana: { weight: 52, price: 100 },
>     >     >   cherry: 97
>     >     > };
>     >     > var object2 = {
>     >     >   banana: { price: 200 },
>     >     >   durian: 100
>     >     > };
>     >     >
>     >     > // Merge object2 into object1, recursively
>     >     > $.extend( true, object1, object2 );
>     >     >
>     >     > //object1 =
>     >     >
>     >  
>      {"apple":0,"banana":{"weight":52,"price":200},"cherry":97,"durian":100}
>     >     >
>     >     > I have made a sample Plunker with jQuery.extend brute force
>     >     converted to
>     >     > lang.jmixin using dojo's isObject, IsArray and isFunction in
>     >     app/lang.js
>     >     > which is a copy of current dojo/_base/lang.  It works for
>     the above
>     >     > input, but as dojo doesn't have a function similar to
>     >     isPlainObject that
>     >     > I can see, it may not work exactly as theirs does.
>     >     >
>     >     > Plunker link:
>     http://plnkr.co/edit/ebYbu9nQ5m3rAbyQbMP1?p=preview
>     >     <http://plnkr.co/edit/ebYbu9nQ5m3rAbyQbMP1?p=preview>
>     >     >
>     >     --
>     >     Dojo Toolkit: http://dojotoolkit.org/
>     >     Tutorials: http://dojotoolkit.org/documentation/
>     >     <http://dojotoolkit.org/documentation/>
>     >
>     >     [hidden email]
>     <mailto:[hidden email]>
>     >     <mailto:[hidden email]
>     <mailto:[hidden email]>>
>     >     To unsubscribe, visit:
>     >     http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>     >     <http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest>
>     >
>     >
>     --
>     Dojo Toolkit: http://dojotoolkit.org/
>     Tutorials: http://dojotoolkit.org/documentation/
>
>     [hidden email]
>     <mailto:[hidden email]>
>     To unsubscribe, visit:
>     http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Co-Founder, Dojo Toolkit
CEO, SitePen, Inc.  http://www.sitepen.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deep lang.mixin

Michael Schall
Dylan -  

Thanks for your help and direction...

I think I'm going to go back and look at your initial suggestion... If you think the "best" approach is to create a dojox package, why not just look into pulling in dojo 2 lang as a module.  From the looks of it, lang is almost self contained. 

Do you know if there any examples/documentation of how to transpile/build dojo 2?  How do you get it to support AMD?  I've looked, but have only come across the build examples for dojo 1.x.

On Thu, Jan 19, 2017 at 3:37 PM, Dylan Schiemann <[hidden email]> wrote:
I see a few approaches:

1. Add to dojo/_base/lang. Probably the simplest, but limits what you
can do.
2. Add a new dojo/mixin module. Ok, but would probably add confusion.
3. Add a new dojox/lang/mixin module. Probably the best place to add it,
even though it might not get a lot of attention there. At least then you
could add better versions of mixin and deepMixin and not risk confusion
with what is in dojo/_base/lang

So I'd probably lean towards #3 as the right approach given the constraints.

Regards,
-Dylan

on 1/19/17, 11:18 (GMT-07:00) Michael Schall said the following:
> I agree pulling in parts of Dojo 2 would be interesting, but probably
> don't want to pull that much in for a single function...
>
> When I get time to look into pulling this back, would the correct end
> goal be:
>
> Backward compatibility: only add a deepMixin (and renamed private called
> functions as they collide) and leave current mixin (and called
> functions) unchanged?
> Smaller file: pull back both deepMixin and mixin?
>
> The smaller file approach would probably be best, but I'm not sure the
> mixin functions between 1.x and 2.x are functionally equivalent.  The
> tests I can find for dojo 1.x lang.mixin
> (https://github.com/dojo/dojo/blob/master/tests/unit/_base/lang.js#L67
> <https://github.com/dojo/dojo/blob/master/tests/unit/_base/lang.js>)
> seem pretty sparse as compared to the ones for 2.x
> (https://github.com/dojo/core/blob/master/tests/unit/lang.ts#L142).
>
>
> On Thu, Jan 19, 2017 at 6:44 AM Dylan Schiemann <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hi Mike,
>
>     We could. I'd be happy to review a PR if someone wants to backport it.
>
>     Another option of course could be to use @dojo/core within your Dojo 1
>     app. It would be larger than just adding a function to
>     dojo/_base/lang.js, but @dojo/core is pretty small. I'd be curious to
>     hear how that experience goes if you're interested in that experiment.
>     You could basically transpile @dojo/core and then use @dojo/core/lang as
>     an AMD module.
>
>     Regards,
>     -Dylan
>
>     on 1/18/17, 17:31 (GMT-07:00) Michael Schall said the following:
>     > Dylan - Thanks for the quick response!
>     >
>     > I tested this today a bit and I think this may work for our cases.
>     >
>     > Looks like dojo 2's core/lang exports a deepMixin function (
>     > https://github.com/dojo/core/blob/master/src/lang.ts#L165 ) that will
>     > support this in the future and has special handling for arrays similar
>     > to the jQuery implementation?
>     >
>     > Could core/lang's deepMixin be back ported to 1.x's lang module?
>     >
>     > Mike
>     >
>     > On Wed, Jan 18, 2017 at 6:32 AM, Dylan Schiemann
>     <[hidden email] <mailto:[hidden email]>
>     > <mailto:[hidden email] <mailto:[hidden email]>>> wrote:
>     >
>     >     Hi Michael,
>     >
>     >     It's in an odd location, but I believe what you are looking
>     for is the
>     >     same as dojo/request/util.deepCopy
>     >
>     >     See https://jsfiddle.net/dylan/oja45dv8/
>     >     <https://jsfiddle.net/dylan/oja45dv8/>
>     >
>     >     Regards,
>     >     -Dylan
>     >
>     >     on 1/17/17, 21:06 (GMT-07:00) Michael Schall said the following:
>     >     > I opened an enhancement request
>     >     > (https://bugs.dojotoolkit.org/ticket/18958
>     >     <https://bugs.dojotoolkit.org/ticket/18958>) today but
>     probably should
>     >     > have started here first...
>     >     >
>     >     > Basically I would like a deep mixin similar to jQuey's
>     extend(true,
>     >     > obj1, obj2) overload...
>     >     >
>     >     > var object1 = {
>     >     >   apple: 0,
>     >     >   banana: { weight: 52, price: 100 },
>     >     >   cherry: 97
>     >     > };
>     >     > var object2 = {
>     >     >   banana: { price: 200 },
>     >     >   durian: 100
>     >     > };
>     >     >
>     >     > // Merge object2 into object1, recursively
>     >     > $.extend( true, object1, object2 );
>     >     >
>     >     > //object1 =
>     >     >
>     >
>      {"apple":0,"banana":{"weight":52,"price":200},"cherry":97,"durian":100}
>     >     >
>     >     > I have made a sample Plunker with jQuery.extend brute force
>     >     converted to
>     >     > lang.jmixin using dojo's isObject, IsArray and isFunction in
>     >     app/lang.js
>     >     > which is a copy of current dojo/_base/lang.  It works for
>     the above
>     >     > input, but as dojo doesn't have a function similar to
>     >     isPlainObject that
>     >     > I can see, it may not work exactly as theirs does.
>     >     >
>     >     > Plunker link:
>     http://plnkr.co/edit/ebYbu9nQ5m3rAbyQbMP1?p=preview
>     >     <http://plnkr.co/edit/ebYbu9nQ5m3rAbyQbMP1?p=preview>
>     >     >
>     >     --
>     >     Dojo Toolkit: http://dojotoolkit.org/
>     >     Tutorials: http://dojotoolkit.org/documentation/
>     >     <http://dojotoolkit.org/documentation/>
>     >
>     >     [hidden email]
>     <mailto:[hidden email]>
>     >     <mailto:[hidden email]
>     <mailto:[hidden email]>>
>     >     To unsubscribe, visit:
>     >     http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>     >     <http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest>
>     >
>     >
>     --
>     Dojo Toolkit: http://dojotoolkit.org/
>     Tutorials: http://dojotoolkit.org/documentation/
>
>     [hidden email]
>     <mailto:[hidden email]>
>     To unsubscribe, visit:
>     http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest


--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deep lang.mixin

dylanks
Hi Mike,

The process for dojo/core would be to npm install core and its
dependencies (has and shim):

npm install @dojo/shim
npm install @dojo/has
npm install @dojo/core

You may get a few spurious warnings.

Then the packages should exist as UMD modules in node_modules/@dojo/ ,
so add the location of the @dojo package in your dojo config, and you
should be good to go by requiring @dojo/core/lang as an AMD module.

I have not tried building these modules with the Dojo 1 build system,
but this version is transpiled to ES5, so things should just work hopefully.

Regards,
-Dylan

on 1/23/17, 20:45 (GMT-07:00) Michael Schall said the following:

> Dylan -  
>
> Thanks for your help and direction...
>
> I think I'm going to go back and look at your initial suggestion... If
> you think the "best" approach is to create a dojox package, why not just
> look into pulling in dojo 2 lang as a module.  From the looks of it,
> lang is almost self contained.
>
> Do you know if there any examples/documentation of how
> to transpile/build dojo 2?  How do you get it to support AMD?  I've
> looked, but have only come across the build examples for dojo 1.x.
>
> On Thu, Jan 19, 2017 at 3:37 PM, Dylan Schiemann <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     I see a few approaches:
>
>     1. Add to dojo/_base/lang. Probably the simplest, but limits what you
>     can do.
>     2. Add a new dojo/mixin module. Ok, but would probably add confusion.
>     3. Add a new dojox/lang/mixin module. Probably the best place to add it,
>     even though it might not get a lot of attention there. At least then you
>     could add better versions of mixin and deepMixin and not risk confusion
>     with what is in dojo/_base/lang
>
>     So I'd probably lean towards #3 as the right approach given the
>     constraints.
>
>     Regards,
>     -Dylan
>
>     on 1/19/17, 11:18 (GMT-07:00) Michael Schall said the following:
>     > I agree pulling in parts of Dojo 2 would be interesting, but probably
>     > don't want to pull that much in for a single function...
>     >
>     > When I get time to look into pulling this back, would the correct end
>     > goal be:
>     >
>     > Backward compatibility: only add a deepMixin (and renamed private
>     called
>     > functions as they collide) and leave current mixin (and called
>     > functions) unchanged?
>     > Smaller file: pull back both deepMixin and mixin?
>     >
>     > The smaller file approach would probably be best, but I'm not sure the
>     > mixin functions between 1.x and 2.x are functionally equivalent.  The
>     > tests I can find for dojo 1.x lang.mixin
>     > (https://github.com/dojo/dojo/blob/master/tests/unit/_base/lang.js#L67 <https://github.com/dojo/dojo/blob/master/tests/unit/_base/lang.js#L67>
>     > <https://github.com/dojo/dojo/blob/master/tests/unit/_base/lang.js
>     <https://github.com/dojo/dojo/blob/master/tests/unit/_base/lang.js>>)
>     > seem pretty sparse as compared to the ones for 2.x
>     > (https://github.com/dojo/core/blob/master/tests/unit/lang.ts#L142
>     <https://github.com/dojo/core/blob/master/tests/unit/lang.ts#L142>).
>     >
>     >
>     > On Thu, Jan 19, 2017 at 6:44 AM Dylan Schiemann
>     <[hidden email] <mailto:[hidden email]>
>     > <mailto:[hidden email] <mailto:[hidden email]>>> wrote:
>     >
>     >     Hi Mike,
>     >
>     >     We could. I'd be happy to review a PR if someone wants to
>     backport it.
>     >
>     >     Another option of course could be to use @dojo/core within your
>     Dojo 1
>     >     app. It would be larger than just adding a function to
>     >     dojo/_base/lang.js, but @dojo/core is pretty small. I'd be
>     curious to
>     >     hear how that experience goes if you're interested in that
>     experiment.
>     >     You could basically transpile @dojo/core and then use
>     @dojo/core/lang as
>     >     an AMD module.
>     >
>     >     Regards,
>     >     -Dylan
>     >
>     >     on 1/18/17, 17:31 (GMT-07:00) Michael Schall said the following:
>     >     > Dylan - Thanks for the quick response!
>     >     >
>     >     > I tested this today a bit and I think this may work for our
>     cases.
>     >     >
>     >     > Looks like dojo 2's core/lang exports a deepMixin function (
>     >     > https://github.com/dojo/core/blob/master/src/lang.ts#L165
>     <https://github.com/dojo/core/blob/master/src/lang.ts#L165> ) that will
>     >     > support this in the future and has special handling for
>     arrays similar
>     >     > to the jQuery implementation?
>     >     >
>     >     > Could core/lang's deepMixin be back ported to 1.x's lang module?
>     >     >
>     >     > Mike
>     >     >
>     >     > On Wed, Jan 18, 2017 at 6:32 AM, Dylan Schiemann
>     >     <[hidden email] <mailto:[hidden email]>
>     <mailto:[hidden email] <mailto:[hidden email]>>
>     >     > <mailto:[hidden email] <mailto:[hidden email]>
>     <mailto:[hidden email] <mailto:[hidden email]>>>> wrote:
>     >     >
>     >     >     Hi Michael,
>     >     >
>     >     >     It's in an odd location, but I believe what you are looking
>     >     for is the
>     >     >     same as dojo/request/util.deepCopy
>     >     >
>     >     >     See https://jsfiddle.net/dylan/oja45dv8/
>     <https://jsfiddle.net/dylan/oja45dv8/>
>     >     >     <https://jsfiddle.net/dylan/oja45dv8/
>     <https://jsfiddle.net/dylan/oja45dv8/>>
>     >     >
>     >     >     Regards,
>     >     >     -Dylan
>     >     >
>     >     >     on 1/17/17, 21:06 (GMT-07:00) Michael Schall said the
>     following:
>     >     >     > I opened an enhancement request
>     >     >     > (https://bugs.dojotoolkit.org/ticket/18958
>     <https://bugs.dojotoolkit.org/ticket/18958>
>     >     >     <https://bugs.dojotoolkit.org/ticket/18958
>     <https://bugs.dojotoolkit.org/ticket/18958>>) today but
>     >     probably should
>     >     >     > have started here first...
>     >     >     >
>     >     >     > Basically I would like a deep mixin similar to jQuey's
>     >     extend(true,
>     >     >     > obj1, obj2) overload...
>     >     >     >
>     >     >     > var object1 = {
>     >     >     >   apple: 0,
>     >     >     >   banana: { weight: 52, price: 100 },
>     >     >     >   cherry: 97
>     >     >     > };
>     >     >     > var object2 = {
>     >     >     >   banana: { price: 200 },
>     >     >     >   durian: 100
>     >     >     > };
>     >     >     >
>     >     >     > // Merge object2 into object1, recursively
>     >     >     > $.extend( true, object1, object2 );
>     >     >     >
>     >     >     > //object1 =
>     >     >     >
>     >     >
>     >    
>     {"apple":0,"banana":{"weight":52,"price":200},"cherry":97,"durian":100}
>     >     >     >
>     >     >     > I have made a sample Plunker with jQuery.extend brute
>     force
>     >     >     converted to
>     >     >     > lang.jmixin using dojo's isObject, IsArray and
>     isFunction in
>     >     >     app/lang.js
>     >     >     > which is a copy of current dojo/_base/lang.  It works for
>     >     the above
>     >     >     > input, but as dojo doesn't have a function similar to
>     >     >     isPlainObject that
>     >     >     > I can see, it may not work exactly as theirs does.
>     >     >     >
>     >     >     > Plunker link:
>     >     http://plnkr.co/edit/ebYbu9nQ5m3rAbyQbMP1?p=preview
>     <http://plnkr.co/edit/ebYbu9nQ5m3rAbyQbMP1?p=preview>
>     >     >     <http://plnkr.co/edit/ebYbu9nQ5m3rAbyQbMP1?p=preview
>     <http://plnkr.co/edit/ebYbu9nQ5m3rAbyQbMP1?p=preview>>
>     >     >     >
>     >     >     --
>     >     >     Dojo Toolkit: http://dojotoolkit.org/
>     >     >     Tutorials: http://dojotoolkit.org/documentation/
>     <http://dojotoolkit.org/documentation/>
>     >     >     <http://dojotoolkit.org/documentation/
>     <http://dojotoolkit.org/documentation/>>
>     >     >
>     >     >     [hidden email]
>     <mailto:[hidden email]>
>     >     <mailto:[hidden email]
>     <mailto:[hidden email]>>
>     >     >     <mailto:[hidden email]
>     <mailto:[hidden email]>
>     >     <mailto:[hidden email]
>     <mailto:[hidden email]>>>
>     >     >     To unsubscribe, visit:
>     >     >  
>      http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>     <http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest>
>     >     >  
>      <http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>     <http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest>>
>     >     >
>     >     >
>     >     --
>     >     Dojo Toolkit: http://dojotoolkit.org/
>     >     Tutorials: http://dojotoolkit.org/documentation/
>     <http://dojotoolkit.org/documentation/>
>     >
>     >     [hidden email]
>     <mailto:[hidden email]>
>     >     <mailto:[hidden email]
>     <mailto:[hidden email]>>
>     >     To unsubscribe, visit:
>     >     http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>     <http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest>
>     >
>     --
>     Dojo Toolkit: http://dojotoolkit.org/
>     Tutorials: http://dojotoolkit.org/documentation/
>     <http://dojotoolkit.org/documentation/>
>
>     [hidden email]
>     <mailto:[hidden email]>
>     To unsubscribe, visit:
>     http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>     <http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest>
>
>
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Co-Founder, Dojo Toolkit
CEO, SitePen, Inc.  http://www.sitepen.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deep lang.mixin

dylanks
P.S. https://github.com/dojo/widgets#usage has this documented, and will
soon be added to the READMEs for the other packages, as well as the
tutorials which are starting to be authored.

Regards,
-Dylan

on 1/24/17, 05:27 (GMT-07:00) Dylan Schiemann said the following:

> Hi Mike,
>
> The process for dojo/core would be to npm install core and its
> dependencies (has and shim):
>
> npm install @dojo/shim
> npm install @dojo/has
> npm install @dojo/core
>
> You may get a few spurious warnings.
>
> Then the packages should exist as UMD modules in node_modules/@dojo/ ,
> so add the location of the @dojo package in your dojo config, and you
> should be good to go by requiring @dojo/core/lang as an AMD module.
>
> I have not tried building these modules with the Dojo 1 build system,
> but this version is transpiled to ES5, so things should just work hopefully.
>
> Regards,
> -Dylan
>
> on 1/23/17, 20:45 (GMT-07:00) Michael Schall said the following:
>> Dylan -  
>>
>> Thanks for your help and direction...
>>
>> I think I'm going to go back and look at your initial suggestion... If
>> you think the "best" approach is to create a dojox package, why not just
>> look into pulling in dojo 2 lang as a module.  From the looks of it,
>> lang is almost self contained.
>>
>> Do you know if there any examples/documentation of how
>> to transpile/build dojo 2?  How do you get it to support AMD?  I've
>> looked, but have only come across the build examples for dojo 1.x.
>>
>> On Thu, Jan 19, 2017 at 3:37 PM, Dylan Schiemann <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>>     I see a few approaches:
>>
>>     1. Add to dojo/_base/lang. Probably the simplest, but limits what you
>>     can do.
>>     2. Add a new dojo/mixin module. Ok, but would probably add confusion.
>>     3. Add a new dojox/lang/mixin module. Probably the best place to add it,
>>     even though it might not get a lot of attention there. At least then you
>>     could add better versions of mixin and deepMixin and not risk confusion
>>     with what is in dojo/_base/lang
>>
>>     So I'd probably lean towards #3 as the right approach given the
>>     constraints.
>>
>>     Regards,
>>     -Dylan
>>
>>     on 1/19/17, 11:18 (GMT-07:00) Michael Schall said the following:
>>     > I agree pulling in parts of Dojo 2 would be interesting, but probably
>>     > don't want to pull that much in for a single function...
>>     >
>>     > When I get time to look into pulling this back, would the correct end
>>     > goal be:
>>     >
>>     > Backward compatibility: only add a deepMixin (and renamed private
>>     called
>>     > functions as they collide) and leave current mixin (and called
>>     > functions) unchanged?
>>     > Smaller file: pull back both deepMixin and mixin?
>>     >
>>     > The smaller file approach would probably be best, but I'm not sure the
>>     > mixin functions between 1.x and 2.x are functionally equivalent.  The
>>     > tests I can find for dojo 1.x lang.mixin
>>     > (https://github.com/dojo/dojo/blob/master/tests/unit/_base/lang.js#L67 <https://github.com/dojo/dojo/blob/master/tests/unit/_base/lang.js#L67>
>>     > <https://github.com/dojo/dojo/blob/master/tests/unit/_base/lang.js
>>     <https://github.com/dojo/dojo/blob/master/tests/unit/_base/lang.js>>)
>>     > seem pretty sparse as compared to the ones for 2.x
>>     > (https://github.com/dojo/core/blob/master/tests/unit/lang.ts#L142
>>     <https://github.com/dojo/core/blob/master/tests/unit/lang.ts#L142>).
>>     >
>>     >
>>     > On Thu, Jan 19, 2017 at 6:44 AM Dylan Schiemann
>>     <[hidden email] <mailto:[hidden email]>
>>     > <mailto:[hidden email] <mailto:[hidden email]>>> wrote:
>>     >
>>     >     Hi Mike,
>>     >
>>     >     We could. I'd be happy to review a PR if someone wants to
>>     backport it.
>>     >
>>     >     Another option of course could be to use @dojo/core within your
>>     Dojo 1
>>     >     app. It would be larger than just adding a function to
>>     >     dojo/_base/lang.js, but @dojo/core is pretty small. I'd be
>>     curious to
>>     >     hear how that experience goes if you're interested in that
>>     experiment.
>>     >     You could basically transpile @dojo/core and then use
>>     @dojo/core/lang as
>>     >     an AMD module.
>>     >
>>     >     Regards,
>>     >     -Dylan
>>     >
>>     >     on 1/18/17, 17:31 (GMT-07:00) Michael Schall said the following:
>>     >     > Dylan - Thanks for the quick response!
>>     >     >
>>     >     > I tested this today a bit and I think this may work for our
>>     cases.
>>     >     >
>>     >     > Looks like dojo 2's core/lang exports a deepMixin function (
>>     >     > https://github.com/dojo/core/blob/master/src/lang.ts#L165
>>     <https://github.com/dojo/core/blob/master/src/lang.ts#L165> ) that will
>>     >     > support this in the future and has special handling for
>>     arrays similar
>>     >     > to the jQuery implementation?
>>     >     >
>>     >     > Could core/lang's deepMixin be back ported to 1.x's lang module?
>>     >     >
>>     >     > Mike
>>     >     >
>>     >     > On Wed, Jan 18, 2017 at 6:32 AM, Dylan Schiemann
>>     >     <[hidden email] <mailto:[hidden email]>
>>     <mailto:[hidden email] <mailto:[hidden email]>>
>>     >     > <mailto:[hidden email] <mailto:[hidden email]>
>>     <mailto:[hidden email] <mailto:[hidden email]>>>> wrote:
>>     >     >
>>     >     >     Hi Michael,
>>     >     >
>>     >     >     It's in an odd location, but I believe what you are looking
>>     >     for is the
>>     >     >     same as dojo/request/util.deepCopy
>>     >     >
>>     >     >     See https://jsfiddle.net/dylan/oja45dv8/
>>     <https://jsfiddle.net/dylan/oja45dv8/>
>>     >     >     <https://jsfiddle.net/dylan/oja45dv8/
>>     <https://jsfiddle.net/dylan/oja45dv8/>>
>>     >     >
>>     >     >     Regards,
>>     >     >     -Dylan
>>     >     >
>>     >     >     on 1/17/17, 21:06 (GMT-07:00) Michael Schall said the
>>     following:
>>     >     >     > I opened an enhancement request
>>     >     >     > (https://bugs.dojotoolkit.org/ticket/18958
>>     <https://bugs.dojotoolkit.org/ticket/18958>
>>     >     >     <https://bugs.dojotoolkit.org/ticket/18958
>>     <https://bugs.dojotoolkit.org/ticket/18958>>) today but
>>     >     probably should
>>     >     >     > have started here first...
>>     >     >     >
>>     >     >     > Basically I would like a deep mixin similar to jQuey's
>>     >     extend(true,
>>     >     >     > obj1, obj2) overload...
>>     >     >     >
>>     >     >     > var object1 = {
>>     >     >     >   apple: 0,
>>     >     >     >   banana: { weight: 52, price: 100 },
>>     >     >     >   cherry: 97
>>     >     >     > };
>>     >     >     > var object2 = {
>>     >     >     >   banana: { price: 200 },
>>     >     >     >   durian: 100
>>     >     >     > };
>>     >     >     >
>>     >     >     > // Merge object2 into object1, recursively
>>     >     >     > $.extend( true, object1, object2 );
>>     >     >     >
>>     >     >     > //object1 =
>>     >     >     >
>>     >     >
>>     >    
>>     {"apple":0,"banana":{"weight":52,"price":200},"cherry":97,"durian":100}
>>     >     >     >
>>     >     >     > I have made a sample Plunker with jQuery.extend brute
>>     force
>>     >     >     converted to
>>     >     >     > lang.jmixin using dojo's isObject, IsArray and
>>     isFunction in
>>     >     >     app/lang.js
>>     >     >     > which is a copy of current dojo/_base/lang.  It works for
>>     >     the above
>>     >     >     > input, but as dojo doesn't have a function similar to
>>     >     >     isPlainObject that
>>     >     >     > I can see, it may not work exactly as theirs does.
>>     >     >     >
>>     >     >     > Plunker link:
>>     >     http://plnkr.co/edit/ebYbu9nQ5m3rAbyQbMP1?p=preview
>>     <http://plnkr.co/edit/ebYbu9nQ5m3rAbyQbMP1?p=preview>
>>     >     >     <http://plnkr.co/edit/ebYbu9nQ5m3rAbyQbMP1?p=preview
>>     <http://plnkr.co/edit/ebYbu9nQ5m3rAbyQbMP1?p=preview>>
>>     >     >     >
>>     >     >     --
>>     >     >     Dojo Toolkit: http://dojotoolkit.org/
>>     >     >     Tutorials: http://dojotoolkit.org/documentation/
>>     <http://dojotoolkit.org/documentation/>
>>     >     >     <http://dojotoolkit.org/documentation/
>>     <http://dojotoolkit.org/documentation/>>
>>     >     >
>>     >     >     [hidden email]
>>     <mailto:[hidden email]>
>>     >     <mailto:[hidden email]
>>     <mailto:[hidden email]>>
>>     >     >     <mailto:[hidden email]
>>     <mailto:[hidden email]>
>>     >     <mailto:[hidden email]
>>     <mailto:[hidden email]>>>
>>     >     >     To unsubscribe, visit:
>>     >     >  
>>      http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>>     <http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest>
>>     >     >  
>>      <http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>>     <http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest>>
>>     >     >
>>     >     >
>>     >     --
>>     >     Dojo Toolkit: http://dojotoolkit.org/
>>     >     Tutorials: http://dojotoolkit.org/documentation/
>>     <http://dojotoolkit.org/documentation/>
>>     >
>>     >     [hidden email]
>>     <mailto:[hidden email]>
>>     >     <mailto:[hidden email]
>>     <mailto:[hidden email]>>
>>     >     To unsubscribe, visit:
>>     >     http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>>     <http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest>
>>     >
>>     --
>>     Dojo Toolkit: http://dojotoolkit.org/
>>     Tutorials: http://dojotoolkit.org/documentation/
>>     <http://dojotoolkit.org/documentation/>
>>
>>     [hidden email]
>>     <mailto:[hidden email]>
>>     To unsubscribe, visit:
>>     http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>>     <http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest>
>>
>>
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Co-Founder, Dojo Toolkit
CEO, SitePen, Inc.  http://www.sitepen.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deep lang.mixin

Michael Schall
Dylan - 

I got pulled onto another project so I haven't looked into pulling in the dojo2 modules.  We did find an issue with the dojo1 request/util/deepCopy.  It does not seem to support Date objects.

I have updated the plunker (http://plnkr.co/edit/ebYbu9nQ5m3rAbyQbMP1?p=preview) showing a date property in the object structure.  We have also found a fix and have included the patch below and in the plunker example:

Index: request/util.js
===================================================================
--- request/util.js (revision 5861)
+++ request/util.js (working copy)
@@ -14,7 +14,11 @@
  sval = source[name];
  if(tval !== sval){
  if(tval && typeof tval === 'object' && sval && typeof sval === 'object'){
- exports.deepCopy(tval, sval);
+ if(sval instanceof Date){
+ target[name] = new Date(sval);
+ }else{
+ exports.deepCopy(tval, sval);
+ }
  }else{
  target[name] = sval;
  }

Let me know what you think?  Do I open a ticket for this?

Mike

--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deep lang.mixin

dylanks
That sounds like a reasonable patch... If you open a ticket and a PR I
can land that pretty quickly (we're aiming for updated point releases in
early March).

Regards,
-Dylan

on 2/21/17, 07:06 (GMT-07:00) Michael Schall said the following:

> Dylan -
>
> I got pulled onto another project so I haven't looked into pulling in
> the dojo2 modules.  We did find an issue with the dojo1
> request/util/deepCopy.  It does not seem to support Date objects.
>
> I have updated the plunker
> (http://plnkr.co/edit/ebYbu9nQ5m3rAbyQbMP1?p=preview
> <http://plnkr.co/edit/ebYbu9nQ5m3rAbyQbMP1?p=preview>) showing a date
> property in the object structure.  We have also found a fix and have
> included the patch below and in the plunker example:
>
> Index: request/util.js
> ===================================================================
> --- request/util.js(revision 5861)
> +++ request/util.js(working copy)
> @@ -14,7 +14,11 @@
>  sval = source[name];
>  if(tval !== sval){
>  if(tval && typeof tval === 'object' && sval && typeof sval === 'object'){
> -exports.deepCopy(tval, sval);
> +if(sval instanceof Date){
> +target[name] = new Date(sval);
> +}else{
> +exports.deepCopy(tval, sval);
> +}
>  }else{
>  target[name] = sval;
>  }
>
> Let me know what you think?  Do I open a ticket for this?
>
> Mike
>
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Co-Founder, Dojo Toolkit
CEO, SitePen, Inc.  http://www.sitepen.com/
Loading...