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

config-extends

Package Overview
Dependencies
Maintainers
3
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 2.0.2 to 2.0.3

8

commands/apply.js

@@ -16,2 +16,3 @@ "use strict";

const target = args.target || args.t;
const from = args.from || args.f;
if (!source) {

@@ -21,7 +22,6 @@ console.error('source is required!');

}
const config = yield index_1.configExtends.apply(source, target);
if (!target) {
console.log(JSON.stringify(config, null, 2));
}
const config = yield index_1.configExtends.apply(source, target, { from });
if (!target)
console.log(config);
});
//# sourceMappingURL=apply.js.map

@@ -19,5 +19,5 @@ "use strict";

}
const config = index_1.configExtends.extends(JSON.parse(source));
console.log(JSON.stringify(config, null, 2));
const config = yield index_1.configExtends.extends(JSON.parse(source));
console.log(config);
});
//# sourceMappingURL=extends.js.map

@@ -14,3 +14,4 @@ "use strict";

--source, -s ..... input path of folder or file
--target, -t ..... output file (optional)`,
--target, -t ..... output file (optional)
--from, -f ..... from property (optional)`,
extends: `

@@ -17,0 +18,0 @@ config-extends extends <options>

import { ExtendsOptions } from './model/options';
export declare class ConfigExtends {
private _excludes;
apply(source: string, target?: string, options?: ExtendsOptions): Promise<any>;

@@ -16,3 +17,2 @@ extends(source: string, ...args: string[]): string & string[];

private extendObject2;
private extendObject;
private setData;

@@ -19,0 +19,0 @@ private getData;

@@ -22,2 +22,5 @@ "use strict";

class ConfigExtends {
constructor() {
this._excludes = ['_extends', '_completed'];
}
apply(source, target, options = {}) {

@@ -27,11 +30,11 @@ return __awaiter(this, void 0, void 0, function* () {

let _source;
let _result;
let from;
const filesInfo = [];
if (yield h3lp_1.h3lp.fs.isDirectory(source)) {
_source = source;
_result = undefined;
from = options.from;
}
else {
_source = path_1.default.dirname(source);
_result = path_1.default.parse(source).name;
from = path_1.default.parse(source).name;
}

@@ -41,4 +44,4 @@ yield this.loadSourceConfig(config, filesInfo, _source, options);

config = this.getTargetConfig(config, filesInfo, options);
if (_result !== undefined) {
config = config[_result];
if (from !== undefined) {
config = h3lp_1.h3lp.obj.getValue(config, from);
}

@@ -303,3 +306,3 @@ if (target) {

// TODO: mejorar para que no llegue aca este error
if (baseFullName === '_extends' || baseFullName === '_completed')
if (this._excludes.includes(baseFullName))
return obj;

@@ -313,33 +316,4 @@ let base = this.getData(config, baseFullName.split('.'));

}
return this.extendObject(obj, base);
return h3lp_1.h3lp.obj.extends(obj, base, this._excludes);
}
extendObject(obj, base) {
if (Array.isArray(base)) {
if (!Array.isArray(obj))
return base;
for (let i = 0; i < base.length; i++) {
const baseItem = base[i];
if (baseItem.name) {
const objItem = obj.find(p => p.name === baseItem.name);
if (!objItem) {
obj.push(baseItem);
}
else {
this.extendObject(objItem, baseItem);
}
}
}
}
for (const k in base) {
if (k === '_extends' || k === '_completed')
continue;
if (obj[k] === undefined) {
obj[k] = base[k];
}
else if (typeof obj[k] === 'object') {
this.extendObject(obj[k], base[k]);
}
}
return obj;
}
setData(config, names, data) {

@@ -346,0 +320,0 @@ let _config = config;

@@ -6,2 +6,3 @@ import { ExtendsFormat } from './format';

format?: ExtendsFormat;
from?: string;
}
{
"name": "config-extends",
"version": "2.0.2",
"version": "2.0.3",
"description": "Allow to extend yaml or json files configuration",

@@ -28,3 +28,3 @@ "scripts": {

"dependencies": {
"h3lp": "1.2.6",
"h3lp": "1.2.7",
"js-yaml": "^4.1.0",

@@ -31,0 +31,0 @@ "minimist": "^1.2.6"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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