Skip to content

Commit 8d3ac85

Browse files
authored
fix: correct deprecated API usage and source comment typos (#741)
1 parent 6c6b444 commit 8d3ac85

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/cloud_events.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import * as express from 'express';
1616
import {CloudEvent} from './functions';
1717

1818
/**
19-
* Custom exception class to represent errors durring event conversions.
19+
* Custom exception class to represent errors during event conversions.
2020
*/
2121
export class EventConversionError extends Error {}
2222

@@ -62,7 +62,7 @@ export function getBinaryCloudEventContext(
6262
const context = {} as CloudEvent<unknown>;
6363
for (const name in req.headers) {
6464
if (name.startsWith('ce-')) {
65-
const attributeName = name.substr(
65+
const attributeName = name.substring(
6666
'ce-'.length,
6767
) as keyof CloudEvent<unknown>;
6868
context[attributeName] = req.header(name);

src/function_wrappers.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const parseCloudEventRequest = (req: Request): CloudEvent<unknown> => {
7575
* Helper function to background event context and data payload object from an HTTP
7676
* request.
7777
* @param req - An Express HTTP request
78-
* @returns The data playload and event context parsed from the request
78+
* @returns The data payload and event context parsed from the request
7979
*/
8080
const parseBackgroundEvent = (req: Request): {data: {}; context: Context} => {
8181
const event = req.body;
@@ -130,7 +130,7 @@ const wrapHttpFunction = (execute: HttpFunction): RequestHandler => {
130130
/**
131131
* Wraps an async CloudEvent function in an express RequestHandler.
132132
* @param userFunction - User's function
133-
* @return An Express hander function that invokes the user function
133+
* @return An Express handler function that invokes the user function
134134
*/
135135
const wrapCloudEventFunction = (
136136
userFunction: CloudEventFunction,
@@ -151,7 +151,7 @@ const wrapCloudEventFunction = (
151151
/**
152152
* Wraps callback style CloudEvent function in an express RequestHandler.
153153
* @param userFunction - User's function
154-
* @return An Express hander function that invokes the user function
154+
* @return An Express handler function that invokes the user function
155155
*/
156156
const wrapCloudEventFunctionWithCallback = (
157157
userFunction: CloudEventFunctionWithCallback,
@@ -167,7 +167,7 @@ const wrapCloudEventFunctionWithCallback = (
167167
/**
168168
* Wraps an async event function in an express RequestHandler.
169169
* @param userFunction - User's function
170-
* @return An Express hander function that invokes the user function
170+
* @return An Express handler function that invokes the user function
171171
*/
172172
const wrapEventFunction = (userFunction: EventFunction): RequestHandler => {
173173
const httpHandler = (req: Request, res: Response) => {
@@ -186,7 +186,7 @@ const wrapEventFunction = (userFunction: EventFunction): RequestHandler => {
186186
/**
187187
* Wraps a callback style event function in an express RequestHandler.
188188
* @param userFunction - User's function
189-
* @return An Express hander function that invokes the user function
189+
* @return An Express handler function that invokes the user function
190190
*/
191191
const wrapEventFunctionWithCallback = (
192192
userFunction: EventFunctionWithCallback,
@@ -203,7 +203,7 @@ const wrapEventFunctionWithCallback = (
203203
* Wraps a user function with the provided signature type in an express
204204
* RequestHandler.
205205
* @param userFunction User's function.
206-
* @return An Express hander function that invokes the user function.
206+
* @return An Express handler function that invokes the user function.
207207
*/
208208
export const wrapUserFunction = <T = unknown>(
209209
userFunction: HandlerFunction<T>,

0 commit comments

Comments
 (0)