{"size": 3259, "ext": "js", "max_stars_repo_path": "www/js/Modulos/StorageModulo.js", "max_stars_repo_name": "lucasnpinheiro/homeplay", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "www/js/Modulos/StorageModulo.js", "max_issues_repo_name": "lucasnpinheiro/homeplay", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "www/js/Modulos/StorageModulo.js", "max_forks_repo_name": "lucasnpinheiro/homeplay", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 41.253164557, "max_line_length": 80, "alphanum_fraction": 0.3540963486}
angular.module('starter')
        .factory('StorageModuloFactory',
                function () {

                    var services = {
                        local: {},
                        session: {},
                        enum: {
                            user: 'user',
                            sincronizacaoInicial: 'sincronizacao_inicial',
                            home: 'home',
                            inicializacao: 'inicializacao',
                            pdvAtivo: 'pdv_ativo'
                        }
                    };

                    services.local.get = function (k, d) {
                        d = d || null;
                        var v = window.localStorage.getItem(k);
                        return v || d;
                    };
                    services.local.set = function (k, v) {
                        window.localStorage.setItem(k, v);
                        return v;
                    };
                    services.local.delete = function (k) {
                        window.localStorage.removeItem(k);
                        return null;
                    };
                    services.local.destroy = function () {
                        angular.forEach(window.localStorage, function (v, k) {
                            window.localStorage.removeItem(k);
                        });
                        return null;
                    };

                    services.local.getObject = function (k, d) {
                        d = d || {};
                        var v = JSON.parse(window.localStorage.getItem(k));
                        return v || d;
                    };
                    services.local.setObject = function (k, v) {
                        window.localStorage.setItem(k, JSON.stringify(v));
                        return v;
                    };

                    services.session.get = function (k, d) {
                        d = d || null;
                        var v = window.sessionStorage.getItem(k);
                        return v || d;
                    };
                    services.session.set = function (k, v) {
                        window.sessionStorage.setItem(k, v);
                        return v;
                    };
                    services.session.delete = function (k) {
                        window.sessionStorage.removeItem(k);
                        return null;
                    };
                    services.session.destroy = function () {
                        angular.forEach(window.sessionStorage, function (v, k) {
                            window.sessionStorage.removeItem(k);
                        });
                        return null;
                    };

                    services.session.getObject = function (k, d) {
                        d = d || {};
                        var v = JSON.parse(window.sessionStorage.getItem(k));
                        return v || d;
                    };
                    services.session.setObject = function (k, v) {
                        window.sessionStorage.setItem(k, JSON.stringify(v));
                        return v;
                    };

                    return services;
                }
        );