The needs to diff two string and find minimum change needed is commonly known as Levenshtein distance. This is the JS implementation to diff two strings. There's a more generalized implementation that diffs two object structure and recursively find minimum changes that I will check in separately