1.0.158 • Published 11 months ago

@brainstack/config v1.0.158

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

@brainstack/config

A Micro Config Manager Package

Installation

Install the package using npm:

npm install @brainstack/config

Usage

To use the ConfigManager and ConfigManagerIntegration provided by this package, follow these steps:

  1. Import the required interfaces and functions:
import { ConfigManager, ConfigManagerIntegration } from '@brainstack/config';
  1. Create an integration that implements the ConfigManagerIntegration interface:
const myIntegration: ConfigManagerIntegration<MyValueType> = {
  get(key: string): MyValueType | undefined {
    // Your implementation to retrieve the value for the key
  },
  set(key: string, value: MyValueType): void {
    // Your implementation to set the value for the key
  },
  remove(key: string): void {
    // Your implementation to remove the value for the key
  },
};
  1. Create a ConfigManager instance using the createConfigManager function:
const configManager: ConfigManager<MyValueType> = createConfigManager(myIntegration);
  1. Now you can use the configManager to interact with your configuration values:
// Get a configuration value
const value = configManager.get('myConfigKey');

// Set a configuration value
configManager.set('myConfigKey', newValue);

// Remove a configuration value
configManager.remove('myConfigKey');

Example

Here's an example of how you can use the @brainstack/config package:

import { ConfigManager, ConfigManagerIntegration, createConfigManager } from '@brainstack/config';

// Define an integration
const myIntegration: ConfigManagerIntegration<number> = {
  get(key: string): number | undefined {
    // Implementation to retrieve the value for the key
  },
  set(key: string, value: number): void {
    // Implementation to set the value for the key
  },
  remove(key: string): void {
    // Implementation to remove the value for the key
  },
};

// Create a ConfigManager instance
const configManager: ConfigManager<number> = createConfigManager(myIntegration);

// Use the configManager to get, set, and remove configuration values
const value = configManager.get('myConfigKey');
configManager.set('myConfigKey', newValue);
configManager.remove('myConfigKey');

Contributing

Contributions are welcome! If you would like to contribute to this module, please follow these guidelines:

Fork the repository
Create a new branch for your changes
Make your changes and commit them with descriptive commit messages
Push your changes to your fork
Submit a pull request

License

This module is released under the MIT License.

1.0.154

11 months ago

1.0.153

11 months ago

1.0.156

11 months ago

1.0.155

11 months ago

1.0.152

11 months ago

1.0.151

12 months ago

1.0.158

11 months ago

1.0.157

11 months ago

1.0.147

1 year ago

1.0.146

1 year ago

1.0.148

1 year ago

1.0.145

2 years ago

1.0.144

2 years ago

1.0.143

2 years ago

1.0.142

2 years ago

1.0.141

2 years ago

1.0.140

2 years ago

1.0.139

2 years ago

1.0.136

2 years ago

1.0.138

2 years ago

1.0.137

2 years ago

1.0.132

2 years ago

1.0.131

2 years ago

1.0.134

2 years ago

1.0.133

2 years ago

1.0.130

2 years ago

1.0.135

2 years ago

1.0.129

2 years ago

1.0.128

2 years ago

1.0.125

2 years ago

1.0.124

2 years ago

1.0.127

2 years ago

1.0.126

2 years ago

1.0.77

2 years ago

1.0.76

2 years ago

1.0.75

2 years ago

1.0.74

2 years ago

1.0.79

2 years ago

1.0.78

2 years ago

1.0.80

2 years ago

1.0.84

2 years ago

1.0.83

2 years ago

1.0.82

2 years ago

1.0.81

2 years ago

1.0.86

2 years ago

1.0.85

2 years ago

1.0.66

2 years ago

1.0.65

2 years ago

1.0.64

2 years ago

1.0.69

2 years ago

1.0.68

2 years ago

1.0.67

2 years ago

1.0.73

2 years ago

1.0.72

2 years ago

1.0.71

2 years ago

1.0.70

2 years ago

1.0.62

2 years ago

1.0.61

2 years ago

1.0.60

2 years ago

1.0.63

2 years ago

1.0.44

2 years ago

1.0.48

2 years ago

1.0.47

2 years ago

1.0.46

2 years ago

1.0.45

2 years ago

1.0.49

2 years ago

1.0.51

2 years ago

1.0.50

2 years ago

1.0.55

2 years ago

1.0.54

2 years ago

1.0.53

2 years ago

1.0.52

2 years ago

1.0.59

2 years ago

1.0.58

2 years ago

1.0.57

2 years ago

1.0.56

2 years ago

1.0.43

2 years ago

1.0.42

2 years ago

1.0.41

2 years ago

1.0.40

2 years ago

1.0.39

2 years ago

1.0.37

2 years ago

1.0.36

2 years ago

1.0.35

2 years ago

1.0.34

2 years ago

1.0.32

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago