Skip to content

Commit ef24bff

Browse files
authored
docs: expose documentation for all utilities (#3242)
1 parent 467bd83 commit ef24bff

File tree

4 files changed

+453
-13
lines changed

4 files changed

+453
-13
lines changed

scripts/apidocs/processing/class.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
processClassConstructors,
1414
processClassMethods,
1515
processInterfaceMethods,
16-
processProjectFunctions,
16+
processUtilityFunctions,
1717
} from './method';
1818

1919
/**
@@ -192,12 +192,7 @@ export function processProjectUtilities(project: Project): RawApiDocsPage {
192192
deprecated: undefined,
193193
description: 'A list of all the utilities available in Faker.js.',
194194
examples: [],
195-
methods: processProjectFunctions(
196-
project,
197-
'mergeLocales',
198-
'generateMersenne32Randomizer',
199-
'generateMersenne53Randomizer'
200-
),
195+
methods: processUtilityFunctions(project),
201196
};
202197
}
203198

scripts/apidocs/processing/method.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
type MethodDeclaration,
1212
} from 'ts-morph';
1313
import { groupBy } from '../../../src/internal/group-by';
14-
import { valuesForKeys } from '../utils/value-checks';
1514
import { newProcessingError } from './error';
1615
import type {
1716
RawApiDocsSignature,
@@ -138,12 +137,11 @@ function getAllFunctions(
138137
);
139138
}
140139

141-
export function processProjectFunctions(
142-
project: Project,
143-
...names: string[]
144-
): RawApiDocsMethod[] {
140+
export function processUtilityFunctions(project: Project): RawApiDocsMethod[] {
145141
return processMethodLikes(
146-
valuesForKeys(getAllFunctions(project), names),
142+
Object.values(getAllFunctions(project)).filter((fn) =>
143+
fn.getSourceFile().getFilePath().includes('/src/utils/')
144+
),
147145
(f) => f.getNameOrThrow()
148146
);
149147
}

0 commit comments

Comments
 (0)