You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by bi...@apache.org on 2014/05/09 09:22:19 UTC

[10/24] a) Convert all the DataJS supported functionality from V3 to V4. 1. Remove all the Json verbose logic, make the DataJS accepted and returned javascript object be in Json light format. (Since Json verbose has been completely removed on V4, making

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/e387fc92/JSLib/src/store-memory.js
----------------------------------------------------------------------
diff --git a/JSLib/src/store-memory.js b/JSLib/src/store-memory.js
index 4f35090..3b162f1 100644
--- a/JSLib/src/store-memory.js
+++ b/JSLib/src/store-memory.js
@@ -1,231 +1,231 @@
-// Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
-// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 
-// files (the "Software"), to deal  in the Software without restriction, including without limitation the rights  to use, copy,
-// modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the 
-// Software is furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-// WARRANTIES OF MERCHANTABILITY,  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
-// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-// store-memory.js 
-
-(function (window, undefined) {
-
-    var datajs = window.datajs || {};
-
-    // Imports.
-    var throwErrorCallback = datajs.throwErrorCallback;
-    var delay = datajs.delay;
-
-    // CONTENT START
-
-    var MemoryStore = function (name) {
-        /// <summary>Constructor for store objects that use a sorted array as the underlying mechanism.</summary>
-        /// <param name="name" type="String">Store name.</param>
-
-        var holes = [];
-        var items = [];
-        var keys = {};
-
-        this.name = name;
-
-        var getErrorCallback = function (error) {
-            return error || this.defaultError;
-        };
-
-        var validateKeyInput = function (key, error) {
-            /// <summary>Validates that the specified key is not undefined, not null, and not an array</summary>
-            /// <param name="key">Key value.</param>
-            /// <param name="error" type="Function">Error callback.</param>
-            /// <returns type="Boolean">True if the key is valid. False if the key is invalid and the error callback has been queued for execution.</returns>
-
-            var messageString;
-
-            if (key instanceof Array) {
-                messageString = "Array of keys not supported";
-            }
-
-            if (key === undefined || key === null) {
-                messageString = "Invalid key";
-            }
-
-            if (messageString) {
-                delay(error, { message: messageString });
-                return false;
-            }
-            return true;
-        };
-
-        this.add = function (key, value, success, error) {
-            /// <summary>Adds a new value identified by a key to the store.</summary>
-            /// <param name="key" type="String">Key string.</param>
-            /// <param name="value">Value that is going to be added to the store.</param>
-            /// <param name="success" type="Function" optional="no">Callback for a successful add operation.</param>
-            /// <param name="error" type="Function" optional="yes">Callback for handling errors. If not specified then store.defaultError is invoked.</param>
-            /// <remarks>
-            ///    This method errors out if the store already contains the specified key.
-            /// </remarks>
-
-            error = getErrorCallback(error);
-
-            if (validateKeyInput(key, error)) {
-                if (!keys.hasOwnProperty(key)) {
-                    this.addOrUpdate(key, value, success, error);
-                } else {
-                    error({ message: "key already exists", key: key });
-                }
-            }
-        };
-
-        this.addOrUpdate = function (key, value, success, error) {
-            /// <summary>Adds or updates a value identified by a key to the store.</summary>
-            /// <param name="key" type="String">Key string.</param>
-            /// <param name="value">Value that is going to be added or updated to the store.</param>
-            /// <param name="success" type="Function" optional="no">Callback for a successful add or update operation.</param>
-            /// <param name="error" type="Function" optional="yes">Callback for handling errors. If not specified then store.defaultError is invoked.</param>
-            /// <remarks>
-            ///   This method will overwrite the key's current value if it already exists in the store; otherwise it simply adds the new key and value.
-            /// </remarks>
-
-            error = getErrorCallback(error);
-
-            if (validateKeyInput(key, error)) {
-                var index = keys[key];
-                if (index === undefined) {
-                    if (holes.length > 0) {
-                        index = holes.splice(0, 1);
-                    } else {
-                        index = items.length;
-                    }
-                }
-                items[index] = value;
-                keys[key] = index;
-                delay(success, key, value);
-            }
-        };
-
-        this.clear = function (success) {
-            /// <summary>Removes all the data associated with this store object.</summary>
-            /// <param name="success" type="Function" optional="no">Callback for a successful clear operation.</param>
-
-            items = [];
-            keys = {};
-            holes = [];
-
-            delay(success);
-        };
-
-        this.contains = function (key, success) {
-            /// <summary>Checks whether a key exists in the store.</summary>
-            /// <param name="key" type="String">Key string.</param>
-            /// <param name="success" type="Function" optional="no">Callback indicating whether the store contains the key or not.</param>
-
-            var contained = keys.hasOwnProperty(key);
-            delay(success, contained);
-        };
-
-        this.getAllKeys = function (success) {
-            /// <summary>Gets all the keys that exist in the store.</summary>
-            /// <param name="success" type="Function" optional="no">Callback for a successful get operation.</param>
-
-            var results = [];
-            for (var name in keys) {
-                results.push(name);
-            }
-            delay(success, results);
-        };
-
-        this.read = function (key, success, error) {
-            /// <summary>Reads the value associated to a key in the store.</summary>
-            /// <param name="key" type="String">Key string.</param>
-            /// <param name="success" type="Function" optional="no">Callback for a successful reads operation.</param>
-            /// <param name="error" type="Function" optional="yes">Callback for handling errors. If not specified then store.defaultError is invoked.</param>
-            error = getErrorCallback(error);
-
-            if (validateKeyInput(key, error)) {
-                var index = keys[key];
-                delay(success, key, items[index]);
-            }
-        };
-
-        this.remove = function (key, success, error) {
-            /// <summary>Removes a key and its value from the store.</summary>
-            /// <param name="key" type="String">Key string.</param>
-            /// <param name="success" type="Function" optional="no">Callback for a successful remove operation.</param>
-            /// <param name="error" type="Function" optional="yes">Callback for handling errors. If not specified then store.defaultError is invoked.</param>
-            error = getErrorCallback(error);
-
-            if (validateKeyInput(key, error)) {
-                var index = keys[key];
-                if (index !== undefined) {
-                    if (index === items.length - 1) {
-                        items.pop();
-                    } else {
-                        items[index] = undefined;
-                        holes.push(index);
-                    }
-                    delete keys[key];
-
-                    // The last item was removed, no need to keep track of any holes in the array.
-                    if (items.length === 0) {
-                        holes = [];
-                    }
-                }
-
-                delay(success);
-            }
-        };
-
-        this.update = function (key, value, success, error) {
-            /// <summary>Updates the value associated to a key in the store.</summary>
-            /// <param name="key" type="String">Key string.</param>
-            /// <param name="value">New value.</param>
-            /// <param name="success" type="Function" optional="no">Callback for a successful update operation.</param>
-            /// <param name="error" type="Function" optional="yes">Callback for handling errors. If not specified then store.defaultError is invoked.</param>
-            /// <remarks>
-            ///    This method errors out if the specified key is not found in the store.
-            /// </remarks>
-
-            error = getErrorCallback(error);
-            if (validateKeyInput(key, error)) {
-                if (keys.hasOwnProperty(key)) {
-                    this.addOrUpdate(key, value, success, error);
-                } else {
-                    error({ message: "key not found", key: key });
-                }
-            }
-        };
-    };
-
-    MemoryStore.create = function (name) {
-        /// <summary>Creates a store object that uses memory storage as its underlying mechanism.</summary>
-        /// <param name="name" type="String">Store name.</param>
-        /// <returns type="Object">Store object.</returns>
-        return new MemoryStore(name);
-    };
-
-    MemoryStore.isSupported = function () {
-        /// <summary>Checks whether the underlying mechanism for this kind of store objects is supported by the browser.</summary>
-        /// <returns type="Boolean">True if the mechanism is supported by the browser; otherwise false.</returns>
-        return true;
-    };
-
-    MemoryStore.prototype.close = function () {
-        /// <summary>This function does nothing in MemoryStore as it does not have a connection model.</summary>
-    };
-
-    MemoryStore.prototype.defaultError = throwErrorCallback;
-
-    /// <summary>Identifies the underlying mechanism used by the store.</summary>
-    MemoryStore.prototype.mechanism = "memory";
-
-    // DATAJS INTERNAL START
-    datajs.MemoryStore = MemoryStore;
-    // DATAJS INTERNAL END
-
-    // CONTENT END
+// Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 
+// files (the "Software"), to deal  in the Software without restriction, including without limitation the rights  to use, copy,
+// modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the 
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+// WARRANTIES OF MERCHANTABILITY,  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
+// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+// store-memory.js 
+
+(function (window, undefined) {
+
+    var datajs = window.datajs || {};
+
+    // Imports.
+    var throwErrorCallback = datajs.throwErrorCallback;
+    var delay = datajs.delay;
+
+    // CONTENT START
+
+    var MemoryStore = function (name) {
+        /// <summary>Constructor for store objects that use a sorted array as the underlying mechanism.</summary>
+        /// <param name="name" type="String">Store name.</param>
+
+        var holes = [];
+        var items = [];
+        var keys = {};
+
+        this.name = name;
+
+        var getErrorCallback = function (error) {
+            return error || this.defaultError;
+        };
+
+        var validateKeyInput = function (key, error) {
+            /// <summary>Validates that the specified key is not undefined, not null, and not an array</summary>
+            /// <param name="key">Key value.</param>
+            /// <param name="error" type="Function">Error callback.</param>
+            /// <returns type="Boolean">True if the key is valid. False if the key is invalid and the error callback has been queued for execution.</returns>
+
+            var messageString;
+
+            if (key instanceof Array) {
+                messageString = "Array of keys not supported";
+            }
+
+            if (key === undefined || key === null) {
+                messageString = "Invalid key";
+            }
+
+            if (messageString) {
+                delay(error, { message: messageString });
+                return false;
+            }
+            return true;
+        };
+
+        this.add = function (key, value, success, error) {
+            /// <summary>Adds a new value identified by a key to the store.</summary>
+            /// <param name="key" type="String">Key string.</param>
+            /// <param name="value">Value that is going to be added to the store.</param>
+            /// <param name="success" type="Function" optional="no">Callback for a successful add operation.</param>
+            /// <param name="error" type="Function" optional="yes">Callback for handling errors. If not specified then store.defaultError is invoked.</param>
+            /// <remarks>
+            ///    This method errors out if the store already contains the specified key.
+            /// </remarks>
+
+            error = getErrorCallback(error);
+
+            if (validateKeyInput(key, error)) {
+                if (!keys.hasOwnProperty(key)) {
+                    this.addOrUpdate(key, value, success, error);
+                } else {
+                    error({ message: "key already exists", key: key });
+                }
+            }
+        };
+
+        this.addOrUpdate = function (key, value, success, error) {
+            /// <summary>Adds or updates a value identified by a key to the store.</summary>
+            /// <param name="key" type="String">Key string.</param>
+            /// <param name="value">Value that is going to be added or updated to the store.</param>
+            /// <param name="success" type="Function" optional="no">Callback for a successful add or update operation.</param>
+            /// <param name="error" type="Function" optional="yes">Callback for handling errors. If not specified then store.defaultError is invoked.</param>
+            /// <remarks>
+            ///   This method will overwrite the key's current value if it already exists in the store; otherwise it simply adds the new key and value.
+            /// </remarks>
+
+            error = getErrorCallback(error);
+
+            if (validateKeyInput(key, error)) {
+                var index = keys[key];
+                if (index === undefined) {
+                    if (holes.length > 0) {
+                        index = holes.splice(0, 1);
+                    } else {
+                        index = items.length;
+                    }
+                }
+                items[index] = value;
+                keys[key] = index;
+                delay(success, key, value);
+            }
+        };
+
+        this.clear = function (success) {
+            /// <summary>Removes all the data associated with this store object.</summary>
+            /// <param name="success" type="Function" optional="no">Callback for a successful clear operation.</param>
+
+            items = [];
+            keys = {};
+            holes = [];
+
+            delay(success);
+        };
+
+        this.contains = function (key, success) {
+            /// <summary>Checks whether a key exists in the store.</summary>
+            /// <param name="key" type="String">Key string.</param>
+            /// <param name="success" type="Function" optional="no">Callback indicating whether the store contains the key or not.</param>
+
+            var contained = keys.hasOwnProperty(key);
+            delay(success, contained);
+        };
+
+        this.getAllKeys = function (success) {
+            /// <summary>Gets all the keys that exist in the store.</summary>
+            /// <param name="success" type="Function" optional="no">Callback for a successful get operation.</param>
+
+            var results = [];
+            for (var name in keys) {
+                results.push(name);
+            }
+            delay(success, results);
+        };
+
+        this.read = function (key, success, error) {
+            /// <summary>Reads the value associated to a key in the store.</summary>
+            /// <param name="key" type="String">Key string.</param>
+            /// <param name="success" type="Function" optional="no">Callback for a successful reads operation.</param>
+            /// <param name="error" type="Function" optional="yes">Callback for handling errors. If not specified then store.defaultError is invoked.</param>
+            error = getErrorCallback(error);
+
+            if (validateKeyInput(key, error)) {
+                var index = keys[key];
+                delay(success, key, items[index]);
+            }
+        };
+
+        this.remove = function (key, success, error) {
+            /// <summary>Removes a key and its value from the store.</summary>
+            /// <param name="key" type="String">Key string.</param>
+            /// <param name="success" type="Function" optional="no">Callback for a successful remove operation.</param>
+            /// <param name="error" type="Function" optional="yes">Callback for handling errors. If not specified then store.defaultError is invoked.</param>
+            error = getErrorCallback(error);
+
+            if (validateKeyInput(key, error)) {
+                var index = keys[key];
+                if (index !== undefined) {
+                    if (index === items.length - 1) {
+                        items.pop();
+                    } else {
+                        items[index] = undefined;
+                        holes.push(index);
+                    }
+                    delete keys[key];
+
+                    // The last item was removed, no need to keep track of any holes in the array.
+                    if (items.length === 0) {
+                        holes = [];
+                    }
+                }
+
+                delay(success);
+            }
+        };
+
+        this.update = function (key, value, success, error) {
+            /// <summary>Updates the value associated to a key in the store.</summary>
+            /// <param name="key" type="String">Key string.</param>
+            /// <param name="value">New value.</param>
+            /// <param name="success" type="Function" optional="no">Callback for a successful update operation.</param>
+            /// <param name="error" type="Function" optional="yes">Callback for handling errors. If not specified then store.defaultError is invoked.</param>
+            /// <remarks>
+            ///    This method errors out if the specified key is not found in the store.
+            /// </remarks>
+
+            error = getErrorCallback(error);
+            if (validateKeyInput(key, error)) {
+                if (keys.hasOwnProperty(key)) {
+                    this.addOrUpdate(key, value, success, error);
+                } else {
+                    error({ message: "key not found", key: key });
+                }
+            }
+        };
+    };
+
+    MemoryStore.create = function (name) {
+        /// <summary>Creates a store object that uses memory storage as its underlying mechanism.</summary>
+        /// <param name="name" type="String">Store name.</param>
+        /// <returns type="Object">Store object.</returns>
+        return new MemoryStore(name);
+    };
+
+    MemoryStore.isSupported = function () {
+        /// <summary>Checks whether the underlying mechanism for this kind of store objects is supported by the browser.</summary>
+        /// <returns type="Boolean">True if the mechanism is supported by the browser; otherwise false.</returns>
+        return true;
+    };
+
+    MemoryStore.prototype.close = function () {
+        /// <summary>This function does nothing in MemoryStore as it does not have a connection model.</summary>
+    };
+
+    MemoryStore.prototype.defaultError = throwErrorCallback;
+
+    /// <summary>Identifies the underlying mechanism used by the store.</summary>
+    MemoryStore.prototype.mechanism = "memory";
+
+    // DATAJS INTERNAL START
+    datajs.MemoryStore = MemoryStore;
+    // DATAJS INTERNAL END
+
+    // CONTENT END
 })(this);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/e387fc92/JSLib/src/store.js
----------------------------------------------------------------------
diff --git a/JSLib/src/store.js b/JSLib/src/store.js
index 688e88e..4f0edf5 100644
--- a/JSLib/src/store.js
+++ b/JSLib/src/store.js
@@ -1,61 +1,61 @@
-// Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
-// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 
-// files (the "Software"), to deal  in the Software without restriction, including without limitation the rights  to use, copy,
-// modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the 
-// Software is furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-// WARRANTIES OF MERCHANTABILITY,  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
-// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-// store.js 
-
-(function (window, undefined) {
-   
-    var datajs = window.datajs || {};
-
-    var DomStore = datajs.DomStore;
-    var IndexedDBStore = datajs.IndexedDBStore;
-    var MemoryStore = datajs.MemoryStore;
-
-    // CONTENT START
-
-    var mechanisms = {
-        indexeddb: IndexedDBStore,
-        dom: DomStore,
-        memory: MemoryStore
-    };
-
-    datajs.defaultStoreMechanism = "best";
-
-    datajs.createStore = function (name, mechanism) {
-        /// <summary>Creates a new store object.</summary>
-        /// <param name="name" type="String">Store name.</param>
-        /// <param name="mechanism" type="String" optional="true">A specific mechanism to use (defaults to best, can be "best", "dom", "indexeddb", "webdb").</param>
-        /// <returns type="Object">Store object.</returns>
-
-        if (!mechanism) {
-            mechanism = datajs.defaultStoreMechanism;
-        }
-
-        if (mechanism === "best") {
-            mechanism = (DomStore.isSupported()) ? "dom" : "memory";
-        }
-
-        var factory = mechanisms[mechanism];
-        if (factory) {
-            return factory.create(name);
-        }
-
-        throw { message: "Failed to create store", name: name, mechanism: mechanism };
-    };
-
-    // DATAJS INTERNAL START
-    datajs.mechanisms = mechanisms;
-    // DATAJS INTERNAL END
-
-    // CONTENT END
+// Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 
+// files (the "Software"), to deal  in the Software without restriction, including without limitation the rights  to use, copy,
+// modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the 
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+// WARRANTIES OF MERCHANTABILITY,  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
+// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+// store.js 
+
+(function (window, undefined) {
+   
+    var datajs = window.datajs || {};
+
+    var DomStore = datajs.DomStore;
+    var IndexedDBStore = datajs.IndexedDBStore;
+    var MemoryStore = datajs.MemoryStore;
+
+    // CONTENT START
+
+    var mechanisms = {
+        indexeddb: IndexedDBStore,
+        dom: DomStore,
+        memory: MemoryStore
+    };
+
+    datajs.defaultStoreMechanism = "best";
+
+    datajs.createStore = function (name, mechanism) {
+        /// <summary>Creates a new store object.</summary>
+        /// <param name="name" type="String">Store name.</param>
+        /// <param name="mechanism" type="String" optional="true">A specific mechanism to use (defaults to best, can be "best", "dom", "indexeddb", "webdb").</param>
+        /// <returns type="Object">Store object.</returns>
+
+        if (!mechanism) {
+            mechanism = datajs.defaultStoreMechanism;
+        }
+
+        if (mechanism === "best") {
+            mechanism = (DomStore.isSupported()) ? "dom" : "memory";
+        }
+
+        var factory = mechanisms[mechanism];
+        if (factory) {
+            return factory.create(name);
+        }
+
+        throw { message: "Failed to create store", name: name, mechanism: mechanism };
+    };
+
+    // DATAJS INTERNAL START
+    datajs.mechanisms = mechanisms;
+    // DATAJS INTERNAL END
+
+    // CONTENT END
 })(this);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/e387fc92/JSLib/src/utils.js
----------------------------------------------------------------------
diff --git a/JSLib/src/utils.js b/JSLib/src/utils.js
index 3dd3a49..dd567c7 100644
--- a/JSLib/src/utils.js
+++ b/JSLib/src/utils.js
@@ -1,490 +1,547 @@
-// Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
-// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 
-// files (the "Software"), to deal  in the Software without restriction, including without limitation the rights  to use, copy,
-// modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the 
-// Software is furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-// WARRANTIES OF MERCHANTABILITY,  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
-// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-// utils.js
-
-(function (window, undefined) {
-
-    var datajs = window.datajs || {};
-
-    // CONTENT START
-
-    var activeXObject = function (progId) {
-        /// <summary>Creates a new ActiveXObject from the given progId.</summary>
-        /// <param name="progId" type="String" mayBeNull="false" optional="false">
-        ///    ProgId string of the desired ActiveXObject.
-        /// </param>
-        /// <remarks>
-        ///    This function throws whatever exception might occur during the creation
-        ///    of the ActiveXObject.
-        /// </remarks>
-        /// <returns type="Object">
-        ///     The ActiveXObject instance. Null if ActiveX is not supported by the
-        ///     browser.
-        /// </returns>
-        if (window.ActiveXObject) {
-            return new window.ActiveXObject(progId);
-        }
-        return null;
-    };
-
-    var assigned = function (value) {
-        /// <summary>Checks whether the specified value is different from null and undefined.</summary>
-        /// <param name="value" mayBeNull="true" optional="true">Value to check.</param>
-        /// <returns type="Boolean">true if the value is assigned; false otherwise.</returns>
-        return value !== null && value !== undefined;
-    };
-
-    var contains = function (arr, item) {
-        /// <summary>Checks whether the specified item is in the array.</summary>
-        /// <param name="arr" type="Array" optional="false" mayBeNull="false">Array to check in.</param>
-        /// <param name="item">Item to look for.</param>
-        /// <returns type="Boolean">true if the item is contained, false otherwise.</returns>
-
-        var i, len;
-        for (i = 0, len = arr.length; i < len; i++) {
-            if (arr[i] === item) {
-                return true;
-            }
-        }
-
-        return false;
-    };
-
-    var defined = function (a, b) {
-        /// <summary>Given two values, picks the first one that is not undefined.</summary>
-        /// <param name="a">First value.</param>
-        /// <param name="b">Second value.</param>
-        /// <returns>a if it's a defined value; else b.</returns>
-        return (a !== undefined) ? a : b;
-    };
-
-    var delay = function (callback) {
-        /// <summary>Delays the invocation of the specified function until execution unwinds.</summary>
-        /// <param name="callback" type="Function">Callback function.</param>
-        if (arguments.length === 1) {
-            window.setTimeout(callback, 0);
-            return;
-        }
-
-        var args = Array.prototype.slice.call(arguments, 1);
-        window.setTimeout(function () {
-            callback.apply(this, args);
-        }, 0);
-    };
-
-    // DATAJS INTERNAL START
-    var djsassert = function (condition, message, data) {
-        /// <summary>Throws an exception in case that a condition evaluates to false.</summary>
-        /// <param name="condition" type="Boolean">Condition to evaluate.</param>
-        /// <param name="message" type="String">Message explaining the assertion.</param>
-        /// <param name="data" type="Object">Additional data to be included in the exception.</param>
-
-        if (!condition) {
-            throw { message: "Assert fired: " + message, data: data };
-        };
-    };
-    // DATAJS INTERNAL END
-
-    var extend = function (target, values) {
-        /// <summary>Extends the target with the specified values.</summary>
-        /// <param name="target" type="Object">Object to add properties to.</param>
-        /// <param name="values" type="Object">Object with properties to add into target.</param>
-        /// <returns type="Object">The target object.</returns>
-
-        for (var name in values) {
-            target[name] = values[name];
-        }
-
-        return target;
-    };
-
-    var find = function (arr, callback) {
-        /// <summary>Returns the first item in the array that makes the callback function true.</summary>
-        /// <param name="arr" type="Array" optional="false" mayBeNull="true">Array to check in.</param>
-        /// <param name="callback" type="Function">Callback function to invoke once per item in the array.</param>
-        /// <returns>The first item that makes the callback return true; null otherwise or if the array is null.</returns>
-
-        if (arr) {
-            var i, len;
-            for (i = 0, len = arr.length; i < len; i++) {
-                if (callback(arr[i])) {
-                    return arr[i];
-                }
-            }
-        }
-        return null;
-    };
-
-    var isArray = function (value) {
-        /// <summary>Checks whether the specified value is an array object.</summary>
-        /// <param name="value">Value to check.</param>
-        /// <returns type="Boolean">true if the value is an array object; false otherwise.</returns>
-
-        return Object.prototype.toString.call(value) === "[object Array]";
-    };
-
-    var isDate = function (value) {
-        /// <summary>Checks whether the specified value is a Date object.</summary>
-        /// <param name="value">Value to check.</param>
-        /// <returns type="Boolean">true if the value is a Date object; false otherwise.</returns>
-
-        return Object.prototype.toString.call(value) === "[object Date]";
-    };
-
-    var isObject = function (value) {
-        /// <summary>Tests whether a value is an object.</summary>
-        /// <param name="value">Value to test.</param>
-        /// <remarks>
-        ///     Per javascript rules, null and array values are objects and will cause this function to return true.
-        /// </remarks>
-        /// <returns type="Boolean">True is the value is an object; false otherwise.</returns>
-
-        return typeof value === "object";
-    };
-
-    var parseInt10 = function (value) {
-        /// <summary>Parses a value in base 10.</summary>
-        /// <param name="value" type="String">String value to parse.</param>
-        /// <returns type="Number">The parsed value, NaN if not a valid value.</returns>
-
-        return parseInt(value, 10);
-    };
-
-    var renameProperty = function (obj, oldName, newName) {
-        /// <summary>Renames a property in an object.</summary>
-        /// <param name="obj" type="Object">Object in which the property will be renamed.</param>
-        /// <param name="oldName" type="String">Name of the property that will be renamed.</param>
-        /// <param name="newName" type="String">New name of the property.</param>
-        /// <remarks>
-        ///    This function will not do anything if the object doesn't own a property with the specified old name.
-        /// </remarks>
-
-        if (obj.hasOwnProperty(oldName)) {
-            obj[newName] = obj[oldName];
-            delete obj[oldName];
-        }
-    };
-
-    var throwErrorCallback = function (error) {
-        /// <summary>Default error handler.</summary>
-        /// <param name="error" type="Object">Error to handle.</param>
-        throw error;
-    };
-
-    var trimString = function (str) {
-        /// <summary>Removes leading and trailing whitespaces from a string.</summary>
-        /// <param name="str" type="String" optional="false" mayBeNull="false">String to trim</param>
-        /// <returns type="String">The string with no leading or trailing whitespace.</returns>
-
-        if (str.trim) {
-            return str.trim();
-        }
-
-        return str.replace(/^\s+|\s+$/g, '');
-    };
-
-    var undefinedDefault = function (value, defaultValue) {
-        /// <summary>Returns a default value in place of undefined.</summary>
-        /// <param name="value" mayBeNull="true" optional="true">Value to check.</param>
-        /// <param name="defaultValue">Value to return if value is undefined.</param>
-        /// <returns>value if it's defined; defaultValue otherwise.</returns>
-        /// <remarks>
-        /// This should only be used for cases where falsy values are valid;
-        /// otherwise the pattern should be 'x = (value) ? value : defaultValue;'.
-        /// </remarks>
-        return (value !== undefined) ? value : defaultValue;
-    };
-
-    // Regular expression that splits a uri into its components:
-    // 0 - is the matched string.
-    // 1 - is the scheme.
-    // 2 - is the authority.
-    // 3 - is the path.
-    // 4 - is the query.
-    // 5 - is the fragment.
-    var uriRegEx = /^([^:\/?#]+:)?(\/\/[^\/?#]*)?([^?#:]+)?(\?[^#]*)?(#.*)?/;
-    var uriPartNames = ["scheme", "authority", "path", "query", "fragment"];
-
-    var getURIInfo = function (uri) {
-        /// <summary>Gets information about the components of the specified URI.</summary>
-        /// <param name="uri" type="String">URI to get information from.</param>
-        /// <returns type="Object">
-        /// An object with an isAbsolute flag and part names (scheme, authority, etc.) if available.
-        /// </returns>
-
-        var result = { isAbsolute: false };
-
-        if (uri) {
-            var matches = uriRegEx.exec(uri);
-            if (matches) {
-                var i, len;
-                for (i = 0, len = uriPartNames.length; i < len; i++) {
-                    if (matches[i + 1]) {
-                        result[uriPartNames[i]] = matches[i + 1];
-                    }
-                }
-            }
-            if (result.scheme) {
-                result.isAbsolute = true;
-            }
-        }
-
-        return result;
-    };
-
-    var getURIFromInfo = function (uriInfo) {
-        /// <summary>Builds a URI string from its components.</summary>
-        /// <param name="uriInfo" type="Object"> An object with uri parts (scheme, authority, etc.).</param>
-        /// <returns type="String">URI string.</returns>
-
-        return "".concat(
-            uriInfo.scheme || "",
-            uriInfo.authority || "",
-            uriInfo.path || "",
-            uriInfo.query || "",
-            uriInfo.fragment || "");
-    };
-
-    // Regular expression that splits a uri authority into its subcomponents:
-    // 0 - is the matched string.
-    // 1 - is the userinfo subcomponent.
-    // 2 - is the host subcomponent.
-    // 3 - is the port component.
-    var uriAuthorityRegEx = /^\/{0,2}(?:([^@]*)@)?([^:]+)(?::{1}(\d+))?/;
-
-    // Regular expression that matches percentage enconded octects (i.e %20 or %3A);
-    var pctEncodingRegEx = /%[0-9A-F]{2}/ig;
-
-    var normalizeURICase = function (uri) {
-        /// <summary>Normalizes the casing of a URI.</summary>
-        /// <param name="uri" type="String">URI to normalize, absolute or relative.</param>
-        /// <returns type="String">The URI normalized to lower case.</returns>
-
-        var uriInfo = getURIInfo(uri);
-        var scheme = uriInfo.scheme;
-        var authority = uriInfo.authority;
-
-        if (scheme) {
-            uriInfo.scheme = scheme.toLowerCase();
-            if (authority) {
-                var matches = uriAuthorityRegEx.exec(authority);
-                if (matches) {
-                    uriInfo.authority = "//" +
-                    (matches[1] ? matches[1] + "@" : "") +
-                    (matches[2].toLowerCase()) +
-                    (matches[3] ? ":" + matches[3] : "");
-                }
-            }
-        }
-
-        uri = getURIFromInfo(uriInfo);
-
-        return uri.replace(pctEncodingRegEx, function (str) {
-            return str.toLowerCase();
-        });
-    };
-
-    var normalizeURI = function (uri, base) {
-        /// <summary>Normalizes a possibly relative URI with a base URI.</summary>
-        /// <param name="uri" type="String">URI to normalize, absolute or relative.</param>
-        /// <param name="base" type="String" mayBeNull="true">Base URI to compose with.</param>
-        /// <returns type="String">The composed URI if relative; the original one if absolute.</returns>
-
-        if (!base) {
-            return uri;
-        }
-
-        var uriInfo = getURIInfo(uri);
-        if (uriInfo.isAbsolute) {
-            return uri;
-        }
-
-        var baseInfo = getURIInfo(base);
-        var normInfo = {};
-        var path;
-
-        if (uriInfo.authority) {
-            normInfo.authority = uriInfo.authority;
-            path = uriInfo.path;
-            normInfo.query = uriInfo.query;
-        } else {
-            if (!uriInfo.path) {
-                path = baseInfo.path;
-                normInfo.query = uriInfo.query || baseInfo.query;
-            } else {
-                if (uriInfo.path.charAt(0) === '/') {
-                    path = uriInfo.path;
-                } else {
-                    path = mergeUriPathWithBase(uriInfo.path, baseInfo.path);
-                }
-                normInfo.query = uriInfo.query;
-            }
-            normInfo.authority = baseInfo.authority;
-        }
-
-        normInfo.path = removeDotsFromPath(path);
-
-        normInfo.scheme = baseInfo.scheme;
-        normInfo.fragment = uriInfo.fragment;
-
-        return getURIFromInfo(normInfo);
-    };
-
-    var mergeUriPathWithBase = function (uriPath, basePath) {
-        /// <summary>Merges the path of a relative URI and a base URI.</summary>
-        /// <param name="uriPath" type="String>Relative URI path.</param>
-        /// <param name="basePath" type="String">Base URI path.</param>
-        /// <returns type="String">A string with the merged path.</returns>
-
-        var path = "/";
-        var end;
-
-        if (basePath) {
-            end = basePath.lastIndexOf("/");
-            path = basePath.substring(0, end);
-
-            if (path.charAt(path.length - 1) !== "/") {
-                path = path + "/";
-            }
-        }
-
-        return path + uriPath;
-    };
-
-    var removeDotsFromPath = function (path) {
-        /// <summary>Removes the special folders . and .. from a URI's path.</summary>
-        /// <param name="path" type="string">URI path component.</param>
-        /// <returns type="String">Path without any . and .. folders.</returns>
-
-        var result = "";
-        var segment = "";
-        var end;
-
-        while (path) {
-            if (path.indexOf("..") === 0 || path.indexOf(".") === 0) {
-                path = path.replace(/^\.\.?\/?/g, "");
-            } else if (path.indexOf("/..") === 0) {
-                path = path.replace(/^\/\..\/?/g, "/");
-                end = result.lastIndexOf("/");
-                if (end === -1) {
-                    result = "";
-                } else {
-                    result = result.substring(0, end);
-                }
-            } else if (path.indexOf("/.") === 0) {
-                path = path.replace(/^\/\.\/?/g, "/");
-            } else {
-                segment = path;
-                end = path.indexOf("/", 1);
-                if (end !== -1) {
-                    segment = path.substring(0, end);
-                }
-                result = result + segment;
-                path = path.replace(segment, "");
-            }
-        }
-        return result;
-    };
-
-    var convertByteArrayToHexString = function (str) {
-        var arr = [];
-        if (window.atob === undefined) {
-            arr = decodeBase64(str);
-        } else {
-            var binaryStr = window.atob(str);
-            for (var i = 0; i < binaryStr.length; i++) {
-                arr.push(binaryStr.charCodeAt(i));
-            }
-        }
-        var hexValue = "";
-        var hexValues = "0123456789ABCDEF";
-        for (var j = 0; j < arr.length; j++) {
-            var t = arr[j];
-            hexValue += hexValues[t >> 4];
-            hexValue += hexValues[t & 0x0F];
-        }
-        return hexValue;
-    };
-
-    var decodeBase64 = function (str) {
-        var binaryString = "";
-        for (var i = 0; i < str.length; i++) {
-            var base65IndexValue = getBase64IndexValue(str[i]);
-            var binaryValue = "";
-            if (base65IndexValue !== null) {
-                binaryValue = base65IndexValue.toString(2);
-                binaryString += addBase64Padding(binaryValue);
-            }
-        }
-        var byteArray = [];
-        var numberOfBytes = parseInt(binaryString.length / 8, 10);
-        for (i = 0; i < numberOfBytes; i++) {
-            var intValue = parseInt(binaryString.substring(i * 8, (i + 1) * 8), 2);
-            byteArray.push(intValue);
-        }
-        return byteArray;
-    };
-
-    var getBase64IndexValue = function (character) {
-        var asciiCode = character.charCodeAt(0);
-        var asciiOfA = 65;
-        var differenceBetweenZanda = 6;
-        if (asciiCode >= 65 && asciiCode <= 90) {           // between "A" and "Z" inclusive
-            return asciiCode - asciiOfA;
-        } else if (asciiCode >= 97 && asciiCode <= 122) {   // between 'a' and 'z' inclusive
-            return asciiCode - asciiOfA - differenceBetweenZanda;
-        } else if (asciiCode >= 48 && asciiCode <= 57) {    // between '0' and '9' inclusive
-            return asciiCode + 4;
-        } else if (character == "+") {
-            return 62;
-        } else if (character == "/") {
-            return 63;
-        } else {
-            return null;
-        }
-    };
-
-    var addBase64Padding = function (binaryString) {
-        while (binaryString.length < 6) {
-            binaryString = "0" + binaryString;
-        }
-        return binaryString;
-    };
-    // DATAJS INTERNAL START
-
-    datajs.activeXObject = activeXObject;
-    datajs.assigned = assigned;
-    datajs.contains = contains;
-    datajs.defined = defined;
-    datajs.delay = delay;
-    datajs.djsassert = djsassert;
-    datajs.extend = extend;
-    datajs.find = find;
-    datajs.getURIInfo = getURIInfo;
-    datajs.isArray = isArray;
-    datajs.isDate = isDate;
-    datajs.isObject = isObject;
-    datajs.normalizeURI = normalizeURI;
-    datajs.normalizeURICase = normalizeURICase;
-    datajs.parseInt10 = parseInt10;
-    datajs.renameProperty = renameProperty;
-    datajs.throwErrorCallback = throwErrorCallback;
-    datajs.trimString = trimString;
-    datajs.undefinedDefault = undefinedDefault;
-    datajs.decodeBase64 = decodeBase64;
-    datajs.convertByteArrayToHexString = convertByteArrayToHexString;
-    // DATAJS INTERNAL END
-
-    // CONTENT END
+// Copyright (c) Microsoft Open Technologies, Inc.  All rights reserved.
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation 
+// files (the "Software"), to deal  in the Software without restriction, including without limitation the rights  to use, copy,
+// modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the 
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+// WARRANTIES OF MERCHANTABILITY,  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
+// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+// utils.js
+
+(function (window, undefined) {
+
+    var datajs = window.datajs || {};
+
+    // CONTENT START
+
+    var activeXObject = function (progId) {
+        /// <summary>Creates a new ActiveXObject from the given progId.</summary>
+        /// <param name="progId" type="String" mayBeNull="false" optional="false">
+        ///    ProgId string of the desired ActiveXObject.
+        /// </param>
+        /// <remarks>
+        ///    This function throws whatever exception might occur during the creation
+        ///    of the ActiveXObject.
+        /// </remarks>
+        /// <returns type="Object">
+        ///     The ActiveXObject instance. Null if ActiveX is not supported by the
+        ///     browser.
+        /// </returns>
+        if (window.ActiveXObject) {
+            return new window.ActiveXObject(progId);
+        }
+        return null;
+    };
+
+    var assigned = function (value) {
+        /// <summary>Checks whether the specified value is different from null and undefined.</summary>
+        /// <param name="value" mayBeNull="true" optional="true">Value to check.</param>
+        /// <returns type="Boolean">true if the value is assigned; false otherwise.</returns>
+        return value !== null && value !== undefined;
+    };
+
+    var contains = function (arr, item) {
+        /// <summary>Checks whether the specified item is in the array.</summary>
+        /// <param name="arr" type="Array" optional="false" mayBeNull="false">Array to check in.</param>
+        /// <param name="item">Item to look for.</param>
+        /// <returns type="Boolean">true if the item is contained, false otherwise.</returns>
+
+        var i, len;
+        for (i = 0, len = arr.length; i < len; i++) {
+            if (arr[i] === item) {
+                return true;
+            }
+        }
+
+        return false;
+    };
+
+    var defined = function (a, b) {
+        /// <summary>Given two values, picks the first one that is not undefined.</summary>
+        /// <param name="a">First value.</param>
+        /// <param name="b">Second value.</param>
+        /// <returns>a if it's a defined value; else b.</returns>
+        return (a !== undefined) ? a : b;
+    };
+
+    var delay = function (callback) {
+        /// <summary>Delays the invocation of the specified function until execution unwinds.</summary>
+        /// <param name="callback" type="Function">Callback function.</param>
+        if (arguments.length === 1) {
+            window.setTimeout(callback, 0);
+            return;
+        }
+
+        var args = Array.prototype.slice.call(arguments, 1);
+        window.setTimeout(function () {
+            callback.apply(this, args);
+        }, 0);
+    };
+
+    // DATAJS INTERNAL START
+    var djsassert = function (condition, message, data) {
+        /// <summary>Throws an exception in case that a condition evaluates to false.</summary>
+        /// <param name="condition" type="Boolean">Condition to evaluate.</param>
+        /// <param name="message" type="String">Message explaining the assertion.</param>
+        /// <param name="data" type="Object">Additional data to be included in the exception.</param>
+
+        if (!condition) {
+            throw { message: "Assert fired: " + message, data: data };
+        };
+    };
+    // DATAJS INTERNAL END
+
+    var extend = function (target, values) {
+        /// <summary>Extends the target with the specified values.</summary>
+        /// <param name="target" type="Object">Object to add properties to.</param>
+        /// <param name="values" type="Object">Object with properties to add into target.</param>
+        /// <returns type="Object">The target object.</returns>
+
+        for (var name in values) {
+            target[name] = values[name];
+        }
+
+        return target;
+    };
+
+    var find = function (arr, callback) {
+        /// <summary>Returns the first item in the array that makes the callback function true.</summary>
+        /// <param name="arr" type="Array" optional="false" mayBeNull="true">Array to check in.</param>
+        /// <param name="callback" type="Function">Callback function to invoke once per item in the array.</param>
+        /// <returns>The first item that makes the callback return true; null otherwise or if the array is null.</returns>
+
+        if (arr) {
+            var i, len;
+            for (i = 0, len = arr.length; i < len; i++) {
+                if (callback(arr[i])) {
+                    return arr[i];
+                }
+            }
+        }
+        return null;
+    };
+
+    var isArray = function (value) {
+        /// <summary>Checks whether the specified value is an array object.</summary>
+        /// <param name="value">Value to check.</param>
+        /// <returns type="Boolean">true if the value is an array object; false otherwise.</returns>
+
+        return Object.prototype.toString.call(value) === "[object Array]";
+    };
+
+    var isDate = function (value) {
+        /// <summary>Checks whether the specified value is a Date object.</summary>
+        /// <param name="value">Value to check.</param>
+        /// <returns type="Boolean">true if the value is a Date object; false otherwise.</returns>
+
+        return Object.prototype.toString.call(value) === "[object Date]";
+    };
+
+    var isObject = function (value) {
+        /// <summary>Tests whether a value is an object.</summary>
+        /// <param name="value">Value to test.</param>
+        /// <remarks>
+        ///     Per javascript rules, null and array values are objects and will cause this function to return true.
+        /// </remarks>
+        /// <returns type="Boolean">True is the value is an object; false otherwise.</returns>
+
+        return typeof value === "object";
+    };
+
+    var parseInt10 = function (value) {
+        /// <summary>Parses a value in base 10.</summary>
+        /// <param name="value" type="String">String value to parse.</param>
+        /// <returns type="Number">The parsed value, NaN if not a valid value.</returns>
+
+        return parseInt(value, 10);
+    };
+
+    var renameProperty = function (obj, oldName, newName) {
+        /// <summary>Renames a property in an object.</summary>
+        /// <param name="obj" type="Object">Object in which the property will be renamed.</param>
+        /// <param name="oldName" type="String">Name of the property that will be renamed.</param>
+        /// <param name="newName" type="String">New name of the property.</param>
+        /// <remarks>
+        ///    This function will not do anything if the object doesn't own a property with the specified old name.
+        /// </remarks>
+
+        if (obj.hasOwnProperty(oldName)) {
+            obj[newName] = obj[oldName];
+            delete obj[oldName];
+        }
+    };
+
+    var throwErrorCallback = function (error) {
+        /// <summary>Default error handler.</summary>
+        /// <param name="error" type="Object">Error to handle.</param>
+        throw error;
+    };
+
+    var trimString = function (str) {
+        /// <summary>Removes leading and trailing whitespaces from a string.</summary>
+        /// <param name="str" type="String" optional="false" mayBeNull="false">String to trim</param>
+        /// <returns type="String">The string with no leading or trailing whitespace.</returns>
+
+        if (str.trim) {
+            return str.trim();
+        }
+
+        return str.replace(/^\s+|\s+$/g, '');
+    };
+
+    var undefinedDefault = function (value, defaultValue) {
+        /// <summary>Returns a default value in place of undefined.</summary>
+        /// <param name="value" mayBeNull="true" optional="true">Value to check.</param>
+        /// <param name="defaultValue">Value to return if value is undefined.</param>
+        /// <returns>value if it's defined; defaultValue otherwise.</returns>
+        /// <remarks>
+        /// This should only be used for cases where falsy values are valid;
+        /// otherwise the pattern should be 'x = (value) ? value : defaultValue;'.
+        /// </remarks>
+        return (value !== undefined) ? value : defaultValue;
+    };
+
+    // Regular expression that splits a uri into its components:
+    // 0 - is the matched string.
+    // 1 - is the scheme.
+    // 2 - is the authority.
+    // 3 - is the path.
+    // 4 - is the query.
+    // 5 - is the fragment.
+    var uriRegEx = /^([^:\/?#]+:)?(\/\/[^\/?#]*)?([^?#:]+)?(\?[^#]*)?(#.*)?/;
+    var uriPartNames = ["scheme", "authority", "path", "query", "fragment"];
+
+    var getURIInfo = function (uri) {
+        /// <summary>Gets information about the components of the specified URI.</summary>
+        /// <param name="uri" type="String">URI to get information from.</param>
+        /// <returns type="Object">
+        /// An object with an isAbsolute flag and part names (scheme, authority, etc.) if available.
+        /// </returns>
+
+        var result = { isAbsolute: false };
+
+        if (uri) {
+            var matches = uriRegEx.exec(uri);
+            if (matches) {
+                var i, len;
+                for (i = 0, len = uriPartNames.length; i < len; i++) {
+                    if (matches[i + 1]) {
+                        result[uriPartNames[i]] = matches[i + 1];
+                    }
+                }
+            }
+            if (result.scheme) {
+                result.isAbsolute = true;
+            }
+        }
+
+        return result;
+    };
+
+    var getURIFromInfo = function (uriInfo) {
+        /// <summary>Builds a URI string from its components.</summary>
+        /// <param name="uriInfo" type="Object"> An object with uri parts (scheme, authority, etc.).</param>
+        /// <returns type="String">URI string.</returns>
+
+        return "".concat(
+            uriInfo.scheme || "",
+            uriInfo.authority || "",
+            uriInfo.path || "",
+            uriInfo.query || "",
+            uriInfo.fragment || "");
+    };
+
+    // Regular expression that splits a uri authority into its subcomponents:
+    // 0 - is the matched string.
+    // 1 - is the userinfo subcomponent.
+    // 2 - is the host subcomponent.
+    // 3 - is the port component.
+    var uriAuthorityRegEx = /^\/{0,2}(?:([^@]*)@)?([^:]+)(?::{1}(\d+))?/;
+
+    // Regular expression that matches percentage enconded octects (i.e %20 or %3A);
+    var pctEncodingRegEx = /%[0-9A-F]{2}/ig;
+
+    var normalizeURICase = function (uri) {
+        /// <summary>Normalizes the casing of a URI.</summary>
+        /// <param name="uri" type="String">URI to normalize, absolute or relative.</param>
+        /// <returns type="String">The URI normalized to lower case.</returns>
+
+        var uriInfo = getURIInfo(uri);
+        var scheme = uriInfo.scheme;
+        var authority = uriInfo.authority;
+
+        if (scheme) {
+            uriInfo.scheme = scheme.toLowerCase();
+            if (authority) {
+                var matches = uriAuthorityRegEx.exec(authority);
+                if (matches) {
+                    uriInfo.authority = "//" +
+                    (matches[1] ? matches[1] + "@" : "") +
+                    (matches[2].toLowerCase()) +
+                    (matches[3] ? ":" + matches[3] : "");
+                }
+            }
+        }
+
+        uri = getURIFromInfo(uriInfo);
+
+        return uri.replace(pctEncodingRegEx, function (str) {
+            return str.toLowerCase();
+        });
+    };
+
+    var normalizeURI = function (uri, base) {
+        /// <summary>Normalizes a possibly relative URI with a base URI.</summary>
+        /// <param name="uri" type="String">URI to normalize, absolute or relative.</param>
+        /// <param name="base" type="String" mayBeNull="true">Base URI to compose with.</param>
+        /// <returns type="String">The composed URI if relative; the original one if absolute.</returns>
+
+        if (!base) {
+            return uri;
+        }
+
+        var uriInfo = getURIInfo(uri);
+        if (uriInfo.isAbsolute) {
+            return uri;
+        }
+
+        var baseInfo = getURIInfo(base);
+        var normInfo = {};
+        var path;
+
+        if (uriInfo.authority) {
+            normInfo.authority = uriInfo.authority;
+            path = uriInfo.path;
+            normInfo.query = uriInfo.query;
+        } else {
+            if (!uriInfo.path) {
+                path = baseInfo.path;
+                normInfo.query = uriInfo.query || baseInfo.query;
+            } else {
+                if (uriInfo.path.charAt(0) === '/') {
+                    path = uriInfo.path;
+                } else {
+                    path = mergeUriPathWithBase(uriInfo.path, baseInfo.path);
+                }
+                normInfo.query = uriInfo.query;
+            }
+            normInfo.authority = baseInfo.authority;
+        }
+
+        normInfo.path = removeDotsFromPath(path);
+
+        normInfo.scheme = baseInfo.scheme;
+        normInfo.fragment = uriInfo.fragment;
+
+        return getURIFromInfo(normInfo);
+    };
+
+    var mergeUriPathWithBase = function (uriPath, basePath) {
+        /// <summary>Merges the path of a relative URI and a base URI.</summary>
+        /// <param name="uriPath" type="String>Relative URI path.</param>
+        /// <param name="basePath" type="String">Base URI path.</param>
+        /// <returns type="String">A string with the merged path.</returns>
+
+        var path = "/";
+        var end;
+
+        if (basePath) {
+            end = basePath.lastIndexOf("/");
+            path = basePath.substring(0, end);
+
+            if (path.charAt(path.length - 1) !== "/") {
+                path = path + "/";
+            }
+        }
+
+        return path + uriPath;
+    };
+
+    var removeDotsFromPath = function (path) {
+        /// <summary>Removes the special folders . and .. from a URI's path.</summary>
+        /// <param name="path" type="string">URI path component.</param>
+        /// <returns type="String">Path without any . and .. folders.</returns>
+
+        var result = "";
+        var segment = "";
+        var end;
+
+        while (path) {
+            if (path.indexOf("..") === 0 || path.indexOf(".") === 0) {
+                path = path.replace(/^\.\.?\/?/g, "");
+            } else if (path.indexOf("/..") === 0) {
+                path = path.replace(/^\/\..\/?/g, "/");
+                end = result.lastIndexOf("/");
+                if (end === -1) {
+                    result = "";
+                } else {
+                    result = result.substring(0, end);
+                }
+            } else if (path.indexOf("/.") === 0) {
+                path = path.replace(/^\/\.\/?/g, "/");
+            } else {
+                segment = path;
+                end = path.indexOf("/", 1);
+                if (end !== -1) {
+                    segment = path.substring(0, end);
+                }
+                result = result + segment;
+                path = path.replace(segment, "");
+            }
+        }
+        return result;
+    };
+
+    var convertByteArrayToHexString = function (str) {
+        var arr = [];
+        if (window.atob === undefined) {
+            arr = decodeBase64(str);
+        } else {
+            var binaryStr = window.atob(str);
+            for (var i = 0; i < binaryStr.length; i++) {
+                arr.push(binaryStr.charCodeAt(i));
+            }
+        }
+        var hexValue = "";
+        var hexValues = "0123456789ABCDEF";
+        for (var j = 0; j < arr.length; j++) {
+            var t = arr[j];
+            hexValue += hexValues[t >> 4];
+            hexValue += hexValues[t & 0x0F];
+        }
+        return hexValue;
+    };
+
+    var decodeBase64 = function (str) {
+        var binaryString = "";
+        for (var i = 0; i < str.length; i++) {
+            var base65IndexValue = getBase64IndexValue(str[i]);
+            var binaryValue = "";
+            if (base65IndexValue !== null) {
+                binaryValue = base65IndexValue.toString(2);
+                binaryString += addBase64Padding(binaryValue);
+            }
+        }
+        var byteArray = [];
+        var numberOfBytes = parseInt(binaryString.length / 8, 10);
+        for (i = 0; i < numberOfBytes; i++) {
+            var intValue = parseInt(binaryString.substring(i * 8, (i + 1) * 8), 2);
+            byteArray.push(intValue);
+        }
+        return byteArray;
+    };
+
+    var getBase64IndexValue = function (character) {
+        var asciiCode = character.charCodeAt(0);
+        var asciiOfA = 65;
+        var differenceBetweenZanda = 6;
+        if (asciiCode >= 65 && asciiCode <= 90) {           // between "A" and "Z" inclusive
+            return asciiCode - asciiOfA;
+        } else if (asciiCode >= 97 && asciiCode <= 122) {   // between 'a' and 'z' inclusive
+            return asciiCode - asciiOfA - differenceBetweenZanda;
+        } else if (asciiCode >= 48 && asciiCode <= 57) {    // between '0' and '9' inclusive
+            return asciiCode + 4;
+        } else if (character == "+") {
+            return 62;
+        } else if (character == "/") {
+            return 63;
+        } else {
+            return null;
+        }
+    };
+
+    var addBase64Padding = function (binaryString) {
+        while (binaryString.length < 6) {
+            binaryString = "0" + binaryString;
+        }
+        return binaryString;
+    };
+
+    var getJsonValueArraryLength = function (data) {
+        if (data && data.value) {
+            return data.value.length;
+        }
+
+        return 0;
+    };
+
+    var sliceJsonValueArray = function (data, start, end) {
+        if (data == undefined || data.value == undefined) {
+            return data;
+        }
+
+        if (start < 0) {
+            start = 0;
+        }
+
+        var length = getJsonValueArraryLength(data);
+        if (length < end) {
+            end = length;
+        }
+
+        var newdata = {};
+        for (var property in data) {
+            if (property == "value") {
+                newdata[property] = data[property].slice(start, end);
+            } else {
+                newdata[property] = data[property];
+            }
+        }
+
+        return newdata;
+    };
+
+    var concatJsonValueArray = function (data, concatData) {
+        if (concatData == undefined || concatData.value == undefined) {
+            return data;
+        }
+
+        if (data == undefined || Object.keys(data).length == 0) {
+            return concatData;
+        }
+
+        if (data.value == undefined) {
+            data.value = concatData.value;
+            return data;
+        }
+
+        data.value = data.value.concat(concatData.value);
+
+        return data;
+    };
+
+    // DATAJS INTERNAL START
+
+    datajs.activeXObject = activeXObject;
+    datajs.assigned = assigned;
+    datajs.contains = contains;
+    datajs.defined = defined;
+    datajs.delay = delay;
+    datajs.djsassert = djsassert;
+    datajs.extend = extend;
+    datajs.find = find;
+    datajs.getURIInfo = getURIInfo;
+    datajs.isArray = isArray;
+    datajs.isDate = isDate;
+    datajs.isObject = isObject;
+    datajs.normalizeURI = normalizeURI;
+    datajs.normalizeURICase = normalizeURICase;
+    datajs.parseInt10 = parseInt10;
+    datajs.renameProperty = renameProperty;
+    datajs.throwErrorCallback = throwErrorCallback;
+    datajs.trimString = trimString;
+    datajs.undefinedDefault = undefinedDefault;
+    datajs.decodeBase64 = decodeBase64;
+    datajs.convertByteArrayToHexString = convertByteArrayToHexString;
+    datajs.getJsonValueArraryLength = getJsonValueArraryLength;
+    datajs.sliceJsonValueArray = sliceJsonValueArray;
+    datajs.concatJsonValueArray = concatJsonValueArray;
+    // DATAJS INTERNAL END
+
+    // CONTENT END
 })(this);
\ No newline at end of file