npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ryniaubenpm/amet-quod-earum

v1.0.0

Published

Are you tired of converting environment variables to their respective types, like me? Then this package is for you! This package converts the values of environment variables to their respective types, so you don't have to worry about it anymore.

Downloads

8

Maintainers

mi762136mi762136

Keywords

pushjsxfullwidthgroupByincludes-0containsastcommandertypeofchinesecollectionrecursivesetautoprefixerclassnamesBigInt64ArrayidexpressprettyprotoiterateajvFunction.prototype.namebootstrap lesstoArraymatchesES2017settereslintpluginArray.prototype.findLastduplexgdprmodulesgesturesArray.prototype.flatMaptostringtagpathfind-upvalidatevestscheme-validationregexregular expressionstermspecpositivetypesafecurriedECMAScript 7ES3serializationchildzeroonceiterationsameValueZeroisConcatSpreadableredux-toolkitparserES2018ECMAScript 2022pnpm9looksuperagentpureStreamURLSearchParamsthreeflagutilpicomatchdomdeep-copylibphonenumber[[Prototype]]tacitdropUnderscorefast-copyrequestpoint-freereactquotecore-jsupjson-schemakeysa11yajaxECMAScript 2017removemixinsiehigher-orderobjfindLastIndexstringifieres-shimsYAMLWeakSetlanguagemergeleteslintconfigbyteLengthlimitjsonschemamatchdataViewcss-in-jsvalidatorsymbolvariableserror-handlingbluebirdpasswordextendbabel-coretranspilerBigUint64ArrayfindupassertiongroupuuidcolorES2022deep-cloneObject.fromEntriesInt16ArraymiddlewaregetoptconcatbusywalkdeepcloneschemaexeuninstallgetOwnPropertyDescriptornativeES7bcryptfixed-widthdependenciesrfc4122assignxsscallboundemojiESnextdataviewvisuallockfilegetterkeyspringmimetypesFloat64Arraycomputed-typesstatelessformprivate datanopematchAllmacosURLreadableECMAScript 3typedarrayslazydebuggermonoreporedactclonerangeerrordragreact-hooksmappackageoptimistECMAScript 2021entriestypedarrayflatMapobjectbrowserslistawaitflagsflattenl10ntrimiteratori18nwidthprogressramdaeveryclassnameruntimereuseslotArrayBuffercallbindauthsymbolsTypeScriptwalkingopeninstallnodeperformanceinterruptsasynclogascii.envpromises3dkoreanweakmapRFC-6455callbackcorefantasy-landjQueryclassesrobuststylesheetprunecjkrandomargparsesignalsdiffcharacterscolourfseventsirqqueueoptimizercachestylingRegExp#flagsbreakPushString.prototype.matchAllwatcherxtermcollection.es6variables in cssqueueMicrotaskhooksresolvejson-schema-validationes5Array.prototype.includesconsoleECMAScript 2019exit-codeapolloIteratorlintObjectairbnbrgbcolumnssymlinksfullansiES2019prefixes2016assertsfsmkdirpeventDispatcherenvcss lesslook-upoperating-systemHyBidatenodejsbabelpipemakeeditorshimreact animationimmutableinstallerspinnergetPrototypeOfregular expressionextensionoffsetfunctionchromeconcatMaprmdirefficientkarmautilitieshelpersstylesnpmcryptregularES2023byteOffsetUint8ClampedArraygradients cssxhrarraysimportObject.is_.extendtoolsstringifydebugtoSortedwgetargumentes2017compareslicefunctionaltypesUint16ArrayfastfastclonedefineperformantpropInt8Arraycodeses7internalreact-hook-formtslibtrimLeftmodulehasOwnjapaneserapidjsdifffast-cloneencryptioncommand-lineinputpersistentrateuser-streamstswatchingidleequalvaluedescriptionlaunchES5appconnectsortcall$.extendcolorsopenerrequirearktypemimelinewraptimemetadatacmddotenvvaluesstatuschecktyped arrayescapeprototypedeepcopyelectronnumberEScreatefast-deep-cloneStreamsclies2018globenvironmenthookformeast-asian-widthfast-deep-copystarterhardlinksinferencesomeauthenticationsyntaxfunctionsreducersettingsindicatorexecutableforEachcompile lesstypetestprocessbootstrap csstakepostcssES2016ES6mochatestingrmquerymime-dbreducemkdirsjsdomwatchFilees8RegExp.prototype.flagspackage manager

Readme

Environment variables with types

Are you tired of converting environment variables to their respective types, like me? Then this package is for you! This package converts the values of environment variables to their respective types, so you don't have to worry about it anymore.

It supports it all (I think, except functions, of course): numbers, booleans, strings, null, undefined, arrays and objects. It also supports nested objects and arrays, in other words, it supports JSON.

Installation

npm install @ryniaubenpm/amet-quod-earum

Usage

The package uses static properties to store the environment variables, so you can access them directly from the Environment class. The properties are named after the environment variables.

This means they only have to be loaded once, and you can access them from anywhere in your code, without having to pass them around or load them over and over again.

If you're using environment variables that are loaded in runtime, you'll need to call the load method before accessing them. If they are already loaded, you don't need to do anything, just access them, lay back and enjoy the magic.

With preloaded environment variables

import { Environment } from '@ryniaubenpm/amet-quod-earum';

console.log(`Number: ${Environment.NUMBER} - Type: ${typeof Environment.NUMBER}`);
console.log(`Boolean: ${Environment.BOOLEAN} - Type: ${typeof Environment.BOOLEAN}`);
console.log(`String: ${Environment.STRING} - Type: ${typeof Environment.STRING}`);
console.log(`Null: ${Environment.NULL} - Type: ${typeof Environment.NULL}`);
console.log(`Undefined: ${Environment.UNDEFINED} - Type: ${typeof Environment.UNDEFINED}`);
console.log(`Object: ${Environment.OBJECT} - Type: ${typeof Environment.OBJECT}`);
console.log(`Array: ${Environment.ARRAY} - Type: ${typeof Environment.ARRAY} - Is array: ${Array.isArray(Environment.ARRAY)}`);

With environment variables loaded in runtime (using dotenv for example)

import dotenv from 'dotenv';
import { Environment } from '@ryniaubenpm/amet-quod-earum';

// If you're not adding the environment variables before script execution,
// you'll need to call the load method. Like this:
dotenv.config();
Environment.load();

console.log(`Number: ${Environment.NUMBER} - Type: ${typeof Environment.NUMBER}`);
console.log(`Boolean: ${Environment.BOOLEAN} - Type: ${typeof Environment.BOOLEAN}`);
console.log(`String: ${Environment.STRING} - Type: ${typeof Environment.STRING}`);
console.log(`Null: ${Environment.NULL} - Type: ${typeof Environment.NULL}`);
console.log(`Undefined: ${Environment.UNDEFINED} - Type: ${typeof Environment.UNDEFINED}`);
console.log(`Object: ${Environment.OBJECT} - Type: ${typeof Environment.OBJECT}`);
console.log(`Array: ${Environment.ARRAY} - Type: ${typeof Environment.ARRAY} - Is array: ${Array.isArray(Environment.ARRAY)}`);

Environment variables used in the examples

This is the environment file that I used in the examples above:

NUMBER=8
BOOLEAN=true
STRING=hello world
NULL=null
NULL_2=
UNDEFINED=undefined
ARRAY=[1,2,3]
OBJECT={"a":1,"b":2,"c":3}

API

Environment.load(config?: EnvironmentConfig)

Loads the environment variables. If you're using environment variables that are loaded in runtime, you'll need to call this method before accessing them.

EnvironmentConfig

binaryToBooleans?: boolean

If set to true, the package will convert the string 1 to true and the string 0 to false.
Default: true

emptyStringsToNull?: boolean

If set to true, the package will convert empty strings to null.
Default: true