Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@valu/env

Package Overview
Dependencies
Maintainers
4
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@valu/env - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

26

__tests__/env.test.ts

@@ -70,2 +70,8 @@ import { assertNotAny, assertType } from "@valu/assert";

test("can create env", () => {
const env = new TypedEnv<"FOO" | "BAR">({});
const values = env.createEnv({ BAR: "value" });
expect(values).toEqual({ BAR: "value" });
});
() => {

@@ -105,1 +111,21 @@ const env = new TypedEnv<"FOO">({});

};
() => {
// create env
const env = new TypedEnv<"FOO" | "BAR">({});
const values = env.createEnv({ BAR: "value" });
const s: string = values.BAR;
assertNotAny(values.BAR);
// @ts-expect-error
values.bad;
// @ts-expect-error
values.FOO;
// @ts-expect-error
env.createEnv({ bad: "value" });
};

@@ -0,1 +1,7 @@

## v1.1.0
2022-06-20
- Add .createEnv() [7d160af](https://github.com/valu-digital/npm-packages/commit/7d160af) - Esa-Matti Suuronen
## v1.0.1

@@ -2,0 +8,0 @@

@@ -8,3 +8,8 @@ export declare class TypedEnv<EnvKey extends string = ""> {

delete(key: EnvKey): void;
createEnv<Subset extends EnvKey>(env: {
[P in Subset]?: string;
}): {
[P in Subset]: string;
};
}
//# sourceMappingURL=index.d.ts.map

3

dist/index.js

@@ -29,4 +29,7 @@ "use strict";

}
createEnv(env) {
return env;
}
}
exports.TypedEnv = TypedEnv;
//# sourceMappingURL=index.js.map

2

package.json
{
"name": "@valu/env",
"version": "1.0.1",
"version": "1.1.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -37,2 +37,8 @@ export class TypedEnv<EnvKey extends string = ""> {

}
createEnv<Subset extends EnvKey>(env: { [P in Subset]?: string }): {
[P in Subset]: string;
} {
return env as any;
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc