Skip to content

Commit 608b400

Browse files
committed
refactor(generate-routes): simple is beautiful
1 parent 23c3e96 commit 608b400

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

scripts/generate-routes.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,14 @@
11
const camelCase = require('lodash.camelcase')
22
const sortKeys = require('sort-keys')
3-
const routes = require('@octokit/routes')
3+
const SCIM_ROUTES = require('@octokit/routes').scim
44

55
const newRoutes = {}
66

77
function normalize (methodName) {
88
return camelCase(methodName)
99
}
1010

11-
const endpoints = Object.keys(routes).reduce((result, scope) => {
12-
const scopeEndpoints = routes[scope]
13-
scopeEndpoints.forEach(endpoint => {
14-
endpoint.scope = scope
15-
})
16-
return result.concat(scopeEndpoints)
17-
}, [])
18-
19-
endpoints.forEach(endpoint => {
20-
if (endpoint.scope !== 'scim') {
21-
return
22-
}
23-
11+
SCIM_ROUTES.forEach(endpoint => {
2412
const idName = normalize(endpoint.idName)
2513

2614
// new route

0 commit comments

Comments
 (0)