You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ko...@apache.org on 2014/08/18 15:49:52 UTC

[1/2] [OLINGO-408] add more comments

Repository: olingo-odata4-js
Updated Branches:
  refs/heads/master b59d0b23d -> 24598e5f9


http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/24598e5f/datajs/src/lib/odata/utils.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/odata/utils.js b/datajs/src/lib/odata/utils.js
index 01f59c2..efaea05 100644
--- a/datajs/src/lib/odata/utils.js
+++ b/datajs/src/lib/odata/utils.js
@@ -170,7 +170,7 @@ var geographyTypes = [
  * @param {Function} callback - Callback function to invoke once per schema.
  * @returns The first truthy value to be returned from the callback; null or the last falsy value otherwise.
  */
-var forEachSchema = function (metadata, callback) {
+function forEachSchema(metadata, callback) {
     
 
     if (!metadata) {
@@ -194,7 +194,7 @@ var forEachSchema = function (metadata, callback) {
 
         return callback(metadata);
     }
-};
+}
 
 /** Formats a millisecond and a nanosecond value into a single string.
  * @param {Numaber} ms - Number of milliseconds to format.</param>
@@ -202,7 +202,7 @@ var forEachSchema = function (metadata, callback) {
  * @returns {String} Formatted text.
  * If the value is already as string it's returned as-is.</remarks>
  */
-var formatMilliseconds = function (ms, ns) {
+function formatMilliseconds(ms, ns) {
 
     // Avoid generating milliseconds if not necessary.
     if (ms === 0) {
@@ -217,18 +217,18 @@ var formatMilliseconds = function (ms, ns) {
         ms += formatNumberWidth(ns.toString(), 4);
     }
     return ms;
-};
+}
 
-var formatDateTimeOffsetJSON = function (value) {
+function formatDateTimeOffsetJSON(value) {
     return "\/Date(" + value.getTime() + ")\/";
-};
+}
 
 /** Formats a DateTime or DateTimeOffset value a string.
  * @param {Date} value - Value to format
  * @returns {String} Formatted text.
  * If the value is already as string it's returned as-is
 ยด*/
-var formatDateTimeOffset = function (value) {
+function formatDateTimeOffset(value) {
 
     if (typeof value === "string") {
         return value;
@@ -268,13 +268,13 @@ var formatDateTimeOffset = function (value) {
         formatNumberWidth(value.getUTCMinutes(), 2) + ":" +
         formatNumberWidth(value.getUTCSeconds(), 2) +
         ms + offset;
-};
+}
 
 /** Converts a duration to a string in xsd:duration format.
  * @param {Object} value - Object with ms and __edmType properties.
  * @returns {String} String representation of the time object in xsd:duration format.
  */
-var formatDuration = function (value) {
+function formatDuration(value) {
 
     var ms = value.ms;
 
@@ -299,7 +299,7 @@ var formatDuration = function (value) {
            formatNumberWidth(minutes, 2) + "M" +
            formatNumberWidth(seconds, 2) +
            formatMilliseconds(ms, value.ns) + "S";
-};
+}
 
 /** Formats the specified value to the given width.
  * @param {Number} value - Number to format (non-negative).
@@ -307,7 +307,7 @@ var formatDuration = function (value) {
  * @param {Boolean} append - Flag indicating if the value is padded at the beginning (false) or at the end (true).
  * @returns {String} Text representation.
  */
-var formatNumberWidth = function (value, width, append) {
+function formatNumberWidth(value, width, append) {
     var result = value.toString(10);
     while (result.length < width) {
         if (append) {
@@ -318,22 +318,22 @@ var formatNumberWidth = function (value, width, append) {
     }
 
     return result;
-};
+}
 
 /** Gets the canonical timezone representation.
  * @param {String} timezone - Timezone representation.
  * @returns {String} An 'Z' string if the timezone is absent or 0; the timezone otherwise.
  */
-var getCanonicalTimezone = function (timezone) {
+function getCanonicalTimezone(timezone) {
 
     return (!timezone || timezone === "Z" || timezone === "+00:00" || timezone === "-00:00") ? "Z" : timezone;
-};
+}
 
 /** Gets the type of a collection type name.
  * @param {String} typeName - Type name of the collection.
  * @returns {String} Type of the collection; null if the type name is not a collection type.
  */
-var getCollectionType = function (typeName) {
+function getCollectionType(typeName) {
 
     if (typeof typeName === "string") {
         var end = typeName.indexOf(")", 10);
@@ -342,7 +342,7 @@ var getCollectionType = function (typeName) {
         }
     }
     return null;
-};
+}
 
 /** Sends a request containing OData payload to a server.
 * @param request - Object that represents the request to be sent..
@@ -352,7 +352,7 @@ var getCollectionType = function (typeName) {
 * @param httpClient - HTTP client layer.
 * @param context - Context used for processing the request
 */
-var invokeRequest = function (request, success, error, handler, httpClient, context) {
+function invokeRequest(request, success, error, handler, httpClient, context) {
 
     return httpClient.request(request, function (response) {
         try {
@@ -381,16 +381,16 @@ var invokeRequest = function (request, success, error, handler, httpClient, cont
             throw err;
         }
     }, error);
-};
+}
 
 /** Tests whether a value is a batch object in the library's internal representation.
  * @param value - Value to test.
  * @returns {Boolean} True is the value is a batch object; false otherwise.
  */
-var isBatch = function (value) {
+function isBatch(value) {
 
     return isComplex(value) && isArray(value.__batchRequests);
-};
+}
 
 // Regular expression used for testing and parsing for a collection type.
 var collectionTypeRE = /Collection\((.*)\)/;
@@ -400,47 +400,47 @@ var collectionTypeRE = /Collection\((.*)\)/;
  * @param {Sting} typeName - Type name of the value. This is used to disambiguate from a collection property value.
  * @returns {Boolean} True is the value is a feed value; false otherwise.
  */
-var isCollection = function (value, typeName) {
+function isCollection(value, typeName) {
 
     var colData = value && value.results || value;
     return !!colData &&
         (isCollectionType(typeName)) ||
         (!typeName && isArray(colData) && !isComplex(colData[0]));
-};
+}
 
 /** Checks whether the specified type name is a collection type.
  * @param {String} typeName - Name of type to check.
  * @returns {Boolean} True if the type is the name of a collection type; false otherwise.
  */
-var isCollectionType = function (typeName) {
+function isCollectionType(typeName) {
     return collectionTypeRE.test(typeName);
-};
+}
 
 /** Tests whether a value is a complex type value in the library's internal representation.
  * @param value - Value to test.
  * @returns {Boolean} True is the value is a complex type value; false otherwise.
  */
-var isComplex = function (value) {
+function isComplex(value) {
 
     return !!value &&
         isObject(value) &&
         !isArray(value) &&
         !isDate(value);
-};
+}
 
 /** Checks whether a Date object is DateTimeOffset value
  * @param {Date} value - Value to check
  * @returns {Boolean} true if the value is a DateTimeOffset, false otherwise.
  */
-var isDateTimeOffset = function (value) {
+function isDateTimeOffset(value) {
     return (value.__edmType === "Edm.DateTimeOffset" || (!value.__edmType && value.__offset));
-};
+}
 
 /** Tests whether a value is a deferred navigation property in the library's internal representation.
  * @param value - Value to test.
  * @returns {Boolean} True is the value is a deferred navigation property; false otherwise.
  */
-var isDeferred = function (value) {
+function isDeferred(value) {
 
     if (!value && !isComplex(value)) {
         return false;
@@ -448,60 +448,60 @@ var isDeferred = function (value) {
     var metadata = value.__metadata || {};
     var deferred = value.__deferred || {};
     return !metadata.type && !!deferred.uri;
-};
+}
 
 /** Tests whether a value is an entry object in the library's internal representation.
  * @param value - Value to test.
  * @returns {Boolean} True is the value is an entry object; false otherwise.
  */
-var isEntry = function (value) {
+function isEntry(value) {
 
     return isComplex(value) && value.__metadata && "uri" in value.__metadata;
-};
+}
 
 /** Tests whether a value is a feed value in the library's internal representation.
  * @param value - Value to test.
  * @param {Sting} typeName - Type name of the value. This is used to disambiguate from a collection property value.
  * @returns {Boolean} True is the value is a feed value; false otherwise.
  */
-var isFeed = function (value, typeName) {
+function isFeed(value, typeName) {
 
     var feedData = value && value.results || value;
     return isArray(feedData) && (
         (!isCollectionType(typeName)) &&
         (isComplex(feedData[0]))
     );
-};
+}
 
 /** Checks whether the specified type name is a geography EDM type.
  * @param {String} typeName - Name of type to check.
  * @returns {Boolean} True if the type is a geography EDM type; false otherwise.
  */
-var isGeographyEdmType = function (typeName) {
+function isGeographyEdmType(typeName) {
 
     //check with edm
     var ret = contains(geographyEdmTypes, typeName) || 
         (typeName.indexOf('.') === -1 && contains(geographyTypes, typeName));
     return ret; 
         
-};
+}
 
 /** Checks whether the specified type name is a geometry EDM type.
  * @param {String} typeName - Name of type to check.
  * @returns {Boolean} True if the type is a geometry EDM type; false otherwise.
  */
-var isGeometryEdmType = function (typeName) {
+function isGeometryEdmType(typeName) {
 
     var ret = contains(geometryEdmTypes, typeName) ||
         (typeName.indexOf('.') === -1 && contains(geometryTypes, typeName));
     return ret; 
-};
+}
 
 /** Tests whether a value is a named stream value in the library's internal representation.
  * @param value - Value to test.
  * @returns {Boolean} True is the value is a named stream; false otherwise.
  */
-var isNamedStream = function (value) {
+function isNamedStream(value) {
 
     if (!value && !isComplex(value)) {
         return false;
@@ -509,36 +509,36 @@ var isNamedStream = function (value) {
     var metadata = value.__metadata;
     var mediaResource = value.__mediaresource;
     return !metadata && !!mediaResource && !!mediaResource.media_src;
-};
+}
 
 /** Tests whether a value is a primitive type value in the library's internal representation.
  * @param value - Value to test.
  * @returns {Boolean} True is the value is a primitive type value.
  * Date objects are considered primitive types by the library.
  */
-var isPrimitive = function (value) {
+function isPrimitive(value) {
 
     return isDate(value) ||
         typeof value === "string" ||
         typeof value === "number" ||
         typeof value === "boolean";
-};
+}
 
 /** Checks whether the specified type name is a primitive EDM type.
  * @param {String} typeName - Name of type to check.
  * @returns {Boolean} True if the type is a primitive EDM type; false otherwise.
  */
-var isPrimitiveEdmType = function (typeName) {
+function isPrimitiveEdmType(typeName) {
 
     return contains(primitiveEdmTypes, typeName);
-};
+}
 
 /** Gets the kind of a navigation property value.
  * @param value - Value of the navigation property.
  * @param {Object} [propertyModel] - Object that describes the navigation property in an OData conceptual schema.
  * @returns {String} String value describing the kind of the navigation property; null if the kind cannot be determined.
  */
-var navigationPropertyKind = function (value, propertyModel) {
+function navigationPropertyKind(value, propertyModel) {
 
     if (isDeferred(value)) {
         return "deferred";
@@ -556,19 +556,19 @@ var navigationPropertyKind = function (value, propertyModel) {
         return "feed";
     }
     return null;
-};
+}
 
 /** Looks up a property by name.
  * @param {Array} properties - Array of property objects as per EDM metadata (may be null)
  * @param {String} name - Name to look for.
  * @returns {Object} The property object; null if not found.
  */
-var lookupProperty = function (properties, name) {
+function lookupProperty(properties, name) {
 
     return find(properties, function (property) {
         return property.name === name;
     });
-};
+}
 
 /** Looks up a type object by name.
  * @param {String} name - Name, possibly null or empty.
@@ -576,56 +576,56 @@ var lookupProperty = function (properties, name) {
  * @param {String} kind - Kind of object to look for as per EDM metadata.
  * @returns An type description if the name is found; null otherwise
  */
-var lookupInMetadata = function (name, metadata, kind) {
+function lookupInMetadata(name, metadata, kind) {
 
     return (name) ? forEachSchema(metadata, function (schema) {
         return lookupInSchema(name, schema, kind);
     }) : null;
-};
+}
 
 /** Looks up a entity set by name.
  * @param {Array} properties - Array of entity set objects as per EDM metadata( may be null)
  * @param {String} name - Name to look for.
  * @returns {Object} The entity set object; null if not found.
  */
-var lookupEntitySet = function (entitySets, name) {
+function lookupEntitySet(entitySets, name) {
 
     return find(entitySets, function (entitySet) {
         return entitySet.name === name;
     });
-};
+}
 
 /** Looks up a entity set by name.
  * @param {Array} properties - Array of entity set objects as per EDM metadata (may be null)
  * @param {String} name - Name to look for.
  * @returns {Object} The entity set object; null if not found.
  */
-var lookupSingleton = function (singletons, name) {
+function lookupSingleton(singletons, name) {
 
     return find(singletons, function (singleton) {
         return singleton.name === name;
     });
-};
+}
 
 /** Looks up a complex type object by name.
  * @param {String} name - Name, possibly null or empty.
  * @param metadata - Metadata store; one of edmx, schema, or an array of any of them.
  * @returns A complex type description if the name is found; null otherwise.</returns>
  */
-var lookupComplexType = function (name, metadata) {
+function lookupComplexType(name, metadata) {
 
     return lookupInMetadata(name, metadata, "complexType");
-};
+}
 
 /** Looks up an entity type object by name.
  * @param {String} name - Name, possibly null or empty.
  * @param metadata - Metadata store; one of edmx, schema, or an array of any of them.
  * @returns An entity type description if the name is found; null otherwise.</returns>
  */
-var lookupEntityType = function (name, metadata) {
+function lookupEntityType(name, metadata) {
 
     return lookupInMetadata(name, metadata, "entityType");
-};
+}
 
 
 /** Looks up an
@@ -633,49 +633,49 @@ var lookupEntityType = function (name, metadata) {
  * @param metadata - Metadata store; one of edmx, schema, or an array of any of them.
  * @returns An entity container description if the name is found; null otherwise.</returns>
  */
-var lookupDefaultEntityContainer = function (metadata) {
+function lookupDefaultEntityContainer(metadata) {
 
     return forEachSchema(metadata, function (schema) {
         if (isObject(schema.entityContainer)) { 
             return schema.entityContainer;
         }
     });
-};
+}
 
 /** Looks up an entity container object by name.
  * @param {String} name - Name, possibly null or empty.
  * @param metadata - Metadata store; one of edmx, schema, or an array of any of them.
  * @returns An entity container description if the name is found; null otherwise.</returns>
  */
-var lookupEntityContainer = function (name, metadata) {
+function lookupEntityContainer(name, metadata) {
 
     return lookupInMetadata(name, metadata, "entityContainer");
-};
+}
 
 /** Looks up a function import by name.
  * @param {Array} properties - Array of function import objects as per EDM metadata (May be null)
  * @param {String} name - Name to look for.
  * @returns {Object} The entity set object; null if not found.
  */
-var lookupFunctionImport = function (functionImports, name) {
+function lookupFunctionImport(functionImports, name) {
     return find(functionImports, function (functionImport) {
         return functionImport.name === name;
     });
-};
+}
 
 /** Looks up the target entity type for a navigation property.
  * @param {Object} navigationProperty - 
  * @param {Object} metadata - 
  * @returns {String} The entity type name for the specified property, null if not found.
  */
-var lookupNavigationPropertyType = function (navigationProperty, metadata) {
+function lookupNavigationPropertyType(navigationProperty, metadata) {
 
     var result = null;
     if (navigationProperty) {
         var rel = navigationProperty.relationship;
         var association = forEachSchema(metadata, function (schema) {
             // The name should be the namespace qualified name in 'ns'.'type' format.
-            var nameOnly = removeNamespace(schema["namespace"], rel);
+            var nameOnly = removeNamespace(schema.namespace, rel);
             var associations = schema.association;
             if (nameOnly && associations) {
                 var i, len;
@@ -698,14 +698,14 @@ var lookupNavigationPropertyType = function (navigationProperty, metadata) {
         }
     }
     return result;
-};
+}
 
 /** Looks up the target entityset name for a navigation property.
  * @param {Object} navigationProperty - 
  * @param {Object} metadata - 
  * @returns {String} The entityset name for the specified property, null if not found.
  */
-var lookupNavigationPropertyEntitySet = function (navigationProperty, sourceEntitySetName, metadata) {
+function lookupNavigationPropertyEntitySet(navigationProperty, sourceEntitySetName, metadata) {
 
     if (navigationProperty) {
         var rel = navigationProperty.relationship;
@@ -728,14 +728,14 @@ var lookupNavigationPropertyEntitySet = function (navigationProperty, sourceEnti
         }
     }
     return null;
-};
+}
 
 /** Gets the entitySet info, container name and functionImports for an entitySet
  * @param {Object} navigationProperty - 
  * @param {Object} metadata - 
  * @returns {Object} The info about the entitySet.
  */
-var getEntitySetInfo = function (entitySetName, metadata) {
+function getEntitySetInfo(entitySetName, metadata) {
 
     var info = forEachSchema(metadata, function (schema) {
         var container = schema.entityContainer;
@@ -751,21 +751,21 @@ var getEntitySetInfo = function (entitySetName, metadata) {
     });
 
     return info;
-};
+}
 
 /** Given an expected namespace prefix, removes it from a full name.
  * @param {String} ns - Expected namespace.
  * @param {String} fullName - Full name in 'ns'.'name' form.
  * @returns {String} The local name, null if it isn't found in the expected namespace.
  */
-var removeNamespace = function (ns, fullName) {
+function removeNamespace(ns, fullName) {
 
     if (fullName.indexOf(ns) === 0 && fullName.charAt(ns.length) === ".") {
         return fullName.substr(ns.length + 1);
     }
 
     return null;
-};
+}
 
 /** Looks up a schema object by name.
  * @param {String} name - Name (assigned).
@@ -773,11 +773,11 @@ var removeNamespace = function (ns, fullName) {
  * @param {String} kind - Kind of object to look for as per EDM metadata.
  * @returns An entity type description if the name is found; null otherwise.</returns>
  */
-var lookupInSchema = function (name, schema, kind) {
+function lookupInSchema(name, schema, kind) {
 
     if (name && schema) {
         // The name should be the namespace qualified name in 'ns'.'type' format.
-        var nameOnly = removeNamespace(schema["namespace"], name);
+        var nameOnly = removeNamespace(schema.namespace, name);
         if (nameOnly) {
             return find(schema[kind], function (item) {
                 return item.name === nameOnly;
@@ -785,14 +785,14 @@ var lookupInSchema = function (name, schema, kind) {
         }
     }
     return null;
-};
+}
 
 /** Compares to version strings and returns the higher one.
  * @param {String} left - Version string in the form "major.minor.rev"
  * @param {String} right - Version string in the form "major.minor.rev"
  * @returns {String} The higher version string.
  */
-var maxVersion = function (left, right) {
+function maxVersion(left, right) {
 
     if (left === right) {
         return left;
@@ -815,7 +815,7 @@ var maxVersion = function (left, right) {
             return right;
         }
     }
-};
+}
 
 var normalHeaders = {
     // Headers shared by request and response
@@ -846,7 +846,7 @@ var normalHeaders = {
 /** Normalizes headers so they can be found with consistent casing.
  * @param {Object} headers - Dictionary of name/value pairs.
  */
-var normalizeHeaders = function (headers) {
+function normalizeHeaders(headers) {
 
     for (var name in headers) {
         var lowerName = name.toLowerCase();
@@ -857,20 +857,20 @@ var normalizeHeaders = function (headers) {
             headers[normalName] = val;
         }
     }
-};
+}
 
 /** Parses a string into a boolean value.
  * @param propertyValue - Value to parse.
  * @returns {Boolean} true if the property value is 'true'; false otherwise.
  */
-var parseBool = function (propertyValue) {
+function parseBool(propertyValue) {
 
     if (typeof propertyValue === "boolean") {
         return propertyValue;
     }
 
     return typeof propertyValue === "string" && propertyValue.toLowerCase() === "true";
-};
+}
 
 
 // The captured indices for this expression are:
@@ -886,7 +886,7 @@ var parseDateTimeRE = /^(-?\d{4,})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?(
  * @param {Boolean} withOffset - Whether offset is expected.
  * @returns {Date} The parsed value.
  */
-var parseDateTimeMaybeOffset = function (value, withOffset, nullOnError) {
+function parseDateTimeMaybeOffset(value, withOffset, nullOnError) {
 
     // We cannot parse this in cases of failure to match or if offset information is specified.
     var parts = parseDateTimeRE.exec(value);
@@ -964,13 +964,13 @@ var parseDateTimeMaybeOffset = function (value, withOffset, nullOnError) {
     }
 
     return result;
-};
+}
 
 /** Parses a string into a Date object.
  * @param {String} propertyValue - Value to parse.
  * @returns {Date} The parsed with year, month, day set, time values are set to 0
  */
-var parseDate = function (propertyValue, nullOnError) {
+function parseDate(propertyValue, nullOnError) {
     var parts = propertyValue.split('-');
 
     if (parts.length != 3 && nullOnError) {
@@ -983,11 +983,11 @@ var parseDate = function (propertyValue, nullOnError) {
         0,0,0,0)        // Date.
         );
 
-};
+}
 
 var parseTimeOfDayRE = /^(\d+):(\d+)(:(\d+)(.(\d+))?)?$/;
 
-var parseTimeOfDay = function (propertyValue, nullOnError) {
+function parseTimeOfDay(propertyValue, nullOnError) {
     var parts = parseTimeOfDayRE.exec(propertyValue);
 
 
@@ -997,7 +997,7 @@ var parseTimeOfDay = function (propertyValue, nullOnError) {
         's' :parseInt10(parts[4]),
         'ms' :parseInt10(parts[6]),
      };
-};
+}
 
 /** Parses a string into a DateTimeOffset value.
  * @param {String} propertyValue - Value to parse.
@@ -1009,11 +1009,11 @@ var parseTimeOfDay = function (propertyValue, nullOnError) {
  * the value. The time is adjusted for UTC time, as the current
  * timezone-aware Date APIs will only work with the local timezone.
  */
-var parseDateTimeOffset = function (propertyValue, nullOnError) {
+function parseDateTimeOffset(propertyValue, nullOnError) {
     
 
     return parseDateTimeMaybeOffset(propertyValue, true, nullOnError);
-};
+}
 
 // The captured indices for this expression are:
 // 0       - complete input
@@ -1023,9 +1023,9 @@ var parseDateTimeOffset = function (propertyValue, nullOnError) {
 
 var parseTimeRE = /^([+-])?P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)(?:\.(\d+))?S)?)?/;
 
-var isEdmDurationValue = function(value) {
+function isEdmDurationValue(value) {
     parseTimeRE.test(value);
-};
+}
 
 /** Parses a string in xsd:duration format.
  * @param {String} duration - Duration value.
@@ -1034,7 +1034,7 @@ var isEdmDurationValue = function(value) {
 
  * @returns {Object} Object representing the time
  */
-var parseDuration = function (duration) {
+function parseDuration(duration) {
 
     var parts = parseTimeRE.exec(duration);
 
@@ -1081,13 +1081,13 @@ var parseDuration = function (duration) {
         result.ns = ns;
     }
     return result;
-};
+}
 
 /** Parses a timezone description in (+|-)nn:nn format.
  * @param {String} timezone - Timezone offset.
  * @returns {Object} An object with a (d)irection property of 1 for + and -1 for -, offset (h)ours and offset (m)inutes.
  */
-var parseTimezone = function (timezone) {
+function parseTimezone(timezone) {
 
     var direction = timezone.substring(0, 1);
     direction = (direction === "+") ? 1 : -1;
@@ -1095,14 +1095,14 @@ var parseTimezone = function (timezone) {
     var offsetHours = parseInt10(timezone.substring(1));
     var offsetMinutes = parseInt10(timezone.substring(timezone.indexOf(":") + 1));
     return { d: direction, h: offsetHours, m: offsetMinutes };
-};
+}
 
 /** Prepares a request object so that it can be sent through the network.
 * @param request - Object that represents the request to be sent.
 * @param handler - Handler for data serialization
 * @param context - Context used for preparing the request
 */
-var prepareRequest = function (request, handler, context) {
+function prepareRequest(request, handler, context) {
 
     // Default to GET if no method has been specified.
     if (!request.method) {
@@ -1131,7 +1131,7 @@ var prepareRequest = function (request, handler, context) {
         request.async = true;
     }
 
-};
+}
 
 /** Traverses a tree of objects invoking callback for every value.
  * @param {Object} item - Object or array to traverse.
@@ -1139,7 +1139,7 @@ var prepareRequest = function (request, handler, context) {
  * @returns {Object} The object with traversed properties.
  Unlike the JSON reviver, this won't delete null members.</remarks>
 */
-var traverseInternal = function (item, owner, callback) {
+function traverseInternal(item, owner, callback) {
 
     if (item && typeof item === "object") {
         for (var name in item) {
@@ -1157,7 +1157,7 @@ var traverseInternal = function (item, owner, callback) {
     }
 
     return item;
-};
+}
 
 /** Traverses a tree of objects invoking callback for every value.
  * @param {Object} item - Object or array to traverse.
@@ -1165,10 +1165,10 @@ var traverseInternal = function (item, owner, callback) {
  * @returns {Object} The traversed object.
  * Unlike the JSON reviver, this won't delete null members.</remarks>
 */
-var traverse = function (item, callback) {
+function traverse(item, callback) {
 
     return callback("", traverseInternal(item, "", callback));
-};
+}
 
 exports.dataItemTypeName = dataItemTypeName;
 exports.EDM_BINARY = EDM_BINARY;

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/24598e5f/datajs/src/lib/store.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/store.js b/datajs/src/lib/store.js
index e96289d..5989253 100644
--- a/datajs/src/lib/store.js
+++ b/datajs/src/lib/store.js
@@ -19,15 +19,9 @@
 
  /** @module store */
 
-exports.DomStore       = DomStore       = require('./store/dom.js');
-exports.IndexedDBStore = IndexedDBStore = require('./store/indexeddb.js');
-exports.MemoryStore    = MemoryStore    = require('./store/memory.js');
 
-var mechanisms = {
-    indexeddb: IndexedDBStore,
-    dom: DomStore,
-    memory: MemoryStore
-};
+
+
 
 exports.defaultStoreMechanism = "best";
 
@@ -58,3 +52,12 @@ exports.createStore = function (name, mechanism) {
 exports.mechanisms = mechanisms;
 
 
+exports.DomStore       = DomStore       = require('./store/dom.js');
+exports.IndexedDBStore = IndexedDBStore = require('./store/indexeddb.js');
+exports.MemoryStore    = MemoryStore    = require('./store/memory.js');
+
+var mechanisms = {
+    indexeddb: IndexedDBStore,
+    dom: DomStore,
+    memory: MemoryStore
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/24598e5f/datajs/src/lib/store/dom.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/store/dom.js b/datajs/src/lib/store/dom.js
index 686c046..27c8e4e 100644
--- a/datajs/src/lib/store/dom.js
+++ b/datajs/src/lib/store/dom.js
@@ -19,8 +19,7 @@
 
 /** @module store/dom */
 
-/** DomStore (see {@link DomStore}) */
-module.exports = DomStore;
+
 
 var utils = require('./../datajs.js').utils;
 
@@ -328,3 +327,6 @@ DomStore.prototype.update = function (key, value, success, error) {
 };
 
 
+
+/** DomStore (see {@link DomStore}) */
+module.exports = DomStore;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/24598e5f/datajs/src/lib/store/indexeddb.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/store/indexeddb.js b/datajs/src/lib/store/indexeddb.js
index b66a895..e63567c 100644
--- a/datajs/src/lib/store/indexeddb.js
+++ b/datajs/src/lib/store/indexeddb.js
@@ -19,8 +19,7 @@
 
 /** @module store/indexeddb */
 
-/** IndexedDBStore (see {@link IndexedDBStore}) */
-module.exports = IndexedDBStore;
+
 
 var utils = require('./../datajs.js').utils;
 
@@ -444,3 +443,5 @@ IndexedDBStore.prototype.update = function (key, value, success, error) {
 };
 
 
+/** IndexedDBStore (see {@link IndexedDBStore}) */
+module.exports = IndexedDBStore;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/24598e5f/datajs/src/lib/store/memory.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/store/memory.js b/datajs/src/lib/store/memory.js
index ac7dc80..dabe929 100644
--- a/datajs/src/lib/store/memory.js
+++ b/datajs/src/lib/store/memory.js
@@ -19,8 +19,7 @@
 
  /** @module store/memory */
 
-/** MemoryStore (see {@link MemoryStore}) */
-module.exports = MemoryStore;
+
 
 var utils = require('./../datajs.js').utils;
 
@@ -243,3 +242,5 @@ MemoryStore.prototype.defaultError = throwErrorCallback;
 MemoryStore.prototype.mechanism = "memory";
 
 
+/** MemoryStore (see {@link MemoryStore}) */
+module.exports = MemoryStore;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/24598e5f/datajs/tests/odata-json-parse-tests.html
----------------------------------------------------------------------
diff --git a/datajs/tests/odata-json-parse-tests.html b/datajs/tests/odata-json-parse-tests.html
index 83dd9fc..46fb84b 100644
--- a/datajs/tests/odata-json-parse-tests.html
+++ b/datajs/tests/odata-json-parse-tests.html
@@ -53,6 +53,7 @@ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEAL
     </script>
    
     <script type="text/javascript" src="../build/datajs-2.0.0.js"></script>   
+    <script type="text/javascript" src="common/common.js"></script>
     <script type="text/javascript" src="common/djstest.js"></script>
     <script type="text/javascript" src="odata-json-parse-tests.js"></script>
   </head>

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/24598e5f/datajs/tests/odata-json-parse-tests.js
----------------------------------------------------------------------
diff --git a/datajs/tests/odata-json-parse-tests.js b/datajs/tests/odata-json-parse-tests.js
index eaeefa8..d5021f0 100644
--- a/datajs/tests/odata-json-parse-tests.js
+++ b/datajs/tests/odata-json-parse-tests.js
@@ -38,29 +38,29 @@
             data: null,
         };
         OData.read(metadataRequest, metaDatasuccess, errorFunc,OData.metadataHandler);
-    };
+    }
 
     djstest.addTest(function test1() {
         var checkAll = function (metadata, input, expected) {
-            var info = OData.jsonLight.jsonLightPayloadInfo({ "@odata.context" : input}, metadata)
+            var info = OData.json.createPayloadInfo({ "@odata.context" : input}, metadata);
             djstest.assertAreEqual(info,expected, "Test context fragment: "+ input);
         };
 
         var checkLastTypeName = function (metadata, input, expectedKind, expectedLastTypeName) {
-            var info = OData.jsonLight.jsonLightPayloadInfo({ "@odata.context" : input}, metadata)
+            var info = OData.json.createPayloadInfo({ "@odata.context" : input}, metadata);
             djstest.assertAreEqual(info.detectedPayloadKind,expectedKind, "Test context fragment: "+ input);
             djstest.assertAreEqual(info.typeName,expectedLastTypeName, "Test context fragment: "+ input);
         };
 
         var checkProjection = function (metadata, input, expectedKind, expectedLastTypeName, projection) {
-            var info = OData.jsonLight.jsonLightPayloadInfo({ "@odata.context" : input}, metadata)
+            var info = OData.json.createPayloadInfo({ "@odata.context" : input}, metadata);
             djstest.assertAreEqual(info.detectedPayloadKind,expectedKind, "Test context fragment: "+ input);
             djstest.assertAreEqual(info.typeName,expectedLastTypeName, "Test context fragment: "+ input);
             djstest.assertAreEqual(info.projection,projection, "Test context fragment: "+ input);
         };
 
         var checkKind = function (metadata, input, expected) {
-            var info = OData.jsonLight.jsonLightPayloadInfo({ "@odata.context" : input}, metadata)
+            var info = OData.json.createPayloadInfo({ "@odata.context" : input}, metadata);
             djstest.assertAreEqual(info.detectedPayloadKind,expected, "Test context fragment: "+ input);
         };
 
@@ -104,7 +104,7 @@
         };
 
         runWithMetadata(success);
-    },'test jsonLightPayloadInfo');
+    },'test createPayloadInfo');
 
 
 })(this);


[2/2] git commit: [OLINGO-408] add more comments

Posted by ko...@apache.org.
[OLINGO-408] add more comments


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/commit/24598e5f
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/tree/24598e5f
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/diff/24598e5f

Branch: refs/heads/master
Commit: 24598e5f9cab6d366d190530372eb20cb48a0d55
Parents: b59d0b2
Author: Sven Kobler <sv...@sap.com>
Authored: Mon Aug 18 15:49:38 2014 +0200
Committer: Sven Kobler <sv...@sap.com>
Committed: Mon Aug 18 15:49:38 2014 +0200

----------------------------------------------------------------------
 datajs/demo/scripts/.gitignore           |   1 +
 datajs/src/lib/cache.js                  |  17 ++-
 datajs/src/lib/cache/source.js           |   6 +-
 datajs/src/lib/datajs.js                 |   1 +
 datajs/src/lib/datajs/deferred.js        |  10 +-
 datajs/src/lib/datajs/utils.js           |  57 +++----
 datajs/src/lib/datajs/xml.js             | 165 ++++++++++-----------
 datajs/src/lib/odata.js                  |   7 +-
 datajs/src/lib/odata/batch.js            |  85 +++++------
 datajs/src/lib/odata/handler.js          |  64 ++++----
 datajs/src/lib/odata/json.js             | 128 ++++++++--------
 datajs/src/lib/odata/metadata.js         |  32 ++--
 datajs/src/lib/odata/net.js              |  41 +++---
 datajs/src/lib/odata/utils.js            | 204 +++++++++++++-------------
 datajs/src/lib/store.js                  |  19 ++-
 datajs/src/lib/store/dom.js              |   6 +-
 datajs/src/lib/store/indexeddb.js        |   5 +-
 datajs/src/lib/store/memory.js           |   5 +-
 datajs/tests/odata-json-parse-tests.html |   1 +
 datajs/tests/odata-json-parse-tests.js   |  12 +-
 20 files changed, 459 insertions(+), 407 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/24598e5f/datajs/demo/scripts/.gitignore
----------------------------------------------------------------------
diff --git a/datajs/demo/scripts/.gitignore b/datajs/demo/scripts/.gitignore
index 863d40c..f7f55d4 100644
--- a/datajs/demo/scripts/.gitignore
+++ b/datajs/demo/scripts/.gitignore
@@ -1 +1,2 @@
 datajs-2*
+tmp/

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/24598e5f/datajs/src/lib/cache.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/cache.js b/datajs/src/lib/cache.js
index 68c571c..4afc5cc 100644
--- a/datajs/src/lib/cache.js
+++ b/datajs/src/lib/cache.js
@@ -43,11 +43,7 @@ var getJsonValueArraryLength = utils.getJsonValueArraryLength;
 var sliceJsonValueArray = utils.sliceJsonValueArray;
 var concatJsonValueArray = utils.concatJsonValueArray;
 
-/** estimateSize (see {@link estimateSize}) */
-exports.estimateSize = estimateSize;
 
-/** createDataCache */  
-exports.createDataCache = createDataCache;
 
 /** Appends a page's data to the operation data.
  * @param {Object} operation - Operation with  (i)ndex, (c)ount and (d)ata.
@@ -363,17 +359,21 @@ function DataCacheOperation(stateMachine, promise, isCancelable, index, count, d
         }
     };
 
+
+
     /** Transitions this operation to a new state.
      * @method DataCacheOperation#transition
      * @param {Object} state - State to transition the operation to.
      * @param {Object} [data] - 
      */
-    that.transition = function (state, data) {
+    var transition = function (state, data) {
         that.s = state;
         stateData = data;
         operationStateMachine(state, cacheState, data);
     };
-
+    
+    that.transition = transition;
+    
     return that;
 }
 
@@ -1436,3 +1436,8 @@ function createDataCache (options) {
 };
 
 
+/** estimateSize (see {@link estimateSize}) */
+exports.estimateSize = estimateSize;
+
+/** createDataCache */  
+exports.createDataCache = createDataCache;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/24598e5f/datajs/src/lib/cache/source.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/cache/source.js b/datajs/src/lib/cache/source.js
index 34780ff..edc41b2 100644
--- a/datajs/src/lib/cache/source.js
+++ b/datajs/src/lib/cache/source.js
@@ -25,8 +25,7 @@ var odataRequest = require("./../odata.js");
 var parseInt10 = utils.parseInt10;
 var normalizeURICase = utils.normalizeURICase;
 
-/** ODataCacheSource (see {@link ODataCacheSource}) */
-exports.ODataCacheSource = ODataCacheSource;
+
 
 
 /** Appends the specified escaped query option to the specified URI.
@@ -202,3 +201,6 @@ function ODataCacheSource (options) {
 }
 
 
+
+/** ODataCacheSource (see {@link ODataCacheSource}) */
+exports.ODataCacheSource = ODataCacheSource;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/24598e5f/datajs/src/lib/datajs.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/datajs.js b/datajs/src/lib/datajs.js
index 6803f5f..3c1e67a 100644
--- a/datajs/src/lib/datajs.js
+++ b/datajs/src/lib/datajs.js
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+/** @module datajs */
 
 //expose all external usable functions via self.apiFunc = function
 exports.version = {

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/24598e5f/datajs/src/lib/datajs/deferred.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/datajs/deferred.js b/datajs/src/lib/datajs/deferred.js
index ac06820..7d5fd68 100644
--- a/datajs/src/lib/datajs/deferred.js
+++ b/datajs/src/lib/datajs/deferred.js
@@ -19,11 +19,7 @@
 
 /** @module datajs/deferred */
 
-/** createDeferred (see {@link createDeferred}) */
-exports.createDeferred = createDeferred;
 
-/** DjsDeferred (see {@link DjsDeferred}) */
-exports.DjsDeferred = DjsDeferred;
 
 /** Creates a new function to forward a call.
  * @param {Object} thisValue - Value to use as the 'this' object.
@@ -185,3 +181,9 @@ function createDeferred() {
 
 
 
+
+/** createDeferred (see {@link module:datajs/deferred~createDeferred}) */
+exports.createDeferred = createDeferred;
+
+/** DjsDeferred (see {@link DjsDeferred}) */
+exports.DjsDeferred = DjsDeferred;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/24598e5f/datajs/src/lib/datajs/utils.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/datajs/utils.js b/datajs/src/lib/datajs/utils.js
index cf586db..5d33207 100644
--- a/datajs/src/lib/datajs/utils.js
+++ b/datajs/src/lib/datajs/utils.js
@@ -19,33 +19,6 @@
 
 /** @module datajs/utils */
 
-exports.activeXObject = activeXObject;
-exports.assigned = assigned;
-exports.contains = contains;
-exports.defined = defined;
-exports.delay = delay;
-exports.djsassert = djsassert;
-exports.extend = extend;
-exports.find = find;
-exports.getURIInfo = getURIInfo;
-exports.isArray = isArray;
-exports.isDate = isDate;
-exports.isObject = isObject;
-exports.normalizeURI = normalizeURI;
-exports.normalizeURICase = normalizeURICase;
-exports.parseInt10 = parseInt10;
-exports.renameProperty = renameProperty;
-exports.throwErrorCallback = throwErrorCallback;
-exports.trimString = trimString;
-exports.undefinedDefault = undefinedDefault;
-exports.decodeBase64 = decodeBase64;
-exports.convertByteArrayToHexString = convertByteArrayToHexString;
-exports.getJsonValueArraryLength = getJsonValueArraryLength;
-exports.sliceJsonValueArray = sliceJsonValueArray;
-exports.concatJsonValueArray = concatJsonValueArray;
-exports.startsWith = startsWith;
-exports.endsWith = endsWith;
-exports.getFormatKind = getFormatKind;
 
 
 /** Creates a new ActiveXObject from the given progId.
@@ -574,4 +547,32 @@ function getFormatKind(format, defaultFormatKind) {
 }
 
 
-    
\ No newline at end of file
+    
+    
+exports.activeXObject = activeXObject;
+exports.assigned = assigned;
+exports.contains = contains;
+exports.defined = defined;
+exports.delay = delay;
+exports.djsassert = djsassert;
+exports.extend = extend;
+exports.find = find;
+exports.getURIInfo = getURIInfo;
+exports.isArray = isArray;
+exports.isDate = isDate;
+exports.isObject = isObject;
+exports.normalizeURI = normalizeURI;
+exports.normalizeURICase = normalizeURICase;
+exports.parseInt10 = parseInt10;
+exports.renameProperty = renameProperty;
+exports.throwErrorCallback = throwErrorCallback;
+exports.trimString = trimString;
+exports.undefinedDefault = undefinedDefault;
+exports.decodeBase64 = decodeBase64;
+exports.convertByteArrayToHexString = convertByteArrayToHexString;
+exports.getJsonValueArraryLength = getJsonValueArraryLength;
+exports.sliceJsonValueArray = sliceJsonValueArray;
+exports.concatJsonValueArray = concatJsonValueArray;
+exports.startsWith = startsWith;
+exports.endsWith = endsWith;
+exports.getFormatKind = getFormatKind;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/24598e5f/datajs/src/lib/datajs/xml.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/datajs/xml.js b/datajs/src/lib/datajs/xml.js
index 16e505f..b8af4fe 100644
--- a/datajs/src/lib/datajs/xml.js
+++ b/datajs/src/lib/datajs/xml.js
@@ -17,6 +17,9 @@
  * under the License.
  */
  
+
+/** @module datajs/xml */
+
 var utils    = require('./utils.js');
 
 var activeXObject = utils.activeXObject;
@@ -39,27 +42,27 @@ var mozillaParserErroNS = http + "www.mozilla.org/newlayout/xml/parsererror.xml"
  * @param {String} text - String to check.
  * @returns {Boolean} true if text has any leading or trailing whitespace; false otherwise.
  */
-var hasLeadingOrTrailingWhitespace = function (text) {
+function hasLeadingOrTrailingWhitespace(text) {
     var re = /(^\s)|(\s$)/;
     return re.test(text);
-};
+}
 
 /** Determines whether the specified text is empty or whitespace.
  * @param {String} text - Value to inspect.
  * @returns {Boolean} true if the text value is empty or all whitespace; false otherwise.
  */
-var isWhitespace = function (text) {
+function isWhitespace(text) {
 
 
     var ws = /^\s*$/;
     return text === null || ws.test(text);
-};
+}
 
 /** Determines whether the specified element has xml:space='preserve' applied.
  * @param domElement - Element to inspect.
  * @returns {Boolean} Whether xml:space='preserve' is in effect.
  */
-var isWhitespacePreserveContext = function (domElement) {
+function isWhitespacePreserveContext(domElement) {
 
 
     while (domElement !== null && domElement.nodeType === 1) {
@@ -74,36 +77,36 @@ var isWhitespacePreserveContext = function (domElement) {
     }
 
     return false;
-};
+}
 
 /** Determines whether the attribute is a XML namespace declaration.
  * @param domAttribute - Element to inspect.
  * @return {Boolean} True if the attribute is a namespace declaration (its name is 'xmlns' or starts with 'xmlns:'; false otherwise.
  */
-var isXmlNSDeclaration = function (domAttribute) {
+function isXmlNSDeclaration(domAttribute) {
     var nodeName = domAttribute.nodeName;
     return nodeName == "xmlns" || nodeName.indexOf("xmlns:") === 0;
-};
+}
 
 /** Safely set as property in an object by invoking obj.setProperty.
  * @param obj - Object that exposes a setProperty method.
  * @param {String} name - Property name
  * @param value - Property value.
  */
-var safeSetProperty = function (obj, name, value) {
+function safeSetProperty(obj, name, value) {
 
 
     try {
         obj.setProperty(name, value);
     } catch (_) { }
-};
+}
 
 /** Creates an configures new MSXML 3.0 ActiveX object.
  * @returns {Object} New MSXML 3.0 ActiveX object.
  * This function throws any exception that occurs during the creation
  * of the MSXML 3.0 ActiveX object.
  */
-var msXmlDom3 = function () {
+function msXmlDom3() {
     var msxml3 = activeXObject("Msxml2.DOMDocument.3.0");
     if (msxml3) {
         safeSetProperty(msxml3, "ProhibitDTD", true);
@@ -112,7 +115,7 @@ var msXmlDom3 = function () {
         safeSetProperty(msxml3, "AllowXsltScript", false);
     }
     return msxml3;
-};
+}
 
 /** Creates an configures new MSXML 6.0 or MSXML 3.0 ActiveX object.
  * @returns {Object} New MSXML 3.0 ActiveX object.
@@ -121,7 +124,7 @@ var msXmlDom3 = function () {
  * happens during the creation of the MSXML 6.0 will be handled by the function while
  * the ones that happend during the creation of the MSXML 3.0 will be thrown.
  */
-var msXmlDom = function () {
+function msXmlDom() {
     try {
         var msxml = activeXObject("Msxml2.DOMDocument.6.0");
         if (msxml) {
@@ -131,7 +134,7 @@ var msXmlDom = function () {
     } catch (_) {
         return msXmlDom3();
     }
-};
+}
 
 /** Parses an XML string using the MSXML DOM.
  * @returns {Object} New MSXML DOMDocument node representing the parsed XML string.
@@ -139,7 +142,7 @@ var msXmlDom = function () {
  * of the MSXML ActiveX object.  It also will throw an exception
  * in case of a parsing error.
  */
-var msXmlParse = function (text) {
+function msXmlParse(text) {
     var dom = msXmlDom();
     if (!dom) {
         return null;
@@ -151,27 +154,27 @@ var msXmlParse = function (text) {
         xmlThrowParserError(parseError.reason, parseError.srcText, text);
     }
     return dom;
-};
+}
 
 /** Throws a new exception containing XML parsing error information.
  * @param exceptionOrReason - String indicating the reason of the parsing failure or Object detailing the parsing error.
  * @param {String} srcText -     String indicating the part of the XML string that caused the parsing error.
  * @param {String} errorXmlText - XML string for wich the parsing failed.
  */
-var xmlThrowParserError = function (exceptionOrReason, srcText, errorXmlText) {
+function xmlThrowParserError(exceptionOrReason, srcText, errorXmlText) {
 
     if (typeof exceptionOrReason === "string") {
         exceptionOrReason = { message: exceptionOrReason };
     }
     throw extend(exceptionOrReason, { srcText: srcText || "", errorXmlText: errorXmlText || "" });
-};
+}
 
 /** Returns an XML DOM document from the specified text.
  * @param {String} text - Document text.
  * @returns XML DOM document.
  * This function will throw an exception in case of a parse error
  */
-var xmlParse = function (text) {
+function xmlParse(text) {
     var domParser = window.DOMParser && new window.DOMParser();
     var dom;
 
@@ -219,22 +222,22 @@ var xmlParse = function (text) {
     }
 
     return dom;
-};
+}
 
 /** Builds a XML qualified name string in the form of "prefix:name".
  * @param {String} prefix - Prefix string (may be null)
  * @param {String} name - Name string to qualify with the prefix.
  * @returns {String} Qualified name.
  */
-var xmlQualifiedName = function (prefix, name) {
+function xmlQualifiedName(prefix, name) {
     return prefix ? prefix + ":" + name : name;
-};
+}
 
 /** Appends a text node into the specified DOM element node.
  * @param domNode - DOM node for the element.
  * @param {String} text - Text to append as a child of element.
 */
-var xmlAppendText = function (domNode, textNode) {
+function xmlAppendText(domNode, textNode) {
     if (hasLeadingOrTrailingWhitespace(textNode.data)) {
         var attr = xmlAttributeNode(domNode, xmlNS, "space");
         if (!attr) {
@@ -245,19 +248,19 @@ var xmlAppendText = function (domNode, textNode) {
     }
     domNode.appendChild(textNode);
     return domNode;
-};
+}
 
 /** Iterates through the XML element's attributes and invokes the callback function for each one.
  * @param element - Wrapped element to iterate over.
  * @param {Function} onAttributeCallback - Callback function to invoke with wrapped attribute nodes.
 */
-var xmlAttributes = function (element, onAttributeCallback) {
+function xmlAttributes(element, onAttributeCallback) {
     var attributes = element.attributes;
     var i, len;
     for (i = 0, len = attributes.length; i < len; i++) {
         onAttributeCallback(attributes.item(i));
     }
-};
+}
 
 /** Returns the value of a DOM element's attribute.
  * @param domNode - DOM node for the owning element.
@@ -265,11 +268,11 @@ var xmlAttributes = function (element, onAttributeCallback) {
  * @param {String} nsURI - Namespace URI of the attribute.
  * @returns {String} - The attribute value, null if not found (may be null)
  */
-var xmlAttributeValue = function (domNode, localName, nsURI) {
+function xmlAttributeValue(domNode, localName, nsURI) {
 
     var attribute = xmlAttributeNode(domNode, localName, nsURI);
     return attribute ? xmlNodeValue(attribute) : null;
-};
+}
 
 /** Gets an attribute node from a DOM element.
  * @param domNode - DOM node for the owning element.
@@ -277,7 +280,7 @@ var xmlAttributeValue = function (domNode, localName, nsURI) {
  * @param {String} nsURI - Namespace URI of the attribute.
  * @returns The attribute node, null if not found.
  */
-var xmlAttributeNode = function (domNode, localName, nsURI) {
+function xmlAttributeNode(domNode, localName, nsURI) {
 
     var attributes = domNode.attributes;
     if (attributes.getNamedItemNS) {
@@ -285,25 +288,25 @@ var xmlAttributeNode = function (domNode, localName, nsURI) {
     }
 
     return attributes.getQualifiedItem(localName, nsURI) || null;
-};
+}
 
 /** Gets the value of the xml:base attribute on the specified element.
  * @param domNode - Element to get xml:base attribute value from.
  * @param [baseURI] - Base URI used to normalize the value of the xml:base attribute ( may be null)
  * @returns {String} Value of the xml:base attribute if found; the baseURI or null otherwise.
  */
-var xmlBaseURI = function (domNode, baseURI) {
+function xmlBaseURI(domNode, baseURI) {
 
     var base = xmlAttributeNode(domNode, "base", xmlNS);
     return (base ? normalizeURI(base.value, baseURI) : baseURI) || null;
-};
+}
 
 
 /** Iterates through the XML element's child DOM elements and invokes the callback function for each one.
  * @param element - DOM Node containing the DOM elements to iterate over.
  * @param {Function} onElementCallback - Callback function to invoke for each child DOM element.
 */
-var xmlChildElements = function (domNode, onElementCallback) {
+function xmlChildElements(domNode, onElementCallback) {
 
     xmlTraverse(domNode, /*recursive*/false, function (child) {
         if (child.nodeType === 1) {
@@ -312,7 +315,7 @@ var xmlChildElements = function (domNode, onElementCallback) {
         // continue traversing.
         return true;
     });
-};
+}
 
 /** Gets the descendant element under root that corresponds to the specified path and namespace URI.
  * @param root - DOM element node from which to get the descendant element.
@@ -322,14 +325,14 @@ var xmlChildElements = function (domNode, onElementCallback) {
  * All the elements in the path are matched against namespaceURI.
  * The function will stop searching on the first element that doesn't match the namespace and the path.
  */
-var xmlFindElementByPath = function (root, namespaceURI, path) {
+function xmlFindElementByPath(root, namespaceURI, path) {
     var parts = path.split("/");
     var i, len;
     for (i = 0, len = parts.length; i < len; i++) {
         root = root && xmlFirstChildElement(root, namespaceURI, parts[i]);
     }
     return root || null;
-};
+}
 
 /** Gets the DOM element or DOM attribute node under root that corresponds to the specified path and namespace URI.
  * @param root - DOM element node from which to get the descendant node.
@@ -341,7 +344,7 @@ var xmlFindElementByPath = function (root, namespaceURI, path) {
 * The traversal stops when the whole path has been exahusted or a node that doesn't belogong the specified namespace is encountered.
 * The last segment of the path may be decorated with a starting @ character to indicate that the desired node is a DOM attribute.
 */
-var xmlFindNodeByPath = function (root, namespaceURI, path) {
+function xmlFindNodeByPath(root, namespaceURI, path) {
     
 
     var lastSegmentStart = path.lastIndexOf("/");
@@ -356,7 +359,7 @@ var xmlFindNodeByPath = function (root, namespaceURI, path) {
         return xmlFirstChildElement(node, namespaceURI, nodePath);
     }
     return null;
-};
+}
 
 /** Returns the first child DOM element under the specified DOM node that matches the specified namespace URI and local name.
  * @param domNode - DOM node from which the child DOM element is going to be retrieved.
@@ -364,10 +367,10 @@ var xmlFindNodeByPath = function (root, namespaceURI, path) {
  * @param {String} [localName] - 
  * @return The node's first child DOM element that matches the specified namespace URI and local name; null otherwise.</returns>
  */
-var xmlFirstChildElement = function (domNode, namespaceURI, localName) {
+function xmlFirstChildElement(domNode, namespaceURI, localName) {
 
     return xmlFirstElementMaybeRecursive(domNode, namespaceURI, localName, /*recursive*/false);
-};
+}
 
 /** Returns the first descendant DOM element under the specified DOM node that matches the specified namespace URI and local name.
  * @param domNode - DOM node from which the descendant DOM element is going to be retrieved.
@@ -375,13 +378,13 @@ var xmlFirstChildElement = function (domNode, namespaceURI, localName) {
  * @param {String} [localName] - 
  * @return The node's first descendant DOM element that matches the specified namespace URI and local name; null otherwise.
 */
-var xmlFirstDescendantElement = function (domNode, namespaceURI, localName) {
+function xmlFirstDescendantElement(domNode, namespaceURI, localName) {
     if (domNode.getElementsByTagNameNS) {
         var result = domNode.getElementsByTagNameNS(namespaceURI, localName);
         return result.length > 0 ? result[0] : null;
     }
     return xmlFirstElementMaybeRecursive(domNode, namespaceURI, localName, /*recursive*/true);
-};
+}
 
 /** Returns the first descendant DOM element under the specified DOM node that matches the specified namespace URI and local name.
  * @param domNode - DOM node from which the descendant DOM element is going to be retrieved.
@@ -392,7 +395,7 @@ var xmlFirstDescendantElement = function (domNode, namespaceURI, localName) {
  * - False if the search should be scoped only to the direct children of the DOM node.
  * @return The node's first descendant DOM element that matches the specified namespace URI and local name; null otherwise.
  */
-var xmlFirstElementMaybeRecursive = function (domNode, namespaceURI, localName, recursive) {
+function xmlFirstElementMaybeRecursive(domNode, namespaceURI, localName, recursive) {
 
     var firstElement = null;
     xmlTraverse(domNode, recursive, function (child) {
@@ -407,13 +410,13 @@ var xmlFirstElementMaybeRecursive = function (domNode, namespaceURI, localName,
         return firstElement === null;
     });
     return firstElement;
-};
+}
 
 /** Gets the concatenated value of all immediate child text and CDATA nodes for the specified element.
  * @param domElement - Element to get values for.
  * @returns {String} Text for all direct children.
  */
-var xmlInnerText = function (xmlElement) {
+function xmlInnerText(xmlElement) {
 
     var result = null;
     var root = (xmlElement.nodeType === 9 && xmlElement.documentElement) ? xmlElement.documentElement : xmlElement;
@@ -454,37 +457,37 @@ var xmlInnerText = function (xmlElement) {
         return true;
     });
     return result;
-};
+}
 
 /** Returns the localName of a XML node.
  * @param domNode - DOM node to get the value from.
  * @returns {String} localName of domNode.
  */
-var xmlLocalName = function (domNode) {
+function xmlLocalName(domNode) {
 
     return domNode.localName || domNode.baseName;
-};
+}
 
 /** Returns the namespace URI of a XML node.
  * @param node - DOM node to get the value from.
  * @returns {String} Namespace URI of domNode.
  */
-var xmlNamespaceURI = function (domNode) {
+function xmlNamespaceURI(domNode) {
 
     return domNode.namespaceURI || null;
-};
+}
 
 /** Returns the value or the inner text of a XML node.
  * @param node - DOM node to get the value from.
  * @return Value of the domNode or the inner text if domNode represents a DOM element node.
  */
-var xmlNodeValue = function (domNode) {
+function xmlNodeValue(domNode) {
     
     if (domNode.nodeType === 1) {
         return xmlInnerText(domNode);
     }
     return domNode.nodeValue;
-};
+}
 
 /** Walks through the descendants of the domNode and invokes a callback for each node.
  * @param domNode - DOM node whose descendants are going to be traversed.
@@ -493,7 +496,7 @@ var xmlNodeValue = function (domNode) {
  * - False if the traversal should be scoped only to the direct children of the DOM node.
  * @returns {String} Namespace URI of node.
  */
-var xmlTraverse = function (domNode, recursive, onChildCallback) {
+function xmlTraverse(domNode, recursive, onChildCallback) {
 
     var subtrees = [];
     var child = domNode.firstChild;
@@ -507,7 +510,7 @@ var xmlTraverse = function (domNode, recursive, onChildCallback) {
             child = child.nextSibling || subtrees.shift();
         }
     }
-};
+}
 
 /** Returns the next sibling DOM element of the specified DOM node.
  * @param domNode - DOM node from which the next sibling is going to be retrieved.
@@ -515,7 +518,7 @@ var xmlTraverse = function (domNode, recursive, onChildCallback) {
  * @param {String} [localName] - 
  * @return The node's next sibling DOM element, null if there is none.</returns>
  */
-var xmlSiblingElement = function (domNode, namespaceURI, localName) {
+function xmlSiblingElement(domNode, namespaceURI, localName) {
 
     var sibling = domNode.nextSibling;
     while (sibling) {
@@ -530,7 +533,7 @@ var xmlSiblingElement = function (domNode, namespaceURI, localName) {
         sibling = sibling.nextSibling;
     }
     return null;
-};
+}
 
 /** Creates a new empty DOM document node.
  * @return New DOM document node.</returns>
@@ -542,14 +545,12 @@ var xmlSiblingElement = function (domNode, namespaceURI, localName) {
  * for creating an MXSML 3.0 DOM will be made.  If this last attemp fails or
  * the browser doesn't support ActiveXObject then an exception will be thrown.
  */
-var xmlDom = function () {
-    
-
+function xmlDom() {
     var implementation = window.document.implementation;
     return (implementation && implementation.createDocument) ?
        implementation.createDocument(null, null, null) :
        msXmlDom();
-};
+}
 
 /** Appends a collection of child nodes or string values to a parent DOM node.
  * @param parent - DOM node to which the children will be appended.
@@ -558,7 +559,7 @@ var xmlDom = function () {
  *  If a value in the children collection is a string, then a new DOM text node is going to be created
  *  for it and then appended to the parent.
  */
-var xmlAppendChildren = function (parent, children) {
+function xmlAppendChildren(parent, children) {
     if (!isArray(children)) {
         return xmlAppendChild(parent, children);
     }
@@ -568,7 +569,7 @@ var xmlAppendChildren = function (parent, children) {
         children[i] && xmlAppendChild(parent, children[i]);
     }
     return parent;
-};
+}
 
 /** Appends a child node or a string value to a parent DOM node.
  * @param parent - DOM node to which the child will be appended.
@@ -577,7 +578,7 @@ var xmlAppendChildren = function (parent, children) {
  * If child is a string value, then a new DOM text node is going to be created
  * for it and then appended to the parent.
  */
-var xmlAppendChild = function (parent, child) {
+function xmlAppendChild(parent, child) {
 
     djsassert(parent !== child, "xmlAppendChild() - parent and child are one and the same!");
     if (child) {
@@ -591,7 +592,7 @@ var xmlAppendChild = function (parent, child) {
         }
     }
     return parent;
-};
+}
 
 /** Creates a new DOM attribute node.
  * @param dom - DOM document used to create the attribute.
@@ -599,7 +600,7 @@ var xmlAppendChild = function (parent, child) {
  * @param {String} namespaceURI - Namespace URI.
  * @return DOM attribute node for the namespace declaration.
  */
-var xmlNewAttribute = function (dom, namespaceURI, qualifiedName, value) {
+function xmlNewAttribute(dom, namespaceURI, qualifiedName, value) {
 
     var attribute =
         dom.createAttributeNS && dom.createAttributeNS(namespaceURI, qualifiedName) ||
@@ -607,7 +608,7 @@ var xmlNewAttribute = function (dom, namespaceURI, qualifiedName, value) {
 
     attribute.value = value || "";
     return attribute;
-};
+}
 
 /** Creates a new DOM element node.
  * @param dom - DOM document used to create the DOM element.
@@ -618,13 +619,13 @@ var xmlNewAttribute = function (dom, namespaceURI, qualifiedName, value) {
  * If a value in the children collection is a string, then a new DOM text node is going to be created
  * for it and then appended to the new DOM element.
  */
-var xmlNewElement = function (dom, nampespaceURI, qualifiedName, children) {
+function xmlNewElement(dom, nampespaceURI, qualifiedName, children) {
     var element =
         dom.createElementNS && dom.createElementNS(nampespaceURI, qualifiedName) ||
         dom.createNode(1, qualifiedName, nampespaceURI || undefined);
 
     return xmlAppendChildren(element, children || []);
-};
+}
 
 /** Creates a namespace declaration attribute.
  * @param dom - DOM document used to create the attribute.
@@ -632,16 +633,16 @@ var xmlNewElement = function (dom, nampespaceURI, qualifiedName, children) {
  * @param {String} prefix - Namespace prefix.
  * @return DOM attribute node for the namespace declaration.</returns>
  */
-var xmlNewNSDeclaration = function (dom, namespaceURI, prefix) {
+function xmlNewNSDeclaration(dom, namespaceURI, prefix) {
     return xmlNewAttribute(dom, xmlnsNS, xmlQualifiedName("xmlns", prefix), namespaceURI);
-};
+}
 
 /** Creates a new DOM document fragment node for the specified xml text.
  * @param dom - DOM document from which the fragment node is going to be created.
  * @param {String} text XML text to be represented by the XmlFragment.
  * @return New DOM document fragment object.
  */
-var xmlNewFragment = function (dom, text) {
+function xmlNewFragment(dom, text) {
 
     var value = "<c>" + text + "</c>";
     var tempDom = xmlParse(value);
@@ -655,16 +656,16 @@ var xmlNewFragment = function (dom, text) {
         importedChild = importedChild.nextSibling;
     }
     return fragment;
-};
+}
 
 /** Creates new DOM text node.
  * @param dom - DOM document used to create the text node.
  * @param {String} text - Text value for the DOM text node.
  * @return DOM text node.</returns>
  */ 
-var xmlNewText = function (dom, text) {
+function xmlNewText(dom, text) {
     return dom.createTextNode(text);
-};
+}
 
 /** Creates a new DOM element or DOM attribute node as specified by path and appends it to the DOM tree pointed by root.
  * @param dom - DOM document used to create the new node.
@@ -679,7 +680,7 @@ var xmlNewText = function (dom, text) {
  * The last segment of the path may be decorated with a starting @ character. In this case a new DOM attribute node
  * will be created.
  */
-var xmlNewNodeByPath = function (dom, root, namespaceURI, prefix, path) {
+function xmlNewNodeByPath(dom, root, namespaceURI, prefix, path) {
     var name = "";
     var parts = path.split("/");
     var xmlFindNode = xmlFirstChildElement;
@@ -703,13 +704,13 @@ var xmlNewNodeByPath = function (dom, root, namespaceURI, prefix, path) {
         xmlNode = childNode;
     }
     return xmlNode;
-};
+}
 
 /** Returns the text representation of the document to which the specified node belongs.
  * @param root - Wrapped element in the document to serialize.
  * @returns {String} Serialized document.
 */
-var xmlSerialize = function (domNode) {
+function xmlSerialize(domNode) {
     var xmlSerializer = window.XMLSerializer;
     if (xmlSerializer) {
         var serializer = new xmlSerializer();
@@ -721,13 +722,13 @@ var xmlSerialize = function (domNode) {
     }
 
     throw { message: "XML serialization unsupported" };
-};
+}
 
 /** Returns the XML representation of the all the descendants of the node.
  * @param domNode - Node to serialize.</param>
  * @returns {String} The XML representation of all the descendants of the node.
  */
-var xmlSerializeDescendants = function (domNode) {
+function xmlSerializeDescendants(domNode) {
     var children = domNode.childNodes;
     var i, len = children.length;
     if (len === 0) {
@@ -758,13 +759,13 @@ var xmlSerializeDescendants = function (domNode) {
     }
 
     return xml;
-};
+}
 
 /** Returns the XML representation of the node and all its descendants.
  * @param domNode - Node to serialize
  * @returns {String} The XML representation of the node and all its descendants.
  */
-var xmlSerializeNode = function (domNode) {
+function xmlSerializeNode(domNode) {
 
     var xml = domNode.xml;
     if (xml !== undefined) {
@@ -777,7 +778,7 @@ var xmlSerializeNode = function (domNode) {
     }
 
     throw { message: "XML serialization unsupported" };
-};
+}
 
 exports.http = http;
 exports.w3org = w3org;

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/24598e5f/datajs/src/lib/odata.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/odata.js b/datajs/src/lib/odata.js
index 36343fb..d971025 100644
--- a/datajs/src/lib/odata.js
+++ b/datajs/src/lib/odata.js
@@ -17,6 +17,8 @@
  * under the License.
  */
 
+ /** @module odata */
+
 // Imports
 var odataUtils    = exports.utils     = require('./odata/utils.js');
 var odataHandler  = exports.handler   = require('./odata/handler.js');
@@ -25,7 +27,7 @@ var odataNet      = exports.net       = require('./odata/net.js');
 var odataJson     = exports.json      = require('./odata/json.js');
                     exports.batch     = require('./odata/batch.js');
                     
-exports.metadataHandler =  odataMetadata.metadataHandler;
+
 
 var utils = require('./datajs/utils.js');
 var assigned = utils.assigned;
@@ -47,7 +49,7 @@ var handlers = [odataJson.jsonHandler, odataHandler.textHandler];
  * @param {Object} requestOrResponse - request/response argument for delegated call.
  * @param {Object} context - context argument for delegated call.
  */
-var dispatchHandler = function (handlerMethod, requestOrResponse, context) {
+function dispatchHandler(handlerMethod, requestOrResponse, context) {
 
     var i, len;
     for (i = 0, len = handlers.length; i < len && !handlers[i][handlerMethod](requestOrResponse, context); i++) {
@@ -173,3 +175,4 @@ exports.parseMetadata = function (csdlMetadataDocument) {
 
 // Configure the batch handler to use the default handler for the batch parts.
 exports.batch.batchHandler.partHandler = exports.defaultHandler;
+exports.metadataHandler =  odataMetadata.metadataHandler;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/24598e5f/datajs/src/lib/odata/batch.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/odata/batch.js b/datajs/src/lib/odata/batch.js
index a6d850e..5b006ff 100644
--- a/datajs/src/lib/odata/batch.js
+++ b/datajs/src/lib/odata/batch.js
@@ -17,17 +17,12 @@
  * under the License.
  */
 
-/* {
-    oldname:'odata-batch.js',
-    updated:'20140514 12:59'
-}*/
+/** @module odata/batch */
 
 var utils    = require('./../datajs.js').utils;
 var odataUtils    = require('./utils.js');
 var odataHandler = require('./handler.js');
 
-// Imports
-
 var extend = utils.extend;
 var isArray = utils.isArray;
 var trimString = utils.trimString;
@@ -40,6 +35,14 @@ var normalizeHeaders = odataUtils.normalizeHeaders;
 //TODO var payloadTypeOf = odata.payloadTypeOf;
 var prepareRequest = odataUtils.prepareRequest;
 
+
+
+
+
+// Imports
+
+
+
 // CONTENT START
 var batchMediaType = "multipart/mixed";
 var responseStatusRegex = /^HTTP\/1\.\d (\d{3}) (.*)$/i;
@@ -48,37 +51,37 @@ var responseHeaderRegex = /^([^()<>@,;:\\"\/[\]?={} \t]+)\s?:\s?(.*)/;
 /* Calculates a random 16 bit number and returns it in hexadecimal format.
  * @returns {String} A 16-bit number in hex format.
  */
-var hex16 = function () {
+function hex16() {
 
     return Math.floor((1 + Math.random()) * 0x10000).toString(16).substr(1);
-};
+}
 
 /* Creates a string that can be used as a multipart request boundary.
  * @param {String} [prefix] - 
  * @returns {String} Boundary string of the format: <prefix><hex16>-<hex16>-<hex16>
  */
-var createBoundary = function (prefix) {
+function createBoundary(prefix) {
 
     return prefix + hex16() + "-" + hex16() + "-" + hex16();
-};
+}
 
 /* Gets the handler for data serialization of individual requests / responses in a batch.
  * @param context - Context used for data serialization.
  * @returns Handler object
  */
-var partHandler = function (context) {
+function partHandler(context) {
 
     return context.handler.partHandler;
-};
+}
 
 /* Gets the current boundary used for parsing the body of a multipart response.
  * @param context - Context used for parsing a multipart response.
  * @returns {String} Boundary string.
  */
-var currentBoundary = function (context) {
+function currentBoundary(context) {
     var boundaries = context.boundaries;
     return boundaries[boundaries.length - 1];
-};
+}
 
 /** Parses a batch response.
  * @param handler - This handler.
@@ -86,11 +89,11 @@ var currentBoundary = function (context) {
  * @param {Object} context - Object with parsing context.
  * @return An object representation of the batch.
  */
-var batchParser = function (handler, text, context) {
+function batchParser(handler, text, context) {
 
     var boundary = context.contentType.properties["boundary"];
     return { __batchResponses: readBatch(text, { boundaries: [boundary], handlerContext: context }) };
-};
+}
 
 /** Serializes a batch object representation into text.
  * @param handler - This handler.
@@ -98,20 +101,20 @@ var batchParser = function (handler, text, context) {
  * @param {Object} context - Object with parsing context.
  * @return An text representation of the batch object; undefined if not applicable.#
  */
-var batchSerializer = function (handler, data, context) {
+function batchSerializer(handler, data, context) {
 
     var cType = context.contentType = context.contentType || contentType(batchMediaType);
     if (cType.mediaType === batchMediaType) {
         return writeBatch(data, context);
     }
-};
+}
 
 /* Parses a multipart/mixed response body from from the position defined by the context.
  * @param {String}  text - Body of the multipart/mixed response.
  * @param context - Context used for parsing.
  * @return Array of objects representing the individual responses.
  */
-var readBatch = function (text, context) {
+function readBatch(text, context) {
     var delimiter = "--" + currentBoundary(context);
 
     // Move beyond the delimiter and read the complete batch
@@ -130,7 +133,7 @@ var readBatch = function (text, context) {
 
         var changeResponses;
         if (partContentType && partContentType.mediaType === batchMediaType) {
-            context.boundaries.push(partContentType.properties["boundary"]);
+            context.boundaries.push(partContentType.properties.boundary);
             try {
                 changeResponses = readBatch(text, context);
             } catch (e) {
@@ -168,7 +171,7 @@ var readBatch = function (text, context) {
         readLine(text, context);
     }
     return responses;
-};
+}
 
 /* Parses the http headers in the text from the position defined by the context.
 * @param {String} text - Text containing an http response's headers</param>
@@ -176,7 +179,7 @@ var readBatch = function (text, context) {
 * @returns Object containing the headers as key value pairs.
 * This function doesn't support split headers and it will stop reading when it hits two consecutive line breaks.
 */
-var readHeaders = function (text, context) {
+function readHeaders(text, context) {
     var headers = {};
     var parts;
     var line;
@@ -197,7 +200,7 @@ var readHeaders = function (text, context) {
     normalizeHeaders(headers);
 
     return headers;
-};
+}
 
 /* Parses an HTTP response.
  * @param {String} text -Text representing the http response.
@@ -205,7 +208,7 @@ var readHeaders = function (text, context) {
  * @param {String} delimiter -String used as delimiter of the multipart response parts.
  * @return Object representing the http response.
  */
-var readResponse = function (text, context, delimiter) {
+function readResponse(text, context, delimiter) {
     // Read the status line.
     var pos = context.position;
     var match = responseStatusRegex.exec(readLine(text, context));
@@ -229,17 +232,17 @@ var readResponse = function (text, context, delimiter) {
         headers: headers,
         body: readTo(text, context, "\r\n" + delimiter)
     };
-};
+}
 
 /** Returns a substring from the position defined by the context up to the next line break (CRLF).
  * @param {String} text - Input string.
  * @param context - Context used for reading the input string.
  * @returns {String} Substring to the first ocurrence of a line break or null if none can be found. 
  */
-var readLine = function (text, context) {
+function readLine(text, context) {
 
     return readTo(text, context, "\r\n");
-};
+}
 
 /** Returns a substring from the position given by the context up to value defined by the str parameter and increments the position in the context.
  * @param {String} text - Input string.</param>
@@ -247,7 +250,7 @@ var readLine = function (text, context) {
  * @param {String} [str] - Substring to read up to.
  * @returns {String} Substring to the first ocurrence of str or the end of the input string if str is not specified. Null if the marker is not found.
  */
-var readTo = function (text, context, str) {
+function readTo(text, context, str) {
     var start = context.position || 0;
     var end = text.length;
     if (str) {
@@ -261,14 +264,14 @@ var readTo = function (text, context, str) {
     }
 
     return text.substring(start, end);
-};
+}
 
 /** Serializes a batch request object to a string.
  * @param data - Batch request object in payload representation format
  * @param context - Context used for the serialization
  * @returns {String} String representing the batch request
  */
-var writeBatch = function (data, context) {
+function writeBatch(data, context) {
     if (!isBatch(data)) {
         throw { message: "Data is not a batch object." };
     }
@@ -288,21 +291,21 @@ var writeBatch = function (data, context) {
     contentTypeProperties.boundary = batchBoundary;
 
     return batch;
-};
+}
 
 /** Creates the delimiter that indicates that start or end of an individual request.
  * @param {String} boundary Boundary string used to indicate the start of the request</param>
  * @param {Boolean} close - Flag indicating that a close delimiter string should be generated
  * @returns {String} Delimiter string
  */
-var writeBatchPartDelimiter = function (boundary, close) {
+function writeBatchPartDelimiter(boundary, close) {
     var result = "\r\n--" + boundary;
     if (close) {
         result += "--";
     }
 
     return result + "\r\n";
-};
+}
 
 /** Serializes a part of a batch request to a string. A part can be either a GET request or
  * a change set grouping several CUD (create, update, delete) requests.
@@ -312,7 +315,7 @@ var writeBatchPartDelimiter = function (boundary, close) {
  * @returns {String} String representing the serialized part
  * A change set is an array of request objects and they cannot be nested inside other change sets.
  */
-var writeBatchPart = function (part, context, nested) {
+function writeBatchPart(part, context, nested) {
     
 
     var changeSet = part.__changeRequests;
@@ -343,13 +346,13 @@ var writeBatchPart = function (part, context, nested) {
     }
 
     return result;
-};
+}
 
 /* Serializes a request object to a string.
  * @param request - Request object to serialize</param>
  * @returns {String} String representing the serialized request
  */
-var writeRequest = function (request) {
+function writeRequest(request) {
     var result = (request.method ? request.method : "GET") + " " + request.requestUri + " HTTP/1.1\r\n";
     for (var name in request.headers) {
         if (request.headers[name]) {
@@ -364,11 +367,11 @@ var writeRequest = function (request) {
     }
 
     return result;
-};
+}
+
 
-exports.batchHandler = handler(batchParser, batchSerializer, batchMediaType, MAX_DATA_SERVICE_VERSION);
 
-// DATAJS INTERNAL START
+/** batchHandler (see {@link module:odata/batch~batchParser}) */
+exports.batchHandler = handler(batchParser, batchSerializer, batchMediaType, MAX_DATA_SERVICE_VERSION);
 exports.batchSerializer = batchSerializer;
-exports.writeRequest = writeRequest;
-// DATAJS INTERNAL END
+exports.writeRequest = writeRequest;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/24598e5f/datajs/src/lib/odata/handler.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/odata/handler.js b/datajs/src/lib/odata/handler.js
index 01e368f..3e85a1e 100644
--- a/datajs/src/lib/odata/handler.js
+++ b/datajs/src/lib/odata/handler.js
@@ -17,6 +17,9 @@
  * under the License.
  */
 
+/** @module odata/handler */
+
+
 var utils    = require('./../datajs.js').utils;
 var oDataUtils    = require('./utils.js');
 
@@ -31,7 +34,7 @@ var MAX_DATA_SERVICE_VERSION = "4.0";
  * @param {String} str - String with media type to parse.
  * @return null if the string is empty; an object with 'mediaType' and a 'properties' dictionary otherwise.
  */
-var contentType = function (str) {
+function contentType(str) {
 
     if (!str) {
         return null;
@@ -47,13 +50,13 @@ var contentType = function (str) {
     }
 
     return { mediaType: trimString(contentTypeParts[0]), properties: properties };
-};
+}
 
 /** Serializes an object with media type and properties dictionary into a string.
  * @param contentType - Object with media type and properties dictionary to serialize.
  * @return String representation of the media type object; undefined if contentType is null or undefined.</returns>
  */
-var contentTypeToString = function (contentType) {
+function contentTypeToString(contentType) {
     if (!contentType) {
         return undefined;
     }
@@ -64,7 +67,7 @@ var contentTypeToString = function (contentType) {
         result += ";" + property + "=" + contentType.properties[property];
     }
     return result;
-};
+}
 
 /** Creates an object that is going to be used as the context for the handler's parser and serializer.
  * @param contentType - Object with media type and properties dictionary.
@@ -73,7 +76,7 @@ var contentTypeToString = function (contentType) {
  * @param handler - Handler object that is processing a resquest or response.
  * @return Context object.</returns>
  */
-var createReadWriteContext = function (contentType, dataServiceVersion, context, handler) {
+function createReadWriteContext(contentType, dataServiceVersion, context, handler) {
 
     var rwContext = {};
     extend(rwContext, context);
@@ -84,14 +87,14 @@ var createReadWriteContext = function (contentType, dataServiceVersion, context,
     });
 
     return rwContext;
-};
+}
 
 /** Sets a request header's value. If the header has already a value other than undefined, null or empty string, then this method does nothing.
  * @param request - Request object on which the header will be set.
  * @param {String} name - Header name.
  * @param {String} value - Header value.
  */
-var fixRequestHeader = function (request, name, value) {
+function fixRequestHeader(request, name, value) {
     if (!request) {
         return;
     }
@@ -100,48 +103,48 @@ var fixRequestHeader = function (request, name, value) {
     if (!headers[name]) {
         headers[name] = value;
     }
-};
+}
 
 /** Sets the DataServiceVersion header of the request if its value is not yet defined or of a lower version.
  * @param request - Request object on which the header will be set.
  * @param {String} version - Version value.
  *  If the request has already a version value higher than the one supplied the this function does nothing.
  */
-var fixDataServiceVersionHeader = function (request, version) {   
+function fixDataServiceVersionHeader(request, version) {   
 
     if (request) {
         var headers = request.headers;
         var dsv = headers["OData-Version"];
         headers["OData-Version"] = dsv ? maxVersion(dsv, version) : version;
     }
-};
+}
 
 /** Gets the value of a request or response header.
  * @param requestOrResponse - Object representing a request or a response.
  * @param {String} name - Name of the header to retrieve.
  * @returns {String} String value of the header; undefined if the header cannot be found.
  */
-var getRequestOrResponseHeader = function (requestOrResponse, name) {
+function getRequestOrResponseHeader(requestOrResponse, name) {
 
     var headers = requestOrResponse.headers;
     return (headers && headers[name]) || undefined;
-};
+}
 
 /** Gets the value of the Content-Type header from a request or response.
  * @param requestOrResponse - Object representing a request or a response.
  * @returns {Object} Object with 'mediaType' and a 'properties' dictionary; null in case that the header is not found or doesn't have a value.
  */
-var getContentType = function (requestOrResponse) {
+function getContentType(requestOrResponse) {
 
     return contentType(getRequestOrResponseHeader(requestOrResponse, "Content-Type"));
-};
+}
 
 var versionRE = /^\s?(\d+\.\d+);?.*$/;
 /** Gets the value of the DataServiceVersion header from a request or response.
  * @param requestOrResponse - Object representing a request or a response.
  * @returns {String} Data service version; undefined if the header cannot be found.
  */
-var getDataServiceVersion = function (requestOrResponse) {
+function getDataServiceVersion(requestOrResponse) {
 
     var value = getRequestOrResponseHeader(requestOrResponse, "OData-Version");
     if (value) {
@@ -152,7 +155,7 @@ var getDataServiceVersion = function (requestOrResponse) {
     }
 
     // Fall through and return undefined.
-};
+}
 
 /** Checks that a handler can process a particular mime type.
  * @param handler - Handler object that is processing a resquest or response.
@@ -162,9 +165,9 @@ var getDataServiceVersion = function (requestOrResponse) {
  * The following check isn't as strict because if cType.mediaType = application/; it will match an accept value of "application/xml";
  * however in practice we don't not expect to see such "suffixed" mimeTypes for the handlers.
  */
-var handlerAccepts = function (handler, cType) {
+function handlerAccepts(handler, cType) {
     return handler.accept.indexOf(cType.mediaType) >= 0;
-};
+}
 
 /** Invokes the parser associated with a handler for reading the payload of a HTTP response.
  * @param handler - Handler object that is processing the response.
@@ -173,7 +176,7 @@ var handlerAccepts = function (handler, cType) {
  * @param context - Object used as the context for processing the response.
  * @returns {Boolean} True if the handler processed the response payload and the response.data property was set; false otherwise.
  */
-var handlerRead = function (handler, parseCallback, response, context) {
+function handlerRead(handler, parseCallback, response, context) {
 
     if (!response || !response.headers) {
         return false;
@@ -195,7 +198,7 @@ var handlerRead = function (handler, parseCallback, response, context) {
     }
 
     return false;
-};
+}
 
 /** Invokes the serializer associated with a handler for generating the payload of a HTTP request.
  * @param handler - Handler object that is processing the request.
@@ -204,7 +207,7 @@ var handlerRead = function (handler, parseCallback, response, context) {
  * @param context - Object used as the context for serializing the request.
  * @returns {Boolean} True if the handler serialized the request payload and the request.body property was set; false otherwise.
  */
-var handlerWrite = function (handler, serializeCallback, request, context) {
+function handlerWrite(handler, serializeCallback, request, context) {
     if (!request || !request.headers) {
         return false;
     }
@@ -228,7 +231,7 @@ var handlerWrite = function (handler, serializeCallback, request, context) {
     }
 
     return false;
-};
+}
 
 /** Creates a handler object for processing HTTP requests and responses.
  * @param {Function} parseCallback - Parser function that will process the response payload.
@@ -237,7 +240,7 @@ var handlerWrite = function (handler, serializeCallback, request, context) {
  * @param {String} maxDataServiceVersion - String indicating the highest version of the protocol that this handler can work with.
  * @returns {Object} Handler object.
  */
-var handler = function (parseCallback, serializeCallback, accept, maxDataServiceVersion) {
+function handler(parseCallback, serializeCallback, accept, maxDataServiceVersion) {
 
     return {
         accept: accept,
@@ -251,19 +254,22 @@ var handler = function (parseCallback, serializeCallback, accept, maxDataService
             return handlerWrite(this, serializeCallback, request, context);
         }
     };
-};
+}
 
-var textParse = function (handler, body /*, context */) {
+function textParse(handler, body /*, context */) {
     return body;
-};
+}
 
-var textSerialize = function (handler, data /*, context */) {
+function textSerialize(handler, data /*, context */) {
     if (assigned(data)) {
         return data.toString();
     } else {
         return undefined;
     }
-};
+}
+
+
+
 
 exports.textHandler = handler(textParse, textSerialize, "text/plain", MAX_DATA_SERVICE_VERSION);
 
@@ -275,4 +281,4 @@ exports.fixRequestHeader = fixRequestHeader;
 exports.getRequestOrResponseHeader = getRequestOrResponseHeader;
 exports.getContentType = getContentType;
 exports.getDataServiceVersion = getDataServiceVersion;
-exports.MAX_DATA_SERVICE_VERSION = MAX_DATA_SERVICE_VERSION;
+exports.MAX_DATA_SERVICE_VERSION = MAX_DATA_SERVICE_VERSION;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/24598e5f/datajs/src/lib/odata/json.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/odata/json.js b/datajs/src/lib/odata/json.js
index 61558e7..224e881 100644
--- a/datajs/src/lib/odata/json.js
+++ b/datajs/src/lib/odata/json.js
@@ -17,6 +17,10 @@
  * under the License.
  */
 
+/** @module odata/json */
+
+
+
 var utils        = require('./../datajs.js').utils;
 var oDataUtils   = require('./utils.js');
 var oDataHandler = require('./handler.js');
@@ -93,7 +97,7 @@ var jsonDateRE = /^\/Date\((-?\d+)(\+|-)?(\d+)?\)\/$/;
  * @param {Number} minutes - Number of minutes to format.
  * @returns {String} The minutes in (+/-)hh:mm format.
  */
-var minutesToOffset = function (minutes) {
+function minutesToOffset(minutes) {
 
     var sign;
     if (minutes < 0) {
@@ -107,13 +111,13 @@ var minutesToOffset = function (minutes) {
     minutes = minutes - (60 * hours);
 
     return sign + formatNumberWidth(hours, 2) + ":" + formatNumberWidth(minutes, 2);
-};
+}
 
 /** Parses the JSON Date representation into a Date object.
  * @param {String} value - String value.
  * @returns {Date} A Date object if the value matches one; falsy otherwise.
  */
-var parseJsonDateString = function (value) {
+function parseJsonDateString(value) {
 
     var arr = value && jsonDateRE.exec(value);
     if (arr) {
@@ -138,7 +142,7 @@ var parseJsonDateString = function (value) {
     }
 
     // Allow undefined to be returned.
-};
+}
 
 // Some JSON implementations cannot produce the character sequence \/
 // which is needed to format DateTime and DateTimeOffset into the
@@ -152,7 +156,7 @@ var parseJsonDateString = function (value) {
  * @param {Object} context - Object with parsing context.
  * @return An object representation of the OData payload.</returns>
  */
-var jsonParser = function (handler, text, context) {
+function jsonParser(handler, text, context) {
 
     var recognizeDates = defined(context.recognizeDates, handler.recognizeDates);
     var model = context.metadata;
@@ -178,18 +182,18 @@ var jsonParser = function (handler, text, context) {
     else {
         return json;
     }
-};
+}
 
 
-var addType = function(data, name, value ) {
+function addType(data, name, value ) {
     var fullName = name + '@odata.type';
 
     if ( data[fullName] === undefined) {
         data[fullName] = value;
     }
-};
+}
 
-var addTypeNoEdm = function(data, name, value ) {
+function addTypeNoEdm(data, name, value ) {
     var fullName = name + '@odata.type';
 
     if ( data[fullName] === undefined) {
@@ -200,9 +204,9 @@ var addTypeNoEdm = function(data, name, value ) {
         }
 
     }
-};
+}
 
-var addTypeColNoEdm = function(data, name, value ) {
+function addTypeColNoEdm(data, name, value ) {
     var fullName = name + '@odata.type';
 
     if ( data[fullName] === undefined) {
@@ -212,7 +216,7 @@ var addTypeColNoEdm = function(data, name, value ) {
             data[fullName] = 'Collection('+value+ ')';
         }
     }
-};
+}
 
 
 /* Adds typeinformation for String, Boolean and numerical EDM-types. 
@@ -221,8 +225,8 @@ var addTypeColNoEdm = function(data, name, value ) {
  * @param {Boolean} recognizeDates - True if strings formatted as datetime values should be treated as datetime values. False otherwise.
  * @returns An object representation of the OData payload.
  */
-var readPayloadFull = function (data, model, recognizeDates) {
-
+function readPayloadFull(data, model, recognizeDates) {
+    var type;
     if (utils.isObject(data)) {
         for (var key in data) {
             if (data.hasOwnProperty(key)) {
@@ -235,7 +239,7 @@ var readPayloadFull = function (data, model, recognizeDates) {
                         if (data[key] !== null) {
                             //don't step into geo.. objects
                             var isGeo = false;
-                            var type = data[key+'@odata.type'];
+                            type = data[key+'@odata.type'];
                             if (type && (isGeographyEdmType(type) || isGeometryEdmType(type))) {
                                 // is gemometry type
                             } else {
@@ -243,7 +247,7 @@ var readPayloadFull = function (data, model, recognizeDates) {
                             }
                         }
                     } else {
-                        var type = data[key + '@odata.type'];
+                        type = data[key + '@odata.type'];
 
                         // On .Net OData library, some basic EDM type is omitted, e.g. Edm.String, Edm.Int, and etc.
                         // For the full metadata payload, we need to full fill the @data.type for each property if it is missing. 
@@ -276,7 +280,7 @@ var readPayloadFull = function (data, model, recognizeDates) {
     }
 
     return data;
-};
+}
 
 /** Serializes the data by returning its string representation.
  * @param handler - This handler.
@@ -284,7 +288,7 @@ var readPayloadFull = function (data, model, recognizeDates) {
  * @param {Object} context - Object with serialization context.
  * @returns {String} The string representation of data.
  */
-var jsonSerializer = function (handler, data, context) {
+function jsonSerializer(handler, data, context) {
 
     var dataServiceVersion = context.dataServiceVersion || "4.0";
     var cType = context.contentType = context.contentType || jsonContentType;
@@ -298,9 +302,9 @@ var jsonSerializer = function (handler, data, context) {
     }
 
     return undefined;
-};
+}
 
-var formatJsonRequestPayload = function (data) {
+function formatJsonRequestPayload(data) {
     if (!data) {
         return data;
     }
@@ -327,7 +331,7 @@ var formatJsonRequestPayload = function (data) {
     }
 
     return newdata;
-};
+}
 
 /** JSON replacer function for converting a value to its JSON representation.
  * @param {Object} value - Value to convert.</param>
@@ -335,7 +339,7 @@ var formatJsonRequestPayload = function (data) {
  * This method is used during JSON serialization and invoked only by the JSON.stringify function.
  * It should never be called directly.
  */
-var jsonReplacer = function (_, value) {
+function jsonReplacer(_, value) {
     
 
     if (value && value.__edmType === "Edm.Time") {
@@ -343,7 +347,7 @@ var jsonReplacer = function (_, value) {
     } else {
         return value;
     }
-};
+}
 
 
 /** Creates an object containing information for the json payload.
@@ -351,14 +355,14 @@ var jsonReplacer = function (_, value) {
  * @param {String} typeName - Type name of the JSON payload.
  * @returns {Object} Object with kind and type fields.
  */
-var jsonMakePayloadInfo = function (kind, type) {
+function jsonMakePayloadInfo(kind, type) {
 
     /// TODO docu
     /// <field name="kind" type="String">Kind of the JSON payload. One of the PAYLOADTYPE_XXX constant values.</field>
     /// <field name="type" type="String">Data type of the JSON payload.</field>
 
     return { kind: kind, type: type || null };
-};
+}
 
 /** Creates an object containing information for the context
  * TODO check dou layout
@@ -368,7 +372,7 @@ var jsonMakePayloadInfo = function (kind, type) {
  * @returns {Object.typeName(optional)}  name of the type
  * @returns {Object.type(optional)}  object containing type information for entity- and complex-types ( null if a typeName is a primitive)
 */
-var parseContextUriFragment = function( fragments, model ) {
+function parseContextUriFragment( fragments, model ) {
     var ret = {};
 
     if (fragments.indexOf('/') === -1 ) {
@@ -552,7 +556,7 @@ var parseContextUriFragment = function( fragments, model ) {
     }
 
     return ret;
-};
+}
 
 /** Infers the information describing the JSON payload from its metadata annotation, structure, and data model.
  * @param {Object} data - Json response payload object.
@@ -563,7 +567,7 @@ var parseContextUriFragment = function( fragments, model ) {
  * and allows the user to control how the library behaves with an ambigous JSON payload.
  * @return Object with kind and type fields. Null if there is no metadata annotation or the payload info cannot be obtained..
 */
-var createPayloadInfo = function (data, model) {
+function createPayloadInfo(data, model) {
     
 
     var metadataUri = data[contextUrlAnnotation];
@@ -578,7 +582,7 @@ var createPayloadInfo = function (data, model) {
 
     var fragment = metadataUri.substring(fragmentStart + 1);
     return parseContextUriFragment(fragment,model);
-};
+}
 
 /** Processe a JSON response payload with metadata-minimal
  * @param {Object} data - Json response payload object
@@ -586,7 +590,7 @@ var createPayloadInfo = function (data, model) {
  * @param {Boolean} recognizeDates - Flag indicating whether datetime literal strings should be converted to JavaScript Date objects.
  * @returns {Object} Object in the library's representation.
  */
-var readPayloadMinimal = function (data, model, recognizeDates) {
+function readPayloadMinimal(data, model, recognizeDates) {
 
     if (!assigned(model) || isArray(model)) {
         return data;
@@ -613,14 +617,14 @@ var readPayloadMinimal = function (data, model, recognizeDates) {
     }
 
     return data;
-};
+}
 
 /** Gets the key of an entry.
  * @param {Object} data - JSON entry.
  *
  * @returns {string} Entry instance key.
  */
-var jsonGetEntryKey = function (data, entityModel) {
+function jsonGetEntryKey(data, entityModel) {
 
     var entityInstanceKey;
     var entityKeys = entityModel.key[0].propertyRef;
@@ -643,9 +647,9 @@ var jsonGetEntryKey = function (data, entityModel) {
     }
     entityInstanceKey += ")";
     return entityInstanceKey;
-};
+}
 
-var readPayloadMinimalProperty = function (data, model, collectionInfo, baseURI, recognizeDates) {
+function readPayloadMinimalProperty(data, model, collectionInfo, baseURI, recognizeDates) {
     if (collectionInfo.type !== null) {
         readPayloadMinimalObject(data, collectionInfo, baseURI, model, recognizeDates);
     } else {
@@ -653,9 +657,9 @@ var readPayloadMinimalProperty = function (data, model, collectionInfo, baseURI,
         //data['value@odata.type'] = '#'+collectionInfo.typeName;
     }
     return data;
-};
+}
 
-var readPayloadMinimalCollection = function (data, model, collectionInfo, baseURI, recognizeDates) {
+function readPayloadMinimalCollection(data, model, collectionInfo, baseURI, recognizeDates) {
     //data['@odata.type'] = '#Collection('+collectionInfo.typeName + ')';
     addTypeColNoEdm(data,'', collectionInfo.typeName);
 
@@ -686,8 +690,9 @@ var readPayloadMinimalCollection = function (data, model, collectionInfo, baseUR
         data.value = entries;
     }
     return data;
-};
-var readPayloadMinimalFeed = function (data, model, feedInfo, baseURI, recognizeDates) {
+}
+
+function readPayloadMinimalFeed(data, model, feedInfo, baseURI, recognizeDates) {
     var entries = [];
     var items = data.value;
     for (i = 0, len = items.length; i < len; i++) {
@@ -712,18 +717,18 @@ var readPayloadMinimalFeed = function (data, model, feedInfo, baseURI, recognize
     }
     data.value = entries;
     return data;
-};
+}
 
-var readPayloadMinimalEntry = function (data, model, entryInfo, baseURI, recognizeDates) {
+function readPayloadMinimalEntry(data, model, entryInfo, baseURI, recognizeDates) {
     return readPayloadMinimalObject(data, entryInfo, baseURI, model, recognizeDates);
-};
+}
 
 /** Formats a value according to Uri literal format
  * @param value - Value to be formatted.
  * @param type - Edm type of the value
  * @returns {string} Value after formatting
  */
-var formatLiteral = function (value, type) {
+function formatLiteral(value, type) {
 
     value = "" + formatRowLiteral(value, type);
     value = encodeURIComponent(value.replace("'", "''"));
@@ -755,18 +760,18 @@ var formatLiteral = function (value, type) {
         default:
             return value;
     }
-};
+}
 
-var formatRowLiteral = function (value, type) {
+function formatRowLiteral(value, type) {
     switch (type) {
         case "Edm.Binary":
             return convertByteArrayToHexString(value);
         default:
             return value;
     }
-};
+}
 
-var convertDates = function (data, propertyName,type) {
+function convertDates(data, propertyName,type) {
     if (type === 'Edm.Date') {
         data[propertyName] = oDataUtils.parseDate(data[propertyName], true);
     } else if (type === 'Edm.DateTimeOffset') {
@@ -776,9 +781,9 @@ var convertDates = function (data, propertyName,type) {
     } else if (type === 'Edm.Time') {
         data[propertyName] = oDataUtils.parseTime(data[propertyName], true);
     }
-};
+}
 
-var convertDatesNoEdm = function (data, propertyName,type) {
+function convertDatesNoEdm(data, propertyName,type) {
     if (type === 'Date') {
         data[propertyName] = oDataUtils.parseDate(data[propertyName], true);
     } else if (type === 'DateTimeOffset') {
@@ -788,9 +793,9 @@ var convertDatesNoEdm = function (data, propertyName,type) {
     } else if (type === 'Time') {
         data[propertyName] = oDataUtils.parseTime(data[propertyName], true);
     }
-};
+}
 
-var checkProperties = function (data, objectInfoType, baseURI, model, recognizeDates) {
+function checkProperties(data, objectInfoType, baseURI, model, recognizeDates) {
     for (var name in data) {
         if (name.indexOf("@") === -1) {
             var curType = objectInfoType;
@@ -825,9 +830,9 @@ var checkProperties = function (data, objectInfoType, baseURI, model, recognizeD
             }
         }
     }
-};
+}
 
-var readPayloadMinimalComplexObject = function (data, property, baseURI, model, recognizeDates) {
+function readPayloadMinimalComplexObject(data, property, baseURI, model, recognizeDates) {
     var type = property.type;
     if (isCollectionType(property.type)) {
         type =property.type.substring(11,property.type.length-1);
@@ -843,9 +848,9 @@ var readPayloadMinimalComplexObject = function (data, property, baseURI, model,
     }
   
     checkProperties(data, propertyType, baseURI, model, recognizeDates);
-};
+}
 
-var readPayloadMinimalObject = function (data, objectInfo, baseURI, model, recognizeDates) {
+function readPayloadMinimalObject(data, objectInfo, baseURI, model, recognizeDates) {
     //data['@odata.type'] = '#'+objectInfo.typeName;
     addType(data,'',objectInfo.typeName);
 
@@ -867,11 +872,11 @@ var readPayloadMinimalObject = function (data, objectInfo, baseURI, model, recog
     checkProperties(data, objectInfo.type, baseURI, model, recognizeDates);
     
     return data;
-};
+}
 
 var jsonSerializableMetadata = ["@odata.id", "@odata.type"];
 
-var isJsonSerializableProperty = function (property) {
+function isJsonSerializableProperty(property) {
     if (!property) {
         return false;
     }
@@ -889,22 +894,25 @@ var isJsonSerializableProperty = function (property) {
     }
 
     return false;
-};
+}
 
 /** Determines whether a type name is a primitive type in a JSON payload.
  * @param {String} typeName - Type name to test.
  * @returns {Boolean} True if the type name an EDM primitive type or an OData spatial type; false otherwise.
  */
-var jsonIsPrimitiveType = function (typeName) {
+function jsonIsPrimitiveType(typeName) {
 
     return isPrimitiveEdmType(typeName) || isGeographyEdmType(typeName) || isGeometryEdmType(typeName);
-};
+}
 
 
 var jsonHandler = oDataHandler.handler(jsonParser, jsonSerializer, jsonMediaType, MAX_DATA_SERVICE_VERSION);
 jsonHandler.recognizeDates = false;
 
+
+
+exports.createPayloadInfo = createPayloadInfo;
 exports.jsonHandler = jsonHandler;
 exports.jsonParser = jsonParser;
 exports.jsonSerializer = jsonSerializer;
-exports.parseJsonDateString = parseJsonDateString;
+exports.parseJsonDateString = parseJsonDateString;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/24598e5f/datajs/src/lib/odata/metadata.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/odata/metadata.js b/datajs/src/lib/odata/metadata.js
index 582da7d..5ad70b6 100644
--- a/datajs/src/lib/odata/metadata.js
+++ b/datajs/src/lib/odata/metadata.js
@@ -17,10 +17,14 @@
  * under the License.
  */
 
+/** @module odata/metadata */
+
 var utils    = require('./../datajs.js').utils;
 var oDSxml    = require('./../datajs.js').xml;
 var odataHandler    = require('./handler.js');
 
+
+
 // imports 
 var contains = utils.contains;
 var normalizeURI = utils.normalizeURI;
@@ -51,7 +55,7 @@ var xmlMediaType = "application/xml";
  * If a child element name ends with * then it is understood by the schema that that child element can appear 0 or more times.
  * @returns {Object} Object with attributes, elements, text, and ns fields.
  */
-var schemaElement = function (attributes, elements, text, ns) {
+function schemaElement(attributes, elements, text, ns) {
 
     return {
         attributes: attributes,
@@ -59,7 +63,7 @@ var schemaElement = function (attributes, elements, text, ns) {
         text: text || false,
         ns: ns
     };
-};
+}
 
 // It's assumed that all elements may have Documentation children and Annotation elements.
 // See http://docs.oasis-open.org/odata/odata/v4.0/cs01/part3-csdl/odata-v4.0-cs01-part3-csdl.html for a CSDL reference.
@@ -361,7 +365,7 @@ var schema = {
  * @returns {String} Converted text.
  * If the text starts with multiple uppercase characters, it is left as-is.</remarks>
  */
-var scriptCase = function (text) {
+function scriptCase(text) {
 
     if (!text) {
         return text;
@@ -377,14 +381,14 @@ var scriptCase = function (text) {
     }
 
     return text.charAt(0).toLowerCase();
-};
+}
 
 /** Gets the schema node for the specified element.
  * @param {Object} parentSchema - Schema of the parent XML node of 'element'.
  * @param candidateName - XML element name to consider.
  * @returns {Object} The schema that describes the specified element; null if not found.
  */
-var getChildSchema = function (parentSchema, candidateName) {
+function getChildSchema(parentSchema, candidateName) {
 
     var elements = parentSchema.elements;
     if (!elements) {
@@ -407,22 +411,22 @@ var getChildSchema = function (parentSchema, candidateName) {
     }
 
     return null;
-};
+}
 
 /** Checks whether the specifies namespace URI is one of the known CSDL namespace URIs.
  * @param {String} nsURI - Namespace URI to check.
  * @returns {Boolean} true if nsURI is a known CSDL namespace; false otherwise.
  */
-var isEdmNamespace = function (nsURI) {
+function isEdmNamespace(nsURI) {
 
     return nsURI === edmNs1;
-};
+}
 
 /** Parses a CSDL document.
  * @param element - DOM element to parse.
  * @returns {Object} An object describing the parsed element.
  */
-var parseConceptualModelElement = function (element) {
+function parseConceptualModelElement(element) {
 
     var localName = xmlLocalName(element);
     var nsURI = xmlNamespaceURI(element);
@@ -494,19 +498,21 @@ var parseConceptualModelElement = function (element) {
     }
 
     return item;
-};
+}
 
 /** Parses a metadata document.
  * @param handler - This handler.
  * @param {String} text - Metadata text.
  * @returns An object representation of the conceptual model.</returns>
  */
-var metadataParser = function (handler, text) {
+function metadataParser(handler, text) {
 
     var doc = xmlParse(text);
     var root = xmlFirstChildElement(doc);
     return parseConceptualModelElement(root) || undefined;
-};
+}
+
+
 
 exports.metadataHandler = odataHandler.handler(metadataParser, null, xmlMediaType, MAX_DATA_SERVICE_VERSION);
 
@@ -514,4 +520,4 @@ exports.schema = schema;
 exports.scriptCase = scriptCase;
 exports.getChildSchema = getChildSchema;
 exports.parseConceptualModelElement = parseConceptualModelElement;
-exports.metadataParser = metadataParser;
+exports.metadataParser = metadataParser;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/24598e5f/datajs/src/lib/odata/net.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/odata/net.js b/datajs/src/lib/odata/net.js
index 655a961..9821892 100644
--- a/datajs/src/lib/odata/net.js
+++ b/datajs/src/lib/odata/net.js
@@ -17,6 +17,10 @@
  * under the License.
  */
 
+/** @module odata/net */
+
+
+
 var utils    = require('./../datajs.js').utils;
 // Imports.
 
@@ -35,24 +39,24 @@ var ticks = 0;
  * We allow data to come in a different format, as the servers SHOULD honor the Accept
  * request but may in practice return content with a different MIME type.
  */
-var canUseJSONP = function (request) {
+function canUseJSONP(request) {
     
     if (request.method && request.method !== "GET") {
         return false;
     }
 
     return true;
-};
+}
 
 /** Creates an IFRAME tag for loading the JSONP script
  * @param {String} url - The source URL of the script
  * @returns {HTMLElement} The IFRAME tag
  */
-var createIFrame = function (url) {
+function createIFrame(url) {
     var iframe = window.document.createElement("IFRAME");
     iframe.style.display = "none";
 
-    var attributeEncodedUrl = url.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/\</g, "&lt;");
+    var attributeEncodedUrl = url.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
     var html = "<html><head><script type=\"text/javascript\" src=\"" + attributeEncodedUrl + "\"><\/script><\/head><body><\/body><\/html>";
 
     var body = window.document.getElementsByTagName("BODY")[0];
@@ -65,7 +69,7 @@ var createIFrame = function (url) {
 /** Creates a XmlHttpRequest object.
  * @returns {XmlHttpRequest} XmlHttpRequest object.
  */
-var createXmlHttpRequest = function () {
+function createXmlHttpRequest() {
     if (window.XMLHttpRequest) {
         return new window.XMLHttpRequest();
     }
@@ -84,23 +88,23 @@ var createXmlHttpRequest = function () {
         exception = { message: "XMLHttpRequest not supported" };
     }
     throw exception;
-};
+}
 
 /** Checks whether the specified URL is an absolute URL.
  * @param {String} url - URL to check.
  * @returns {Boolean} true if the url is an absolute URL; false otherwise.
 */
-var isAbsoluteUrl = function (url) {
+function isAbsoluteUrl(url) {
     return url.indexOf("http://") === 0 ||
         url.indexOf("https://") === 0 ||
         url.indexOf("file://") === 0;
-};
+}
 
 /** Checks whether the specified URL is local to the current context.
  * @param {String} url - URL to check.
  * @returns {Boolean} true if the url is a local URL; false otherwise.
  */
-var isLocalUrl = function (url) {
+function isLocalUrl(url) {
 
     if (!isAbsoluteUrl(url)) {
         return true;
@@ -110,13 +114,13 @@ var isLocalUrl = function (url) {
     var location = window.location;
     var locationDomain = location.protocol + "//" + location.host + "/";
     return (url.indexOf(locationDomain) === 0);
-};
+}
 
 /** Removes a callback used for a JSONP request.
  * @param {String} name - Function name to remove.
  * @param {Number} tick - Tick count used on the callback.
  */
-var removeCallback = function (name, tick) {
+function removeCallback(name, tick) {
     try {
         delete window[name];
     } catch (err) {
@@ -131,7 +135,7 @@ var removeCallback = function (name, tick) {
  * @param {Object} iframe - The iframe to remove.
  * @returns {Object} Null value to be assigned to iframe reference.
  */
-var removeIFrame = function (iframe) {
+function removeIFrame(iframe) {
     if (iframe) {
         writeHtmlToIFrame(iframe, "");
         iframe.parentNode.removeChild(iframe);
@@ -144,7 +148,7 @@ var removeIFrame = function (iframe) {
  * @param {XMLHttpRequest} xhr - HTTP request with response available.
  * @param {Array} headers - Target array to fill with name/value pairs.
  */
-var readResponseHeaders = function (xhr, headers) {
+function readResponseHeaders(xhr, headers) {
 
     var responseHeaders = xhr.getAllResponseHeaders().split(/\r?\n/);
     var i, len;
@@ -154,18 +158,18 @@ var readResponseHeaders = function (xhr, headers) {
             headers[header[0]] = header[1];
         }
     }
-};
+}
 
 /** Writes HTML to an IFRAME document.
  * @param {HTMLElement} iframe - The IFRAME element to write to.
  * @param {String} html - The HTML to write.
  */
-var writeHtmlToIFrame = function (iframe, html) {
+function writeHtmlToIFrame(iframe, html) {
     var frameDocument = (iframe.contentWindow) ? iframe.contentWindow.document : iframe.contentDocument.document;
     frameDocument.open();
     frameDocument.write(html);
     frameDocument.close();
-};
+}
 
 exports.defaultHttpClient = {
     callbackParameterName: "$callback",
@@ -329,7 +333,8 @@ exports.defaultHttpClient = {
     }
 };
 
+
+
 exports.canUseJSONP = canUseJSONP;
 exports.isAbsoluteUrl = isAbsoluteUrl;
-exports.isLocalUrl = isLocalUrl;
-
+exports.isLocalUrl = isLocalUrl;
\ No newline at end of file