8

Apparently I have lost all my google skills. I can not find any good results for javascript libraries that attempt to cross-browser standardize javascript and provide small enhancements.

I AM NOT looking for a full framework like jQuery, Prototype, etc... even though they do this type of thing on some level. I'm talking about language/available function standardization only, no DOM stuff. Just a good cross browser library that ensures availability of all the standard stuff (array map, reduce, etc..), support for stuff like Date.toISOString() in IE 6/7/8, etc... I already know about ie7.js, ie8.js and ie9.js, but they don't exactly fit the bill.

So what else is out there?

UPDATE Just to be clear, here is the type of thing said library would do (all crossbrowser, with native fallbacks obviously):

  • Date.toISOstring support
  • Array.map, Array.each, Array.filter, Array.reduce support
  • Shallow/Deep object cloning
  • etc...
9
  • 1
    Good question. I guess nobody really ever bothers with that sort of library since we have jQuery.
    – Adam
    Jul 15, 2011 at 2:35
  • 1
    I'd guess you have to say why doesn't jQuery meet your needs so we could have a better idea of what you're looking for that's different than jQuery.
    – jfriend00
    Jul 15, 2011 at 2:39
  • Im kinda starting to think there isnt anything really good out there. To be honest I asked the question cause im thinking about taking it on as a project.
    – jdc0589
    Jul 15, 2011 at 2:40
  • Don't reinvent the wheel on this one. If someone is going to spend the time to learn a cross-browser library, they are going to want one that also has the ability to be more fully-functional, such as jQuery. Jul 15, 2011 at 2:41
  • 1
    Then, I'd suggest you add to your question a list of what you're looking for beyond the three you've mentioned and maybe you'll be more likely to get responses that match what you're looking for.
    – jfriend00
    Jul 15, 2011 at 2:52

4 Answers 4

11

I find UnderscoreJS very useful for looping/sorting/querying, array manipulation, map/reduce etc:

It doesn't have date time related functions. For datetime parsing, there is dateJS

3
  • Should have remembered underscore, ive seen its name showing up more lately. Out of curiosity, why do all these libraries seem to stay away from just modifying the prototype chain. They never come out and say it, but the impression is that they think its a bad thing.
    – jdc0589
    Jul 15, 2011 at 3:04
  • 2
    Yes. Modifying the prototypical chain is not a good idea especailly if you're a library. You never know what else could be used on the page and you certyainly don't want to override something accidentally.
    – Mrchief
    Jul 15, 2011 at 3:26
  • What prototypejs dared to do was decorate various Object, but thr cud some hard line issues when the developer isn't aware of certain outliers. UnderscoreJS is surely the way to go to provide all basic utilities we want apart from DOM Manipulations. jQuery core is not that heavy if only used for DOM manipulation.
    – a6hi5h3k
    Jul 15, 2011 at 4:34
5

If you're only looking for JS constructs without any DOM bloat, you may be interested in the ES5 shim: https://github.com/kriskowal/es5-shim

It ensures most ES5 features to a reasonable degree.

2
  • Thanks, forgot about that one. Definitely on the right track.
    – jdc0589
    Jul 15, 2011 at 2:58
  • It looks like code.google.com/p/ddr-ecma5 is more thoroughly tested to ensure compatibility, but does basically the same thing.
    – LeBleu
    Mar 13, 2012 at 22:38
4

Array extensions (LastElement, InsertAt, InsertRange, Remove, RemoveAt, RemoveRange, Clear, Contains, Equals, Copy, Append, Merge, Search, Filter): http://programmingsolution.net/post/JavaScript-Array-Extension.aspx

Array extensions: (copy, forEach, find, findAll, contains, distinct, min, max, first, last, sortAscending, sortDescending, randomize, count, except, intersect, average, sum, union, safePush, getRandom, insertAt, remove): http://www.thegrubbsian.com/2009/01/25/useful-javascript-extensions

Date object extensions - datejs.js: (today, compare, between, compareTo, equals, isAFter, isBefore, isLeapYear, parse, parseExact, validateDay, validateHour, validateMonth, validateMinute, validateSecond, validateYear, add, addSeconds, addMinutes, addHours, addDays, addYears, addWeeks, addMonths, clone, getWeek, getISOWeek, setWeek, toISOString): http://code.google.com/p/datejs/wiki/APIDocumentation

copy, deepCopy, clone - http://oranlooney.com/deep-copy-javascript/

1
  • 1
    You should just be using UnderscoreJS...it's much better than any of the options out there, doesn't mess with native objects, and its source code is easy to read and extend.
    – JC Grubbs
    Mar 18, 2012 at 18:53
0

You can try PassJS, an arising JS library.

Not the answer you're looking for? Browse other questions tagged or ask your own question.