212
I Use This!
Very Low Activity

News

Analyzed about 21 hours ago. based on code collected about 22 hours ago.
Posted about 13 years ago by chris
isn't this more simple and functional? function sum (array) { return array.reduce(function (a, b) { return a + b; })} sum([1,2,3])
Posted about 13 years ago by Rafal
@pabrams: thanks. I've modified the function to make it more readable and got rid of most lint warnings. Updated code available on github (https://raw.github.com/kvz/phpjs/master/functions/var/empty.js)
Posted about 13 years ago by pabrams
Hi, for the first two js lint issues, try some carriage returns. Line #26 will also be much easier to read, especially if you format it nicely. Each new line after if (mixed_var === "" could start with a constant number of tabs and then || ... [More] mixed_var === . How 'bout that? Personally, I find code like line #26 to be inexcusable because it's a real pain to read, and very easy to avoid, if using a decent editor. [Less]
Posted about 13 years ago by Brett Zamir
@David: Thanks for the fix with the missing userdata argument. I changed it a bit to check for arguments.length (number of arguments passed), since otherwise, it won't allow explicit passing of "undefined" as an argument. I also added support for ... [More] closures and PHP-style object-function arrays, added an option to avoid eval (not on by default since eval() is more PHP-like in allowing calls to built-in functions), and provided support within array() for walk() as a chainable method. Changes are in Git (see "raw js source"). [Less]
Posted about 13 years ago by kneesspal
Posted about 13 years ago by David
Line 21 doesn't make any sense, you are only passing userdata to the function, and userdata is undefined. Line 21 should be: eval(funcname + '(array[key] , key)');
Posted about 13 years ago by Mike
I found bug with count of parameters for this function. So if we set over than 2 arguments - function returns empty object. You can test own example with colors on this page.
Posted about 13 years ago by Guergenug
Posted about 13 years ago by Brett Zamir
@Click Button Publishing: Glad to hear it is working for you! (I'm trying to help catch up on old messages one-by-one.)
Posted about 13 years ago by Brett Zamir
@Kaushik: Glad to hear it is helpful--thanks for the feedback!