Skip to content

Stringify the differences of two objects for a GraphQL mutation

Notifications You must be signed in to change notification settings

lockykeaney/diff-string

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

diffString

Stringify the differences of two objects for a GraphQL mutation.

yarn install

import diffString from 'diffString'

By passing in two object, you can check for the differences and return a string that can be used for a mutation in a GraphQL mutation.

Example:

const obj1 = {
    name: 'Mark',
    role: 'Builder',
    available: false,
    jobs: 3
}

const obj2 = {
    name: 'Steve',
    role: 'Builder',
    available: true,
    jobs: 2
}

const string = diffString(obj1, obj2)

Will return:

name: "Steve", available: true

About

Stringify the differences of two objects for a GraphQL mutation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published