Implement improved compare-and-replace algorithm for Store.sync.
Add guard against state being set to non-enumerable type.
Strip trailing whitespace.
Merge pull request #5 from mattdeboard/improved-compare

Implement improved compare-and-replace algorithm for Store.sync.