From b193a1b7094a2371c6f508972b7f3a82994988e0 Mon Sep 17 00:00:00 2001 From: Daniel Lee Date: Wed, 18 Feb 2026 10:53:56 -0800 Subject: [PATCH] fix: correct deprecated API usage and source comment typos --- src/cloud_events.ts | 4 ++-- src/function_wrappers.ts | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cloud_events.ts b/src/cloud_events.ts index 4682fe8b0..af9872695 100644 --- a/src/cloud_events.ts +++ b/src/cloud_events.ts @@ -16,7 +16,7 @@ import * as express from 'express'; import {CloudEvent} from './functions'; /** - * Custom exception class to represent errors durring event conversions. + * Custom exception class to represent errors during event conversions. */ export class EventConversionError extends Error {} @@ -62,7 +62,7 @@ export function getBinaryCloudEventContext( const context = {} as CloudEvent; for (const name in req.headers) { if (name.startsWith('ce-')) { - const attributeName = name.substr( + const attributeName = name.substring( 'ce-'.length, ) as keyof CloudEvent; context[attributeName] = req.header(name); diff --git a/src/function_wrappers.ts b/src/function_wrappers.ts index 401f95db8..de3410d44 100644 --- a/src/function_wrappers.ts +++ b/src/function_wrappers.ts @@ -75,7 +75,7 @@ const parseCloudEventRequest = (req: Request): CloudEvent => { * Helper function to background event context and data payload object from an HTTP * request. * @param req - An Express HTTP request - * @returns The data playload and event context parsed from the request + * @returns The data payload and event context parsed from the request */ const parseBackgroundEvent = (req: Request): {data: {}; context: Context} => { const event = req.body; @@ -130,7 +130,7 @@ const wrapHttpFunction = (execute: HttpFunction): RequestHandler => { /** * Wraps an async CloudEvent function in an express RequestHandler. * @param userFunction - User's function - * @return An Express hander function that invokes the user function + * @return An Express handler function that invokes the user function */ const wrapCloudEventFunction = ( userFunction: CloudEventFunction, @@ -151,7 +151,7 @@ const wrapCloudEventFunction = ( /** * Wraps callback style CloudEvent function in an express RequestHandler. * @param userFunction - User's function - * @return An Express hander function that invokes the user function + * @return An Express handler function that invokes the user function */ const wrapCloudEventFunctionWithCallback = ( userFunction: CloudEventFunctionWithCallback, @@ -167,7 +167,7 @@ const wrapCloudEventFunctionWithCallback = ( /** * Wraps an async event function in an express RequestHandler. * @param userFunction - User's function - * @return An Express hander function that invokes the user function + * @return An Express handler function that invokes the user function */ const wrapEventFunction = (userFunction: EventFunction): RequestHandler => { const httpHandler = (req: Request, res: Response) => { @@ -186,7 +186,7 @@ const wrapEventFunction = (userFunction: EventFunction): RequestHandler => { /** * Wraps a callback style event function in an express RequestHandler. * @param userFunction - User's function - * @return An Express hander function that invokes the user function + * @return An Express handler function that invokes the user function */ const wrapEventFunctionWithCallback = ( userFunction: EventFunctionWithCallback, @@ -203,7 +203,7 @@ const wrapEventFunctionWithCallback = ( * Wraps a user function with the provided signature type in an express * RequestHandler. * @param userFunction User's function. - * @return An Express hander function that invokes the user function. + * @return An Express handler function that invokes the user function. */ export const wrapUserFunction = ( userFunction: HandlerFunction,