Skip to content

Instantly share code, notes, and snippets.

@JonasGao
Created March 28, 2019 09:57
Show Gist options
  • Save JonasGao/51fbedc8bde4371c1d400b61931fb76a to your computer and use it in GitHub Desktop.
Save JonasGao/51fbedc8bde4371c1d400b61931fb76a to your computer and use it in GitHub Desktop.
**
* 用于比较属性的帮助方法。应该仅在开发时使用
*/
export const helper = {
cache: {},
diff(key: string | number, ...args) {
const latestArgs: any[] = this.cache[key];
if (!latestArgs) {
this.cache[key] = args;
return
}
latestArgs.forEach((prev, index) => {
const next = args[index];
if (prev !== next) {
console.log('[key]', key, 'find diff! [index]', index, '[prev]', prev, typeof prev, '[next]', next, typeof next);
}
});
this.cache[key] = args;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment