UNPKG
@humanlayer/sdk
Version:
alpha (0.7.9-alpha.1)
latest (0.7.9)
0.7.9
0.7.9-alpha.1
0.7.8
0.7.8-alpha.1
typescript client for humanlayer.dev
github.com/humanlayer/humanlayer
humanlayer/humanlayer
@humanlayer/sdk
/
src
/
testing
/
index.ts
14 lines
(13 loc)
•
315 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
export
function
with_env_var
(
key
:
string
,
value
:
string
,
callback
: () =>
any
) {
const
prevValue = process.
env
[key] process.
env
[key] = value
try
{
callback
() }
finally
{
if
(
typeof
prevValue !==
'undefined'
) { process.
env
[key] = prevValue }
else
{
delete
process.
env
[key] } } }