0.0.3 • Published 7 years ago

object-delta-mask v0.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Object Delta Mask

Produces a grpc json mask string that can be used for patch http verbs. The string constains the property paths of what is differnent from the source object. See JSON Mapping : FieldMask string "f.fooBar,h"

Installation

  • npm: npm install object-delta-mask
const mask = require('object-delta-mask');

  let merchant = {
                name: "home",
                description: "james is a nice boy",
                id: 203203,
                age: 23,
                isActive: false,
                price: {
                    micro: 2000,
                    isCheap: false,
                    address: {
                        line1: "dfdfd"
                    }
                }
            };
  let dirtyMerchant = {
                name: "home",
                description: "james is a boy",
                id: 203203,
                age: 20,
                isActive: true,
                price: {
                    micro: 2001,
                    isCheap: true,
                    address: {
                        line1: "fddd"
                    }
                }
            };
  
  let result = mask.createMask(merchant, dirtyMerchant);
    
    
  //result ="description,age,isActive,price.micro,price.isCheap,price.address.line1"