JSFiddle - React, Tailwind, and code Playground

JavaScript

function orderedObject()
    {
         this.keys = [];
         this.keyIndex = {};
         this.store = {};
    }
    
    
    orderedObject.prototype.addItem = function(key,value)
    {
         this.keyIndex[key] = this.keys.length;
         this.keys.push(key);
         this.store[key] = value;
    }
    
    orderedObject.prototype.getItem = function(key)
    {
         return this.store[key];
    }
    
    orderedObject.prototype.getKeyBefore = function(key)
    {
         return this.keys[this.keyIndex[key] - 1];
    }
    
    orderedObject.prototype.getKeyAfter = function(key)
    {
         return this.keys[this.keyIndex[key] + 1];
    }
    
    var testObject = new orderedObject();
    
    testObject.addItem("5" , ["name", "link2"]);
    testObject.addItem("8" , ["name 2", "link 2"]);
    testObject.addItem("11" , ["name 3", "link 3"]);
    
    console.log(testObject.getKeyBefore("8"))
    console.log(testObject.getKeyAfter("8"))