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

config-object

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

config-object - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

58

lib/index.js
(function() {
var Config, ConfigPrototype, Error2, cson, fs, path, _,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
var Config, ConfigPrototype, Error2, _, cson, fs, path,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;

@@ -12,3 +12,3 @@ _ = require('lodash');

cson = require('cson-safe');
cson = require('cson-parser');

@@ -21,3 +21,3 @@ Error2 = require('error2');

ConfigPrototype.prototype.load = function(filename, options) {
var cfg, f, format, point, _i, _len, _ref;
var cfg, f, format, j, len, point, ref;
if (options == null) {

@@ -29,8 +29,8 @@ options = {};

format: void 0,
root: path.dirname(((_ref = module.parent) != null ? _ref.filename : void 0) || module.filename)
root: path.dirname(((ref = module.parent) != null ? ref.filename : void 0) || module.filename)
});
if (typeof filename !== 'string') {
if (filename.length) {
for (_i = 0, _len = filename.length; _i < _len; _i++) {
f = filename[_i];
for (j = 0, len = filename.length; j < len; j++) {
f = filename[j];
this.load(f, options);

@@ -82,3 +82,3 @@ }

}
_(point).merge(cfg);
_(point).merge(cfg).commit();
return this;

@@ -88,3 +88,3 @@ };

ConfigPrototype.prototype.clone = function(options) {
var attribute, cfg, key, keys, root, _i, _len;
var attribute, cfg, j, key, keys, len, root;
if (options == null) {

@@ -100,13 +100,13 @@ options = {};

keys = (function() {
var _results;
_results = [];
var results;
results = [];
for (attribute in this.get(root)) {
_results.push(attribute);
results.push(attribute);
}
return _results;
return results;
}).call(this);
}
cfg = new this.constructor;
for (_i = 0, _len = keys.length; _i < _len; _i++) {
key = keys[_i];
for (j = 0, len = keys.length; j < len; j++) {
key = keys[j];
cfg.set(key, this.get(root + '/' + key));

@@ -118,3 +118,3 @@ }

ConfigPrototype.prototype.set = function(key, value) {
var data, i, segment, segments, _i, _len;
var data, i, j, len, segment, segments;
value = _.cloneDeep(value);

@@ -131,3 +131,3 @@ segments = key.split('/').filter(function(segment) {

data = this;
for (i = _i = 0, _len = segments.length; _i < _len; i = ++_i) {
for (i = j = 0, len = segments.length; j < len; i = ++j) {
segment = segments[i];

@@ -146,3 +146,3 @@ if (i + 1 === segments.length) {

ConfigPrototype.prototype.get = function(key, options) {
var data, segment, stack, _i, _len, _ref;
var data, j, len, ref, segment, stack;
if (key == null) {

@@ -160,9 +160,9 @@ key = '/';

stack = "/";
_ref = key.split('/');
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
segment = _ref[_i];
ref = key.split('/');
for (j = 0, len = ref.length; j < len; j++) {
segment = ref[j];
if (!segment) {
continue;
}
stack += "" + segment + "/";
stack += segment + "/";
if (!data[segment]) {

@@ -191,8 +191,8 @@ if (options["throw"]) {

ConfigPrototype.prototype.clear = function() {
var key, _results;
_results = [];
var key, results;
results = [];
for (key in this) {
_results.push(delete this[key]);
results.push(delete this[key]);
}
return _results;
return results;
};

@@ -204,4 +204,4 @@

Config = (function(_super) {
__extends(Config, _super);
Config = (function(superClass) {
extend(Config, superClass);

@@ -208,0 +208,0 @@ function Config() {

{
"name": "config-object",
"version": "0.3.0",
"version": "0.3.1",
"description": "Configuration as a pure JS object, with helpers :)",

@@ -9,3 +9,3 @@ "main": "lib/index.js",

"develop": "gulp watch",
"prepublish": "gulp --requre 'coffee-script' build"
"prepublish": "gulp build"
},

@@ -32,14 +32,14 @@ "repository": {

"dependencies": {
"cson-safe": "^0.1.1",
"cson-parser": "^1.0.8",
"error2": "^0.2.1",
"lodash": "^2.4.1"
"lodash": "^3.3.1"
},
"devDependencies": {
"coffee-script": "^1.7.1",
"del": "^0.1.1",
"gulp": "^3.8.5",
"gulp-coffee": "^2.0.1",
"gulp-mocha": "^0.4.1",
"should": "^4.0.4"
"coffee-script": "^1.9.1",
"del": "^1.1.1",
"gulp": "^3.8.11",
"gulp-coffee": "^2.3.1",
"gulp-mocha": "^2.0.0",
"should": "^5.0.1"
}
}
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