Socket
Socket
Sign inDemoInstall

expander

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expander - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

21

index.js
const _ = require('lodash');
const getobject = require('getobject');
const EventEmitter = require('events').EventEmitter;

@@ -101,6 +102,20 @@ // exported object

expander.walk = function (config, lookup, key) {
var path = [];
var nodes = lookup.split('.');
var merges = [config.get(key)];
nodes.forEach(function (node) {
path.push(node);
merges.push(config.get(path.concat(key).join('.')));
});
return _.merge.apply(null, merges);
};
// provide a getter/setter interface for expander
// this is so ugly.
expander.interface = function (data) {
var emitter = new EventEmitter();
var API = function (prop, value) {
if (arguments.length === 2) {
emitter.emit('set', prop, value);
return getobject.set(data, prop, value);

@@ -111,3 +126,7 @@ } else {

};
['get', 'getRaw', 'set', 'process'].forEach(function (method) {
API.set = function (prop, value) {
return API(prop, value);
};
API.on = emitter.on.bind(emitter);
['get', 'getRaw', 'process'].forEach(function (method) {
API[method] = expander[method].bind(null, data);

@@ -114,0 +133,0 @@ });

2

package.json
{
"name": "expander",
"description": "Expand template strings in declarative configurations.",
"version": "0.3.0",
"version": "0.3.1",
"homepage": "https://github.com/tkellen/expander",

@@ -6,0 +6,0 @@ "author": {

@@ -83,2 +83,3 @@ # expander [![Build Status](https://secure.travis-ci.org/tkellen/node-expander.png?branch=master)](http://travis-ci.org/tkellen/node-expander)

* 2014-02-11 - v0.3.1 - interface emits events on set
* 2014-02-10 - v0.3.0 - support a getter/setter api

@@ -85,0 +86,0 @@ * 2013-12-15 - v0.2.2 - support auto expansion of functions

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