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

@arcjet/env

Package Overview
Dependencies
Maintainers
0
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arcjet/env - npm Package Compare versions

Comparing version 1.0.0-alpha.17 to 1.0.0-alpha.18

1

index.d.ts

@@ -12,5 +12,4 @@ export type Env = {

export declare function isDevelopment(env: Env): boolean;
export declare function isProduction(env: Env): boolean;
export declare function logLevel(env: Env): "debug" | "info" | "warn" | "error";
export declare function baseUrl(env: Env): string;
export declare function apiKey(env: Env): string | undefined;

19

index.js

@@ -9,5 +9,2 @@ function platform(env) {

}
function isProduction(env) {
return env.NODE_ENV === "production" || env.ARCJET_ENV === "production";
}
function logLevel(env) {

@@ -34,8 +31,5 @@ const level = env["ARCJET_LOG_LEVEL"];

function baseUrl(env) {
// TODO(#90): Remove this production conditional before 1.0.0
if (isProduction(env)) {
// Use ARCJET_BASE_URL if it is set and belongs to our allowlist; otherwise
// use the hardcoded default.
if (typeof env["ARCJET_BASE_URL"] === "string" &&
baseUrlAllowed.includes(env["ARCJET_BASE_URL"])) {
// TODO(#90): Remove this conditional before 1.0.0
if (isDevelopment(env)) {
if (env["ARCJET_BASE_URL"]) {
return env["ARCJET_BASE_URL"];

@@ -51,3 +45,6 @@ }

else {
if (env["ARCJET_BASE_URL"]) {
// Use ARCJET_BASE_URL if it is set and belongs to our allowlist; otherwise
// use the hardcoded default.
if (typeof env["ARCJET_BASE_URL"] === "string" &&
baseUrlAllowed.includes(env["ARCJET_BASE_URL"])) {
return env["ARCJET_BASE_URL"];

@@ -70,2 +67,2 @@ }

export { apiKey, baseUrl, isDevelopment, isProduction, logLevel, platform };
export { apiKey, baseUrl, isDevelopment, logLevel, platform };

@@ -21,6 +21,2 @@ export type Env = {

export function isProduction(env: Env) {
return env.NODE_ENV === "production" || env.ARCJET_ENV === "production";
}
export function logLevel(env: Env) {

@@ -49,10 +45,5 @@ const level = env["ARCJET_LOG_LEVEL"];

export function baseUrl(env: Env) {
// TODO(#90): Remove this production conditional before 1.0.0
if (isProduction(env)) {
// Use ARCJET_BASE_URL if it is set and belongs to our allowlist; otherwise
// use the hardcoded default.
if (
typeof env["ARCJET_BASE_URL"] === "string" &&
baseUrlAllowed.includes(env["ARCJET_BASE_URL"])
) {
// TODO(#90): Remove this conditional before 1.0.0
if (isDevelopment(env)) {
if (env["ARCJET_BASE_URL"]) {
return env["ARCJET_BASE_URL"];

@@ -69,3 +60,8 @@ }

} else {
if (env["ARCJET_BASE_URL"]) {
// Use ARCJET_BASE_URL if it is set and belongs to our allowlist; otherwise
// use the hardcoded default.
if (
typeof env["ARCJET_BASE_URL"] === "string" &&
baseUrlAllowed.includes(env["ARCJET_BASE_URL"])
) {
return env["ARCJET_BASE_URL"];

@@ -72,0 +68,0 @@ }

{
"name": "@arcjet/env",
"version": "1.0.0-alpha.17",
"version": "1.0.0-alpha.18",
"description": "Arcjet environment detection",

@@ -44,9 +44,9 @@ "license": "Apache-2.0",

"devDependencies": {
"@arcjet/eslint-config": "1.0.0-alpha.17",
"@arcjet/rollup-config": "1.0.0-alpha.17",
"@arcjet/tsconfig": "1.0.0-alpha.17",
"@arcjet/eslint-config": "1.0.0-alpha.18",
"@arcjet/rollup-config": "1.0.0-alpha.18",
"@arcjet/tsconfig": "1.0.0-alpha.18",
"@jest/globals": "29.7.0",
"@rollup/wasm-node": "4.18.0",
"jest": "29.7.0",
"typescript": "5.4.5"
"typescript": "5.5.2"
},

@@ -53,0 +53,0 @@ "publishConfig": {

@@ -48,7 +48,2 @@ <a href="https://arcjet.com" target="_arcjet-home">

env.isProduction({ NODE_ENV: "production" }) === true;
env.isProduction({ NODE_ENV: "development" }) === false;
env.isProduction({ ARCJET_ENV: "production" }) === true;
env.isProduction({ ARCJET_ENV: "development" }) === false;
env.isDevelopment({ NODE_ENV: "production" }) === false;

@@ -55,0 +50,0 @@ env.isDevelopment({ NODE_ENV: "development" }) === true;

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