jquery.squirrel.js
function stash(storage, storageKey, key, value) {

        // get the squirrel storage object.
        var store = window.JSON.parse(storage.getItem(storageKey));

        // if it doesn't exist, create an empty object.
        if (store === null) {

            store = {};

        }

        // if a value isn't specified.
        if (isUndefined(value) || value === null) {

            // return the store value if the store value exists; otherwise, null.
            return !isUndefined(store[key]) ? store[key] : null;

        }

        // if a value is specified.
        // create an append object literal.
        var append = {};

        // add the new value to the object that we'll append to the store object.
        append[key] = value;

        // extend the squirrel store object.
        // in ES6 this can be shortened to just $.extend(store, {[key]: value}), as there would be no need
        // to create a temporary storage object.
        $.extend(store, append);

        // re-session the squirrel store again.
        storage.setItem(storageKey, window.JSON.stringify(store));

        // return the value.
        return value;

    }
function stash(storage, storageKey, key, value) {

        // get the squirrel storage object.
        var store = window.JSON.parse(storage.getItem(storageKey));

        // if it doesn't exist, create an empty object.
        if (store === null) {

            store = {};

        }

        // if a value isn't specified.
        if (isUndefined(value) || value === null) {

            // return the store value if the store value exists; otherwise, null.
            return !isUndefined(store[key]) ? store[key] : null;

        }

        // if a value is specified.
        // create an append object literal.
        var append = {};

        // add the new value to the object that we'll append to the store object.
        append[key] = value;

        // extend the squirrel store object.
        // in ES6 this can be shortened to just $.extend(store, {[key]: value}), as there would be no need
        // to create a temporary storage object.
        $.extend(store, append);

        // re-session the squirrel store again.
        storage.setItem(storageKey, window.JSON.stringify(store));

        // return the value.
        return value;

    }
function stash ( storage , storageKey , key , value ) { // get the squirrel storage object. var store = window . JSON . parse ( storage . getItem ( storageKey ) ) ; // if it doesn't exist, create an empty object. if ( store === null ) { store = { } ; } // if a value isn't specified. if ( isUndefined ( value ) || value === null ) { // return the store value if the store value exists; otherwise, null. return ! isUndefined ( store [ key ] ) ? store [ key ] : null ; } // if a value is specified. // create an append object literal. var append = { } ; // add the new value to the object that we'll append to the store object. append [ key ] = value ; // extend the squirrel store object. // in ES6 this can be shortened to just $.extend(store, {[key]: value}), as there would be no need // to create a temporary storage object. $ . extend ( store , append ) ; // re-session the squirrel store again. storage . setItem ( storageKey , window . JSON . stringify ( store ) ) ; // return the value. return value ; }
METHODS stash or grab a value from our session store object.
METHODS stash or grab a value from our session store object .