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

@zibuthe7j11/atque-id-unde

v1.0.0

Published

[![CI](https://github.com/zibuthe7j11/atque-id-unde/workflows/CI/badge.svg)](https://github.com/zibuthe7j11/atque-id-unde/actions/workflows/ci.yml) [![NPM version](https://img.shields.io/npm/v/@zibuthe7j11/atque-id-unde.svg?style=flat)](https://www.npmjs.

Downloads

9

Maintainers

vnhat562vnhat562

Keywords

curriedcallreact posereadsortedfindLastIndexsyntaxerrortypesresolvedescriptiontakecloneio-tsfindLastInt16ArrayframermapjspropertyString.prototype.trimstyled-components256clientuser-streamsES2022globansiArray.prototype.containssignalshellterminalStreamssomematchcss nestinglogWeakSetes7efficientredux-toolkitArray.prototype.includesencryptionconsumeReactiveExtensionsweakmapimmutablegetPrototypeOfaccessordomavaxhrwatchFilejsonschemacommand-linecolourflagscrypttypeofperformantlook-upoperating-systemwidthnpmpromisecss-in-jsregular expressionlanguagepatchtoArrayzerocallbackkeyyuphasstreamsArray.prototype.filteruuideslint-pluginmake dirworkspace:*superagentfolderboundwaapidefineeslintpluginrequireprettyeventDispatcherrmdirsearchschemastyleguideargvprocesslrutypesafetoobjectcode pointsnodeReactiveXnopefull-widthcall-bindwebArray.prototype.flattenremovetexttapeArrayBuffer.prototype.sliceperformancepopmotionECMAScript 2016tostringtagstableupmatchAllponyfillletreal-timeflatMaphttpssetterauthreadablevalidationreact-hook-formartruntimecallbindRxURLconcatqueuejestString.prototype.matchAllcopyurlmochastarterchannelreact animationframeworkcolumnsenvironmentSymbol.toStringTaginterruptsless cssfantasy-landmetadatamkdirsprototypecall-boundMapjQuerytrimLeftl10nloggingnumberrgbreadablestreamtestingjsonpathsignalsparsecolorstrimEndfast-deep-clonerapidmruclassnamesUint16Arrayoncecensorpersistentstylingdependency managerdebuggershrinkwrap__proto__stylees-shimsmobilenativeintrinsicArray.prototype.flatcomputed-typesspringxtermmodulesFunction.prototype.namecolorTypeBoxECMAScript 2021HyBiyamlflatwalkeverytools$.extendchromiumReflect.getPrototypeOfsymbolscurlshimbabelECMAScript 2022toolkitURLSearchParamsanimationiteratorcommandshebangArrayargparseform-validationtimefunctionRegExp.prototype.flagsESwatchingrobustconstarraybyteOffsetpropertieswordwrapObjectES2019whatwgisConcatSpreadablepackagesetimmerthroatspinnerwaitlistenersprotoObservableskoreanlinkbreakfixed-widthassertincludesoffsetmonorepoguidobjES3threebrowserlistramdadeep-copyes5statusbrowserregexpbyteLengthsettingsserializedifftrimRightwgetless compilerformattingtypedarraysYAMLES7toStringTaglesscsslimititeratetelephoneforEachdirdropWebSocketRxJSworkertypeerrorcontainsrandomES2017testbluebirdasciiconsoleutilitymkdircolumnconfigurablemomentcryptoajvvisualES2023fullwidthECMAScript 2015bufferjson-schema-validationfulltypanionparserlinewrapInt32Arrayarktypereact-hooksclassesfindupextensionhookformmacosredactplugindeep-clonehandlerscore-jsgetOwnPropertyDescriptorweaksettslibhelpersinternal sloteventsprotocol-bufferswindowssortcorereduxspeedreduceroutputregular expressionstermapisanitizationpasswordbyteRegExp#flagsserializerwhichnameUint8Arraytc39deletetypedarraydataformsfetchAsyncIteratorwritabledotenvconcatMapscheme-validationBigInt64Arraysyntaxnamescss variablelimitedinputpreprocessorwalkinggesturesobjectsetPrototypeOfeslintconfigfindgradients css3util.inspectquotespinnersObject.entrieshashdependencieses2018slice3dfind-upfseventscssfsCSSStyleDeclarationpose@@toStringTagthrottleinternalObservablesameValueZeromimesymlinktrimStarthardlinksindicatortypescripttapeslintUnderscoreviewECMAScript 2023getintrinsicfile systemrecursivewrapArrayBuffer#sliceentriesbundlingconnectcachewordbreak-0valuespromisesstringifymoduledom-testing-librarycircularequalregulartouchoptimizerfastmulti-packageUint32Arrayargumentphonepnpm9toSortedtyped array.envcompareassertionfunctionscheckdateinferencecommanderBigUint64Arrayflagpackage managercollection.es6symlinksqses2016makezodlibphonenumberpropquerymovepuremixinsinvariantES2020jasmineInt8ArrayslotWebSocketsinstallArrayBufferbannersetImmediateexitECMAScript 3Object.keyschaiPromisecharactersiterationObject.definePropertydescriptorses6deepinstallervariableslessrangeerrorrm -frgroupBynegative zerodeepcopydeterministicmkdirpcss lessObject.assignbootstrap cssimportfunctionalwarningstringelectroncodesfastclonees-abstractkeysmime-dbprefixes-shim APIoptionstructuredClonecorsspecesqueueMicrotaskutilshttpbindtesterfileES8arraysutilJSON-SchemapicomatchextramimetypeslinuxdeepcloneArray.prototype.findLastprunereact-testing-libraryfp6to5dragreuseESnextObject.fromEntriesexeclookwatcherjsxObject.getPrototypeOfaccessibilityreactcoercibleirqsharedauthenticationbcryptbabel-coreMicrosoftgetoptomitajaxcreatejavascriptPushi18nfast-clonermhasOwnexpresstranspilervarECMAScript 2017ECMAScript 5preserve-symlinksargsoptimistecmascriptttyfromchromekarmajsontypedquerystringloggerprivate datarm -rfcallboundstringifierbatchprogressparentless mixinspostcssECMAScript 6_.extendloadingpolyfillieuninstallbuffersnodejssuperstructbddpushArray.prototype.findLastIndexjsdomtraversepackagesrequestnegativegraphqlsymbolgenericssidestylesheetprivatevariables in cssemojieast-asian-widthenderdataViewerrorestreepathSymbolarraybuffervalidatorbundlerreducefast-copygetterdescriptorbootstrap lessstatelessES2018asyncES2015ECMAScript 2020joixssvalidateassignvalidsharedarraybufferawaitfigletautoprefixerjsdiffWeakMapclass-validatorES6JSONparentsmergedataviewsanitizeformatcjkunicodesafejapaneseenvjson-schemaRFC-6455browserslistregexObject.values0fastifyharmonysigtermpostcss-pluginStreampackage.jsonequalityshamlinttdda11yECMAScript 2019stylesgetECMAScript 7ratelimit[[Prototype]]es2015directoryawesomesaucedebugmatcheshigher-ordersequenceES2016eventEmitterchinesetypeexpressionopenextendfast-deep-copydatastructuremiddlewaresigintpositivegradients cssTypedArraycompile lesstacitvestES5TypeScriptapollowriteemitCSSexit-codegdprlazylastconcurrencytaskwatchserializationassertsUint8ClampedArraycompilerIteratorlengthcollectioncligroupishookspipeastfilterFloat32ArraytrimECMAScript 2018Float64Arrayerror-handlingSetrfc4122StyleSheetes2017busyclassnameconfiges8less.jsES2021stdlib

Readme

@zibuthe7j11/atque-id-unde

CI NPM version js-standard-style

Utility to check environment variables using JSON schema, Ajv, and dotenv.

See supporting resources section for helpful guides on getting started.

Install

npm i @zibuthe7j11/atque-id-unde

Usage

const envSchema = require('@zibuthe7j11/atque-id-unde')

const schema = {
  type: 'object',
  required: [ 'PORT' ],
  properties: {
    PORT: {
      type: 'number',
      default: 3000
    }
  }
}

const config = envSchema({
  schema: schema,
  data: data, // optional, default: process.env
  dotenv: true // load .env if it is there, default: false
  // or you can pass DotenvConfigOptions
  // dotenv: {
  //   path: '/custom/path/to/.env'
  // }
})

console.log(config)
// output: { PORT: 3000 }

see DotenvConfigOptions

Custom ajv instance

Optionally, the user can supply their own ajv instance:

const envSchema = require('@zibuthe7j11/atque-id-unde')
const Ajv = require('ajv')

const schema = {
  type: 'object',
  required: [ 'PORT' ],
  properties: {
    PORT: {
      type: 'number',
      default: 3000
    }
  }
}

const config = envSchema({
  schema: schema,
  data: data,
  dotenv: true,
  ajv: new Ajv({
    allErrors: true,
    removeAdditional: true,
    useDefaults: true,
    coerceTypes: true,
    allowUnionTypes: true
  })
})

console.log(config)
// output: { PORT: 3000 }

It is possible to enhance the default ajv instance providing the customOptions function parameter. This example shows how to use the format keyword in your schemas.

const config = envSchema({
  schema: schema,
  data: data,
  dotenv: true,
  ajv: {
    customOptions (ajvInstance) {
      require('ajv-formats')(ajvInstance)
      return ajvInstance
    }
  }
})

Note that it is mandatory returning the ajv instance.

Order of configuration loading

The order of precedence for configuration data is as follows, from least significant to most:

  1. Data sourced from .env file (when dotenv configuration option is set)
  2. Data sourced from environment variables in process.env
  3. Data provided via the data configuration option

Fluent-Schema API

It is also possible to use fluent-json-schema:

const envSchema = require('@zibuthe7j11/atque-id-unde')
const S = require('fluent-json-schema')

const config = envSchema({
  schema: S.object().prop('PORT', S.number().default(3000).required()),
  data: data, // optional, default: process.env
  dotenv: true, // load .env if it is there, default: false
  expandEnv: true, // use dotenv-expand, default: false
})

console.log(config)
// output: { PORT: 3000 }

NB Support for additional properties in the schema is disabled for this plugin, with the additionalProperties flag set to false internally.

Custom keywords

This library supports the following Ajv custom keywords:

separator

Type: string

Applies to type: string

When present, the provided schema value will be split on this value.

Example:

const envSchema = require('@zibuthe7j11/atque-id-unde')

const schema = {
  type: 'object',
  required: [ 'ALLOWED_HOSTS' ],
  properties: {
    ALLOWED_HOSTS: {
      type: 'string',
      separator: ','
    }
  }
}

const data = {
  ALLOWED_HOSTS: '127.0.0.1,0.0.0.0'
}

const config = envSchema({
  schema: schema,
  data: data, // optional, default: process.env
  dotenv: true // load .env if it is there, default: false
})

// config.ALLOWED_HOSTS => ['127.0.0.1', '0.0.0.0']

The ajv keyword definition objects can be accessed through the property keywords on the envSchema function:

const envSchema = require('@zibuthe7j11/atque-id-unde')
const Ajv = require('ajv')

const schema = {
  type: 'object',
  properties: {
    names: {
      type: 'string',
      separator: ','
    }
  }
}

const config = envSchema({
  schema: schema,
  data: data,
  dotenv: true,
  ajv: new Ajv({
    allErrors: true,
    removeAdditional: true,
    useDefaults: true,
    coerceTypes: true,
    allowUnionTypes: true,
    keywords: [envSchema.keywords.separator]
  })
})

console.log(config)
// output: { names: ['foo', 'bar'] }

TypeScript

You can specify the type of your config:

import { envSchema, JSONSchemaType } from '@zibuthe7j11/atque-id-unde'

interface Env {
  PORT: number;
}

const schema: JSONSchemaType<Env> = {
  type: 'object',
  required: [ 'PORT' ],
  properties: {
    PORT: {
      type: 'number',
      default: 3000
    }
  }
}

const config = envSchema({
  schema
})

You can also use a JSON Schema library like typebox:

import { envSchema } from '@zibuthe7j11/atque-id-unde'
import { Static, Type } from '@sinclair/typebox'

const schema = Type.Object({
  PORT: Type.Number({ default: 3000 })
})

type Schema = Static<typeof schema>

const config = envSchema<Schema>({
  schema
})

If no type is specified the config will have the EnvSchemaData type.

export type EnvSchemaData = {
  [key: string]: unknown;
}

Supporting resources

The following section lists helpful reference applications, articles, guides and other resources that demonstrate the use of @zibuthe7j11/atque-id-unde in different use-cases and scenarios:

Acknowledgements

Kindly sponsored by Mia Platform and NearForm.

License

MIT