🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@rentpath/hive-config

Package Overview
Dependencies
Maintainers
11
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rentpath/hive-config

Utilities for managing configuration objects in Node.js applications.

latest
npmnpm
Version
1.1.4
Version published
Maintainers
11
Created
Source

hive-config

Utilities for managing configuration objects in Node.js applications.

API Reference

merge(target, ...[sources])

Recursively merges own and inherited string keyed properties of source configuration objects into a destination object. Special handling is given to any property whose value is a function, and whose key beings with $, which will be called as a resolver function with the previous value of the property as an argument. The return value is used as the merged property value.

const obj1 = {
  foo: 'foo',
}

const obj2 = {
  $foo: prev => `${prev} bar`
}

merge({}, obj1, obj2)
// -> { foo: 'foo bar' }

combine(target, ...[sources])

Recursively merges own and inherited string keyed properties of source configuration objects into a destination object, but with special handling for arrays. If both the source and the target are arrays, then the two arrays are combined.

const obj1 = {
  items: [1],
}

const obj2 = {
  items: [2],
}

combine({}, obj1, obj2)
// -> { items: [1, 2] }

compile(context, ...[configs])

A configuration resolver that iterates over a set of configs, and for each config that evaluates to a function, calls it with a provided context argument. The returned value(s) for each config are returned.

const config1 = {
  foo: 'foo',
}

const config2 = ctx => ({
  foo: ctx.foo,
})

compile({ foo: 'bar' }, config1, config2)
// -> [{ foo: 'foo' }, { foo: 'bar' }]

FAQs

Package last updated on 12 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts