<commit_before>var exec = require('cordova/exec');
var TAG = "NativeStorage.js";

function inBrowser() {
    return (window.cordova && window.cordova.platformId === 'browser') || !(window.phonegap || window.cordova);
}

/* Method for storage in localstorage if run in browser */
NativeStorage.prototype.setInLocalStorage = function (reference, variable, success, error) {
    try {
        var varAsString = JSON.stringify(variable);
        console.log("LocalStorage Saving: "+varAsString);
        localStorage.setItem(reference, varAsString);
        success(varAsString);
    } catch (err) {
        error(err);
    }

};

NativeStorage.prototype.getFromLocalStorage = function (reference, success, error) {
    try {
        var obj = JSON.parse(localStorage.getItem(reference));
        console.log("LocalStorage Reading: "+obj);
        success(obj);
    } catch (err) {
        error(err);
    }
};



function NativeStorage() {
    console.log(TAG + ": is created");
    if(inBrowser()){
        console.log("browser detected!");
        if(!window.localStorage) console.log("ALERT! localstorage isn't supported");
    }
}



NativeStorage.prototype.set = function(reference, value, success, error) {
    if (reference === null) {
        error("The reference can't be null");
    }
    if (value === null) {
        error("a Null value isn't supported");
    }
    switch (typeof value) {
        case 'undefined':
            error("an undefined type isn't supported");
            break;
        case 'boolean':
            {
                this.putBoolean(reference, value, success, error);
                break;
            }
        case 'number':
            {<commit_msg>Added return during storageset failures<commit_after>var exec = require('cordova/exec');
var TAG = "NativeStorage.js";

function inBrowser() {
    return (window.cordova && window.cordova.platformId === 'browser') || !(window.phonegap || window.cordova);
}

/* Method for storage in localstorage if run in browser */
NativeStorage.prototype.setInLocalStorage = function (reference, variable, success, error) {
    try {
        var varAsString = JSON.stringify(variable);
        console.log("LocalStorage Saving: "+varAsString);
        localStorage.setItem(reference, varAsString);
        success(varAsString);
    } catch (err) {
        error(err);
    }

};

NativeStorage.prototype.getFromLocalStorage = function (reference, success, error) {
    try {
        var obj = JSON.parse(localStorage.getItem(reference));
        console.log("LocalStorage Reading: "+obj);
        success(obj);
    } catch (err) {
        error(err);
    }
};



function NativeStorage() {
    console.log(TAG + ": is created");
    if(inBrowser()){
        console.log("browser detected!");
        if(!window.localStorage) console.log("ALERT! localstorage isn't supported");
    }
}



NativeStorage.prototype.set = function(reference, value, success, error) {
    if (reference === null) {
        error("The reference can't be null");
        return;
    }
    if (value === null) {
        error("a Null value isn't supported");
        return;
    }
    switch (typeof value) {
        case 'undefined':
            error("an undefined type isn't supported");
            break;
        case 'boolean':
            {
                this.putBoolean(reference, value, success, error);
                break;
            }
        case 'number':
            {
{'fraction_non_alphanumeric': 0.13205351948807445, 'fraction_numerical': 0.0, 'mean_word_length': 2.5711318795430946, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2057677', 'n_tokens_mistral': 953, 'n_tokens_neox': 932, 'n_words': 230}