(fn: () => boolean)
| 22 | } |
| 23 | |
| 24 | function cached(fn: () => boolean) { |
| 25 | if (process.env.NODE_ENV === 'test') { |
| 26 | return fn; |
| 27 | } |
| 28 | |
| 29 | let res: boolean | null = null; |
| 30 | return () => { |
| 31 | if (res == null) { |
| 32 | res = fn(); |
| 33 | } |
| 34 | return res; |
| 35 | }; |
| 36 | } |
| 37 | |
| 38 | const isMac = cached(function () { |
| 39 | return testPlatform(/^Mac/i); |