Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

config-extends

Package Overview
Dependencies
Maintainers
3
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

config-extends - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

2

package.json
{
"name": "config-extends",
"version": "2.0.0",
"version": "2.0.1",
"description": "Allow to extend yaml or json files configuration",

@@ -5,0 +5,0 @@ "scripts": {

# Config Extends
Allow to extend json or yaml/json files configuration
## Features
- Multiple extension

@@ -12,5 +14,8 @@ - Can be loaded from yaml or json files

## Methods
### .extends(source,...args) [synchronously]
This api allows to extend one or more json objects
- Paramas:
This api allows to extend one or more json objects
- Params:
- source : object with extensions defined

@@ -20,4 +25,6 @@ - args : others sources

### .apply(source,target) [asynchronous]
This api allows to extend configuration from a file or several files from a path
- Paramas:
- Params:
- source : path of file or folder

@@ -29,14 +36,21 @@ - target : file result (optional)

## Installation
### module for node.js
```Shell
$ npm install config-extends
npm install config-extends
```
### CLI executable
If you want to extends from CLI, install config-extends globally:
```Shell
$ npm install -g config-extends
npm install -g config-extends
```
## Usage
## Usage
### From library for node.js
```javascript

@@ -54,2 +68,3 @@ const ConfigExtends = require("config-extends")

### From library for browsers
```javascript

@@ -65,5 +80,8 @@ <script src="config-extends.min.js"></script>

```
### From CLI
extends
```
```shell
usage: config-extends extends -s

@@ -76,3 +94,4 @@

apply
```
```shell
usage: config-extends apply -s [-t]

@@ -88,2 +107,3 @@

### Simple extension
```javascript

@@ -97,3 +117,5 @@ let source ={

```
result:
```json

@@ -107,2 +129,3 @@ {

### Chain extension
```javascript

@@ -118,3 +141,5 @@ let source ={

```
result:
```json

@@ -131,2 +156,3 @@ {

### Multiple extension
```javascript

@@ -143,3 +169,5 @@ let source ={

```
result:
```json

@@ -155,3 +183,5 @@ {

```
### apply from path
```javascript

@@ -161,7 +191,9 @@ let config = await ConfigExtends.apply(path.join(__dirname,'test-1'));

```
structure folder
- test-1
- folder1
- file1.yaml content => c: 3
- folder2
- folder2
- file1.yaml content => _extends: [file,folder1.file1]

@@ -175,2 +207,3 @@ d: 1

result
```json

@@ -186,7 +219,11 @@ {

```
### apply from path CLI
```shell
config-extends apply -s ./test/test-1
```
$ config-extends apply -s ./test/test-1
```
result:
```json

@@ -202,10 +239,12 @@ {

```
### apply from single file
```
```javascript
let config = await configExtends.apply(path.join(__dirname,'raspberry.yaml'));
console.log(JSON.stringify(config.version,null,2));
```
raspberry.yaml
```yaml

@@ -273,2 +312,3 @@ version:

result:
```yaml

@@ -292,6 +332,5 @@ {

## Test
```Shell
$ npm test
npm run test
```
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