ah this. well it's ok, that underscore does not match native API. underscore is not a shim, it uses nativ implementations under the hood, if any present. this is ok. it uses it's own api and not implement the standard. anyway, underscore IS one solution, may be a better in some cases, for a bunch of tasks. even if its to big to include, one still could copy some implementations for own use.
Am Samstag, 29. Dezember 2012 00:04:36 UTC+1 schrieb Rick Waldron: > > > > On Friday, December 28, 2012, greelgorke wrote: > >> well, yes, you are right at this point. Mark said, he uses much of typeof >> and sometimes instanceof for Array detection. So, his use case may be a >> good one for underscore. but if you just want this one single function, it >> is an overkill, but even then it's worth to look at its code and just take >> the picks you need, and use them. it's MIT >> >> > Furthermore, underscore has a nasty history of not correctly matching >> native implementations >> is this a claim like: "don't use it, because it had bugs earlier"? huh? >> > > No, because they still exist. Natives have sparse array handling, > underscore does not. indexOf has some made up third param that isn't > fromIndex. > > Anything else? > > Rick > > > > >> Am Freitag, 28. Dezember 2012 23:03:27 UTC+1 schrieb Rick Waldron: >> >> >> >> On Friday, December 28, 2012, greelgorke wrote: >> >> look further, there is more than just isArray. AND underscore falls back >> to native implementations, if any present. and it's just it: same interface >> for every plattform. >> >> >> Yes, I'm very aware of underscore, thank you. I don't believe in adding a >> full on library for the sake of using a single function that language >> already offers natively. Furthermore, underscore has a nasty history of not >> correctly matching native implementations, so lucky you: same API, >> different behaviour. >> >> The only platforms that don't support Array.isArray are old IEs. >> >> >> Rick >> >> >> >> Am Freitag, 28. Dezember 2012 22:31:28 UTC+1 schrieb Rick Waldron: >> >> >> >> On Friday, December 28, 2012, greelgorke wrote: >> >> psst.. i heard underscore have some cool tools for the typeof pain, like >> http://underscorejs.org/#****isArray <http://underscorejs.org/#isArray> >> >> >> *facepalm* >> >> Really? On a platform that supports Array.isArray built-in? >> >> Rick >> >> >> >> Am Donnerstag, 27. Dezember 2012 22:32:03 UTC+1 schrieb Mark Hahn: >> >> > what sort of program scenarios you've found yourself in where >> instanceof was the "go to" solution >> >> I use typeof a lot, but instanceof not so often. I sometimes use >> instanceof Array when I don't have a helper around for that. >> >> I've just started a module for use in node and the client that "fixes" >> these as much as possible. It is annoying when I get an error just >> because of lack of camelCasing. My mind isn't good at remembering >> minor things. >> >> Does anyone know how I could fix typeof in node? I can see how to do >> it in the client. Luckily I'm using coffeescript so making typeOf a >> function will be used like `typeOf x` and it will look the same as >> typeof `x`. >> >> > Completely irrelevant to the discussion... >> >> What is irrelevant? >> >> On Thu, Dec 27, 2012 at 1:06 PM, Rick Waldron <[email protected]> >> wrote: >> > Inline... >> > >> > >> > On Thursday, December 27, 2012, Mark Hahn wrote: >> >> >> >> Why not also allow readDir? It would cause no harm to do so. >> >> >> >> This isn't node, but what also bugs me is typeof and instanceof. I >> >> cringe every time I type them. >> > >> > >> > Completely irrelevant to the discussion... but you have my attention >> now—I'm >> > curious to know what sort of program scenarios you've found yourself in >> > where instanceof was the "go to" solution (but painful to use?), aside >> from >> > useful type checking (types as in "object types", not as in >> "data-types"). >> > If you want to know if x has Foo constructor in its prototype chain, >> > instanceof has you covered. >> > >> > Rick >> > >> > >> >> >> >> >> >> >> >> On Thu, Dec 27, 2012 at 11:47 AM, David Habereder >> >> <[email protected]> wrote: >> >> > That clears that up. Thanks. >> >> > >> >> > Am Donnerstag, 27. Dezember 2012 20:36:30 UTC+1 schrieb Matt >> Sergeant: >> >> >> >> >> >> I think you'll likely find where it isn't the case (such as >> readdir) >> >> >> the >> >> >> name comes from the POSIX function name. There's no readfile >> function >> >> >> in >> >> >> POSIX, but there is readdir(). The only other case seems to be >> >> >> readlink, >> >> >> which is the same issue. >> >> >> >> >> >> http://linux.die.net/man/2/**rea****ddir<http://linux.die.net/man/2/readdir> >> >> >> >> >> >> http://linux.die.net/man/2/**rea****dlink<http://linux.die.net/man/2/readlink> >> >> >> >> >> >> >> >> >> >> >> >> On Thu, Dec 27, 2012 at 1:02 PM, David Habereder < >> [email protected]> >> >> >> wrote: >> >> >>> >> >> >> >> >> -- >> 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 >> > -- 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
