Skip to content

Commit a2cf500

Browse files
committed
replace IIFE
1 parent 998e85e commit a2cf500

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/schema-converters/internalToExpanded.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { InternalTypeToStandardTypeMap, RELAXED_EJSON_DEFINITIONS } from './inte
44
import { InternalTypeToBsonTypeMap } from './internalToMongoDB';
55
import { allowAbort } from './util';
66

7-
export const convertInternalToExpanded = (function() {
7+
const createConvertInternalToExpanded = function() {
88
const usedDefinitions = new Set<string>();
99

1010
function clearUsedDefinitions() {
@@ -113,4 +113,11 @@ export const convertInternalToExpanded = (function() {
113113
};
114114
return schema;
115115
};
116-
})();
116+
};
117+
118+
export function convertInternalToExpanded(
119+
internalSchema: InternalSchema,
120+
options: { signal?: AbortSignal } = {}
121+
): Promise<ExpandedJSONSchema> {
122+
return createConvertInternalToExpanded()(internalSchema, options);
123+
}

src/schema-converters/internalToStandard.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ export const RELAXED_EJSON_DEFINITIONS = {
247247
}
248248
};
249249

250-
export const convertInternalToStandard = (function() {
250+
const createConvertInternalToStandard = function() {
251251
const usedDefinitions = new Set<string>();
252252

253253
function clearUsedDefinitions() {
@@ -336,4 +336,11 @@ export const convertInternalToStandard = (function() {
336336
};
337337
return schema;
338338
};
339-
})();
339+
};
340+
341+
export function convertInternalToStandard(
342+
internalSchema: InternalSchema,
343+
options: { signal?: AbortSignal } = {}
344+
): Promise<StandardJSONSchema> {
345+
return createConvertInternalToStandard()(internalSchema, options);
346+
}

0 commit comments

Comments
 (0)