Skip to content

Commit b4c70fd

Browse files
committed
Remove unneeded objectEntries and objectFromEntries use
1 parent f1d5458 commit b4c70fd

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

src/cli.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ import chalk from 'chalk'
77
import { messageWithCauses, stackWithCauses } from 'pony-cause'
88
import updateNotifier from 'tiny-updater'
99

10-
import {
11-
objectEntries,
12-
objectFromEntries
13-
} from '@socketsecurity/registry/lib/objects'
14-
1510
import * as cliCommands from './commands'
1611
import { logSymbols } from './utils/chalk-markdown'
1712
import { AuthError, InputError } from './utils/errors'
@@ -23,10 +18,10 @@ const rootPkgJsonPath = path.join(rootPath, 'package.json')
2318

2419
const rootPkgJson = require(rootPkgJsonPath)
2520

26-
const formattedCliCommands = objectFromEntries(
27-
objectEntries(cliCommands).map(entry => {
21+
const formattedCliCommands = Object.fromEntries(
22+
Object.entries(cliCommands).map(entry => {
2823
const key = entry[0]
29-
entry[0] = typeof key === 'string' ? camelToHyphen(key) : key
24+
entry[0] = camelToHyphen(key)
3025
return entry
3126
})
3227
)

src/commands/cdxgen.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import spawn from '@npmcli/promise-spawn'
55
import chalk from 'chalk'
66
import yargsParse from 'yargs-parser'
77

8-
import { objectEntries } from '@socketsecurity/registry/lib/objects'
9-
108
import type { CliSubcommand } from '../utils/meow-with-subcommands'
119

1210
const distPath = __dirname
@@ -131,18 +129,18 @@ function argvToArray(argv: {
131129
}): string[] {
132130
if (argv['help']) return ['--help']
133131
const result = []
134-
for (const { 0: key, 1: value } of objectEntries(argv)) {
132+
for (const { 0: key, 1: value } of Object.entries(argv)) {
135133
if (key === '_' || key === '--') continue
136134
if (key === 'babel' || key === 'install-deps' || key === 'validate') {
137135
// cdxgen documents no-babel, no-install-deps, and no-validate flags so
138136
// use them when relevant.
139137
result.push(`--${value ? key : `no-${key}`}`)
140138
} else if (value === true) {
141-
result.push(`--${String(key)}`)
139+
result.push(`--${key}`)
142140
} else if (typeof value === 'string') {
143-
result.push(`--${String(key)}`, String(value))
141+
result.push(`--${key}`, String(value))
144142
} else if (Array.isArray(value)) {
145-
result.push(`--${String(key)}`, ...value.map(String))
143+
result.push(`--${key}`, ...value.map(String))
146144
}
147145
}
148146
if (argv['--']) {

0 commit comments

Comments
 (0)