Nefarious Pomegranate Magnate

    object-rewinder
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.1 • Public • Published

    Installation

    npm install object-rewinder
    

    Getting started

    import ObjectRewinder from 'object-rewinder';
    
    let dataToWatch = { empty: 'object' };
    
    let rewinder = new ObjectRewinder(dataToWatch);
    dataToWatch = rewinder.getObject(); // Overwrite the data with the observed one
    
    // From now on every change on "dataToWatch" will be recorded
    // And We're be able to rollback thoses changes
    
    dataToWatch.value = 'very good value'
    console.log(dataToWatch);
    
    //  Outputs:
    //   {
    //     empty: 'object',
    //     value: 'very good value'
    //   }
    
    rewinder.back();
    console.log(dataToWatch);
    
    //  Outputs:
    //   {
    //     empty: 'object',
    //   }
    
    rewinder.forward();
    console.log(dataToWatch);
    
    //  Outputs:
    //   {
    //     empty: 'object',
    //     value: 'very good value'
    //   }

    Install

    npm i object-rewinder

    DownloadsWeekly Downloads

    0

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    51.4 kB

    Total Files

    54

    Last publish

    Collaborators

    • lulula1mc