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

@app-config/extension-utils

Package Overview
Dependencies
Maintainers
2
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@app-config/extension-utils - npm Package Compare versions

Comparing version 2.4.6 to 2.5.0

1

dist/es/index.d.ts

@@ -5,2 +5,3 @@ import type { ParsingExtension, ParsingExtensionKey, ParsingExtensionTransform } from '@app-config/core';

export declare function composeExtensions(extensions: ParsingExtension[]): ParsingExtension;
export declare function named(name: string, parsingExtension: ParsingExtension): ParsingExtension;
export declare function forKey(key: string | string[], parsingExtension: ParsingExtension): ParsingExtension;

@@ -7,0 +8,0 @@ export declare function keysToPath(keys: ParsingExtensionKey[]): string;

import { parseValue, Root, AppConfigError } from '@app-config/core';
import { SchemaBuilder } from '@serafin/schema-builder';
export function composeExtensions(extensions) {
return (value, [k]) => {
const composed = (value, [k]) => {
// only applies to the root - override the parsing extensions
if (k !== Root)
return false;
return (_, __, source) => parseValue(value, source, extensions, { shouldFlatten: true });
return (_, __, source, baseExtensions) =>
// restart the parse tree, but with additional extensions included
parseValue(value, source,
// ensures that a recursion doesn't happen
baseExtensions.concat(extensions).filter((v) => v !== composed), { shouldFlatten: true });
};
return composed;
}
export function named(name, parsingExtension) {
Object.defineProperty(parsingExtension, 'extensionName', { value: name });
return parsingExtension;
}
export function forKey(key, parsingExtension) {

@@ -11,0 +21,0 @@ const shouldApply = ([_, k]) => {

@@ -5,2 +5,3 @@ import type { ParsingExtension, ParsingExtensionKey, ParsingExtensionTransform } from '@app-config/core';

export declare function composeExtensions(extensions: ParsingExtension[]): ParsingExtension;
export declare function named(name: string, parsingExtension: ParsingExtension): ParsingExtension;
export declare function forKey(key: string | string[], parsingExtension: ParsingExtension): ParsingExtension;

@@ -7,0 +8,0 @@ export declare function keysToPath(keys: ParsingExtensionKey[]): string;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validationFunction = exports.validateOptions = exports.ParsingExtensionInvalidOptions = exports.keysToPath = exports.forKey = exports.composeExtensions = void 0;
exports.validationFunction = exports.validateOptions = exports.ParsingExtensionInvalidOptions = exports.keysToPath = exports.forKey = exports.named = exports.composeExtensions = void 0;
const core_1 = require("@app-config/core");
const schema_builder_1 = require("@serafin/schema-builder");
function composeExtensions(extensions) {
return (value, [k]) => {
const composed = (value, [k]) => {
// only applies to the root - override the parsing extensions
if (k !== core_1.Root)
return false;
return (_, __, source) => core_1.parseValue(value, source, extensions, { shouldFlatten: true });
return (_, __, source, baseExtensions) =>
// restart the parse tree, but with additional extensions included
core_1.parseValue(value, source,
// ensures that a recursion doesn't happen
baseExtensions.concat(extensions).filter((v) => v !== composed), { shouldFlatten: true });
};
return composed;
}
exports.composeExtensions = composeExtensions;
function named(name, parsingExtension) {
Object.defineProperty(parsingExtension, 'extensionName', { value: name });
return parsingExtension;
}
exports.named = named;
function forKey(key, parsingExtension) {

@@ -15,0 +26,0 @@ const shouldApply = ([_, k]) => {

4

package.json
{
"name": "@app-config/extension-utils",
"description": "Utilities for writing @app-config parsing extensions",
"version": "2.4.6",
"version": "2.5.0",
"license": "MPL-2.0",

@@ -33,3 +33,3 @@ "author": {

"dependencies": {
"@app-config/core": "^2.4.6",
"@app-config/core": "^2.5.0",
"@serafin/schema-builder": "0.14"

@@ -36,0 +36,0 @@ },

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