tasks/pagesJson_uirouter.js
function objectToString(object, tabs) {
            var result = [];
            var keys = Object.keys(object);

            keys.forEach(function (key, keyIndex) {
                var line;
                var formatedKey;

                if (-1 < key.indexOf('@')) {
                    formatedKey = '\'' + key + '\'';
                } else {
                    formatedKey = key;
                }

                if (typeof object[key] === 'object') {
                    if (Array.isArray(object[key])) {
                        var newTabs = (tabs + 1);

                        line = getTabs(tabs) + '' + formatedKey + ': [';

                        object[key].forEach(function (item, itemIndex) {
                            if (typeof item === 'object') {
                                line += "\n" + getTabs(newTabs) + '{';
                                line += "\n" + objectToString(item, (newTabs + 1));
                                line += "\n" + getTabs(newTabs) + '}';
                            } else if (typeof item === 'string') {
                                line += "\n" + getTabs(newTabs) + '\'' + addslashes(item) + '\'';
                            } else if (typeof item === 'boolean') {
                                line += "\n" + getTabs(newTabs) + '' + item;
                            } else if (typeof item === 'number') {
                                line += "\n" + getTabs(newTabs) + '' + item;
                            }

                            if (itemIndex < (object[key].length - 1)) {
                                line += ',';
                            }
                        });

                        line += "\n" + getTabs(tabs) + ']';
                    } else {
                        line = getTabs(tabs) + '' + formatedKey + ': {' + "\n";
                        line += objectToString(object[key], (tabs + 1));
                        line += "\n" + getTabs(tabs) + '}';
                    }
                } else if (typeof object[key] === 'string') {
                    line = getTabs(tabs) + '' + formatedKey + ': \'' + addslashes(object[key]) + '\'';
                } else if (typeof object[key] === 'boolean') {
                    line = getTabs(tabs) + '' + formatedKey + ': ' + object[key];
                } else if (typeof object[key] === 'number') {
                    line = getTabs(tabs) + '' + formatedKey + ': ' + object[key];
                }

                if (keyIndex < (keys.length - 1)) {
                    line += ',';
                }

                result.push(line);
            });

            return result.join("\n");
        }
function objectToString(object, tabs) {
            var result = [];
            var keys = Object.keys(object);

            keys.forEach(function (key, keyIndex) {
                var line;
                var formatedKey;

                if (-1 < key.indexOf('@')) {
                    formatedKey = '\'' + key + '\'';
                } else {
                    formatedKey = key;
                }

                if (typeof object[key] === 'object') {
                    if (Array.isArray(object[key])) {
                        var newTabs = (tabs + 1);

                        line = getTabs(tabs) + '' + formatedKey + ': [';

                        object[key].forEach(function (item, itemIndex) {
                            if (typeof item === 'object') {
                                line += "\n" + getTabs(newTabs) + '{';
                                line += "\n" + objectToString(item, (newTabs + 1));
                                line += "\n" + getTabs(newTabs) + '}';
                            } else if (typeof item === 'string') {
                                line += "\n" + getTabs(newTabs) + '\'' + addslashes(item) + '\'';
                            } else if (typeof item === 'boolean') {
                                line += "\n" + getTabs(newTabs) + '' + item;
                            } else if (typeof item === 'number') {
                                line += "\n" + getTabs(newTabs) + '' + item;
                            }

                            if (itemIndex < (object[key].length - 1)) {
                                line += ',';
                            }
                        });

                        line += "\n" + getTabs(tabs) + ']';
                    } else {
                        line = getTabs(tabs) + '' + formatedKey + ': {' + "\n";
                        line += objectToString(object[key], (tabs + 1));
                        line += "\n" + getTabs(tabs) + '}';
                    }
                } else if (typeof object[key] === 'string') {
                    line = getTabs(tabs) + '' + formatedKey + ': \'' + addslashes(object[key]) + '\'';
                } else if (typeof object[key] === 'boolean') {
                    line = getTabs(tabs) + '' + formatedKey + ': ' + object[key];
                } else if (typeof object[key] === 'number') {
                    line = getTabs(tabs) + '' + formatedKey + ': ' + object[key];
                }

                if (keyIndex < (keys.length - 1)) {
                    line += ',';
                }

                result.push(line);
            });

            return result.join("\n");
        }
function objectToString ( object , tabs ) { var result = [ ] ; var keys = Object . keys ( object ) ; keys . forEach ( function ( key , keyIndex ) { var line ; var formatedKey ; if ( - 1 < key . indexOf ( '@' ) ) { formatedKey = '\'' + key + '\'' ; } else { formatedKey = key ; } if ( typeof object [ key ] === 'object' ) { if ( Array . isArray ( object [ key ] ) ) { var newTabs = ( tabs + 1 ) ; line = getTabs ( tabs ) + '' + formatedKey + ': [' ; object [ key ] . forEach ( function ( item , itemIndex ) { if ( typeof item === 'object' ) { line += "\n" + getTabs ( newTabs ) + '{' ; line += "\n" + objectToString ( item , ( newTabs + 1 ) ) ; line += "\n" + getTabs ( newTabs ) + '}' ; } else if ( typeof item === 'string' ) { line += "\n" + getTabs ( newTabs ) + '\'' + addslashes ( item ) + '\'' ; } else if ( typeof item === 'boolean' ) { line += "\n" + getTabs ( newTabs ) + '' + item ; } else if ( typeof item === 'number' ) { line += "\n" + getTabs ( newTabs ) + '' + item ; } if ( itemIndex < ( object [ key ] . length - 1 ) ) { line += ',' ; } } ) ; line += "\n" + getTabs ( tabs ) + ']' ; } else { line = getTabs ( tabs ) + '' + formatedKey + ': {' + "\n" ; line += objectToString ( object [ key ] , ( tabs + 1 ) ) ; line += "\n" + getTabs ( tabs ) + '}' ; } } else if ( typeof object [ key ] === 'string' ) { line = getTabs ( tabs ) + '' + formatedKey + ': \'' + addslashes ( object [ key ] ) + '\'' ; } else if ( typeof object [ key ] === 'boolean' ) { line = getTabs ( tabs ) + '' + formatedKey + ': ' + object [ key ] ; } else if ( typeof object [ key ] === 'number' ) { line = getTabs ( tabs ) + '' + formatedKey + ': ' + object [ key ] ; } if ( keyIndex < ( keys . length - 1 ) ) { line += ',' ; } result . push ( line ) ; } ) ; return result . join ( "\n" ) ; }
Transformer un objet en chaine
@param {Object} object
@param {Number} tabs
Transformer un objet en chaine