- /**
- * Extend an Object with another Object's properties.
- *
- * The source objects are specified as additional arguments.
- *
- * @param dst Object the object to extend.
- *
- * @return Object the final object.
- */
- var _extend = function(dst) {
- var sources = Array.prototype.slice.call(arguments, 1);
- for (var i=0; i<sources.length; ++i) {
- var src = sources[i];
- for (var p in src) {
- if (src.hasOwnProperty(p)) dst[p] = src[p];
- }
- }
- return dst;
- };
-
-
- /**
- * Defer execution of given function.
- * @param {Function} func
- */
- var _defer = function(func) {
- if (typeof setImmediate === 'function') {
- return setImmediate(func);
- } else {
- return setTimeout(func, 0);
- }
- };
+ var collator;
+ try {
+ collator = (typeof Intl !== "undefined" && typeof Intl.Collator !== "undefined") ? Intl.Collator("generic", { sensitivity: "base" }) : null;
+ } catch (err){
+ console.log("Collator could not be initialized and wouldn't be used");
+ }
+ // arrays to re-use
+ var prevRow = [],
+ str2Char = [];