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

@envelop/core

Package Overview
Dependencies
Maintainers
1
Versions
1365
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@envelop/core - npm Package Compare versions

Comparing version 5.0.1 to 5.0.2-alpha-20240820115508-6d2d9e8f0ae9bc143dfbb61da9176712731212ce

29

cjs/utils.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.errorAsyncIterator = exports.finalAsyncIterator = exports.handleStreamOrSingleExecutionResult = exports.isAsyncIterable = exports.makeExecute = exports.mapAsyncIterator = exports.makeSubscribe = exports.isIntrospectionOperationString = exports.envelopIsIntrospectionSymbol = void 0;
exports.mapMaybePromise = exports.isPromise = exports.errorAsyncIterator = exports.finalAsyncIterator = exports.handleStreamOrSingleExecutionResult = exports.isAsyncIterable = exports.makeExecute = exports.mapAsyncIterator = exports.makeSubscribe = exports.isIntrospectionOperationString = exports.envelopIsIntrospectionSymbol = void 0;
exports.envelopIsIntrospectionSymbol = Symbol('ENVELOP_IS_INTROSPECTION');

@@ -189,1 +189,28 @@ function isIntrospectionOperationString(operation) {

exports.errorAsyncIterator = errorAsyncIterator;
function isPromise(value) {
return value?.then !== undefined;
}
exports.isPromise = isPromise;
function mapMaybePromise(value, mapper, errorMapper) {
if (isPromise(value)) {
if (errorMapper) {
try {
return value.then(mapper, errorMapper);
}
catch (e) {
return errorMapper(e);
}
}
return value.then(mapper);
}
if (errorMapper) {
try {
return mapper(value);
}
catch (e) {
return errorMapper(e);
}
}
return mapper(value);
}
exports.mapMaybePromise = mapMaybePromise;

@@ -178,1 +178,26 @@ export const envelopIsIntrospectionSymbol = Symbol('ENVELOP_IS_INTROSPECTION');

}
export function isPromise(value) {
return value?.then !== undefined;
}
export function mapMaybePromise(value, mapper, errorMapper) {
if (isPromise(value)) {
if (errorMapper) {
try {
return value.then(mapper, errorMapper);
}
catch (e) {
return errorMapper(e);
}
}
return value.then(mapper);
}
if (errorMapper) {
try {
return mapper(value);
}
catch (e) {
return errorMapper(e);
}
}
return mapper(value);
}

2

package.json
{
"name": "@envelop/core",
"version": "5.0.1",
"version": "5.0.2-alpha-20240820115508-6d2d9e8f0ae9bc143dfbb61da9176712731212ce",
"sideEffects": false,

@@ -5,0 +5,0 @@ "dependencies": {

@@ -30,1 +30,3 @@ import { AsyncIterableIteratorOrValue, DefaultContext, ExecuteFunction, ExecutionArgs, OnExecuteDoneEventPayload, OnExecuteDoneHookResult, OnExecuteDoneHookResultOnNextHook, PromiseOrValue, SubscribeFunction } from '@envelop/types';

export declare function errorAsyncIterator<TInput>(source: AsyncIterable<TInput>, onError: (err: unknown) => void): AsyncGenerator<TInput>;
export declare function isPromise<T>(value: any): value is Promise<T>;
export declare function mapMaybePromise<T, R>(value: PromiseOrValue<T>, mapper: (v: T) => PromiseOrValue<R>, errorMapper?: (e: any) => PromiseOrValue<R>): PromiseOrValue<R>;

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