New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

etcd-flatten

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

etcd-flatten

Flatten the results of a recursive etcd query into a flat object with keys and values

latest
Source
npmnpm
Version
0.0.2
Version published
Weekly downloads
5
-54.55%
Maintainers
1
Weekly downloads
 
Created
Source

etcd-flatten

Travis

Flatten the results of a recursive etcd query into a flat object with keys and values

installation

$ npm install etcd-flatten

usage

Imagine we have some deeply nested keys in etcd:

$ etcdctl ls --recursive
/shapes
/shapes/circle
/shapes/circle/red
/shapes/circle/green
/shapes/square
/shapes/square/red

We can do a recursive query and get a tree like structure

etcd-flatten will take this tree structure and return a flat object with paths mapped to values and no directories included

var etcdjs = require('etcdjs')
var flatten = require('etcd-flatten')

var etcd = etcdjs('127.0.0.1:4001')

etcd.get('/shapes', {
	recursive:true
}, function(err, results){

	if(!err && results.node){
		var leafs = flatten(results.node)
		console.dir(leafs)	
	}
	
})

/*
{
	'/shapes/circle/red':'CIRCLE RED',
	'/shapes/circle/green':'CIRCLE GREEN',
	'/shapes/square/red':'SQUARE RED'
}
	
*/

api

var flatObject = flatten(etcdResults)

Pass the top-level node from an etcd query.

A flat object containing all leafs by their path is returned.

license

MIT

Keywords

etcd

FAQs

Package last updated on 05 May 2014

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