On Feb 13, 2:50 pm, Michael Geary m...@mg.to wrote:
On Sun, Feb 13, 2011 at 5:18 AM, The Desk Wide Web w...@deskwide.net wrote:
Thanks for the response. You'd think not, but in my case, if I did not
store copies of the strings, I could not delete the object properties.
Could possibly
Michael - cognitive dissonance - actually a plus for Node given that
a lot of web development is in JavaScript already so client/server
side use the same language.
I do not think migration of existing apps is going to be a win
unless there is a benefit from async I/O and other node features -
Hi all
,
What are the groups thoughts on safely accessing a nested objects
value that may be undefined? I recently came across a blog post [1]
from Oliver Steele where he did a shortcut that looks like this:
var person = {address: {zip: 1234}},
person2 = {};
console.log(Person2
Thanks (to you and to Andre).
Ivan
On Tuesday, February 15, 2011 10:12:06 AM UTC+1, Peter van der Zee wrote:
On Tue, Feb 15, 2011 at 9:53 AM, Ivan S ivan@gmail.com wrote:
Hi all.
I don't know ECMA script specification so well, so if someone can explain
what's the difference
On Tue, Feb 15, 2011 at 10:17 AM, Ivan S ivan.sku...@gmail.com wrote:
Let's say we have this example:
(There's no need for the html cruft..)
function testPassByRef() {
var obj = {};
(function(passed_obj) {
passed_obj = {prop : 'test'}
Ha awesome. Took me a minute to get it and now I quite like it.
However some kind of intellisense is usually at hand to save repeatedly
writing out the parent objects.
On 15 Feb 2011 09:16, Sam Merrell merrell@gmail.com wrote:
Hi all
,
What are the groups thoughts on safely accessing a
((person2||{}).address||{}).zip || no zip);
Actually this takes the place of code like this:
(person2 person2.address person2.address.zip) ? person2.address.zip :
no zip;
You can also use an if statement if you want.
Does the code lose readability when done with that sort of shorthand?
On Tue, Feb 15, 2011 at 12:08 PM, Adrian Olaru agol...@gmail.com wrote:
((person2||{}).address||{}).zip || no zip);
I find it harder to determine what's actually going on. But maybe it just
takes a little time getting used to. Clearly not the way to go for apps
where speed is important, but I
On Tue, Feb 15, 2011 at 12:02 AM, Sam Merrell merrell@gmail.com wrote:
Hi all
,
What are the groups thoughts on safely accessing a nested objects
value that may be undefined? I recently came across a blog post [1]
from Oliver Steele where he did a shortcut that looks like this:
var
On Tue, Feb 15, 2011 at 1:59 PM, Diego Perini diego.per...@gmail.comwrote:
I believe this is almost equivalent:
try { a = person2.address.zip; } catch(err) { a = 'no zip'; }
Oh, actually I like that. Maybe even better unless you do it a lot.
- peter
--
To view archived discussions from
Asen Bozhilov wrote:
Scott Sauyet:
I'm looking for a critique of an API. I built this some months ago,
and might need it again, and would love to have other eyes on it.
On a recent project I found myself in need of some configuration data
that could be easily changed, data in which one
On Tue, Feb 15, 2011 at 3:04 PM, Dmitry Pashkevich dip...@mail.ru wrote:
I am not very savvy in using exceptions... Are there any pitfalls with
their use in such case?
There's a small performance hit (which may vary across engines). And
possibly some odd collisions with the exception variable
Sam Merrell:
What are the groups thoughts on safely accessing a nested objects
value that may be undefined?
Firstly you should answer on the question, are you going to create
objects which properties value may be undefined?
I recently came across a blog post [1]
from Oliver Steele where he
Scott Sauyet:
Not at all. Have you done any performance tests?
I haven't yet. I am planning to test against built-in JSON.parse and
various Crockford's implementation.
I have made front-end for this code:
URL:http://asenbozhilov.com/json.html
You can use it as a validator of your JSON
On Tue, Feb 15, 2011 at 3:18 PM, Angus Croll anguscr...@gmail.com wrote:
Hi Dmitry
Oliver Steele's version is cute - but maybe too cute for production
code (not so readable)
I would probably do this;
person2 person2.address (person2.address.zip || 'no zip');
(the 'if' just adds visual
On Tue, Feb 15, 2011 at 3:41 PM, Asen Bozhilov asen.bozhi...@gmail.com wrote:
Scott Sauyet:
Not at all. Have you done any performance tests?
I haven't yet. I am planning to test against built-in JSON.parse and
various Crockford's implementation.
I have made front-end for this code:
It is quite possible to develop client/server applications without
writing a single line of JavaScript. irt Async I/O, due to the
syntactical limitations of JavaScript this can be very unwieldy, and
admittedly its splitting hairs but not all I/O is asynchronous (Date,
Math.random, etc...) so its a
On Tue, Feb 15, 2011 at 8:22 AM, Scott Sauyet scott.sau...@gmail.comwrote:
Asen Bozhilov wrote:
[...]
It seems API is enough useful and convenient, I am
interested in the opinion of the others members, too.
Only one issue with:
merge = function(base, ext) {
//...
};
I
Looks like a code smell of bad design. If you have a Person object it
would be unnecessary to do member sniffing tests and literal
injections like this.
So instead of this:
var person = {address: {zip: 1234}},
person2 = {};
console.log(Person2 undefined: +
Diego Perini:
I have one question, without having gone through reading the specs.
Would it be useful, and still spec compliant, to detect an Invalid
leading comma too as an error instead of a Invalid property name ?
You already detect the Invalid trailing comma and the passed objects
could
Michael, If you've gone that far why not just have Person have a
getZip() method to encapsulate the null checking?
On Feb 15, 7:37 am, Michael Haufe (TNO) t...@thenewobjective.com
wrote:
Looks like a code smell of bad design. If you have a Person object it
would be unnecessary to do member
On 15 February 2011 09:12, Peter van der Zee jsment...@qfox.nl wrote:
On Tue, Feb 15, 2011 at 9:53 AM, Ivan S ivan.sku...@gmail.com wrote:
As for the given example, there is absolutely no difference, a function is
created first and executed right after doing so. There are no observable
On Feb 14, 5:02 pm, Sam Merrell merrell@gmail.com wrote:
What are the groups thoughts on safely accessing a nested objects
value that may be undefined?
[snip]
Does the code lose readability when done with that sort of shorthand?
Also, is there the possibility of a performance hit for
Juriy Zaytsev wrote:
Scott Sauyet wrote:
Asen Bozhilov wrote:
I don't know which engines are target of your code, but older JScript
versions has trouble with enumeration of user defined properties which
are same as bult-in properties of `Object.prototype'.
See the blog post of Garret:
It could be a getter/setter. You are also assuming that a null will
exist in the first place which it may well not. It also isn't clear
what you're implying by If you've gone that far
On Feb 15, 10:12 am, Angus Croll anguscr...@gmail.com wrote:
Michael, If you've gone that far why not just have
On Feb 15, 7:12 pm, Peter van der Zee jsment...@qfox.nl wrote:
On Tue, Feb 15, 2011 at 9:53 AM, Ivan S ivan.sku...@gmail.com wrote:
Hi all.
I don't know ECMA script specification so well, so if someone can explain
what's the difference between this two:
(function() {
}());
26 matches
Mail list logo