New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

light-config

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

light-config - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

52

dist/index.js

@@ -0,15 +1,42 @@

'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports['default'] = lightConfig;
require('babel-polyfill'); // :(
const DELIMITER = '.';
var DELIMITER = '.';
export default function lightConfig(serverConfig, properties) {
function lightConfig(serverConfig, properties) {
var clientConfig = {};
for (let property of properties) {
if (isSingleLevel(property)) {
clientConfig[property] = serverConfig[property];
} else {
const propertyTree = property.split(DELIMITER);
clientConfig = Object.assign(clientConfig, createConfigMap(propertyTree, serverConfig));
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = properties[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var property = _step.value;
if (isSingleLevel(property)) {
clientConfig[property] = serverConfig[property];
} else {
var propertyTree = property.split(DELIMITER);
clientConfig = Object.assign(clientConfig, createConfigMap(propertyTree, serverConfig));
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator['return']) {
_iterator['return']();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}

@@ -21,9 +48,9 @@

function createConfigMap(propertyTree, serverConfig) {
const config = {};
var config = {};
var lastTargetRef = config;
var lastSourceRef = Object.assign({}, serverConfig);
for (let i = 0; i < propertyTree.length; i++) {
let property = propertyTree[i];
let hasChild = !!propertyTree[i + 1];
for (var i = 0; i < propertyTree.length; i++) {
var property = propertyTree[i];
var hasChild = !!propertyTree[i + 1];
lastTargetRef[property] = hasChild ? {} : lastSourceRef[property];

@@ -40,1 +67,2 @@ lastSourceRef = lastSourceRef[property];

}
module.exports = exports['default'];
{
"name": "light-config",
"version": "1.0.0",
"version": "1.0.1",
"description": "Share specific subsets of your server-side config with the browser",

@@ -31,4 +31,6 @@ "main": "dist/index.js",

"homepage": "https://github.com/jamesseanwright/lightconfig#readme",
"dependencies": {
"babel-polyfill": "^6.0.16"
},
"devDependencies": {
"babel-polyfill": "^6.0.16",
"chai": "3.4.0",

@@ -35,0 +37,0 @@ "mocha": "2.3.3"

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

# Light Config
# Light Config [![Build status](https://travis-ci.org/jamesseanwright/light-config.svg)](https://travis-ci.org/jamesseanwright/light-config)
Share specific subsets of your server-side config with the browser

@@ -3,0 +3,0 @@

Sorry, the diff of this file is not supported yet

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