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

config-extends

Package Overview
Dependencies
Maintainers
1
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 0.0.1 to 0.0.2

2

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

@@ -5,0 +5,0 @@ "main": "./lib/config-extends",

@@ -1,2 +0,2 @@

# Config Extended
# Config Extends
Allow to extend yaml or json files configuration

@@ -19,2 +19,176 @@

console.log(JSON.stringify(config));
```
```
### extends in single file
```
let config = await configExtends.load(path.join(__dirname,'raspberry.yaml'));
console.log(JSON.stringify(config.version));
```
#### raspberry.yaml content
```
version:
PiA:
_extends: [family.Pi, model.A]
PiB:
_extends: [family.Pi, model.B]
PiA+:
_extends: [family.Pi, model.A]
measure:
_extends: measure.compact
PiB+:
_extends: [family.Pi, model.B]
Pi2B:
measure:
_extends: measure.standard
Pi3A:
_extends: [family.Pi3, model.A]
Pi3A+:
_extends: [family.Pi3, model.A]
Pi3B+:
_extends: [family.Pi3, model.B]
Pi4B1G:
_extends: family.Pi4
memory: 1G
Pi4B2G:
_extends: family.Pi4
memory: 2G
Pi4B4G:
_extends: family.Pi4
memory: 4G
Pi4B8G:
_extends: family.Pi4
memory: 8G
family:
Pi:
wireless: false
measure:
_extends: measure.standard
Pi3:
wireless: true
measure:
_extends: measure.standard
Pi4:
_extends: [model.B]
wireless: true
measure:
_extends: measure.standard
model:
A:
ethernet: false
B:
ethernet: true
measure:
standard:
high: 85.6
long: 56.5
compact:
high: 65
long: 56.5
```
#### result:
```
{
"PiA": {
"wireless": false,
"measure": {
"high": 85.6,
"long": 56.5
},
"ethernet": false
},
"PiB": {
"wireless": false,
"measure": {
"high": 85.6,
"long": 56.5
},
"ethernet": true
},
"PiA+": {
"measure": {
"high": 85.6,
"long": 56.5
},
"wireless": false,
"ethernet": false
},
"PiB+": {
"wireless": false,
"measure": {
"high": 85.6,
"long": 56.5
},
"ethernet": true
},
"Pi2B": {
"measure": {
"high": 85.6,
"long": 56.5
}
},
"Pi3A": {
"wireless": true,
"measure": {
"high": 85.6,
"long": 56.5
},
"ethernet": false
},
"Pi3A+": {
"wireless": true,
"measure": {
"high": 85.6,
"long": 56.5
},
"ethernet": false
},
"Pi3B+": {
"wireless": true,
"measure": {
"high": 85.6,
"long": 56.5
},
"ethernet": true
},
"Pi4B1G": {
"memory": "1G",
"wireless": true,
"measure": {
"high": 85.6,
"long": 56.5
},
"ethernet": true
},
"Pi4B2G": {
"memory": "2G",
"wireless": true,
"measure": {
"high": 85.6,
"long": 56.5
},
"ethernet": true
},
"Pi4B4G": {
"memory": "4G",
"wireless": true,
"measure": {
"high": 85.6,
"long": 56.5
},
"ethernet": true
},
"Pi4B8G": {
"memory": "8G",
"wireless": true,
"measure": {
"high": 85.6,
"long": 56.5
},
"ethernet": true
}
}
```

@@ -8,4 +8,4 @@ const path = require('path');

// let config = await configExtended.load(path.join(__dirname,'raspberry.yaml'));
// console.log(JSON.stringify(config.version));
let config = await configExtends.load(path.join(__dirname,'raspberry.yaml'));
console.log(JSON.stringify(config.version));

@@ -19,4 +19,4 @@ // console.log(path.join(path.parse('a/b/c.yaml').dir,path.parse('a/b/c.yaml').name));

let config = await configExtends.load(path.join(__dirname,'tetris'));
console.log(JSON.stringify(config));
// let config = await configExtends.load(path.join(__dirname,'tetris'));
// console.log(JSON.stringify(config));
// let list = []

@@ -23,0 +23,0 @@ // for(let k in config.version){

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