eng: move selfhost test provider as a workspace extension (#208699)

Testing #208184, closes #207756
This commit is contained in:
Connor Peet
2024-03-28 09:08:23 -07:00
committed by GitHub
parent baa003c674
commit d42fad27b2
20 changed files with 2008 additions and 2 deletions

View File

@@ -0,0 +1,16 @@
/*---------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
export const memoizeLast = <A, T>(fn: (args: A) => T): ((args: A) => T) => {
let last: { arg: A; result: T } | undefined;
return arg => {
if (last && last.arg === arg) {
return last.result;
}
const result = fn(arg);
last = { arg, result };
return result;
};
};