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

fastconf

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastconf - npm Package Compare versions

Comparing version 0.1.1 to 0.2.1

9

index.js
'use strict'
module.exports = function fastconf (options, namespaces, envOverride) {
module.exports = function fastconf (_options, namespaces, envOverride) {
let options
if (Array.isArray(_options)) {
options = {keys: _options}
} else {
options = _options
}
if (!options || typeof options !== 'object') {

@@ -5,0 +12,0 @@ throw new Error('No options object provided!')

2

package.json
{
"name": "fastconf",
"version": "0.1.1",
"version": "0.2.1",
"description": "super simple environment-based configuration utility",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -20,13 +20,13 @@ fastconf

const config = fastconf({
keys: [
['FOO_BAR', {type: Number}],
['NOPE', {type: Boolean, defaultValue: false}],
['MORE_THINGS', {defaultValue: 'apples'}]
]
}, {
xbpf: {
const config = fastconf([
// All keys are required unless a default value is provided
['FOO_BAR', {type: Number}],
['NOPE', {type: Boolean, defaultValue: false}],
['MORE_THINGS', {defaultValue: 'apples'}]
], {
xbpf: { // You can also pass an object (with the keys prop) if you want to
// further configure fastconf
prefix: 'XBPF_',
keys: [
'ZIG_ZAG' // You can also just provide strings (options are defaults)
'ZIG_ZAG' // You can also just provide strings in keys array (options are defaults)
]

@@ -59,2 +59,5 @@ }

const config = fastconf({
// (Since 0.2.0) You can now just pass an array in place of the first object,
// which is equivalent to passing {keys: [the array]}
// Prefix, useful for not having to repeat yourself.

@@ -61,0 +64,0 @@ // If you have a prefix of 'NICE_', and have a required key 'FOO_BAR',

@@ -52,9 +52,7 @@ 'use strict'

const config = fastconf({
keys: [
['FOO_BAR', {type: Number}],
['NOPE', {type: Boolean, defaultValue: false}],
['MORE_THINGS', {defaultValue: 'apples'}]
]
}, {
const config = fastconf([
['FOO_BAR', {type: Number}],
['NOPE', {type: Boolean, defaultValue: false}],
['MORE_THINGS', {defaultValue: 'apples'}]
], {
xbpf: {

@@ -271,1 +269,2 @@ prefix: 'XBPF_',

test.todo('key checking if string')
test.todo('array of keys for options testing')
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