packages/ove-lib-utils/src/persistence.js
function (item) {
        let x;
        switch (item.type) {
            case Type.STRING:
            case Type.NUMBER:
            case Type.BOOLEAN:
            case Type.UNDEFINED:
                return item.value;
            case Type.ARRAY:
                x = [];
                item.value.forEach(function (e) {
                    let key = e.key.substring(e.key.lastIndexOf('[') + 1, e.key.lastIndexOf(']'));
                    x[parseInt(key, 10)] = _fromPersistable(e);
                });
                return x;
            case Type.OBJECT:
                x = {};
                item.value.forEach(function (e) {
                    let key = e.key.substring(e.key.lastIndexOf('[') + 1, e.key.lastIndexOf(']'));
                    x[key] = _fromPersistable(e);
                });
                return x;
            default:
                _logUnknownType(item.type);
        }
    }
function (item) {
        let x;
        switch (item.type) {
            case Type.STRING:
            case Type.NUMBER:
            case Type.BOOLEAN:
            case Type.UNDEFINED:
                return item.value;
            case Type.ARRAY:
                x = [];
                item.value.forEach(function (e) {
                    let key = e.key.substring(e.key.lastIndexOf('[') + 1, e.key.lastIndexOf(']'));
                    x[parseInt(key, 10)] = _fromPersistable(e);
                });
                return x;
            case Type.OBJECT:
                x = {};
                item.value.forEach(function (e) {
                    let key = e.key.substring(e.key.lastIndexOf('[') + 1, e.key.lastIndexOf(']'));
                    x[key] = _fromPersistable(e);
                });
                return x;
            default:
                _logUnknownType(item.type);
        }
    }
function ( item ) { let x ; switch ( item . type ) { case Type . STRING : case Type . NUMBER : case Type . BOOLEAN : case Type . UNDEFINED : return item . value ; case Type . ARRAY : x = [ ] ; item . value . forEach ( function ( e ) { let key = e . key . substring ( e . key . lastIndexOf ( '[' ) + 1 , e . key . lastIndexOf ( ']' ) ) ; x [ parseInt ( key , 10 ) ] = _fromPersistable ( e ) ; } ) ; return x ; case Type . OBJECT : x = { } ; item . value . forEach ( function ( e ) { let key = e . key . substring ( e . key . lastIndexOf ( '[' ) + 1 , e . key . lastIndexOf ( ']' ) ) ; x [ key ] = _fromPersistable ( e ) ; } ) ; return x ; default : _logUnknownType ( item . type ) ; } }
A utility method to extract the original value in its original type.
A utility method to extract the original value in its original type .