gemini-configparser
Advanced tools
Comparing version 1.3.2 to 1.4.0
@@ -20,6 +20,18 @@ const _ = require('lodash'); | ||
function getEnvName(prefixes, subKey) { | ||
if (typeof prefixes === 'string') { | ||
return prefixes + subKey; | ||
} | ||
const relatedEnvPrefixIndex = prefixes.findIndex((prefix => Object.hasOwnProperty.call(env, prefix + subKey))); | ||
const envPrefix = relatedEnvPrefixIndex >= 0 ? prefixes[relatedEnvPrefixIndex] : prefixes[0]; | ||
return envPrefix + subKey; | ||
} | ||
function getNested(option, {namePrefix, envPrefix, cliPrefix}) { | ||
return (subKey) => { | ||
const envName = envPrefix + _.snakeCase(subKey); | ||
const envSubKey = _.snakeCase(subKey); | ||
const cliFlag = cliPrefix + _.kebabCase(subKey); | ||
const envName = getEnvName(envPrefix, envSubKey); | ||
@@ -26,0 +38,0 @@ const argIndex = parsedArgv.lastIndexOf(cliFlag); |
{ | ||
"name": "gemini-configparser", | ||
"version": "1.3.2", | ||
"version": "1.4.0", | ||
"description": "Config parser module for gemini", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -12,3 +12,4 @@ declare module "gemini-configparser" { | ||
type RootPrefixes = { | ||
envPrefix: string; | ||
// If defined as an array and multiple prefixes match, first defined in the array will be used | ||
envPrefix: string | string[]; | ||
cliPrefix: string; | ||
@@ -15,0 +16,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
16249
270
0