Re: [JSMentors] Parameters vs. Objects as Parameters

2011-06-20 Thread Sidney San Martín
Not exactly. You'd replace `foo` with the `argment()`ed version, and then this: foo({ a: 'one', c: 'three' }); become equivalent to calling the original like this: foo('one', undefined, 'three'); It's just a wrapper to make writing functions which take options easier. So instead of writ

Re: [JSMentors] Parameters vs. Objects as Parameters

2011-06-19 Thread Sidney San Martín
This question — how to make using an arguments hash for some or all of your arguments fun — has been bugging me for a while. So I just started a tiny new library called argment: . Check it out! For the moment, it’s nine lines and does only the simplest c

Re: [JSMentors] Parameters vs. Objects as Parameters

2011-06-16 Thread RobG
Matthew Bramer wrote: > Thanks guys for the feedback and that article has a bunch of #Awesomesauce > in it. > > If memory considerations are minimal, then I'll just have to use that post > as guidance. Anyone have any more insight on the difference in memory > usage? I'm pressing that issue b/c

Re: [JSMentors] Parameters vs. Objects as Parameters

2011-06-16 Thread Matthew Bramer
Thanks guys for the feedback and that article has a bunch of #Awesomesauce in it. If memory considerations are minimal, then I'll just have to use that post as guidance. Anyone have any more insight on the difference in memory usage? I'm pressing that issue b/c we have to code for bare minima

Re: [JSMentors] Parameters vs. Objects as Parameters

2011-06-16 Thread Jason Persampieri
Disregarding the original question of memory considerations (because it's obviously where this conversation is going to go)... Rebecca Murphy did a nice round up of parameter vs option object options. http://blog.rebeccamurphey.com/objects-as-arguments-in-javascript-where-do-y The general consen

Re: [JSMentors] Parameters vs. Objects as Parameters

2011-06-16 Thread Amit Kumar
Personally, I prefer the single object parameter approach. Like you say, it's much more maintainable; if you ever add or remove parameters, none of your client code needs to be changed. You also avoid having to remember parameter order when calling a method. -Amit On Thu, Jun 16, 2011 at 6:09 PM,

Re: [JSMentors] Parameters vs. Objects as Parameters

2011-06-16 Thread Anton Kovalyov
I really don't think that there is a big memory overhead with one approach or another (correct me if I am wrong). I personally prefer using formal parameters for functions with one or two parameters total and objects for functions with more complicated set of arguments. Especially when you are d