Necessary Pigeonholing Mechanism

    @creately/sakota
    TypeScript icon, indicating that this package has built-in type declarations

    2.4.5 • Public • Published

    SaKota

    SaKota proxies js objects and records all changes made on an object without modifying the given object.

    Getting Started

    Install @creately/sakota module from npm.

    npm install @creately/sakota

    Wrap an existing object with a proxy and make some changes to the proxied object. It should reflect all changes made to the object without modifying the source.

    import { Sakota } from '@creately/sakota'
    
    const source = { x: 10, y: 20, c1: { x: 20, y: 30, z: 40 }}
    const proxy = Sakota.create(source);
    
    // make some changes
    proxy.z = 30;
    proxy.c1.y = 40;
    delete proxy.c1.z;
    
    console.log(source)
    // { x: 10, y: 20, c1: { x: 20, y: 30, z: 40 }}
    
    console.log(proxy)
    // { x: 10, y: 20, z: 30, c1: { x: 20, y: 40 }}

    Changes made to the object are all recorded as a MongoDB like modifier.

    const changes = Sakota.changes(proxy);
    console.log(changes)
    // {
    //     $set: { z: 30, 'c1.y': 40 },
    //     $unset: { 'c1.z': true },
    // }

    Keywords

    none

    Install

    npm i @creately/sakota

    DownloadsWeekly Downloads

    18

    Version

    2.4.5

    License

    MIT

    Unpacked Size

    51.2 kB

    Total Files

    7

    Last publish

    Collaborators

    • thisunravisara
    • nuwacgx
    • jziegelaar
    • chandika
    • vinochs
    • shashik_thiwanka
    • sasindu
    • rumaizcinergix
    • sajeeva
    • linatrefai
    • damithcgx