New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

getenv.ts

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

getenv.ts - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# [1.1.0](https://gitlab.com/tdolsen/getenv.ts/compare/v1.0.0...v1.1.0) (2018-09-21)
### Features
* sets TS compile target to ES5 ([05a216c](https://gitlab.com/tdolsen/getenv.ts/commit/05a216c))
# 1.0.0 (2018-09-13)

@@ -2,0 +9,0 @@

2

dist/conversions.js

@@ -14,3 +14,3 @@ "use strict";

function toFloat(value) {
const ret = typeof value === "number" ? value : parseFloat(value);
var ret = typeof value === "number" ? value : parseFloat(value);
if (isNaN(ret))

@@ -17,0 +17,0 @@ return undefined;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function invalidTypeError(env, type) {
return new TypeError(`Environment variable "${env}" is not of type ${type}.`);
return new TypeError("Environment variable \"" + env + "\" is not of type " + type + ".");
}
exports.invalidTypeError = invalidTypeError;
//# sourceMappingURL=error-handling.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const conversions_1 = require("./conversions");
const error_handling_1 = require("./error-handling");
var conversions_1 = require("./conversions");
var error_handling_1 = require("./error-handling");
/**

@@ -16,6 +16,6 @@ * Gets the raw value of given `env` variable, falling back to `fallback` if

function getEnvRaw(env, fallback) {
const ret = process.env[env] || fallback;
var ret = process.env[env] || fallback;
// Ensure variable is defined.
if (ret === undefined) {
throw new ReferenceError(`Environment variable "${env}" is not defined.`);
throw new ReferenceError("Environment variable \"" + env + "\" is not defined.");
}

@@ -26,3 +26,3 @@ return ret;

function getEnvBoolean(env, fallback) {
const envVar = conversions_1.toBoolean(getEnvRaw(env, fallback));
var envVar = conversions_1.toBoolean(getEnvRaw(env, fallback));
if (typeof envVar !== "boolean")

@@ -34,3 +34,3 @@ throw error_handling_1.invalidTypeError(env, "boolean");

function getEnvFloat(env, fallback) {
const envVar = conversions_1.toFloat(getEnvRaw(env, fallback));
var envVar = conversions_1.toFloat(getEnvRaw(env, fallback));
if (typeof envVar !== "number")

@@ -42,3 +42,3 @@ throw error_handling_1.invalidTypeError(env, "float");

function getEnvInteger(env, fallback) {
let envVar;
var envVar;
try {

@@ -56,3 +56,3 @@ envVar = getEnvFloat(env, fallback);

function getEnvString(env, fallback) {
const envVar = conversions_1.toString(getEnvRaw(env, fallback));
var envVar = conversions_1.toString(getEnvRaw(env, fallback));
if (typeof envVar !== "string")

@@ -79,3 +79,3 @@ throw error_handling_1.invalidTypeError(env, "string");

if (fallback !== undefined) {
const fallbackType = typeof fallback;
var fallbackType = typeof fallback;
// Get expected return type from fallback value.

@@ -95,3 +95,3 @@ switch (fallbackType) {

default:
throw new Error(`Conversion type "${fallbackType}" is not supported for conversion of environment variables.`);
throw new Error("Conversion type \"" + fallbackType + "\" is not supported for conversion of environment variables.");
}

@@ -98,0 +98,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const getenv_1 = require("./getenv");
var getenv_1 = require("./getenv");
// Remap to exported name.
const getenv = getenv_1.getEnv;
var getenv = getenv_1.getEnv;
// Define typecast functions.

@@ -7,0 +7,0 @@ getenv.bool = getenv_1.getEnvBoolean;

{
"name": "getenv.ts",
"version": "1.0.0",
"description": "Get and typecast environment variables with TypeScript.",
"version": "1.1.0",
"description": "Get and typecast environment variables with TypeScript",
"author": "Torkild Dyvik Olsen <torkild@tdolsen.net>",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -7,3 +7,3 @@ {

"moduleResolution": "node",
"target": "es6",
"target": "es5",
"lib": ["dom", "es7"],

@@ -10,0 +10,0 @@ "strict": true,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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