tasks/lib/reader.js
function addJSONProperties(jsonData, propertiesGroups, filePath, currentNamesPath) {

        var i,
            group,
            propertyDefinition,
            propertyDefinitionWithoutObjectName,
            propertyName,
            data;

        if (currentNamesPath === undefined) {
            currentNamesPath = '';
        }

        // get all values
        for (i in jsonData) {

            // add to group if is a simply object
            if (jsonData[i] instanceof Array || jsonData[i] == null || typeof jsonData[i] !== 'object' || grunt.util._.isEmpty(jsonData[i])) {

                // find group
                propertyDefinition = (currentNamesPath ? currentNamesPath + '.' + i : i)
                    .replace(/^[^.]+\./, '');
                group = propertiesUtils.getGroup(propertyDefinition, propertiesGroups);

                if (!group) {
                    grunt.log.error('Object ' + propertyDefinition + ' without init file');
                    return;
                }

                grunt.verbose.ok(propertyDefinition);

                // generate property data
                propertyDefinitionWithoutObjectName = propertyDefinition
                    .replace(group.pattern, '')
                    .replace(/^\./, '');
                propertyName = propertyDefinitionWithoutObjectName
                    .replace(/^prototype\./i, '');

                data = {
                    name:     propertyName,
                    comment:  '',

                    type:     'object',
                    isPublic: propertiesUtils.isPublic(propertyName),
                    isFromPrototype: propertiesUtils.isFromPrototype(propertyDefinitionWithoutObjectName),
                    filePath: filePath
                };


                // string -> "string"
                // true   -> true
                switch (typeof jsonData[i]) {
                case 'object':
                    if (jsonData[i] != null) {
                        data.source = JSON.stringify(jsonData[i]);
                    }
                    break;
                case 'string':
                    data.source = '"' + jsonData[i].split('"').join('\\"') + '"';
                    break;
                }
                if (data.source === undefined) {
                    data.source = '' + jsonData[i];
                }

                // add property data to prototype or inline array
                group[(data.isFromPrototype ? 'prototypeProperties' : 'inlineProperties')].push(data);
            } else {
                // is object
                // add attributeName to path and try to add
                addJSONProperties(jsonData[i], propertiesGroups, filePath, currentNamesPath ? currentNamesPath + '.' + i : i);
            }
        }
    }
function addJSONProperties(jsonData, propertiesGroups, filePath, currentNamesPath) {

        var i,
            group,
            propertyDefinition,
            propertyDefinitionWithoutObjectName,
            propertyName,
            data;

        if (currentNamesPath === undefined) {
            currentNamesPath = '';
        }

        // get all values
        for (i in jsonData) {

            // add to group if is a simply object
            if (jsonData[i] instanceof Array || jsonData[i] == null || typeof jsonData[i] !== 'object' || grunt.util._.isEmpty(jsonData[i])) {

                // find group
                propertyDefinition = (currentNamesPath ? currentNamesPath + '.' + i : i)
                    .replace(/^[^.]+\./, '');
                group = propertiesUtils.getGroup(propertyDefinition, propertiesGroups);

                if (!group) {
                    grunt.log.error('Object ' + propertyDefinition + ' without init file');
                    return;
                }

                grunt.verbose.ok(propertyDefinition);

                // generate property data
                propertyDefinitionWithoutObjectName = propertyDefinition
                    .replace(group.pattern, '')
                    .replace(/^\./, '');
                propertyName = propertyDefinitionWithoutObjectName
                    .replace(/^prototype\./i, '');

                data = {
                    name:     propertyName,
                    comment:  '',

                    type:     'object',
                    isPublic: propertiesUtils.isPublic(propertyName),
                    isFromPrototype: propertiesUtils.isFromPrototype(propertyDefinitionWithoutObjectName),
                    filePath: filePath
                };


                // string -> "string"
                // true   -> true
                switch (typeof jsonData[i]) {
                case 'object':
                    if (jsonData[i] != null) {
                        data.source = JSON.stringify(jsonData[i]);
                    }
                    break;
                case 'string':
                    data.source = '"' + jsonData[i].split('"').join('\\"') + '"';
                    break;
                }
                if (data.source === undefined) {
                    data.source = '' + jsonData[i];
                }

                // add property data to prototype or inline array
                group[(data.isFromPrototype ? 'prototypeProperties' : 'inlineProperties')].push(data);
            } else {
                // is object
                // add attributeName to path and try to add
                addJSONProperties(jsonData[i], propertiesGroups, filePath, currentNamesPath ? currentNamesPath + '.' + i : i);
            }
        }
    }
function addJSONProperties ( jsonData , propertiesGroups , filePath , currentNamesPath ) { var i , group , propertyDefinition , propertyDefinitionWithoutObjectName , propertyName , data ; if ( currentNamesPath === undefined ) { currentNamesPath = '' ; } // get all values for ( i in jsonData ) { // add to group if is a simply object if ( jsonData [ i ] instanceof Array || jsonData [ i ] == null || typeof jsonData [ i ] !== 'object' || grunt . util . _ . isEmpty ( jsonData [ i ] ) ) { // find group propertyDefinition = ( currentNamesPath ? currentNamesPath + '.' + i : i ) . replace ( / ^[^.]+\. / , '' ) ; group = propertiesUtils . getGroup ( propertyDefinition , propertiesGroups ) ; if ( ! group ) { grunt . log . error ( 'Object ' + propertyDefinition + ' without init file' ) ; return ; } grunt . verbose . ok ( propertyDefinition ) ; // generate property data propertyDefinitionWithoutObjectName = propertyDefinition . replace ( group . pattern , '' ) . replace ( / ^\. / , '' ) ; propertyName = propertyDefinitionWithoutObjectName . replace ( / ^prototype\. / i , '' ) ; data = { name : propertyName , comment : '' , type : 'object' , isPublic : propertiesUtils . isPublic ( propertyName ) , isFromPrototype : propertiesUtils . isFromPrototype ( propertyDefinitionWithoutObjectName ) , filePath : filePath } ; // string -> "string" // true   -> true switch ( typeof jsonData [ i ] ) { case 'object' : if ( jsonData [ i ] != null ) { data . source = JSON . stringify ( jsonData [ i ] ) ; } break ; case 'string' : data . source = '"' + jsonData [ i ] . split ( '"' ) . join ( '\\"' ) + '"' ; break ; } if ( data . source === undefined ) { data . source = '' + jsonData [ i ] ; } // add property data to prototype or inline array group [ ( data . isFromPrototype ? 'prototypeProperties' : 'inlineProperties' ) ] . push ( data ) ; } else { // is object // add attributeName to path and try to add addJSONProperties ( jsonData [ i ] , propertiesGroups , filePath , currentNamesPath ? currentNamesPath + '.' + i : i ) ; } } }
Add JSON properties values to their properties group
@param jsonData {String}
@param propertiesGroups [{Object}]
@param filePath {String}
@param currentNamesPath {String}
@returns {Object}
Add JSON properties values to their properties group