JSFiddle - React, Tailwind, and code Playground

JavaScript

localStorage.pes_54321 = '{"baz":"biz"}';
localStorage.pes_12345 = '{"foo":"bar"}';

function getData(chave) {
    return Object.keys(localStorage).filter(function(key) {
        return key.indexOf(chave) == 0;
    }).map(function(key) {
        return JSON.parse(localStorage[key]);
    });
}
console.log(JSON.stringify(getData('pes'))); // [{"foo":"bar"},{"baz":"biz"}]
console.log(JSON.stringify(getData('pes_54321'))); // [{"baz":"biz"}]